spvctrl.data.util.log_downsample_split_indices#
- log_downsample_split_indices(n_samples: int, n_pre_trigger: int, n_log_downsampled: int) ndarray | None[source]#
Indices for log-downsampling a recorded transient with a pre-trigger, splitting the record at the trigger.
The post-trigger samples are log-downsampled on the forward time axis (dense at the beginning, i.e. the earliest times), the pre-trigger samples are log-downsampled on the reversed time axis (dense near the trigger,
t -> 0^-). The pre-trigger budget is the dynamic fractionround(n_log_downsampled * n_pre_trigger / n_post_trigger)— each side gets a share of the downsampled points proportional to its time span — with a minimum of 8 points when any pre-trigger is recorded. The returned indices are strictly increasing, so indexing with them keeps the time axis monotonic.Noneis returned when no downsampling is needed, i.e. when the record holds no more samples than the combined budget.- Parameters:
n_samples – Total number of samples of the recorded segment, including pre-trigger samples.
n_pre_trigger – Number of pre-trigger samples: the first
n_pre_triggersamples of the record are before the trigger.n_log_downsampled – Target number of downsampled points of the post-trigger part.
- Returns:
Strictly increasing array of sample indices, or None to keep all points.