salvus.project.tools.data_selection
Functions
compute_window()
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
tnumpy.ndarray — The time axis in seconds. Must be equidistantly sampled.window_centerfloat — The center of the window in the same reference time as the time axis.window_widthfloat — The width of the window.ramp_widthfloat — 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_typestr — The type of window to use. Currently supports:"hanning".sidesstr — 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.