qrem.common.config

This module provides functionality for parsing configuration files and command-line arguments specifically tailored for the Quantum Research Environment Manager (QREM) project. The module includes helper functions for parsing various data types and a class QremConfigLoader that facilitates loading and managing configuration settings.

The config file is designed to help in preparation and documenting the configuration of each QREM execution on quantum computers. It is an ini file, that contains all the parameters necessary to configure an experiment. Parameters can also be passed as a command line arguments.

Example config files can be found in the qrem/configs folder of the package and accessed through followint variables: - qrem.common.config.example_config_ibm_path - qrem.common.config.example_config_aws_path

Sections

The configuration is organized into sections: ‘general’, ‘data’, ‘experiment’, ‘characterization’ and ‘mitigation’.
general

Contains general settings for the experiment, such as the experiment’s name, author, and logging level.

data

Manages settings related to data handling, including backups of circuits, job IDs, and circuit metadata.

experiment

Specifies various parameters and settings directly related to the quantum experiment, including device information, provider details, experiment type, and quantum circuit configuration.

characterization

Contains settings for characterization of the quantum device.

mitigation

Contains settings for mitigation of the quantum device.

Configuration Parameters

[general]
experiment_namestr

The name of the experiment, used for bookkeeping in all files.

authorstr

The name or nickname of the author, saved in all files for tracking.

verbose_logbool

Enables verbose logging for additional information during execution.

[data]
backup_circuitsbool

Indicates whether to save the original list of circuits in the QREM definition to a file.

backup_job_idsbool

Specifies whether to save job IDs to a file after submitting data to a backend.

backup_circuits_metadatabool

Determines whether to add additional information (like qubit readout errors, list of bad qubits) to the saved circuits list.

[experiment]
experiment_pathstr

The file path for storing experiment-related files.

device_namestr

The name of the quantum device (e.g., ‘ibm_seattle’, ‘Aspen-M-3’).

providerstr

The quantum computing provider (e.g., ‘IBM’, ‘AWS-BRAKET’).

ibm_connection_methodstr

Specific to IBM, defines the connection method to the quantum machine (e.g., ‘RUNTIME_SESSIONS’, ‘RUNTIME’).

provider_instancestr

For IBM, specifies the provider instance, such as ‘ibm-q/open/main’.

aws_pickle_resultsbool

Specifies if results should be pickled when using AWS Braket.

aws_braket_task_retriesint

The number of retries for AWS Braket tasks.

experiment_typestr

The type of experiment, such as ‘QDoT’, ‘DDoT’, ‘QDT’, ‘RFE’.

k_localityint

The locality of the experiment, with values ranging from 2 to 5.

gate_thresholdfloat

Gate error threshold, if crossed - qubits will be excluded from calculations. ranging from 0 to 1. A value of 0 or Null includes all qubits.

ground_state_circuitsbool

Determines if ground state circuits should be included.

ground_state_circuits_pathstr

File path to the pickle file containing ground state circuits information.

ground_states_countint

The number of ground states to be considered in the experiment.

limited_circuit_randomnessbool

Indicates if limitations should be imposed on number of random circuits (e.g., number of random circuits).

random_circuits_countint

Total count of random circuits to be sent, relevant when ‘limited_circuit_randomness’ is True.

shots_per_circuitint

Number of shots (repetitions) per circuit, relevant when ‘limited_circuit_randomness’ is True.

job_tagstuple

Tags used for identifying jobs sent to the backend.

qbits_of_interestlist or None

List of qubits to be used, following the device’s native indexing convention. Not yet implemented.

ensure_completnes_on_pairsbool

Ensures completeness of the experiment on qubit pairs (currently always true).

Usage

The configuration file is used by the QREM module to set up and manage quantum experiments. Users can modify the file to customize various aspects of their experiments, including experimental parameters, data backup options, and device-specific settings.

Notes

@authors: Jan Tuziemski, Filip Maciejewski, Joanna Majsak, Oskar Słowik, Marcin Kotowski, Katarzyna Kowalczyk-Murynka, Paweł Przewłocki, Piotr Podziemski, Michał Oszmaniec @contact: michal.oszmaniec@cft.edu.pl

Module Contents

Classes

QremConfigLoader

Functions

parse_str(in_str)

Helper function to evaluate a string in the config file.

parse_literal(instr)

Converts a string specifying a list or tuple.

parse_boolean(b)

Interpret config parameter as a boolean values.

Attributes

example_config_ibm_path

Example configuration file path for execution on IBM Quantum devices.

example_config_aws_path

Example configuration file path for execution on AWS Braket Quantum devices.

aa

qrem.common.config.example_config_ibm_path

Example configuration file path for execution on IBM Quantum devices.

qrem.common.config.example_config_aws_path

Example configuration file path for execution on AWS Braket Quantum devices.

qrem.common.config.parse_str(in_str)

Helper function to evaluate a string in the config file.

Parameters:

in_str (str) – The input string to be evaluated.

Returns:

The evaluated string.

Return type:

str

qrem.common.config.parse_literal(instr)

Converts a string specifying a list or tuple.

Parameters:

instr (str) – The input string specifying a list.

Returns:

The converted list.

Return type:

any

qrem.common.config.parse_boolean(b)

Interpret config parameter as a boolean values.

Parameters:

b (str) – The input string representing a boolean value.

Returns:

The interpreted boolean value.

Return type:

bool

Raises:

ValueError – If the input string cannot be interpreted as a boolean.

class qrem.common.config.QremConfigLoader
config_parser
load(default_path=str(example_config_ibm_path), as_dict=False)

Processes a config file specific for QREM.

Parameters:
  • cmd_args (list, optional) – Command line arguments (default is None).

  • default_path (str, optional) – Path to the default config file (default is ‘default.ini’ located within “qrem/config” path of the module ).

  • as_dict (bool, optional) – If True, returns the configuration as a dictionary (default is False).

Returns:

The parsed configuration.

Return type:

configargparse.Namespace or dict

values()

Return summary of configuration values

help()

Print help for preparation of the config file

qrem.common.config.aa