qiskit_noise_learning.experiment_builder.ExperimentBuilderStage
class qiskit_noise_learning.experiment_builder.ExperimentBuilderStage
Bases: ABC
Abstract base for a stage in the experiment-building pipeline.
Each stage takes an Experiment and returns a new Experiment with additional fields populated or existing fields transformed.
Subclasses declare which Experiment fields they require via the required_fields class attribute, and which fields they populate (can take form None to a non-None value) via populates_fields. The public run() method validates that the required fields are not None before dispatching to _run().
ExperimentBuilder uses populates_fields to compute its aggregate required_fields: a stage’s requirement is satisfied if a preceding stage populates that field.
Parameters
- required_fields – Tuple of
Experimentproperty names that must be non-Nonebefore this stage can execute. - populates_fields – Tuple of
Experimentproperty names that this stage populates on the returnedExperiment.
__init__
__init__()
Methods
Attributes
Column 1 | Column 2 |
|---|---|
populates_fields | |
required_fields |
run
run(experiment: Experiment) → Experiment
Validate required fields, then apply this stage.
Parameters
experiment – The input experiment.
Returns
A new Experiment with this stage’s transformations applied.
Raises
ValueError – If any field listed in required_fields is None.