qermit.spam — Qermit 0.2.0 documentation

# qermit.spam

spam_mitres.gen_FullyCorrelated_SPAM_MitRes(calibration_shots: int, correlations: List[List[pytket._tket.circuit.Node]], **kwargs) → qermit.taskgraph.mitres.MitRes

  Produces a MitRes object for performing SPAM correction with subsets of fully correlated device nodes specified by correlations. Requires 2^n circuits to fully characterise, where n is the size of the largest sublist of correlated nodes.

  Parameters

    - backend (Backend) – Default Backend characterisation and experiment are executed on.

    - calibration_shots (int) – Number of shots required for each characterisation circuit

    - correlations (List[List[Node]]) – Each sublist of Node corresponds to some set of fully correlated nodes.

spam_mitres.gen_UnCorrelated_SPAM_MitRes(calibration_shots: int, **kwargs) → qermit.taskgraph.mitres.MitRes

  Produces a MitRes object for performing SPAM correction with no correlated nodes. Requires 2 circuits to characterise device.

  Parameters

    - backend (Backend) – Default Backend characterisation and experiment are executed on.

    - calibration_shots (int) – Number of shots required for each characterisation circuit

full_spam_correction.gen_full_tomography_spam_circuits_task(shots: int, qubit_subsets: List[List[pytket._tket.circuit.Qubit]]) → qermit.taskgraph.mittask.MitTask

  Generate MitTask for calibration circuits according to the specified correlation and given backend.

  Parameters

    - backend (Backend) – Backend on which the experiments are run.

    - qubit_subsets (List[List[Qubit]]) – A list of lists of correlated Nodes of a Device. Qubits within the same list are assumed to only have SPAM errors correlated with each other. Thus to allow SPAM errors between all qubits you should provide a single list. The qubits in qubit_subsets must be nodes in the backend’s associated Device.

    - shots – An int corresponding to the number of shots of each calibration circuit required.

  Returns

    A MitTask object, requiring 1 List[CircuitShots] wire and returning (List[CircuitShots], List[StateInfo]) corresponding to Calibration Circuits and corresponding states.

  Return type

    MitTask

full_spam_correction.gen_full_tomography_spam_characterisation_task(qubit_subsets: List[List[pytket._tket.circuit.Qubit]]) → qermit.taskgraph.mittask.MitTask

  Uses results from device for characterisation circuits to characterise transition matrices for different qubit subsets and stores them in backend.

  Parameters

    - backend (Backend) – Backend for storing characterisations in.

    - qubit_subsets (List[List[Qubit]]) – Subsets of qubits in backend corresponding to different correlated subsets.

full_spam_correction.gen_full_tomography_spam_correction_task(corr_method: qermit.spam.full_transition_tomography.CorrectionMethod) → qermit.taskgraph.mittask.MitTask

  Uses characterisation result held in backend to correct for SPAM noise in passed BackendResult objects. Method used to invert SPAM characteriastion matrices and correct results given by CorrectionMethod enum.

  Parameters

    - backend (Backend) – Device Backend holding SPAM characterisation.

    - corr_method (CorrectionMethod) – Method used to invert matrices and correct results.

    - characterised (bool) – bool passed from characterisation task confirming characterisation is complete.

full_spam_correction.gen_get_bit_maps_task() → qermit.taskgraph.mittask.MitTask

  Returns a task that takes a list of circuits and returns the circuits, and a map betwen each circuit bit and the qubit it is measured on.