moseq2_app.gui package

Submodules

GUI - Progress Module

This module handles all jupyter notebook progress related functionalities.

moseq2_app.gui.progress.check_progress(progress_filepath='/Users/sherry/Desktop/MoSeq/moseq2-app/docs/progress.yaml', exts=['dat', 'mkv', 'avi', 'tar.gz'])

Check whether progress file exists and prompt user input on whether to overwrite, load old, or generate a new one.

Args: base_dir (str): path to directory to create/find progress file progress_filepath (str): path to progress filename

moseq2_app.gui.progress.find_progress(base_progress)

Search for paths to all existing MosSeq2-Notebook dependencies and updates the progress paths dictionary.

Args: base_progress (dict): base dictionary of progress variables

Returns: base_progress (dict): updated dictionary of progress variables

moseq2_app.gui.progress.generate_intital_progressfile(filename='progress.yaml')

Generate a progress YAML file with the scanned parameter paths.

Args: filename (str): path to file to write progress YAML to

Returns: base_progress_vars (dict): Loaded/Found progress variables

moseq2_app.gui.progress.generate_missing_metadata(sess_dir, sess_name)

Generate default metadata.json file for session that does not already include one.

Args: sess_dir (str): Path to directory to create metadata.json file in. sess_name (str): Name of the directory to set the metadata SessionName.

moseq2_app.gui.progress.get_extraction_progress(base_dir, exts=['dat', 'mkv', 'avi'])

Count the number of fully extracted sessions, and print the session directory names of the incomplete or missing extractions.

Args: base_dir (str): Path to parent directory containing all sessions

Returns: path_dict (dict): Dict with paths to all found sessions num_extracted (int): Total number of completed extractions

moseq2_app.gui.progress.get_pca_progress(progress_vars, pca_progress)

Update the PCA progress dict variables and prints the names of the missing keys.

Args: progress_vars (dict): progress dict including the relevant PCA paths pca_progress (dict): PCA progress boolean dict used to display progress bar

Returns: pca_progress (dict): Updated PCA progress boolean dict.

moseq2_app.gui.progress.get_session_paths(data_dir, extracted=False, flipped=False, exts=['dat', 'mkv', 'avi'])

Find all depth recording sessions and their paths (with given extensions) to work on given base directory.

Args: data_dir (str): path to directory containing all session folders. exts (list): list of depth file extensions to search for. flipped (bool): indicates whether to show corrected flip videos extracted (bool): indicates to return paths to extracted sessions only.

Returns: path_dict (dict): session directory name keys pair with their respective absolute paths.

moseq2_app.gui.progress.get_sessions(data_dir, skip_extracted=True, extensions=('dat', 'mkv', 'avi', 'tar.gz'))

get sessions to extract

Args:

data_dir (str): path to project directory skip_extracted (bool, optional): bool flag for skipping extracted sessions. Defaults to True. extensions (tuple, optional): extensions to look for depth recordings. Defaults to (‘dat’, ‘mkv’, ‘avi’, ‘tar.gz’).

Returns:

_type_: _description_

moseq2_app.gui.progress.load_progress(progress_file)

Load progress file variables

Args: progress_file (str): path to progress file.

Returns: progress_vars (dict): dictionary of loaded progress variables

moseq2_app.gui.progress.print_progress(base_dir, progress_vars, exts=['dat', 'mkv', 'avi'])

Search for all the paths included in the progress file and displays 4 progress bars, one for each pipeline step.

Args: base_dir (str): Path to parent directory containing all sessions progress_vars (dict): notebook progress dict

moseq2_app.gui.progress.progress_path_sanity_check(progress_paths, progress_filepath='./progress.yaml')

check whether all relavent paths are correct in the progress file.

Args:

progress_paths (dict): dictionary of the progress paths. progress_filepath (str, optional): path to progress.yaml file. Defaults to ‘./progress.yaml’.

moseq2_app.gui.progress.restore_progress_vars(progress_file='/Users/sherry/Desktop/MoSeq/moseq2-app/docs/progress.yaml', init=False, overwrite=False)

Restore all saved progress variables to Jupyter Notebook.

Args: progress_file (str): path to progress file

Returns: vars (dict): All progress file variables

moseq2_app.gui.progress.update_progress(progress_file, varK, varV)

Update progress file with new notebook variable

Args: progress_file (str): path to progress file varK (str): key in progress file to update varV (str): updated value to write

Returns: progress (dict): Loaded path dict from the progress yaml file.

GUI - Widgets Module

This module contains the widget components that comprise the group setting table functionality.

class moseq2_app.gui.widgets.GroupSettingWidgets(index_filepath)

Bases: object

clear_clicked(b=None)

Clear the display.

Args: b (ipywidgets.Button click): callback from button when user clicks the button. Returns:

update_clicked(b=None)

Update the index file with the current table state upon Save button click.

Args: b (button click)

update_table(b=None)

Update table upon “Set Button” click

Args: b (button click)

GUI - Wrappers Module

Wrapper functions for all the functionality included in moseq2-app.

moseq2_app.gui.wrappers.interactive_crowd_movie_comparison_preview_wrapper(config_filepath, index_path, model_path, syll_info_path, output_dir, df_path=None, get_pdfs=True, load_parquet=False)

launch an interactive crowd movie comparison application.

Args: config_filepath (str): path to config file containing crowd movie generation parameters index_path (str): path to index file with paths to all the extracted sessions model_path (str): path to trained model containing syllable labels. syll_info_path (str): path to syllable information file containing syllable labels output_dir (str): path to directory to store crowd movies df_path (str): optional path to pre-existing syllable information to plot get_pdfs (bool): indicates whether to compute and display position heatmaps load_parquet (bool): Indicates to load previously saved syllable data.

moseq2_app.gui.wrappers.interactive_plot_transition_graph_wrapper(model_path, index_path, info_path, df_path=None, max_syllables=None, plot_vertically=False, load_parquet=False)

prepare the data for the interactive graphing function.

Args: model_path (str): Path to trained model. index_path (str): Path to index file containined trained data metadata. info_path (str): Path to user-labeled syllable information file. df_path (str): Path to pre-saved syllable information. max_syllables (int or None): Limit maximum number of displayed syllables. load_parquet (bool): Indicates to load previously saved data.

moseq2_app.gui.wrappers.interactive_syllable_labeler_wrapper(model_path, config_file, index_file, crowd_movie_dir, output_file, fig_dir, max_syllables=None, n_explained=99, select_median_duration_instances=False, max_examples=20)

launch a syllable crowd movie preview and interactive labeling application.

Args: model_path (str): Path to trained model. crowd_movie_dir (str): Path to crowd movie directory output_file (str): Path to syllable label information file max_syllables (int): Maximum number of syllables to preview and label.

moseq2_app.gui.wrappers.validate_extractions_wrapper(input_dir)

test the measured scalar values to determine whether some sessions should be flagged and diagnosed before aggregating the sessions.

Args: input_dir (str): path to parent directory containing all the extracted session folders

Module contents