spin_pulse.environment.experimental_environment¶
Description of the noisy environment associated to a hardware.
Classes¶
Contain a quantum experimental environment with configurable noise models. |
Module Contents¶
- class spin_pulse.environment.experimental_environment.ExperimentalEnvironment(hardware_specs, noise_type=NoiseType.PINK, T2S=100.0, TJS=None, duration=2**10, only_idle=False, segment_duration=2**10, seed=None, *, noise_directory=None)[source]¶
Contain a quantum experimental environment with configurable noise models.
- - hardware_specs
HardwareSpecs class, that defines the hardware settings.
- Type:
class
- - noise_type
Type of noise to simulate. Must be “pink”, “white”, or “quasistatic”.
- Type:
- - T2S
Characteristic time of individual qubits.
- Type:
- - TJS
Characteristic time of coupled two-qubit system at maximal J coupling without noise on the qubit’s frequency.
- Type:
float or None
- - duration
Total duration of the simulation.
- Type:
- - segment_duration
Duration of each noise segment; used to partition the time trace.
- Type:
- - only_idle
Flag to apply noise only to idle qubits.
- Type:
- - time_traces_coupling
List of time traces for coupling noise for each pair of qubits (if TJS is set).
- - seed
seed integer for random number generation. If not specified, no seed used.
- Type:
int or None
Initialize the ExperimentalEnvironment with specified noise characteristics and simulation parameters.
- Parameters:
hardware_specs (class) – HardwareSpecs class, that defines the hardware settings.
noise_type (NoiseType) – Type of noise to simulate. Must be “pink”, “white”, or “quasistatic”.
T2S (float) – Characteristic time of individual qubits.
TJS (float or None) – Characteristic time of coupled two-qubit system at maximal J coupling with no noise on the qubit’s frequency.
duration (int) – Total duration of the simulation.
only_idle (bool) – Flag to apply noise only to idle qubits.
segment_duration (int) – Duration of each noise segment; used to partition the time trace.
seed (int or None) – seed integer for random number generation. If not specified, no seed used.
noise_directory (str | os.PathLike | None) – Existing disk directory for temporary pink-noise histories and FFT arrays. Files are reclaimed when the arrays and their views are released. Parallel generation uses threads to avoid copying mapped arrays between worker processes. Each concurrent worker still needs its own FFT workspace.
- Raises:
ValueError – If an invalid noise_type is provided.
- noise_generator: type[spin_pulse.environment.noise.WhiteNoiseTimeTrace] | type[spin_pulse.environment.noise.QuasistaticNoiseTimeTrace] | type[spin_pulse.environment.noise.PinkNoiseTimeTrace][source]¶
- noise_directory: str | os.PathLike | None = None[source]¶
- hardware_specs: spin_pulse.transpilation.hardware_specs.HardwareSpecs[source]¶
- noise_type: spin_pulse.environment.noise.NoiseType[source]¶
- generate_time_traces(n_jobs=1)[source]¶
Generate noise time traces for each qubit’s frequency and J coupling to each pair of qubits if TJS is defined.
- Parameters:
n_jobs (int) – Number of core used to generate the time trace.
- Behavior:
For each qubit, instantiate a noise generator using the selected noise_type. The generator uses T2S, duration, and segment_duration to produce a time trace. If TJS is provided, generate additional time traces for J coupling noise for each pair of qubits.
- Effects:
Populate self.time_traces with one noise trace per qubit. If TJS is set, populate self.time_traces_coupling with one trace per pair of qubits (n-1 traces for n qubits).