Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.tools.data_selection

Functions

compute_window()

def compute_window(
    t: numpy.ndarray,
    window_center: float,
    window_width: float,
    ramp_width: float,
    window_type: str = "hanning",
    sides: str = "both",
) -> numpy.ndarray: ...

Helper function computing windows as a weighting function that can be applied to an array.

A bit more intuitive and accurate to use compared to straight up numpy windows. Also fast as it utilizes numba.

Parameters
  • t numpy.ndarray — The time axis in seconds. Must be equidistantly sampled.
  • window_center float — The center of the window in the same reference time as the time axis.
  • window_width float — The width of the window.
  • ramp_width float — The width of the ramp on both sides. Cannot not be larger than half the total width. Using this is an option to discard less of the data.
  • window_type str — The type of window to use. Currently supports: "hanning".
  • sides str — One of "both", "left", “right” - Decides which sides will be tapered.
Returns numpy.ndarray — The weighting array. Will have exactly the same shape as t and will be filled with values ranging from 0.0 to 1.0. Element-wise multiplication with this array will effectively window data.

Submodules