sage.dsp.welch
Filename : welch.py Description : Short description of the file
Created on 2026-01-20 12:42:08
__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
Classes
Welch PSD estimator wrapping |
|
Welch PSD estimator using PyTorch (CPU-friendly). |
Module Contents
- class ScipyWelch(sample_rate, nperseg_in_seconds=4.0, average='median', detrend='constant', window='hann', scaling='density')[source]
Welch PSD estimator wrapping
scipy.signal.welch().Provides a consistent interface for estimating the one-sided power spectral density of a 1D time series using Welch’s overlapping-segment method. Suitable for offline PSD computation during the data-preparation stage (not used inside the training loop).
- Parameters:
sample_rate (float) – Sampling rate in Hz.
nperseg_in_seconds (float) – Welch segment length in seconds (default 4.0 s).
average (str) – Segment averaging method —
"mean"or"median"(default).detrend (str or None) – Detrending applied to each segment (default
"constant").window (str) – Window function name (default
"hann").scaling (str) –
"density"(V²/Hz, default) or"spectrum"(V²).
:param : :type : param sample_rate: Sampling rate in Hz :param : :type : param nperseg_in_seconds: Segment length in seconds :param : :type : param average: ‘mean’ or ‘median’ :param : :type : param detrend: Detrending method :param : :type : param window: Window function :param : :type : param scaling: ‘density’ or ‘spectrum’
- class TorchWelch(delta_t=1.0 / 2048, seg_len=4096, seg_stride=2048, window='hann', avg_method='median', require_exact_data_fit=False, minimum_segments=None)[source]
Welch PSD estimator using PyTorch (CPU-friendly).
Designed for a single time series per call. Returns PSD in frequency domain. Refer: https://pycbc.org/pycbc/latest/html/_modules/pycbc/psd/estimate.html
- Parameters:
- window
Window type (‘hann’) or torch tensor