Skip to main content
IBM Quantum Platform

qiskit_noise_learning.experiment_builder.Experiment

class qiskit_noise_learning.experiment_builder.Experiment(*, fidelity_model: LinearMap[Hashable, FidelityIndex] | ModelGateSet | None = None, paths: list[Path] | None = None, instruction_sequences: list[InstructionSequence] | None = None, relations: set[tuple[int, int]] | None = None, shots: int = 20, randomizations: int = 50, randomization_multipliers: list[int] | None = None, validate: bool = True)

GitHub

Bases: object

A learning experiment specification.

An Experiment collects all the data needed to define a noise-learning experiment: a fidelity model, analysis paths, instruction sequences, their relations, and execution parameters (shots and randomizations).

All fields are optional and may be progressively populated via ExperimentBuilderStage instances.

Parameters

  • fidelity_model – A fidelity model or a model gate set (which is wrapped in an IdentityFidelityModel).
  • paths – Paths to analyze.
  • instruction_sequences – Instruction sequences (may include both bound and unbound).
  • relations – Set of (path_idx, sequence_idx) tuples indicating which paths are traversed by which instruction sequences.
  • shots – Global number of shots (default 20).
  • randomizations – Global number of randomizations (default 50).
  • randomization_multipliers – Per-sequence randomization multiplier (parallel to instruction_sequences).
  • validate – If True (default), enforce the same validation checks as replace() (co-replacement, length consistency, relations bounds).

__init__

__init__(*, fidelity_model: LinearMap[Hashable, FidelityIndex] | ModelGateSet | None = None, paths: list[Path] | None = None, instruction_sequences: list[InstructionSequence] | None = None, relations: set[tuple[int, int]] | None = None, shots: int = 20, randomizations: int = 50, randomization_multipliers: list[int] | None = None, validate: bool = True)


Methods

Column 1
Column 2
__init__(*[, fidelity_model, paths, ...])
replace(*[, validate])Return a shallow copy with the given fields overridden.

Attributes

Column 1
Column 2
design_matrixThe design matrix, lazily computed from the fidelity model and paths.
fidelity_modelThe fidelity model.
gate_setThe model gate set.
instruction_sequencesThe instruction sequences.
is_executableWhether this experiment has all the information required to be run.
pathsThe analysis paths.
randomization_multipliersPer-sequence randomization multipliers.
randomizationsGlobal number of randomizations.
relationsThe set of path and sequence relations.
shotsGlobal number of shots.

fidelity_model

Type: LinearMap[Hashable, FidelityIndex] | None

The fidelity model.

gate_set

Type: ModelGateSet | None

The model gate set.

paths

Type: list[Path] | None

The analysis paths.

instruction_sequences

Type: list[InstructionSequence] | None

The instruction sequences.

relations

Type: set[tuple[int, int]] | None

The set of path and sequence relations.

shots

Type: int

Global number of shots.

randomizations

Type: int

Global number of randomizations.

randomization_multipliers

Type: list[int] | None

Per-sequence randomization multipliers.

design_matrix

Type: IndexedMatrix

The design matrix, lazily computed from the fidelity model and paths.

Raises

ValueError – If fidelity_model or paths is None.

is_executable

Type: bool

Whether this experiment has all the information required to be run.

Requires: instruction_sequences is set, all sequences are bound and complete, and randomization_multipliers is set.

replace

replace(*, validate: bool = True, **kwargs) → Experiment

Return a shallow copy with the given fields overridden.

When validate=True (default), the following checks are enforced:

  • Co-replacement: instruction_sequences and randomization_multipliers must always both be None or both be non-None. Replacing one without the other is only allowed if it preserves this invariant.
  • Length consistency: randomization_multipliers must have the same length as instruction_sequences.
  • Relations bounds: Setting relations requires paths and instruction_sequences to be present, and all indices must be in bounds.
  • Soft invalidation: Replacing paths or instruction_sequences without providing new relations will set relations to None with a warning.

Parameters

  • validate – If True, enforce the above checks. If False, fields are set as-is with no validation.
  • **kwargs – Field names and their new values.

Raises

  • TypeError – If an unrecognized field name is given.
  • ValueError – If a validation constraint is violated.
Was this page helpful?
Report a bug, typo, or request content on GitHub.