spin_pulse.environment.noise¶
- This modules provides a set of noise classes for simulating different noise processes:
QUASISTATIC: Quasistatic noise generated by QuasistaticNoiseTimeTrace from
spin_pulse.environment.noise.quasistatic.PINK: Pink (1/f) noise generated by PinkNoiseTimeTrace from
spin_pulse.environment.noise.pink.WHITE: White Gaussian noise generated by WhiteNoiseTimeTrace from
spin_pulse.environment.noise.white.
Re-exported objects¶
The following objects can be directly imported from spin_pulse.environment.noise even if they are implemented in submodules.
Base class for generating and manipulating noise time traces. |
|
Enumerate the supported noise models for spin-qubit simulations. |
|
Generate a pink noise time trace with a 1/f power spectral density. |
|
Generate a quasi-static noise time trace for spin-qubit simulations. |
|
Generate a white noise time trace. |
Submodules¶
Classes¶
Base class for generating and manipulating noise time traces. |
|
Enumerate the supported noise models for spin-qubit simulations. |
|
Generate a pink noise time trace with a 1/f power spectral density. |
|
Generate a quasi-static noise time trace for spin-qubit simulations. |
|
Generate a white noise time trace. |
Package Contents¶
- class spin_pulse.environment.noise.NoiseTimeTrace(duration)[source]¶
Base class for generating and manipulating noise time traces.
A noise time trace is represented as an array of length
duration, containing the instantaneous noise values \(\epsilon(t)\) that affect the qubit. Subclasses implement specific noise models (quasistatic, pink, white, etc.) and populate thevaluesarray accordingly.- - duration
Total number of time steps in the noise trace.
- Type:
- - values
Array of noise values of length
duration.- Type:
ndarray
Initializes an empty noise time trace of given duration.
- Parameters:
duration (int) – Total number of time steps in the noise trace.
- duration¶
- values¶
- ramsey_contrast(ramsey_duration)[source]¶
Compute the Ramsey contrast for a qubit subject to this noise trace.
The qubit is initialized in the equal superposition state \(\frac{\\lvert 0 \rangle + \\lvert 1 \rangle}{\\sqrt{2}}\) and evolves under a pure dephasing Hamiltonian \(H(t) = \\omega(t) Z\). The Ramsey contrast is obtained from the accumulated phase \(\\sum_t \\omega(t)\) over segments of length
ramsey_duration. The trace is divided into independent experiments of equal length and the contrast is averaged over all experiments.- Parameters:
ramsey_duration (int) – Number of time steps per Ramsey experiment.
- Returns:
Averaged Ramsey contrast of length
ramsey_duration.- Return type:
float
- class spin_pulse.environment.noise.NoiseType(*args, **kwds)[source]¶
Bases:
enum.EnumEnumerate the supported noise models for spin-qubit simulations.
Each enum value corresponds to the time-trace class used to generate the associated noise realization.
- Noise types:
- QUASISTATIC: Quasistatic noise generated by
QuasistaticNoiseTimeTrace.
PINK: Pink (1/f) noise generated by PinkNoiseTimeTrace.
WHITE: White Gaussian noise generated by WhiteNoiseTimeTrace.
- QUASISTATIC = 'QuasistaticNoiseTimeTrace'¶
- PINK = 'PinkNoiseTimeTrace'¶
- WHITE = 'WhiteNoiseTimeTrace'¶
- class spin_pulse.environment.noise.PinkNoiseTimeTrace(T2S, duration, segment_duration, seed=None)[source]¶
Bases:
spin_pulse.environment.noise.noise_time_trace.NoiseTimeTraceGenerate a pink noise time trace with a 1/f power spectral density.
This class constructs a noise trace of length
durationwhere the spectral density follows a pink noise distribution proportional to1/f. A low-frequency cutoff is enforced at1/segment_durationby building the trace from repeated pink noise segments. The parameterT2Sdetermines the noise intensity through the scaling factorS0defined as:S0 = 1 / (4 * pi^2 * log(segment_duration) * T2S^2)
The internal array
valuescontains the generated noise samples and is used by methods such asramsey_contrastto evaluate the effect of pink noise on qubit coherence.- - segment_duration
Length of each pink noise segment.
- Type:
- - S0
Scaling factor controlling the noise intensity.
- Type:
- - T2S
Coherence time parameter determining the noise intensity.
- Type:
- - sigma
Standard deviation of the generated noise values.
- Type:
- - values
Noise values of length
duration.- Type:
ndarray
Create a pink noise time trace for spin qubit simulations.
The generated noise satisfies a spectral density proportional to
1/(f*ts)with a low frequency cutofff_min=1/segment_duration. The parameterT2Ssets the noise intensity through the relationS0 = 1 / (4 * pi^2 * log(segment_duration) * T2S^2). The internal noise trace has lengthdurationand is constructed by repeating pink noise segments.- Parameters:
- Returns:
The time trace is stored internally in
self.values.- Return type:
None
- segment_duration¶
- values¶
- S0¶
- T2S¶
- sigma¶
- plot_ramsey_contrast(ramsey_duration)[source]¶
Plot analytical and numerical Ramsey contrast curves.
- This method overlays:
the analytical Gaussian contrast expected for pink noise,
a corrected analytical contrast that accounts for the frequency cutoff imposed by
segment_duration,the numerical contrast obtained from the underlying noise trace.
- Parameters:
ramsey_duration (int) – Number of time steps used in the Ramsey experiment evaluation.
- Returns:
The function produces a plot of the Ramsey contrast.
- Return type:
None
- class spin_pulse.environment.noise.QuasistaticNoiseTimeTrace(T2S, duration, segment_duration, seed=None)[source]¶
Bases:
spin_pulse.environment.noise.noise_time_trace.NoiseTimeTraceGenerate a quasi-static noise time trace for spin-qubit simulations.
This noise type produces a sequence of piecewise-constant Gaussian noise segments. Each segment has duration
segment_duration, and all samples within a segment share the same random value. The resulting noise corresponds to a quasi-static fluctuation with standard deviation determined by the coherence timeT2S.- - segment_duration
Duration of each constant-noise segment.
- Type:
- - sigma
Standard deviation of the quasistatic noise, computed as \(\sqrt{2}/T_2^*\).
- Type:
- - T2S
Coherence time parameter used to scale the noise.
- Type:
- - values
Array of noise values of length
duration.- Type:
ndarray
Initialize a quasi-static Gaussian noise trace.
The noise trace is constructed from repeated Gaussian segments of length
segment_duration. Each segment takes a single Gaussian random value with zero mean and standard deviation \(\sqrt{2}/T_2^*\). The total duration must be an integer multiple of the segment length.- Parameters:
- Raises:
ValueError – If
durationis not divisible bysegment_duration.
- segment_duration¶
- sigma¶
- T2S¶
- values¶
- plot_ramsey_contrast(ramsey_duration)[source]¶
Plot the analytical and simulated Ramsey contrast.
The analytical contrast \(\exp(-t^2 / T_2^{*2})\) is plotted together with the contrast returned by the parent
NoiseTimeTraceclass.- Parameters:
ramsey_duration (int) – Duration over which the Ramsey signal is evaluated.
- class spin_pulse.environment.noise.WhiteNoiseTimeTrace(T2S, duration, segment_duration, seed=None)[source]¶
Bases:
spin_pulse.environment.noise.noise_time_trace.NoiseTimeTraceGenerate a white noise time trace.
This class constructs a noise trace of length
durationwhere each time step is drawn from an independent Gaussian distribution. The noise intensity is determined by the coherence timeT2Sthat fixes the standard deviation \(\sqrt{2/T_2^*}\). White noise corresponds to a flat power spectral density and requiressegment_duration = 1.- - segment_duration
Always equal to 1 for white noise.
- Type:
- - sigma
Standard deviation controlling the noise intensity.
- Type:
- - T2S
Coherence time parameter determining the noise intensity.
- Type:
- - values
Noise samples of length
duration.- Type:
ndarray
Initialize a white noise time trace for spin qubit simulations.
Each value of the trace is drawn independently from a Gaussian distribution with zero mean and standard deviation \(\sqrt{2/T_2^*}\). The
segment_durationparameter must be equal to 1, since white noise has no temporal correlations.- Parameters:
- Returns:
The generated noise values are stored in
self.values.- Return type:
None
- segment_duration = 1¶
- sigma¶
- values¶
- T2S¶
- plot_ramsey_contrast(ramsey_duration)[source]¶
Plot analytical and numerical Ramsey contrast for white noise.
The plot overlays:
the analytical exponential decay expected for white noise,
the numerical contrast computed from the generated time trace.
- Parameters:
ramsey_duration (int) – Number of time steps used in the Ramsey experiment evaluation.
- Returns:
The function produces a plot of the Ramsey contrast.
- Return type:
None