nearest_frame_to_timepoint#

petpal.utils.useful_functions.nearest_frame_to_timepoint(frame_times: numpy.ndarray) collections.abc.Callable[[float], float]#

Returns a step function that gets the index of the frame closest to a provided timepoint based on an array of frame times, such as the frame starts or reference times.

Parameters:

frame_times (np.ndarray) – The frame times on which to generate the step function.

Returns:

nearest_frame_func (Callable[[float],float])

A function that returns the time closest to

the provided timepoint.