qcmet.core.FileManager#

class qcmet.core.FileManager(benchmark_name, base_path, create_timestamp_folder=True, log_level=20, run_id=None, save_circuits=True, save_plots=True, save_intermediate=True)[source]#

Handles benchmark data saving and directory structure.

This class creates a consistent directory layout for each benchmark run and provides methods to save JSON data, plots, and other intermediate results.

The folders are set up in the following structure:

base_path/
└── benchmark_name/

├── results/ │ └── plots/ ├── data/ ├── logs/ ├── intermediate/ └── config/

benchmark_name#

Name of the benchmark.

Type:

str

base_path#

Base directory where results will be saved.

Type:

str | Path

create_timestamp_folder#

Whether to create a timestamped subfolder.

Type:

bool

run_id#

Unique identifier for the run (default is current timestamp).

Type:

str

log_level#

Logging level.

Type:

int

save_circuits#

Whether to save quantum circuits.

Type:

bool

save_plots#

Whether to save plots.

Type:

bool

save_intermediate#

Whether to save intermediate data.

Type:

bool

__init__(benchmark_name, base_path, create_timestamp_folder=True, log_level=20, run_id=None, save_circuits=True, save_plots=True, save_intermediate=True)#

Methods

__init__(benchmark_name, base_path[, ...])

get_config_path()

Get the path to the config directory.

get_data_path()

Get the path to the data directory.

get_intermediate_path()

Get the path to the intermediate directory.

get_logs_path()

Get the path to the logs directory.

get_plots_path()

Get the path to the plots directory.

get_results_path()

Get the path to the results directory.

save_json(data, filename[, subfolder])

Save a dictionary as a JSON file in the specified subfolder.

save_plot(figure, filename[, format])

Save a matplotlib figure to the plots directory.

Attributes

benchmark_name: str#
base_path: str | Path#
create_timestamp_folder: bool = True#
log_level: int = 20#
run_id: str = None#
save_circuits: bool = True#
save_plots: bool = True#
save_intermediate: bool = True#
get_results_path()[source]#

Get the path to the results directory.

Returns:

Path to the results directory.

Return type:

Path

get_data_path()[source]#

Get the path to the data directory.

Returns:

Path to the data directory.

Return type:

Path

get_plots_path()[source]#

Get the path to the plots directory.

Returns:

Path to the plots directory.

Return type:

Path

get_config_path()[source]#

Get the path to the config directory.

Returns:

Path to the config directory.

Return type:

Path

get_logs_path()[source]#

Get the path to the logs directory.

Returns:

Path to the logs directory.

Return type:

Path

get_intermediate_path()[source]#

Get the path to the intermediate directory.

Returns:

Path to the intermediate directory.

Return type:

Path

save_json(data, filename, subfolder='results')[source]#

Save a dictionary as a JSON file in the specified subfolder.

Parameters:
  • data (Dict[str, Any]) – Data to be saved.

  • filename (str) – Name of the JSON file (without extension).

  • subfolder (str) – Subfolder to save the file in.

Returns:

Path to the saved JSON file.

Return type:

Path

save_plot(figure, filename, format='png')[source]#

Save a matplotlib figure to the plots directory.

Parameters:
  • figure (matplotlib.figure.Figure) – The figure to save.

  • filename (str) – Name of the file (without extension).

  • format (str) – File format (e.g., ‘png’, ‘pdf’).

Returns:

Path to the saved plot file.

Return type:

Path