sage.data.psd.smoothing

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

Created on 2026-02-11 20:48:57

__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

LogSplineSmoothing

PSD smoother based on a univariate spline fit in log-log space.

Module Contents

class LogSplineSmoothing(smooth_factor=None, upweight_regions=None, return_coeffs=False, noise_low_frequency_cutoff=15.0)[source]

PSD smoother based on a univariate spline fit in log-log space.

Transforms both frequency and PSD to log scale before fitting a scipy.interpolate.UnivariateSpline, then exponentiates the result back. Log-log fitting is well-suited to PSDs because their broad-band structure follows approximate power laws, so the spline needs fewer knots and produces a more physically plausible smooth curve than a linear-domain fit would.

Frequencies below noise_low_frequency_cutoff are excluded from the spline fit (the seismic wall makes PSD estimates unreliable there); the original values are returned unchanged for those bins.

Parameters:
  • smooth_factor (float or None) – Smoothing parameter passed to UnivariateSpline as s. Larger values produce smoother output. If None, a heuristic 0.2 * n_points is used on the first call.

  • upweight_regions (list[tuple[float, float]] or None) – Optional list of (f_low, f_high) frequency bands to upweight (weight 2 vs. default 1) so the spline tracks those regions more closely (e.g. the detector’s most sensitive band).

  • return_coeffs (bool) – Unused placeholder for future coefficient export (default False).

  • noise_low_frequency_cutoff (float) – Frequency (Hz) below which PSD values are not used for fitting (default 15.0).

smooth_factor = None[source]
upweight_regions = None[source]
return_coeffs = False[source]
noise_low_frequency_cutoff = 15.0[source]
smooth(freqs, psd, smooth_factor=None)[source]

Smooth a noisy PSD estimate using a spline in log-log space.

Parameters:
  • freqs ((F,) array) – Frequency array (must be > 0).

  • psd ((F,) array) – PSD values (must be > 0).

  • smooth_factor (float or None) – Smoothing strength. Larger = smoother. If None, an automatic heuristic is used.

Returns:

psd_smooth – Smoothed PSD (same shape as input).

Return type:

(F,) array