Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sronilsson committed Dec 20, 2024
2 parents fd110b1 + 659cced commit 6f28605
Show file tree
Hide file tree
Showing 229 changed files with 1,506 additions and 1,015 deletions.
17 changes: 11 additions & 6 deletions simba/sandbox/CLAHE.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import os
from datetime import datetime
import threading
from datetime import datetime
from tkinter import *
from tkinter import Button
from simba.utils.enums import Keys, Links, Options

from simba.mixins.pop_up_mixin import PopUpMixin
from simba.ui.tkinter_functions import CreateLabelFrameWithIcon, FileSelect, FolderSelect
from simba.utils.checks import check_file_exist_and_readable, check_if_dir_exists
from simba.ui.tkinter_functions import (CreateLabelFrameWithIcon, FileSelect,
FolderSelect)
from simba.utils.checks import (check_file_exist_and_readable,
check_if_dir_exists)
from simba.utils.enums import Keys, Links, Options
from simba.utils.printing import SimbaTimer, stdout_success
from simba.utils.read_write import (find_files_of_filetypes_in_directory,
get_fn_ext)
from simba.video_processors.clahe_ui import interactive_clahe_ui
from simba.video_processors.video_processing import clahe_enhance_video
from simba.utils.read_write import find_files_of_filetypes_in_directory, get_fn_ext
from simba.utils.printing import stdout_success, SimbaTimer


class CLAHEPopUp(PopUpMixin):
def __init__(self):
Expand Down
3 changes: 2 additions & 1 deletion simba/sandbox/Geometry_7.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os

import numpy as np

from simba.mixins.config_reader import ConfigReader
from simba.mixins.geometry_mixin import GeometryMixin
from simba.mixins.image_mixin import ImageMixin
from simba.utils.read_write import read_df
from simba.plotting.geometry_plotter import GeometryPlotter
from simba.utils.read_write import read_df

CONFIG_PATH = '/Users/simon/Desktop/envs/simba/troubleshooting/RAT_NOR/project_folder/project_config.ini'
VIDEO_NAME = '2022-06-20_NOB_DOT_4'
Expand Down
22 changes: 13 additions & 9 deletions simba/sandbox/MitraFeatureExtractor.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import argparse
import os
from itertools import product
from typing import Union

import numpy as np
import pandas as pd
from numba.typed import List
from itertools import product
import argparse
from typing import Union

from simba.feature_extractors.perimeter_jit import jitted_hull
from simba.mixins.abstract_classes import AbstractFeatureExtraction
from simba.mixins.circular_statistics import CircularStatisticsMixin
from simba.mixins.config_reader import ConfigReader
from simba.mixins.feature_extraction_mixin import FeatureExtractionMixin
from simba.mixins.timeseries_features_mixin import TimeseriesFeatureMixin
from simba.mixins.statistics_mixin import Statistics
from simba.mixins.circular_statistics import CircularStatisticsMixin
from simba.feature_extractors.perimeter_jit import jitted_hull
from simba.utils.checks import check_if_filepath_list_is_empty, check_all_file_names_are_represented_in_video_log
from simba.utils.read_write import read_df, get_fn_ext, read_frm_of_video
from simba.utils.read_write import SimbaTimer, stdout_success, write_df
from simba.mixins.timeseries_features_mixin import TimeseriesFeatureMixin
from simba.utils.checks import (
check_all_file_names_are_represented_in_video_log,
check_if_filepath_list_is_empty)
from simba.utils.read_write import (SimbaTimer, get_fn_ext, read_df,
read_frm_of_video, stdout_success,
write_df)

NOSE = 'nose'
LEFT_SIDE = 'left_side'
Expand Down
18 changes: 12 additions & 6 deletions simba/sandbox/ROI_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
__author__ = "Simon Nilsson"

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

import numpy as np
import pandas as pd

from simba.mixins.config_reader import ConfigReader
from simba.mixins.feature_extraction_mixin import FeatureExtractionMixin
from simba.mixins.feature_extraction_supplement_mixin import FeatureExtractionSupplemental
from simba.utils.checks import check_file_exist_and_readable, check_float, check_valid_lst, check_all_file_names_are_represented_in_video_log, check_that_column_exist
from simba.mixins.feature_extraction_supplement_mixin import \
FeatureExtractionSupplemental
from simba.utils.checks import (
check_all_file_names_are_represented_in_video_log,
check_file_exist_and_readable, check_float, check_that_column_exist,
check_valid_lst)
from simba.utils.data import detect_bouts, slice_roi_dict_for_video
from simba.utils.enums import Keys
from simba.utils.errors import (MissingColumnsError, CountError, ROICoordinatesNotFoundError)
from simba.utils.errors import (CountError, MissingColumnsError,
ROICoordinatesNotFoundError)
from simba.utils.printing import stdout_success
from simba.utils.read_write import get_fn_ext, read_df, read_data_paths
from simba.utils.read_write import get_fn_ext, read_data_paths, read_df
from simba.utils.warnings import NoDataFoundWarning
from simba.utils.data import slice_roi_dict_for_video, detect_bouts


