-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
We decided to store e.g. Breaths using the time, not an index. This is useful when e.g. using sources with different time axes, or when applying interpolation. Storing indices would be very error-prone.
However, this results in the need to find the index of a timepoint in a time array often. This can be slow, and verbose. Therefore, we should introduce a feature that does this quickly and easily. An example could be:
@np.vectorize
def get_breath_times(b):
return (
(b.start_time, b.middle_time) if isinstance(b, Breath) else (None, None)
)
breath_times = np.asarray(get_breath_times(pixel_breaths.values)).astype(float)
breath_indices = np.searchsorted(filtered_regional.time, breath_times).astype(
float
)Metadata
Metadata
Assignees
Labels
No labels