src/wai_data_tools/movie_to_images.py
def calculate_frames_in_timespan(t_start: np.ndarray, t_end: np.ndarray, fps: float) -> np.ndarray:
    """
    Calculates the frames in the given timespan. Will include one more frame at each end if possible.
    :param t_start: start of time interval
    :param t_end: end of time interval
    :param fps: frames per second
    :return: array with frame indices
    """

    logging.debug("Calculating start and end frame.")

    t_frame = 1 / fps

    frame_start = t_start / t_frame

    if frame_start % 1 > 0:
        logging.debug("Remainder when calculating the index for start frame is not zero. Performing floor operation.")
        frame_start = np.floor(frame_start)

    frame_end = t_end / t_frame

    if frame_end % 1 > 0:
        logging.debug("Remainder when calculating the index for end frame is not zero. Performing ceiling operation.")
        frame_end = np.ceil(frame_end)

    logging.debug("Frames with label start at frame %s and ends at %s", frame_start, frame_end)

    return np.arange(frame_start, frame_end)

    Calculates the frames in the given timespan. Will include one more frame at each end if possible.
    :param t_start: start of time interval
    :param t_end: end of time interval
    :param fps: frames per second
    :return: array with frame indices
    
Calculates the frames in the given timespan. Will include one more frame at each end if possible.
Calculates the frames in the given timespan . Will include one more frame at each end if possible .
def calculate_frames_in_timespan(t_start: np.ndarray, t_end: np.ndarray, fps: float) -> np.ndarray:
    logging.debug("Calculating start and end frame.")
    t_frame = 1 / fps
    frame_start = t_start / t_frame
    if frame_start % 1 > 0:
        logging.debug("Remainder when calculating the index for start frame is not zero. Performing floor operation.")
        frame_start = np.floor(frame_start)
    frame_end = t_end / t_frame
    if frame_end % 1 > 0:
        logging.debug("Remainder when calculating the index for end frame is not zero. Performing ceiling operation.")
        frame_end = np.ceil(frame_end)
    logging.debug("Frames with label start at frame %s and ends at %s", frame_start, frame_end)
    return np.arange(frame_start, frame_end)
def calculate_frames_in_timespan ( t_start : np . ndarray , t_end : np . ndarray , fps : float ) -> np . ndarray : logging . debug ( "Calculating start and end frame." ) t_frame = 1 / fps frame_start = t_start / t_frame if frame_start % 1 > 0 : logging . debug ( "Remainder when calculating the index for start frame is not zero. Performing floor operation." ) frame_start = np . floor ( frame_start ) frame_end = t_end / t_frame if frame_end % 1 > 0 : logging . debug ( "Remainder when calculating the index for end frame is not zero. Performing ceiling operation." ) frame_end = np . ceil ( frame_end ) logging . debug ( "Frames with label start at frame %s and ends at %s" , frame_start , frame_end ) return np . arange ( frame_start , frame_end )
Calculates the frames in the given timespan.
Calculates the frames in the given timespan .
"""
    Calculates the frames in the given timespan. Will include one more frame at each end if possible.
    :param t_start: start of time interval
    :param t_end: end of time interval
    :param fps: frames per second
    :return: array with frame indices
    """
array with frame indices
array with frame indices
t_start
np.ndarray
start of time interval
start of time interval
t_end
np.ndarray
end of time interval
end of time interval
fps
float
frames per second
frames per second