IO - Video Module

Helper functions for handling crowd movie file writing and video metadata maintenance. dict) dict

Verify extraction parameters that should be consistent across sessions. If not, the function raises a RuntimeError.

Args: index (dict): dictionary of extraction parameters.

Returns: vid_parameters (dict): a dictionary with a subset of the used extraction parameters., model_fit, index_file, output_dir)

Create an info.yaml file in the crowd movie directory that holds model training parameters.

Args: model_path (str): path to model used to generate movies model_fit (dict): loaded ARHMM mdoel results index_file (str): path to index file used with model output_dir (str): path to crowd movies directory to store file in., config_data, ordering, labels, label_uuids, output_dir)

Create crowd movies for each syllable.

Args: sorted_index (dict): dictionary of sorted index data. config_data (dict): dictionary of visualization parameters. filename_format (str): string format that denotes the saved crowd movie file names. ordering (list): ordering for the new mapping of the relabeled syllable usages. labels (numpy ndarray): list of syllable usages label_uuids (list): list of session uuids each series of labels belongs to. output_dir (str): path directory where all the movies are written., frames=array([], dtype=float64), threads=6, fps=30, pixel_format='rgb24', codec='h264', slices=24, slicecrc=1, frame_size=None, depth_min=0, depth_max=80, get_cmd=False, cmap='jet', text=None, text_scale=1, text_thickness=2, pipe=None, close_pipe=True, progress_bar=True, **kwargs)

Writes out a false-colored mp4 video.

Args: filename (str): path to write output crowd movie file frames (numpy.ndarray): num_frames x rows x columns threads (int): number of threads to write file fps (int): frames per second pixel_format (str): ffmpeg image formatting flag. codec (str): ffmpeg image encoding flag. slices (int): number of slices per thread. slicecrc (int): check integrity of slices. frame_size (tuple): image dimensions depth_min (int): minimum mouse distance from bucket floor depth_max (int): maximum mouse distance from bucket floor get_cmd (bool): return ffmpeg command instead of executing the command in python. cmap (str): color map selection. text (range(num_frames): display frame number in output video. text_scale (int): text size. text_thickness (int): text thickness. pipe (subProcess.Pipe object): if not None, indicates that there are more frames to be written. close_pipe (bool): indicates whether video is done writing, and to close pipe to file-stream. progress_bar (bool): display progress bar. kwargs (dict): extra keyword arguments

Returns: pipe (subProcess.Pipe object): if there are more slices/chunks to write to, otherwise the path to the movie.