def process_file()

in fairmotion/tasks/motion_prediction/preprocess.py [0:0]


def process_file(ftuple, create_windows, convert_fn, lengths):
    src_len, tgt_len = lengths
    filepath, file_id = ftuple
    motion = amass_dip.load(filepath)
    motion.name = file_id

    if create_windows is not None:
        window_size, window_stride = create_windows
        if motion.num_frames() < window_size:
            return [], []
        matrices = [
            convert_fn(motion.rotations())
            for motion in split_into_windows(
                motion, window_size, window_stride
            )
        ]
    else:
        matrices = [convert_fn(motion.rotations())]

    return (
        [matrix[:src_len, ...].reshape((src_len, -1)) for matrix in matrices],
        [
            matrix[src_len : src_len + tgt_len, ...].reshape((tgt_len, -1))
            for matrix in matrices
        ],
    )