colored_noise_stf_signal

random.colored_noise_stf_signal(power_spectral_density, frequency_step, batch_shape=(), seed=None)

Sample the one-sided power spectral density (PSD) of a random noise process in the time domain and returns the resultant noise trajectories as an Stf.

Parameters:
  • power_spectral_density (np.ndarray or Tensor (1D, real)) – The one-sided power spectral density of the noise sampled at frequencies \(\{0, \Delta f, 2\Delta f, \ldots , M\Delta f\}\).

  • frequency_step (float) – The step size \(\Delta f\) of power spectrum densities samples power_spectral_density. Must be a strictly positive number.

  • batch_shape (list[int] or tuple[int], optional) – The batch shape of the returned Stf. By default, the batch shape is (), that is, the returned Stf represents only one noise trajectory. If the batch shape is (m, n,...), the returned Stf represents m*n*… trajectories arranged in this batch shape.

  • seed (int or None, optional) – A seed for the random number generator used for sampling. When set, same trajectories are produced on every run of this function, provided all the other arguments also remain unchanged. Defaults to None, in which case the generated noise trajectories can be different from one run to another.

Returns:

An Stf signal representing the noise trajectories in the time domain. The batch shape of this Stf is same as the argument batch_shape.

Return type:

Stf

Notes

Given a frequency step size of \(\Delta f\) and discrete samples \(P[k] = P(k\Delta f)\) of a one-sided power spectral density function \(P(f)\), the output is a possibly batched Stf which represents one random realization of the random noise process. Each such trajectory is periodic with a time period of \(1/\Delta f\).

Examples

Create a PWC signal by sampling from a power spectral density function to define a noise Hamiltonian.

>>> sigma_z = np.diag([1, -1])
>>> frequency_step = 2e3
>>> frequencies = np.arange(0, 2e6, frequency_step)
>>> frequency_cutoff = 0.05e6
>>> power_densities = 4e9 / (frequencies + frequency_cutoff)
>>> noise_stf = graph.random.colored_noise_stf_signal(
...     power_spectral_density=power_densities, frequency_step=2000.0, batch_shape=(100,)
... )
>>> noise_stf
<Stf: operation_name="random_colored_noise_stf_signal", value_shape=(), batch_shape=(100,)>
>>> noise_pwc = graph.discretize_stf(stf=noise_stf, duration=2e-6, segment_count=50)
>>> noise_hamiltonian = noise_pwc * sigma_z
>>> noise_hamiltonian
<Pwc: name="multiply_#3", operation_name="multiply", value_shape=(2, 2), batch_shape=(100,)>

Refer to the How to simulate quantum dynamics subject to noise with graphs user guide to find the example in context.