salvus.project.tools.processing.block_processing.adjust_length
salvus.project.tools.processing.block_processing.adjust_length salvus project tools processing block_processing adjust_length Blockwise length adjustment.
Functions
adjust_length()
adjust_length()def adjust_length(
data: np.ndarray, t_in: np.ndarray, filter_params: LengthAdjustmentParams
) -> tuple[np.ndarray, np.ndarray]: ...Adjust the length of receivers along the time axis (-1).
Useful for both padding data and/or trimming data. See the documentation of
LengthAdjustmentParams for an explanation of the adjustment settings.
Parameters
datanp.ndarray — The data to resample. Will be checked to ensure that it is of the correct shape (n_rec, n_cmp, n_samples).t_innp.ndarray — The time axis of the input samples. Must be strictly increasing.filter_paramsLengthAdjustmentParams — Parameters controlling the padding / trimming of the input receiver traces.
Returns tuple[np.ndarray, np.ndarray] — A tuple of the (new_time_axis, trimmed / padded receivers).
Classes
LengthAdjustmentParams
LengthAdjustmentParamsclass LengthAdjustmentParams(builtins.object):
def __init__(
self, start_time: float, end_time: float, fill_value: float = 0.0
) -> None: ...Parameters controlling padding and / or trimming of receiver arrays.
Start and end times which are not a multiple of the receiver array’s
constant time step will be truncated to the nearest multiple of the time
step. This is similar to “nearest_sample = True” in Obspy’s trim function.
Receiver values outside the domain of the input time axis will be filled
with fill_value.
Parameters
start_timefloat — The desired start time of the trace.end_timefloat — The desired end time of the trace.fill_valuefloat — The value to fill with when the new length is greater than the old length.