sage.data.waveform.waveform_utils

Filename : utils.py Description : Short description of the file

Created on 2026-03-02 10:20:35

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

GitHub Repository: NULL

Documentation: NULL

Functions

get_freqs([f_l, f_u, sample_length_in_s, batch_size, ...])

Build a uniform frequency grid from f_l to f_u inclusive.

Module Contents

get_freqs(f_l=20.0, f_u=1024.0, sample_length_in_s=16.0, batch_size=None, device='cpu', dtype=torch.float64)[source]

Build a uniform frequency grid from f_l to f_u inclusive.

The bin spacing is df = 1 / sample_length_in_s, matching the DFT convention used throughout Sage. Optionally broadcasts the grid to a batch dimension for vectorised waveform generation.

Parameters:
  • f_l (float) – Lower frequency bound in Hz (default 20.0).

  • f_u (float) – Upper frequency bound in Hz (default 1024.0).

  • sample_length_in_s (float) – Segment duration in seconds; determines df = 1/T (default 16.0).

  • batch_size (int or None) – If given, expand the output to shape (batch_size, F); otherwise returns shape (F,) (default None).

  • device (str or torch.device) – Target device (default "cpu").

  • dtype (torch.dtype) – Output dtype (default torch.float64).

Returns:

  • f (torch.Tensor) – Frequency array, shape (F,) or (batch_size, F).

  • f_ref (torch.Tensor) – Reference frequency (f_l), shape () or (batch_size, 1).