EmulationConfig
- class pulser.backend.EmulationConfig(*, callbacks=(), observables=(), default_evaluation_times=(1.0,), initial_state=None, with_modulation=False, interaction_matrix=None, prefer_device_noise_model=False, noise_model=None, n_trajectories=None, default_num_shots=1000, **backend_options)
Bases:
BackendConfig,Generic[StateType]Configures an emulation on a backend.
Note
Additional parameters may be provided. It is up to the emulation backend that receives a configuration with extra parameters to assess whether it recognizes them and how it will use them. To know all parameters expected by an EmulatorBackend, consult its associated EmulationConfig subclass found under
EmulatorBackend.config_type.- Parameters:
observables (Sequence[Observable], default:
()) – A sequence of observables to compute at specific evaluation times. The observables without specified evaluation times will use this configuration’s ‘default_evaluation_times’.callbacks (Sequence[Callback], default:
()) – A general callback that is not an observable. Observables must be fed into the observables arg, since they all interact with the Results, and are subject to additional validation. Unlike observables, these are called at every emulation step.default_evaluation_times (Sequence[SupportsFloat] | Literal[‘Full’], default:
(1.0,)) – The default times at which observables are computed. Can be a sequence of unique relative times between 0 (the start of the sequence) and 1 (the end of the sequence), in ascending order. Can also be specified as “Full”, in which case every step in the emulation will also be an evaluation time.initial_state (StateType | None, default:
None) – The initial state from which emulation starts. If specified, the state type needs to be compatible with the emulator backend (i.e. it must matchEmulatorBackend.config_type.state_type). If left undefined, defaults to starting with all qudits in the ground state.with_modulation (bool, default:
False) – Whether to emulate the sequence with the programmed input or the expected output.interaction_matrix (ArrayLike | None, default:
None) – An optional interaction matrix to replace the interaction terms in the Hamiltonian. For an N-qudit system, must be an NxN symmetric matrix where entry (i, j) dictates the interaction coefficient between qudits i and j, ie it replaces the C_n/r_{ij}^n term.prefer_device_noise_model (bool, default:
False) – If True, uses the noise model of the sequence’s device (if the sequence’s device has one), regardless of the noise model given with this configuration.noise_model (NoiseModel | None, default:
None) – An optional noise model to emulate the sequence with. Ignored if the sequence’s device has default noise model and prefer_device_noise_model=True.n_trajectories (int | None, default:
None) –The number of trajectories to average over when the emulation includes stochastic noise or is using a Monte Carlo solver. When left undefined:
(1) If ‘prefer_device_noise_model=False’, tries to use the (now deprecated) value of NoiseModel.runs. If that is also not defined, defaults to 1 trajectory.
(2) If ‘prefer_device_noise_model=True’, defaults to 40 trajectories.
default_num_shots (int, default:
1000) – The default number of shots forBitStrings, used whenever the observable doesn’t define its own. Defaults to 1000.
Attributes
A sequence of callbacks that are not observables.
A sequence of observables to compute at specific evaluation times.
The default times at which observables are computed.
A custom initial state from which emulation starts.
Whether to emulate the sequence with output modulation effects.
An interaction matrix to replace the Hamiltonian interaction terms.
Whether to use the noise model of the sequence's
Device.A custom noise model to emulate the sequence with.
The number of trajectories to average over (when applicable).
The default number of shots for
BitStrings.Methods
Deserialize an EmulationConfig from an abstract JSON object.
Assesses whether a relative time is an evaluation time.
Checks if a time is within a collection of evaluation times.
Serialize EmulationConfig to a JSON formatted str.
Returns a copy of the config with the given changes.
Signatures
- operator_type
alias of
OperatorRepr
- state_type
alias of
StateRepr
- classmethod from_abstract_repr(obj_str)
Deserialize an EmulationConfig from an abstract JSON object.
- Parameters:
obj_str (str) – The JSON string representing the config encoded in the abstract JSON format.
- Returns:
The EmulationConfig instance.
- Return type:
- is_evaluation_time(t, tol=1e-06)
Assesses whether a relative time is an evaluation time.
- Return type:
bool
- static is_time_in_evaluation_times(t, evaluation_times, tol=1e-06)
Checks if a time is within a collection of evaluation times.
- Return type:
bool
- to_abstract_repr(skip_validation=False)
Serialize EmulationConfig to a JSON formatted str.
- Return type:
str
- with_changes(**changes)
Returns a copy of the config with the given changes.
- Return type:
TypeVar(Self, bound= BackendConfig)
-
callbacks:
Sequence[Callback] A sequence of callbacks that are not observables.
-
default_evaluation_times:
ndarray|Literal['Full'] The default times at which observables are computed.
-
default_num_shots:
int The default number of shots for
BitStrings.
-
initial_state:
TypeVar(StateType, bound=State) |None A custom initial state from which emulation starts.
-
interaction_matrix:
AbstractArray|None An interaction matrix to replace the Hamiltonian interaction terms.
-
n_trajectories:
int The number of trajectories to average over (when applicable).
-
noise_model:
NoiseModel A custom noise model to emulate the sequence with.
-
observables:
Sequence[Observable] A sequence of observables to compute at specific evaluation times.
-
prefer_device_noise_model:
bool Whether to use the noise model of the sequence’s
Device.
-
with_modulation:
bool Whether to emulate the sequence with output modulation effects.