Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	simba/data_processors/interpolation_smoothing.py
  • Loading branch information
sronilsson committed Jul 2, 2024
2 parents f80a4fa + 1a15961 commit 930983d
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 92 deletions.
99 changes: 65 additions & 34 deletions simba/SimBA.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,81 @@

from simba.bounding_box_tools.boundary_menus import BoundaryMenus
from simba.cue_light_tools.cue_light_menues import CueLightAnalyzerMenu
from simba.labelling.labelling_advanced_interface import select_labelling_video_advanced
from simba.labelling.labelling_advanced_interface import \
select_labelling_video_advanced
from simba.labelling.labelling_interface import select_labelling_video
from simba.labelling.targeted_annotations_clips import select_labelling_video_targeted_clips
from simba.labelling.targeted_annotations_clips import \
select_labelling_video_targeted_clips
from simba.model.grid_search_rf import GridSearchRandomForestClassifier
from simba.model.inference_batch import InferenceBatch
from simba.model.inference_validation import InferenceValidation
from simba.model.train_rf import TrainRandomForestClassifier
from simba.outlier_tools.outlier_corrector_location import OutlierCorrecterLocation
from simba.outlier_tools.outlier_corrector_movement import OutlierCorrecterMovement
from simba.outlier_tools.skip_outlier_correction import OutlierCorrectionSkipper
from simba.plotting.interactive_probability_grapher import InteractiveProbabilityGrapher
from simba.outlier_tools.outlier_corrector_location import \
OutlierCorrecterLocation
from simba.outlier_tools.outlier_corrector_movement import \
OutlierCorrecterMovement
from simba.outlier_tools.skip_outlier_correction import \
OutlierCorrectionSkipper
from simba.plotting.interactive_probability_grapher import \
InteractiveProbabilityGrapher
from simba.roi_tools.ROI_define import *
from simba.roi_tools.ROI_menus import *
from simba.roi_tools.ROI_reset import *
from simba.third_party_label_appenders.BENTO_appender import BentoAppender
from simba.third_party_label_appenders.BORIS_appender import BorisAppender
from simba.third_party_label_appenders.deepethogram_importer import DeepEthogramImporter
from simba.third_party_label_appenders.ethovision_import import ImportEthovision
from simba.third_party_label_appenders.observer_importer import NoldusObserverImporter
from simba.third_party_label_appenders.deepethogram_importer import \
DeepEthogramImporter
from simba.third_party_label_appenders.ethovision_import import \
ImportEthovision
from simba.third_party_label_appenders.observer_importer import \
NoldusObserverImporter
from simba.third_party_label_appenders.solomon_importer import SolomonImporter
from simba.ui.create_project_ui import ProjectCreatorPopUp
from simba.ui.import_pose_frame import ImportPoseFrame
from simba.ui.import_videos_frame import ImportVideosFrame
from simba.ui.machine_model_settings_ui import MachineModelSettingsPopUp
from simba.ui.pop_ups.about_simba_pop_up import AboutSimBAPopUp
from simba.ui.pop_ups.animal_directing_other_animals_pop_up import AnimalDirectingAnimalPopUp
from simba.ui.pop_ups.append_roi_features_animals_pop_up import AppendROIFeaturesByAnimalPopUp
from simba.ui.pop_ups.append_roi_features_bodypart_pop_up import AppendROIFeaturesByBodyPartPopUp
from simba.ui.pop_ups.animal_directing_other_animals_pop_up import \
AnimalDirectingAnimalPopUp
from simba.ui.pop_ups.append_roi_features_animals_pop_up import \
AppendROIFeaturesByAnimalPopUp
from simba.ui.pop_ups.append_roi_features_bodypart_pop_up import \
AppendROIFeaturesByBodyPartPopUp
from simba.ui.pop_ups.archive_files_pop_up import ArchiveProcessedFilesPopUp
from simba.ui.pop_ups.batch_preprocess_pop_up import BatchPreProcessPopUp
from simba.ui.pop_ups.boolean_conditional_slicer_pup_up import BooleanConditionalSlicerPopUp
from simba.ui.pop_ups.clf_add_remove_print_pop_up import (AddClfPopUp, PrintModelInfoPopUp, RemoveAClassifierPopUp)
from simba.ui.pop_ups.boolean_conditional_slicer_pup_up import \
BooleanConditionalSlicerPopUp
from simba.ui.pop_ups.clf_add_remove_print_pop_up import (
AddClfPopUp, PrintModelInfoPopUp, RemoveAClassifierPopUp)
from simba.ui.pop_ups.clf_by_roi_pop_up import ClfByROIPopUp
from simba.ui.pop_ups.clf_by_timebins_pop_up import TimeBinsClfPopUp
from simba.ui.pop_ups.clf_descriptive_statistics_pop_up import ClfDescriptiveStatsPopUp
from simba.ui.pop_ups.clf_descriptive_statistics_pop_up import \
ClfDescriptiveStatsPopUp
from simba.ui.pop_ups.clf_plot_pop_up import SklearnVisualizationPopUp
from simba.ui.pop_ups.clf_probability_plot_pop_up import VisualizeClassificationProbabilityPopUp
from simba.ui.pop_ups.clf_validation_plot_pop_up import ClassifierValidationPopUp
from simba.ui.pop_ups.clf_probability_plot_pop_up import \
VisualizeClassificationProbabilityPopUp
from simba.ui.pop_ups.clf_validation_plot_pop_up import \
ClassifierValidationPopUp
from simba.ui.pop_ups.csv_2_parquet_pop_up import (Csv2ParquetPopUp,
Parquet2CsvPopUp)
from simba.ui.pop_ups.data_plot_pop_up import DataPlotterPopUp
from simba.ui.pop_ups.directing_animal_to_bodypart_plot_pop_up import DirectingAnimalToBodyPartVisualizerPopUp
from simba.ui.pop_ups.directing_other_animals_plot_pop_up import DirectingOtherAnimalsVisualizerPopUp
from simba.ui.pop_ups.direction_animal_to_bodypart_settings_pop_up import DirectionAnimalToBodyPartSettingsPopUp
from simba.ui.pop_ups.directing_animal_to_bodypart_plot_pop_up import \
DirectingAnimalToBodyPartVisualizerPopUp
from simba.ui.pop_ups.directing_other_animals_plot_pop_up import \
DirectingOtherAnimalsVisualizerPopUp
from simba.ui.pop_ups.direction_animal_to_bodypart_settings_pop_up import \
DirectionAnimalToBodyPartSettingsPopUp
from simba.ui.pop_ups.distance_plot_pop_up import DistancePlotterPopUp
from simba.ui.pop_ups.fsttc_pop_up import FSTTCPopUp
from simba.ui.pop_ups.gantt_pop_up import GanttPlotPopUp
from simba.ui.pop_ups.heatmap_clf_pop_up import HeatmapClfPopUp
from simba.ui.pop_ups.heatmap_location_pop_up import HeatmapLocationPopup
from simba.ui.pop_ups.interpolate_pop_up import InterpolatePopUp
from simba.ui.pop_ups.kleinberg_pop_up import KleinbergPopUp
from simba.ui.pop_ups.make_path_plot_pop_up import MakePathPlotPopUp
from simba.ui.pop_ups.movement_analysis_pop_up import MovementAnalysisPopUp
from simba.ui.pop_ups.movement_analysis_time_bins_pop_up import MovementAnalysisTimeBinsPopUp
from simba.ui.pop_ups.movement_analysis_time_bins_pop_up import \
MovementAnalysisTimeBinsPopUp
from simba.ui.pop_ups.mutual_exclusivity_pop_up import MutualExclusivityPupUp
from simba.ui.pop_ups.outlier_settings_pop_up import OutlierSettingsPopUp
from simba.ui.pop_ups.path_plot_pop_up import PathPlotPopUp
Expand All @@ -80,17 +104,22 @@
from simba.ui.pop_ups.quick_path_plot_pop_up import QuickLineplotPopup
from simba.ui.pop_ups.remove_roi_features_pop_up import RemoveROIFeaturesPopUp
from simba.ui.pop_ups.roi_analysis_pop_up import ROIAnalysisPopUp
from simba.ui.pop_ups.roi_analysis_time_bins_pop_up import ROIAnalysisTimeBinsPopUp
from simba.ui.pop_ups.roi_analysis_time_bins_pop_up import \
ROIAnalysisTimeBinsPopUp
from simba.ui.pop_ups.roi_features_plot_pop_up import VisualizeROIFeaturesPopUp
from simba.ui.pop_ups.roi_size_standardizer_popup import ROISizeStandardizerPopUp
from simba.ui.pop_ups.roi_size_standardizer_popup import \
ROISizeStandardizerPopUp
from simba.ui.pop_ups.roi_tracking_plot_pop_up import VisualizeROITrackingPopUp
from simba.ui.pop_ups.set_machine_model_parameters_pop_up import SetMachineModelParameters
from simba.ui.pop_ups.set_machine_model_parameters_pop_up import \
SetMachineModelParameters
from simba.ui.pop_ups.severity_analysis_pop_up import AnalyzeSeverityPopUp
from simba.ui.pop_ups.smoothing_popup import SmoothingPopUp
from simba.ui.pop_ups.interpolate_pop_up import InterpolatePopUp
from simba.ui.pop_ups.spontaneous_alternation_pop_up import SpontaneousAlternationPopUp
from simba.ui.pop_ups.subset_feature_extractor_pop_up import FeatureSubsetExtractorPopUp
from simba.ui.pop_ups.third_party_annotator_appender_pop_up import ThirdPartyAnnotatorAppenderPopUp
from simba.ui.pop_ups.spontaneous_alternation_pop_up import \
SpontaneousAlternationPopUp
from simba.ui.pop_ups.subset_feature_extractor_pop_up import \
FeatureSubsetExtractorPopUp
from simba.ui.pop_ups.third_party_annotator_appender_pop_up import \
ThirdPartyAnnotatorAppenderPopUp
from simba.ui.pop_ups.validation_plot_pop_up import ValidationVideoPopUp
from simba.ui.pop_ups.video_processing_pop_up import (
BackgroundRemoverPopUp, BoxBlurPopUp, BrightnessContrastPopUp,
Expand All @@ -114,20 +143,22 @@
SuperimposeTextPopUp, SuperimposeTimerPopUp, SuperimposeVideoNamesPopUp,
SuperimposeVideoPopUp, SuperimposeWatermarkPopUp, UpsampleVideosPopUp,
VideoRotatorPopUp, VideoTemporalJoinPopUp)
from simba.ui.pop_ups.visualize_pose_in_dir_pop_up import VisualizePoseInFolderPopUp
from simba.ui.pop_ups.visualize_pose_in_dir_pop_up import \
VisualizePoseInFolderPopUp
from simba.ui.tkinter_functions import DropDownMenu, Entry_Box, FileSelect
from simba.ui.video_info_ui import VideoInfoTable
from simba.ui.import_pose_frame import ImportPoseFrame
from simba.ui.import_videos_frame import ImportVideosFrame
from simba.utils.checks import (check_ffmpeg_available, check_file_exist_and_readable, check_int)
from simba.utils.checks import (check_ffmpeg_available,
check_file_exist_and_readable, check_int)
from simba.utils.custom_feature_extractor import CustomFeatureExtractor
from simba.utils.enums import OS, Defaults, Formats, Paths, TagNames
from simba.utils.errors import InvalidInputError
from simba.utils.lookups import (get_bp_config_code_class_pairs, get_emojis, get_icons_paths)
from simba.utils.lookups import (get_bp_config_code_class_pairs, get_emojis,
get_icons_paths)
from simba.utils.printing import stdout_success, stdout_warning
from simba.utils.read_write import get_video_meta_data
from simba.utils.warnings import FFMpegNotFoundWarning, PythonVersionWarning
from simba.video_processors.video_processing import extract_frames_from_all_videos_in_directory
from simba.video_processors.video_processing import \
extract_frames_from_all_videos_in_directory

