qstone.utils package¶
Submodules¶
qstone.utils.config_schema module¶
Schema for the configuration file
qstone.utils.utils module¶
General utilities. Used across the jobs
- class qstone.utils.utils.ComputationStep(value)[source]¶
Bases:
Enum
Step of computation for profiling
- POST = 'POST'¶
- PRE = 'PRE'¶
- QUERY = 'QUERY'¶
- RUN = 'RUN'¶
- class qstone.utils.utils.JobReturnCode(value)[source]¶
Bases:
Enum
Type of exit code of job run
- INSUFFICIENT_QPU_RESOURCES = 1¶
- JOB_COMPLETED = 0¶
- POST_STEP_INCOMPLETE = 4¶
- PRE_STEP_INCOMPLETE = 2¶
- RUN_STEP_INCOMPLETE = 3¶
- class qstone.utils.utils.QpuConfiguration[source]¶
Bases:
object
Defines the configuration of a QPU (Quantum Processing Unit)
- qstone.utils.utils.load_json_profile(trace_info: str, schema: DataFrameSchema) DataFrame [source]¶
Loads function json profile and checks it against the schema
- Parameters:
trace_info – File location of function traced information
schema – Validator schema
Returns pandas dataframe containing profile information
- qstone.utils.utils.parse_json(config: str) Dict [source]¶
Parses the JSON file, validates it against the schema and returns a dictionary representation
- qstone.utils.utils.qasm_circuit_random_sample(qasm: str, repetitions: int) Dict [source]¶
Mocks simulation of qasm circuit by giving random readouts for classical registers
- Parameters:
qasm – string representation of qasm circuit
repetitions – number of readouts to simulate
Returns frequency of each classical bit string sampled
- qstone.utils.utils.trace(computation_type: str, computation_step: ComputationStep, label: str | None = None)[source]¶
General tracing of the function. Wrapper