class ROIAnalyzer(ConfigReader, FeatureExtractionMixin):
Expand Down
11 changes: 7 additions & 4 deletions simba/sandbox/ROI_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
import itertools
import os
from copy import deepcopy
from typing import Tuple, Optional, Union, Dict
from typing import Dict, Optional, Tuple, Union

import cv2
import numpy as np

from simba.mixins.config_reader import ConfigReader
from simba.mixins.plotting_mixin import PlottingMixin
from simba.roi_tools.ROI_analyzer import ROIAnalyzer
from simba.utils.data import create_color_palettes, slice_roi_dict_for_video, detect_bouts
from simba.utils.checks import check_float, check_if_keys_exist_in_dict, check_file_exist_and_readable, check_video_and_data_frm_count_align
from simba.utils.checks import (check_file_exist_and_readable, check_float,
check_if_keys_exist_in_dict,
check_video_and_data_frm_count_align)
from simba.utils.data import (create_color_palettes, detect_bouts,
slice_roi_dict_for_video)
from simba.utils.enums import Formats, Paths, TagNames, TextOptions
from simba.utils.errors import DuplicationError, NoFilesFoundError
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (get_fn_ext, get_video_meta_data)
from simba.utils.read_write import get_fn_ext, get_video_meta_data
from simba.utils.warnings import DuplicateNamesWarning

SHOW_BODY_PARTS = 'show_body_part'
Expand Down
20 changes: 11 additions & 9 deletions simba/sandbox/ROI_plotter_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import platform
import shutil
from typing import Optional, Union, Dict, Tuple
from typing import Dict, Optional, Tuple, Union

import cv2
import numpy as np
Expand All @@ -14,17 +14,19 @@
from simba.mixins.config_reader import ConfigReader
from simba.mixins.plotting_mixin import PlottingMixin
from simba.roi_tools.ROI_analyzer import ROIAnalyzer
from simba.utils.data import create_color_palettes, detect_bouts, slice_roi_dict_for_video
from simba.utils.enums import Paths, TagNames, TextOptions, Formats
from simba.utils.checks import (check_file_exist_and_readable, check_float,
check_if_keys_exist_in_dict, check_int,
check_video_and_data_frm_count_align)
from simba.utils.data import (create_color_palettes, detect_bouts,
slice_roi_dict_for_video)
from simba.utils.enums import Formats, Paths, TagNames, TextOptions
from simba.utils.errors import NoFilesFoundError
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (concatenate_videos_in_folder, get_fn_ext, get_video_meta_data, find_core_cnt)
from simba.utils.read_write import (concatenate_videos_in_folder,
find_core_cnt, get_fn_ext,
get_video_meta_data)
from simba.utils.warnings import DuplicateNamesWarning
from simba.utils.checks import (check_float,
check_int,
check_if_keys_exist_in_dict,
check_file_exist_and_readable,
check_video_and_data_frm_count_align)

pd.options.mode.chained_assignment = None

SHOW_BODY_PARTS = 'show_body_part'
Expand Down
14 changes: 8 additions & 6 deletions simba/sandbox/abod.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from typing import Union, Optional
from typing import Optional, Union

import numpy as np
import pandas as pd
from sklearn.covariance import EllipticEnvelope
from pyod.models.abod import ABOD

from simba.utils.checks import check_valid_array, check_float, check_int
from sklearn.neighbors import LocalOutlierFactor
from sklearn.covariance import EllipticEnvelope
from sklearn.datasets import make_blobs
from simba.mixins.plotting_mixin import PlottingMixin
from sklearn.neighbors import LocalOutlierFactor

from simba.mixins.feature_extraction_mixin import FeatureExtractionMixin
from simba.mixins.plotting_mixin import PlottingMixin
from simba.utils.checks import check_float, check_int, check_valid_array


