qermit.clifford_noise_characterisation

qermit.clifford_noise_characterisation.ccl.gen_CDR_MitEx(device_backend, simulator_backend, n_non_cliffords, n_pairs, total_state_circuits, **kwargs)[source]

Produces a MitEx object for applying Clifford Circuit Learning & Clifford Data Regression mitigation methods when calculating expectation values of observables. Implementation as in arXiv:2005.10189.

Parameters:
  • device_backend (Backend) – Backend object device experiments are default run through.

  • simulator_backend (Backend) – Backend object simulated characterisation experiments are default run through.

  • n_non_cliffords (int) – Number of gates in Ansatz Circuit left as non-Clifford gates when producing characterisation circuits.

  • n_pairs (int) – Number of non-Clifford gates sampled to become Clifford and vice versa each time a new state circuit is generated.

  • total_state_circuits (int) – Total number of state circuits produced for characterisation.

Key states_simulator_mitex:

MitEx object noiseless characterisation simulations are executed on, default simulator_backend with basic compilation of circuit.

Key states_device_mitex:

MitEx object noisy characterisation circuit are executed on, default device_backend with basic compilation of circuit.

Key experiment_mitex:

MitEx object that actual experiment circuits are executed on, default backend with some compilation of circuit.

Key model:

Model characterised by state circuits, default _PolyCDRCorrect(1) (see cdr_post.py for other options).

Key likelihood_function:

LikelihoodFunction used to filter state circuit results, given by a LikelihoodFunction Enum, default set to none.

Key tolerance:

Model can be perturbed when calibration circuits have by exact expectation values too close to each other. This parameter sets a distance between exact expectation values which at least some calibration circuits should have.

Key distance_tolerance:

The absolute tolerance on the distance between expectation values of the calibration and original circuit.

Key calibration_fraction:

The upper bound on the fraction of calibration circuits which have noisy expectation values far from that of the original circuit.

Return type:

MitEx

class qermit.clifford_noise_characterisation.ccl.LikelihoodFunction(value)[source]

An enumeration.

none(qpo_noisy, qpo_exact)[source]

Returns probability 1 of accepting returned results.

Parameters:
Return type:

float

Returns:

Always 1, meaning any result is accepted.

qermit.clifford_noise_characterisation.dfsc.gen_DFSC_MitEx(backend, **kwargs)[source]

Produces a MitEx object that applies DFSC characterisation to all experiment results.

Parameters:

backend (Backend) – Backend experiments are run through.

Key experiment_mitex:

MitEx object observable experiments are run through

Key characterisation_mitex:

MitEX object characteriastion experiments are run through.

Return type:

MitEx

Returns:

MitEx object for automatic DFSC correction of circuits.

qermit.clifford_noise_characterisation.ccl.ccl_state_task_gen(n_non_cliffords, n_pairs, total_state_circuits, simulator_backend, tolerance, max_state_circuits_attempts)[source]

Returns a MitTask object for which given some set of experiments, for each experiment prepares a set of state circuits for Clifford Circuit Learning characterisation. The original experiment is returned on the first wire, state circuits for running on backend on second wire, and state circuits for noiseless simulation on the third wire.

Parameters:
  • n_non_cliffords (int) – Number of remaining non-Clifford gates in generated State Circuits.

  • n_pairs (int) – Parameter used for guiding properties of State Circuits generated.

  • total_state_circuits (int) – Number of state circuits prepared for characterisation.

  • tolerance (float) – Model can be perturbed when calibration circuits have by exact expectation values too close to each other. This parameter sets a distance between exact expectation values which at least some calibration circuits should have.

  • simulator_backend (Backend) – Backend object simulated characterisation experiments are default run through.

  • max_state_circuits_attempts (int) – The maximum number of times to attempt to generate a list of calibrations circuit with significantly different expectation values, before resorting to a list with similar expectation values.

Return type:

MitTask

Returns:

MitTask object for preparing and returning state circuits for characterisation.

qermit.clifford_noise_characterisation.ccl.ccl_result_batching_task_gen(n_state_circuits)[source]

For each experiment run through MitEx, pairs up noisy and noiseless expectation values from state circuits for that experiments CCL calibration and then returns results for a single calibration in a single list.

Parameters:

n_state_circuits (int) – Number of state circuits initially prepared for each experiment characterisation.

Return type:

MitTask

Returns:

MitTask object that organises QubitPauliOperator objects required for characterisation.

qermit.clifford_noise_characterisation.ccl.ccl_likelihood_filtering_task_gen(likelihood_function, **kwargs)[source]
Parameters:

likelihood_function (LikelihoodFunction) – LikelihoodFunction enum used to accept or reject some pair of noisy and noiseless expectation. Function must take two QubitPauliOperator as parameter, and return a single float between 0 and 1 as answer.

Key seed:

Seed value for sampling probability for likelihood function

Return type:

MitTask

Returns:

MitTask object that removes some characterisation results under some condition set by the likelihood_function option.

qermit.clifford_noise_characterisation.dfsc.DFSC_circuit_task_gen()[source]

For each experiment, the ansatz circuit has all symbolic gates substituted for Clifford angles (in this case, all 0’s). If any non symbolic gates are non Clifford, an error is thrown. For each Clifford ansatz circuit, a new ObservableTracke is forme with new measurement circuits added for each Qubit Pauli String in the operator.

Return type:

MitTask

Returns:

MitTask object that produces characterisation circuits for DFSC on a new wire as new experiments

qermit.clifford_noise_characterisation.dfsc.DFSC_collater_task_gen()[source]

For each experiment passed to MitEx, DFSC characterisation produces an ObservableTracker of a single Measurement Circuit for each combination of Clifford circuit produced, eigenstates preparation and QubitPauliString in operator, via several nested Lists. This task unpackages these Lists into a single List as suitable for input to MitEx objects. It also stores information required to produce characterisation from resulting QubitPauliOperators out of MitEx object.

Return type:

MitTask

Returns:

MitTask object that collates many BackendResult objects for a single frame randomisation instance and converts them into a single BackendResult object.

qermit.clifford_noise_characterisation.dfsc.DFSC_characterisation_task_gen()[source]

Given characterisation results for all experiments, Clifford circuits and QubitPauliStrings, produces a characterisation result for each Experiment.

Return type:

MitTask

Returns:

MitTask object for organising and calculating characterisation.

qermit.clifford_noise_characterisation.dfsc.DFSC_correction_task_gen(zero_threshold)[source]

For each experiment expectation, if characterisation value greater than threshold, divide experiment expectation by characterisation value to correct for depolarising noise.

Parameters:

zero_threshold (float) – Method does not correct for zero characterisation expectation values, threshold for this zero limit.

Return type:

MitTask

Returns:

Function for DFSC correction.