sys.setrecursionlimit(10**6)
currentPlatform = platform.system()
Expand Down
13 changes: 9 additions & 4 deletions simba/data_processors/interpolate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pandas as pd

pd.options.mode.chained_assignment = None
import os
from typing import Optional, Union, List
from copy import deepcopy
from typing import List, Optional, Union

import numpy as np

try:
Expand All @@ -11,12 +13,15 @@
from typing_extensions import Literal

from simba.mixins.config_reader import ConfigReader
from simba.utils.checks import (check_str, check_valid_lst, check_file_exist_and_readable)
from simba.utils.checks import (check_file_exist_and_readable, check_str,
check_valid_lst)
from simba.utils.data import animal_interpolator, body_part_interpolator
from simba.utils.enums import TagNames
from simba.utils.errors import DataHeaderError, InvalidInputError
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (find_files_of_filetypes_in_directory, get_fn_ext, read_df, write_df, copy_files_to_directory)
from simba.utils.data import animal_interpolator, body_part_interpolator
from simba.utils.read_write import (copy_files_to_directory,
find_files_of_filetypes_in_directory,
get_fn_ext, read_df, write_df)


class Interpolate(ConfigReader):
Expand Down
4 changes: 2 additions & 2 deletions simba/data_processors/interpolation_smoothing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
from simba.utils.enums import Methods, TagNames
from simba.utils.errors import DataHeaderError, NoFilesFoundError
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (find_files_of_filetypes_in_directory, find_video_of_file, get_fn_ext, get_video_meta_data, read_df, write_df)
from simba.utils.read_write import (find_files_of_filetypes_in_directory, find_video_of_file, get_fn_ext,
get_video_meta_data, read_df, write_df)


