qermit.clifford_noise_characterisation — Qermit 0.2.0 documentation

# qermit.clifford_noise_characterisation

ccl.gen_CDR_MitEx(simulator_backend: pytket.backends.backend.Backend, n_non_cliffords: int, n_pairs: int, total_state_circuits: int, **kwargs) → qermit.taskgraph.mitex.MitEx

  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.

class qermit.clifford_noise_characterisation.ccl.LikelihoodFunction(value)

  An enumeration.

  none(qpo_noisy: pytket.utils.operators.QubitPauliOperator, qpo_exact: pytket.utils.operators.QubitPauliOperator) → float

    Returns probability 1 of accepting returned results.

    Parameters

      - qpo_noisy (QubitPauliOperators) – Results calculated from device of choice.

      - qpo_exact (QubitPauliOperator) – Results calculated from noiseless simulator of choice.

    Returns

      Always 1, meaning any result is accepted.

    Return type

      float

dfsc.gen_DFSC_MitEx(**kwargs) → qermit.taskgraph.mitex.MitEx

  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.

  Returns

    MitEx object for automatic DFSC correction of circuits.

  Return type

    MitEx

ccl.ccl_state_task_gen(n_pairs: int, total_state_circuits: int, simulator_backend: pytket.backends.backend.Backend, tolerance: float, max_state_circuits_attempts: int) → qermit.taskgraph.mittask.MitTask

  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 – 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.

  Returns

    MitTask object for preparing and returning state circuits for characterisation.

  Return type

    MitTask

ccl.ccl_result_batching_task_gen() → qermit.taskgraph.mittask.MitTask

  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.

  Returns

    MitTask object that organises QubitPauliOperator objects required for characterisation.

  Return type

    MitTask.

ccl.ccl_likelihood_filtering_task_gen(**kwargs) → qermit.taskgraph.mittask.MitTask
  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

  Returns

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

  Return type

    MitTask

dfsc.DFSC_circuit_task_gen() → qermit.taskgraph.mittask.MitTask

  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.

  Returns

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

  Return type

    MitTask

dfsc.DFSC_collater_task_gen() → qermit.taskgraph.mittask.MitTask

  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.

  Returns

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

  Return type

    MitTask

dfsc.DFSC_characterisation_task_gen() → qermit.taskgraph.mittask.MitTask

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

  Returns

    MitTask object for organising and calculating characterisation.

  Return type

    MitTask

dfsc.DFSC_correction_task_gen() → qermit.taskgraph.mittask.MitTask

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

  Parameters

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

  Returns

    Function for DFSC correctoin.

  Return type

    MitTask