sage.data.noise.white_noise

Filename : white_noise.py Description : White Gaussian noise generators for pipeline testing.

Created on 2026-01-19 16:18:49

__author__ = Narenraju Nagarajan __copyright__ = Copyright 2026, Sage __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __email__ = N/A __status__ = [‘inProgress’, ‘Archived’, ‘inUsage’, ‘Debugging’]

GitHub Repository: NULL

Documentation: NULL

Classes

WhiteNoiseGenerator

Generate independent white Gaussian noise for each detector.

WhiteGaussianNoiseSampler

Batch white Gaussian noise sampler for pipeline development and testing.

Module Contents

class WhiteNoiseGenerator[source]

Generate independent white Gaussian noise for each detector.

Produces zero-mean, unit-variance Gaussian noise with independent seeds per detector. Primarily used for controlled testing and as a substitute for real noise during pipeline development or unit tests.

generate(sample_length_in_num, seed=0)[source]

Draw a single white Gaussian noise realisation.

Parameters:
  • sample_length_in_num (int) – Number of samples to generate.

  • seed (int) – NumPy random seed for reproducibility.

Returns:

Zero-mean, unit-variance Gaussian noise.

Return type:

numpy.ndarray, shape (sample_length_in_num,)

apply(special, det_only='')[source]

Generate dual-detector white noise for a single sample.

Parameters:
  • special (dict) – Must contain "sample_seed" (int) and "data_cfg" with signal_length (s) and sample_rate (Hz) attributes.

  • det_only (str) – Unused; kept for API compatibility.

Returns:

Stacked H1/L1 white noise arrays.

Return type:

numpy.ndarray, shape (2, N)

class WhiteGaussianNoiseSampler(seed=None)[source]

Bases: torch.nn.Module

Batch white Gaussian noise sampler for pipeline development and testing.

Generates independent zero-mean unit-variance Gaussian noise in the time domain per detector, converts to the frequency domain via rfft (norm='forward'), and returns a GPU-resident FD_UNIFORM batch that mirrors the MemmapNoiseSampler API.

The returned noise is (B, D, F) complex, ready to be combined with signal batches and passed through FiducialWhitening. When the signal sampler uses worst-case multibanding, the training loop’s auto-multibanding selector converts this to FD_COARSE automatically before injection.

Parameters:

seed (int or None) – Seed for the internal NumPy RNG (for reproducibility).

GRAPH_READY[source]

Falsestandard_normal is not traceable by torch.compile.

Type:

bool

Initialize internal Module state, shared by both nn.Module and ScriptModule.
GRAPH_READY = False[source]
seq_len[source]
device[source]
n_detectors[source]
batch_size[source]
rng[source]
noise_target[source]
forward()[source]

Return a noise batch and zero targets.

Returns:

  • noise_fd (torch.Tensor, shape (B, D, F) complex)

  • noise_target (torch.Tensor, shape (B, 1) float — all zeros)