class Interpolate(ConfigReader):
Expand Down Expand Up @@ -815,4 +816,3 @@ def run(self):
# input_dir: str,
# time_window: int,
# smoothing_method: str):

13 changes: 9 additions & 4 deletions simba/data_processors/smoothing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
__author__ = "Simon Nilsson"

import os
from typing import Union, List, Optional
from copy import deepcopy
from typing import List, Optional, Union

import pandas as pd

Expand All @@ -12,12 +12,17 @@
from typing_extensions import Literal

from simba.mixins.config_reader import ConfigReader
from simba.utils.checks import (check_str, check_int, check_valid_lst, check_file_exist_and_readable)
from simba.utils.checks import (check_file_exist_and_readable, check_int,
check_str, check_valid_lst)
from simba.utils.data import df_smoother, savgol_smoother
from simba.utils.enums import TagNames
from simba.utils.errors import InvalidInputError, NoFilesFoundError
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (find_files_of_filetypes_in_directory, find_video_of_file, get_fn_ext, read_video_info, get_video_meta_data, read_df, write_df, copy_files_to_directory)
from simba.utils.data import savgol_smoother, df_smoother
from simba.utils.read_write import (copy_files_to_directory,
find_files_of_filetypes_in_directory,
find_video_of_file, get_fn_ext,
get_video_meta_data, read_df,
read_video_info, write_df)


