spin_pulse.environment.noise.pink

Classes

PinkNoiseTimeTrace

Generate a pink noise time trace with a 1/f power spectral density.

Functions

get_pink_noise(segment_duration[, seed])

Generate a single segment of pink noise using an inverse FFT method.

get_pink_noise_with_repetitions(duration, segment_duration)

Generate pink noise of a given total duration by repeating segments.

Module Contents

spin_pulse.environment.noise.pink.get_pink_noise(segment_duration, seed=None)[source]

Generate a single segment of pink noise using an inverse FFT method.

The generated sequence has length segment_duration and follows a spectral density proportional to 1/freq.

This implementation is adapted from the Matlab implementation of the algorithm described in [Little2007].

References

[Little2007] M. A. Little, P. E. McSharry, S. J. Roberts, D. A. E. Costello, and I. M. Moroz, “Exploiting nonlinear recurrence and fractal scaling properties for voice disorder detection”, BioMedical Engineering OnLine, 6:23 (2007).

Parameters:
  • segment_duration (int) – Number of time points in the generated pink noise segment.

  • seed (int | None) – Optional seed for reproducible random number generation.

Returns:

Array of length segment_duration containing a

realization of pink noise.

Return type:

ndarray

Raises:

ValueError – If segment_duration is odd.

spin_pulse.environment.noise.pink.get_pink_noise_with_repetitions(duration, segment_duration, seed=None)[source]

Generate pink noise of a given total duration by repeating segments.

A base pink noise segment of length segment_duration is generated repeatedly and concatenated until the total length reaches duration. A low frequency cutoff of 1/segment_duration is implicitly imposed.

Parameters:
  • duration (int) – Total number of time points in the final noise trace.

  • segment_duration (int) – Length of each repeated pink noise segment.

  • seed (int | None) – Optional seed for reproducible random number generation.

Returns:

Pink noise trace of length duration.

Return type:

ndarray

class spin_pulse.environment.noise.pink.PinkNoiseTimeTrace(T2S, duration, segment_duration, seed=None)[source]

Bases: spin_pulse.environment.noise.noise_time_trace.NoiseTimeTrace

Generate a pink noise time trace with a 1/f power spectral density.

This class constructs a noise trace of length duration where the spectral density follows a pink noise distribution proportional to 1/f. A low-frequency cutoff is enforced at 1/segment_duration by building the trace from repeated pink noise segments. The parameter T2S determines the noise intensity through the scaling factor S0 defined as:

S0 = 1 / (4 * pi^2 * log(segment_duration) * T2S^2)

The internal array values contains the generated noise samples and is used by methods such as ramsey_contrast to evaluate the effect of pink noise on qubit coherence.

- segment_duration

Length of each pink noise segment.

Type:

int

- S0

Scaling factor controlling the noise intensity.

Type:

float

- T2S

Coherence time parameter determining the noise intensity.

Type:

float

- sigma

Standard deviation of the generated noise values.

Type:

float

- 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 cutoff f_min=1/segment_duration. The parameter T2S sets the noise intensity through the relation S0 = 1 / (4 * pi^2 * log(segment_duration) * T2S^2). The internal noise trace has length duration and is constructed by repeating pink noise segments.

Parameters:
  • T2S (float) – Coherence time parameter determining the noise intensity.

  • duration (int) – Total number of time steps in the noise trace.

  • segment_duration (int) – Length of each pink noise segment.

  • seed (int | None) – Optional seed for reproducible random number generation.

Returns:

The time trace is stored internally in self.values.

Return type:

None

segment_duration[source]
values[source]
S0[source]
T2S[source]
sigma[source]
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