def angle_based_od(data: np.ndarray,
k: Union[int, float] = 5,
Expand Down
6 changes: 4 additions & 2 deletions simba/sandbox/add_body_part.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os.path

import numpy as np
import pandas as pd

from simba.mixins.feature_extraction_mixin import FeatureExtractionMixin
from simba.mixins.config_reader import ConfigReader
from simba.utils.read_write import read_df, write_df, get_fn_ext, read_frm_of_video
from simba.mixins.feature_extraction_mixin import FeatureExtractionMixin
from simba.utils.checks import check_if_dir_exists
from simba.utils.read_write import (get_fn_ext, read_df, read_frm_of_video,
write_df)

#CHANGE THIS TO THE PATH OF YOUR SIMBA PROJECT CONFIG
CONFIG_PATH = '/Users/simon/Desktop/envs/simba/troubleshooting/two_black_animals_14bp/project_folder/project_config.ini'
Expand Down
3 changes: 2 additions & 1 deletion simba/sandbox/adjusted_rand.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from sklearn.metrics import (adjusted_mutual_info_score, adjusted_rand_score, fowlkes_mallows_score)
from sklearn.metrics import (adjusted_mutual_info_score, adjusted_rand_score,
fowlkes_mallows_score)


def cluster_comparison(x: np.ndarray, y: np.ndarray, method: str = 'adjusted_rand_score'):
Expand Down
5 changes: 4 additions & 1 deletion simba/sandbox/adjusted_rand_score.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import numpy as np
from sklearn.metrics import (adjusted_mutual_info_score, adjusted_rand_score,
fowlkes_mallows_score)

from simba.utils.checks import check_valid_array
from sklearn.metrics import adjusted_rand_score, fowlkes_mallows_score, adjusted_mutual_info_score


def adjusted_rand(x: np.ndarray, y: np.ndarray) -> float:
"""
Expand Down
10 changes: 7 additions & 3 deletions simba/sandbox/advanced_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import numpy as np
import pandas as pd

pd.options.mode.chained_assignment = None


Expand All @@ -14,11 +15,14 @@
from typing_extensions import Literal

from simba.mixins.config_reader import ConfigReader
from simba.utils.checks import (check_valid_boolean, check_instance, check_that_column_exist, check_str, check_file_exist_and_readable)
from simba.utils.checks import (check_file_exist_and_readable, check_instance,
check_str, check_that_column_exist,
check_valid_boolean)
from simba.utils.errors import DataHeaderError, InvalidInputError
from simba.utils.printing import SimbaTimer, 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.read_write import (copy_files_to_directory,
find_files_of_filetypes_in_directory,
get_fn_ext, read_df, write_df)

BODY_PART_TYPE = 'body-part'
ANIMAL_TYPE = 'animal'
Expand Down
15 changes: 10 additions & 5 deletions simba/sandbox/advanced_smoothing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from copy import deepcopy
from typing import Any, Dict, Optional, Union

import pandas as pd

try:
Expand All @@ -11,14 +12,18 @@
from typing_extensions import Literal

from simba.mixins.config_reader import ConfigReader
from simba.utils.checks import (check_valid_boolean, check_instance, check_str, check_int, check_that_column_exist, check_file_exist_and_readable)
from simba.utils.checks import (check_file_exist_and_readable, check_instance,
check_int, check_str, check_that_column_exist,
check_valid_boolean)
from simba.utils.data import df_smoother, savgol_smoother
from simba.utils.enums import Methods, TagNames
from simba.utils.errors import DataHeaderError, NoFilesFoundError, InvalidInputError
from simba.utils.errors import (DataHeaderError, InvalidInputError,
NoFilesFoundError)
from simba.utils.printing import SimbaTimer, log_event, stdout_success
from simba.utils.read_write import (find_files_of_filetypes_in_directory,
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, write_df, copy_files_to_directory)
from simba.utils.data import savgol_smoother, df_smoother
get_video_meta_data, read_df, write_df)

BODY_PART_TYPE = 'body-part'
ANIMAL_TYPE = 'animal'
Expand Down
6 changes: 4 additions & 2 deletions simba/sandbox/annotations_mitra.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pandas as pd
import glob
import os
from simba.utils.read_write import get_fn_ext
import shutil

import pandas as pd

from simba.utils.read_write import get_fn_ext

# ANNOTATED_VIDEOS_PATH = '/Users/simon/Desktop/envs/simba/troubleshooting/mitra/annotated_videos.csv'
# DATA_PATH = '/Users/simon/Desktop/envs/simba/troubleshooting/mitra/project_folder/csv/input_csv/originals'
# OUT_DIR = '/Users/simon/Desktop/envs/simba/troubleshooting/mitra/project_folder/csv/input_csv/'
Expand Down
Loading

0 comments on commit 6f28605

Please sign in to comment.