class Smoothing(ConfigReader):
Expand Down
11 changes: 7 additions & 4 deletions simba/mixins/pop_up_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
import os
from tkinter import *
from tkinter import ttk
from typing import Callable, Dict, List, Optional, Tuple, Union, Any
from typing import Any, Callable, Dict, List, Optional, Tuple, Union

import PIL.Image
from PIL import ImageTk

from simba.mixins.config_reader import ConfigReader
from simba.ui.tkinter_functions import (DropDownMenu, Entry_Box, FileSelect, hxtScrollbar)
from simba.utils.checks import (check_float, check_int, check_valid_lst, check_instance)
from simba.ui.tkinter_functions import (DropDownMenu, Entry_Box, FileSelect,
hxtScrollbar)
from simba.utils.checks import (check_float, check_instance, check_int,
check_valid_lst)
from simba.utils.enums import Formats, Options
from simba.utils.errors import CountError, NoFilesFoundError
from simba.utils.lookups import (get_color_dict, get_icons_paths, get_named_colors)
from simba.utils.lookups import (get_color_dict, get_icons_paths,
get_named_colors)
from simba.utils.read_write import find_core_cnt


Expand Down
13 changes: 9 additions & 4 deletions simba/pose_importers/dlc_importer_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

import os
import shutil
from typing import List, Union, Dict, Optional, Any
from typing import Any, Dict, List, Optional, Union

import pandas as pd

