Cue-light tools๏
On this page
Cue light analyzer๏
- class simba.data_processors.cue_light_analyzer.CueLightAnalyzer(config_path, data_dir, cue_light_names, save_dir=None, core_cnt=- 1, detailed_data=False, verbose=True)[source]๏
Bases:
simba.mixins.config_reader.ConfigReaderAnalyze when cue lights are in ON and OFF states. Results are stored in the
project_folder/csv/cue_lightscue lights directory.- Parameters
config_path (Union[str, os.PathLike],) โ path to SimBA project config file in Configparser format
data_dir (Union[str, os.PathLike],) โ directory holding pose-estimation data. E.g.,
project_folder/csv/outlier_corrected_movement_locationcue_light_names (List[str]) โ Names of cue light ROIs, as defined in the SimBA ROI interface.
Note
References
- 1
Lรณpez-Moraga, A., Luyten, L., & Beckers, T. (2025). Generalization and extinction of platform-mediated avoidance in male and female rats. Scientific Reports, 15, 9730.
- Example
>>> cue_light_analyzer = CueLightAnalyzer(config_path='MyProjectConfig', in_dir='project_folder/csv/outlier_corrected_movement_location', cue_light_names=['Cue_light']) >>> cue_light_analyzer.run()
Cue light classification statistics๏
- class simba.data_processors.cue_light_clf_statistics.CueLightClfAnalyzer(config_path, cue_light_names, clf_names, data_dir=None, pre_window=0, post_window=0)[source]๏
Bases:
simba.mixins.config_reader.ConfigReaderCompute aggregate statistics when classified behaviors are occurring in relation to the cue light ON and OFF states.
- Parameters
config_path (Union[str, os.PathLike]) โ path to SimBA project config file in Configparser format
pre_window (int) โ Time period (in millisecond) before the onset of each cue light to compute aggregate classification statistics within.
post_window (int) โ Time period (in millisecond) after the offset of each cue light to compute aggregate classification statistics within.
cue_light_names (List[str]) โ Names of cue lights, as defined in the SimBA ROI interface.
list (List[str]) โ Names of the classifiers we want to compute aggregate statistics for.
Note
- Example
>>> test = CueLightClfAnalyzer(config_path=r"C: roubleshooting\cue_light 1\project_folder\project_config.ini", >>> pre_window=1, >>> post_window=1, >>> cue_light_names=['cl'], >>> clf_names=['freeze']) >>> test.run() >>> test.save()
Cue light movement statistics๏
- class simba.data_processors.cue_light_movement_statistics.CueLightMovementAnalyzer(config_path, cue_light_names, bp_name, data_dir=None, pre_window=0, post_window=0, verbose=True)[source]๏
Bases:
simba.mixins.config_reader.ConfigReaderCompute aggregate statistics of animal movement in relation to the cue light ON and OFF states.
- Parameters
config_path (str) โ path to SimBA project config file in Configparser format
pre_window (int) โ Time period (in millisecond) before the onset of each cue light to compute aggregate classification statistics within.
post_window (int) โ Time period (in millisecond) after the offset of each cue light to compute aggregate classification statistics within.
cue_light_names (List[str]) โ Names of cue lights, as defined in the SimBA ROI interface.
threshold (float) โ The body-part post-estimation probability threshold. SimBA omits movement calculations for frames where the body-part probability threshold is lower than the user-specified threshold.
Note
- Examples
>>> test = CueLightMovementAnalyzer(config_path=r"C: roubleshooting\cue_light 1\project_folder\project_config.ini", >>> pre_window=0, >>> post_window=0, >>> cue_light_names=['cl'], >>> data_dir=r"C: roubleshooting\cue_light 1\project_folder\csv\cue_lights", >>> bp_name='Nose') >>> >>> test.run() >>> test.save()
Cue light plotting๏
- class simba.plotting.cue_light_visualizer.CueLightVisualizer(config_path, cue_light_names, video_path, data_path, frame_setting=False, video_setting=True, core_cnt=- 1, show_pose=True, verbose=True)[source]๏
Bases:
simba.mixins.config_reader.ConfigReaderVisualize SimBA computed cue-light ON and OFF states and the aggregate statistics of ON and OFF states.
- Parameters
config_path (str) โ path to SimBA project config file in Configparser format.
cue_light_names (List[str]) โ Names of cue lights, as defined in the SimBA ROI interface.
video_path (str) โ Path to video which user wants to create visualizations of cue light states and aggregate statistics for.
frame_setting (bool) โ If True, creates individual frames in png format. Defaults to False.
video_setting (bool) โ If True, creates compressed videos in mp4 format. Defaults to True.
- Examples
>>> cue_light_visualizer = CueLightVisualizer(config_path='SimBAConfig', cue_light_names=['Cue_light'], video_path='VideoPath', video_setting=True, frame_setting=False) >>> cue_light_visualizer.run()