lisbet.postprocessing#
LISBET
Functions
|
Load machine annotations from the given root directory. |
|
Select motifs from a set of Hidden Markov Models using a posteriori linkage. |
- lisbet.postprocessing.load_annotations(annot_root, hmm_list)[source]#
Load machine annotations from the given root directory.
- Parameters:
annot_root (str) – The root directory containing the annotation files.
hmm_list (list of int) – List of numbers of states for Hidden Markov Models (HMMs).
- Returns:
session_data – Dictionary where keys are session paths and values are DataFrames with concatenated HMM annotations.
- Return type:
dict
- lisbet.postprocessing.select_prototypes(data_path, min_n_components, max_n_components, method='best', frame_threshold=0.05, bout_threshold=0.5, distance_threshold=0.6, fps=30, output_path=None)[source]#
Select motifs from a set of Hidden Markov Models using a posteriori linkage.
- Parameters:
data_path (
str) – The root directory containing the annotation files.min_n_components (
int) – Minimum number of states for the HMMs.max_n_components (
int) – Maximum number of states for the HMMs.method (
str) – Method for selecting prototypes. Valid options are ‘min’ and ‘best’.frame_threshold (
float) – Minimum fraction of allocated frames for motifs to be kept.bout_threshold (
float) – Minimum mean bout duration in seconds for motifs to be kept.distance_threshold (
float) – Maximum Jaccard distance from the closest motif (pairs only).fps (
int) – Frames per second, used to compute bout duration.output_path (
str|None) – Path to store the output predictions. If None, results are not saved.
- Return type:
tuple[dict,list[tuple[str,DataFrame]]]- Returns:
hmm_info (dict) – Dictionary containing supporting information useful for plotting the results.
predictions (list of tuples) – List of tuples, where each tuple contains a session key and the corresponding motifs DataFrame.
Notes
[a] This method could be easily generalized to other clustering algorithms.