from simba.mixins.config_reader import ConfigReader
from simba.data_processors.interpolate import Interpolate
from simba.data_processors.smoothing import Smoothing
from simba.utils.checks import (check_file_exist_and_readable, check_int, check_str, check_if_keys_exist_in_dict, check_instance)
from simba.mixins.config_reader import ConfigReader
from simba.utils.checks import (check_file_exist_and_readable,
check_if_keys_exist_in_dict, check_instance,
check_int, check_str)
from simba.utils.errors import FileExistError, InvalidInputError
from simba.utils.printing import SimbaTimer, stdout_success
from simba.utils.read_write import (get_fn_ext, get_number_of_header_columns_in_df, find_files_of_filetypes_in_directory)
from simba.utils.read_write import (find_files_of_filetypes_in_directory,
get_fn_ext,
get_number_of_header_columns_in_df)

DLC_ = 'DLC_'
DeepCut = 'DeepCut'
Expand Down
5 changes: 3 additions & 2 deletions simba/pose_importers/madlc_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
from simba.utils.checks import (check_file_exist_and_readable,
check_if_dir_exists,
check_if_keys_exist_in_dict, check_instance,
check_str, check_valid_lst, check_int)
check_int, check_str, check_valid_lst)
from simba.utils.enums import Formats, Methods, Options
from simba.utils.errors import BodypartColumnNotFoundError
from simba.utils.printing import SimbaTimer, stdout_success
from simba.utils.read_write import (find_all_videos_in_project, get_video_meta_data, write_df)
from simba.utils.read_write import (find_all_videos_in_project,
get_video_meta_data, write_df)


class MADLCImporterH5(ConfigReader, PoseImporterMixin):
Expand Down
11 changes: 8 additions & 3 deletions simba/pose_importers/sleap_csv_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
from copy import deepcopy
from typing import Union, Dict, List, Any, Optional
from typing import Any, Dict, List, Optional, Union

import numpy as np
import pandas as pd
Expand All @@ -11,11 +11,16 @@
from simba.data_processors.smoothing import Smoothing
from simba.mixins.config_reader import ConfigReader
from simba.mixins.pose_importer_mixin import PoseImporterMixin
from simba.utils.checks import check_that_column_exist, check_str, check_int, check_if_keys_exist_in_dict, check_if_dir_exists, check_valid_lst
from simba.utils.checks import (check_if_dir_exists,
check_if_keys_exist_in_dict, check_int,
check_str, check_that_column_exist,
check_valid_lst)
from simba.utils.enums import Methods, TagNames
from simba.utils.errors import CountError
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (clean_sleap_file_name, find_all_videos_in_project, get_fn_ext, get_video_meta_data, write_df)
from simba.utils.read_write import (clean_sleap_file_name,
find_all_videos_in_project, get_fn_ext,
get_video_meta_data, write_df)

TRACK = "track"
INSTANCE_SCORE = "instance.score"
Expand Down
13 changes: 9 additions & 4 deletions simba/pose_importers/sleap_h5_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
from simba.data_processors.smoothing import Smoothing
from simba.mixins.config_reader import ConfigReader
from simba.mixins.pose_importer_mixin import PoseImporterMixin
from simba.utils.checks import check_file_exist_and_readable
from simba.utils.checks import check_str, check_int, check_if_keys_exist_in_dict, check_if_dir_exists, check_valid_lst
from simba.utils.checks import (check_file_exist_and_readable,
check_if_dir_exists,
check_if_keys_exist_in_dict, check_int,
check_str, check_valid_lst)
from simba.utils.enums import Methods, TagNames
from simba.utils.errors import BodypartColumnNotFoundError
from simba.utils.printing import (SimbaTimer, log_event, stdout_success, stdout_warning)
from simba.utils.read_write import (clean_sleap_file_name, find_all_videos_in_project, get_fn_ext, get_video_meta_data, write_df)
from simba.utils.printing import (SimbaTimer, log_event, stdout_success,
stdout_warning)
from simba.utils.read_write import (clean_sleap_file_name,
find_all_videos_in_project, get_fn_ext,
get_video_meta_data, write_df)


class SLEAPImporterH5(ConfigReader, PoseImporterMixin):
Expand Down
Loading

0 comments on commit 930983d

Please sign in to comment.