simba-uw-tf-dev 4.6.2__py3-none-any.whl → 4.7.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simba/assets/.recent_projects.txt +1 -0
- simba/assets/lookups/tooptips.json +6 -1
- simba/data_processors/agg_clf_counter_mp.py +52 -53
- simba/data_processors/blob_location_computer.py +1 -1
- simba/data_processors/circling_detector.py +30 -13
- simba/data_processors/cuda/geometry.py +45 -27
- simba/data_processors/cuda/image.py +1648 -1598
- simba/data_processors/cuda/statistics.py +72 -26
- simba/data_processors/cuda/timeseries.py +1 -1
- simba/data_processors/cue_light_analyzer.py +5 -9
- simba/data_processors/egocentric_aligner.py +25 -7
- simba/data_processors/freezing_detector.py +55 -47
- simba/data_processors/kleinberg_calculator.py +61 -29
- simba/feature_extractors/feature_subsets.py +14 -7
- simba/feature_extractors/mitra_feature_extractor.py +2 -2
- simba/feature_extractors/straub_tail_analyzer.py +4 -6
- simba/labelling/standard_labeller.py +1 -1
- simba/mixins/config_reader.py +5 -2
- simba/mixins/geometry_mixin.py +22 -36
- simba/mixins/image_mixin.py +24 -28
- simba/mixins/plotting_mixin.py +28 -10
- simba/mixins/statistics_mixin.py +48 -11
- simba/mixins/timeseries_features_mixin.py +1 -1
- simba/mixins/train_model_mixin.py +67 -29
- simba/model/inference_batch.py +1 -1
- simba/model/yolo_seg_inference.py +3 -3
- simba/outlier_tools/skip_outlier_correction.py +1 -1
- simba/plotting/ROI_feature_visualizer_mp.py +3 -5
- simba/plotting/clf_validator_mp.py +4 -5
- simba/plotting/cue_light_visualizer.py +6 -7
- simba/plotting/directing_animals_visualizer_mp.py +2 -3
- simba/plotting/distance_plotter_mp.py +378 -378
- simba/plotting/gantt_creator.py +29 -10
- simba/plotting/gantt_creator_mp.py +96 -33
- simba/plotting/geometry_plotter.py +270 -272
- simba/plotting/heat_mapper_clf_mp.py +4 -6
- simba/plotting/heat_mapper_location_mp.py +2 -2
- simba/plotting/light_dark_box_plotter.py +2 -2
- simba/plotting/path_plotter_mp.py +26 -29
- simba/plotting/plot_clf_results_mp.py +455 -454
- simba/plotting/pose_plotter_mp.py +28 -29
- simba/plotting/probability_plot_creator_mp.py +288 -288
- simba/plotting/roi_plotter_mp.py +31 -31
- simba/plotting/single_run_model_validation_video_mp.py +427 -427
- simba/plotting/spontaneous_alternation_plotter.py +2 -3
- simba/plotting/yolo_pose_track_visualizer.py +32 -27
- simba/plotting/yolo_pose_visualizer.py +35 -36
- simba/plotting/yolo_seg_visualizer.py +2 -3
- simba/pose_importers/simba_blob_importer.py +3 -3
- simba/roi_tools/roi_aggregate_stats_mp.py +5 -4
- simba/roi_tools/roi_clf_calculator_mp.py +4 -4
- simba/sandbox/analyze_runtimes.py +30 -0
- simba/sandbox/cuda/egocentric_rotator.py +374 -374
- simba/sandbox/get_cpu_pool.py +5 -0
- simba/sandbox/proboscis_to_tip.py +28 -0
- simba/sandbox/test_directionality.py +47 -0
- simba/sandbox/test_nonstatic_directionality.py +27 -0
- simba/sandbox/test_pycharm_cuda.py +51 -0
- simba/sandbox/test_simba_install.py +41 -0
- simba/sandbox/test_static_directionality.py +26 -0
- simba/sandbox/test_static_directionality_2d.py +26 -0
- simba/sandbox/verify_env.py +42 -0
- simba/third_party_label_appenders/transform/coco_keypoints_to_yolo.py +3 -3
- simba/third_party_label_appenders/transform/coco_keypoints_to_yolo_bbox.py +2 -2
- simba/ui/pop_ups/clf_plot_pop_up.py +2 -2
- simba/ui/pop_ups/fsttc_pop_up.py +27 -25
- simba/ui/pop_ups/gantt_pop_up.py +31 -6
- simba/ui/pop_ups/kleinberg_pop_up.py +39 -40
- simba/ui/pop_ups/video_processing_pop_up.py +37 -29
- simba/ui/tkinter_functions.py +3 -0
- simba/utils/custom_feature_extractor.py +1 -1
- simba/utils/data.py +90 -14
- simba/utils/enums.py +1 -0
- simba/utils/errors.py +441 -440
- simba/utils/lookups.py +1203 -1203
- simba/utils/printing.py +124 -124
- simba/utils/read_write.py +3769 -3721
- simba/utils/yolo.py +10 -1
- simba/video_processors/blob_tracking_executor.py +2 -2
- simba/video_processors/clahe_ui.py +1 -1
- simba/video_processors/egocentric_video_rotator.py +44 -41
- simba/video_processors/multi_cropper.py +1 -1
- simba/video_processors/video_processing.py +5264 -5222
- simba/video_processors/videos_to_frames.py +43 -33
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/METADATA +4 -3
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/RECORD +90 -80
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.6.2.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/top_level.txt +0 -0
simba/utils/printing.py
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
__author__ = "Simon Nilsson; sronilsson@gmail.com"
|
|
2
|
-
|
|
3
|
-
try:
|
|
4
|
-
from typing import Literal
|
|
5
|
-
except:
|
|
6
|
-
from typing_extensions import Literal
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
from typing import Optional
|
|
12
|
-
|
|
13
|
-
from simba.utils.enums import Defaults, TagNames
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def stdout_success(msg: str, source: Optional[str] = "", elapsed_time: Optional[str] = None) -> None:
|
|
17
|
-
"""
|
|
18
|
-
Helper to parse msg of completed operation to SimBA main interface.
|
|
19
|
-
|
|
20
|
-
:param str msg: Message to be parsed.
|
|
21
|
-
:param Optional[str] source: Optional string indicating the source method or function of the msg for logging.
|
|
22
|
-
:param Optional[str] elapsed_time: Optional string indicating the runtime of the completed operation.
|
|
23
|
-
:return None:
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
log_event(logger_name=f"{source}.{stdout_success.__name__}", log_type=TagNames.COMPLETE.value, msg=msg)
|
|
27
|
-
if elapsed_time:
|
|
28
|
-
print(f"SIMBA COMPLETE: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.COMPLETE.value}")
|
|
29
|
-
else:
|
|
30
|
-
print(f"SIMBA COMPLETE: {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.COMPLETE.value}")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def stdout_warning(msg: str, elapsed_time: Optional[str] = None) -> None:
|
|
34
|
-
"""
|
|
35
|
-
Helper to parse warning msg to SimBA main interface.
|
|
36
|
-
|
|
37
|
-
:param str msg: Message to be parsed.
|
|
38
|
-
:param Optional[str] source: Optional string indicating the source method or function of the msg for logging.
|
|
39
|
-
:param elapsed_time: Optional string indicating the runtime.
|
|
40
|
-
:return None:
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
if elapsed_time:
|
|
44
|
-
print(f"SIMBA WARNING: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.WARNING.value}")
|
|
45
|
-
else:
|
|
46
|
-
print(f"SIMBA WARNING: {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.WARNING.value}")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def stdout_trash(msg: str, source: Optional[str] = "", elapsed_time: Optional[str] = None) -> None:
|
|
50
|
-
"""
|
|
51
|
-
Helper to parse msg of delete operation to SimBA main interface.
|
|
52
|
-
|
|
53
|
-
:param str msg: Message to be parsed.
|
|
54
|
-
:param Optional[str] source: Optional string indicating the source method or function of the operation for logging.
|
|
55
|
-
:param elapsed_time: Optional string indicating the runtime.
|
|
56
|
-
:return None:
|
|
57
|
-
"""
|
|
58
|
-
|
|
59
|
-
log_event(logger_name=f"{source}.{stdout_trash.__name__}", log_type=TagNames.TRASH.value, msg=msg)
|
|
60
|
-
if elapsed_time:
|
|
61
|
-
print(f"SIMBA COMPLETE: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.TRASH.value}")
|
|
62
|
-
else:
|
|
63
|
-
print(f"SIMBA COMPLETE: {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.TRASH.value}")
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def stdout_information(msg: str, source: Optional[str] = "", elapsed_time: Optional[str] = None) -> None:
|
|
67
|
-
"""
|
|
68
|
-
Helper to parse information msg to SimBA main interface. E.g., how many monitors and their resolutions which is available.
|
|
69
|
-
|
|
70
|
-
:param str msg: Message to be parsed.
|
|
71
|
-
:param Optional[str] source: Optional string indicating the source method or function of the operation for logging.
|
|
72
|
-
:param elapsed_time: Optional string indicating the runtime.
|
|
73
|
-
:return None:
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
log_event(logger_name=f"{source}.{stdout_trash.__name__}", log_type=TagNames.INFORMATION.value, msg=msg)
|
|
77
|
-
if elapsed_time:
|
|
78
|
-
print(f"SIMBA COMPLETE: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.INFORMATION.value}")
|
|
79
|
-
else:
|
|
80
|
-
print(f"{msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.INFORMATION.value}")
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
class SimbaTimer(object):
|
|
84
|
-
"""Timer class for keeping track of start and end-times of calls"""
|
|
85
|
-
|
|
86
|
-
def __init__(self, start: bool = False):
|
|
87
|
-
if start:
|
|
88
|
-
self.start_timer()
|
|
89
|
-
|
|
90
|
-
def start_timer(self):
|
|
91
|
-
self.timer = time.time()
|
|
92
|
-
|
|
93
|
-
def stop_timer(self):
|
|
94
|
-
if not hasattr(self, "timer"):
|
|
95
|
-
self.elapsed_time = -1
|
|
96
|
-
self.elapsed_time_str = "-1"
|
|
97
|
-
else:
|
|
98
|
-
self.elapsed_time = round(time.time() - self.timer, 4)
|
|
99
|
-
self.elapsed_time_str = str(self.elapsed_time)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def log_event(logger_name: str, log_type: Literal["CLASS_INIT", "error", "warning"], msg: str):
|
|
103
|
-
logger = logging.getLogger(str(logger_name))
|
|
104
|
-
if log_type == TagNames.CLASS_INIT.value:
|
|
105
|
-
logger.info(f"{TagNames.CLASS_INIT.value}||{msg}")
|
|
106
|
-
elif log_type == TagNames.ERROR.value:
|
|
107
|
-
logger.error(f"{TagNames.ERROR.value}||{msg}")
|
|
108
|
-
elif log_type == TagNames.WARNING.value:
|
|
109
|
-
logger.warning(f"{TagNames.WARNING.value}||{msg}")
|
|
110
|
-
elif log_type == TagNames.TRASH.value:
|
|
111
|
-
logger.info(f"{TagNames.TRASH.value}||{msg}")
|
|
112
|
-
elif log_type == TagNames.COMPLETE.value:
|
|
113
|
-
logger.info(f"{TagNames.COMPLETE.value}||{msg}")
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def perform_timing(func):
|
|
117
|
-
def decorator(*args, **kwargs):
|
|
118
|
-
timer = SimbaTimer(start=True)
|
|
119
|
-
results = func(*args, **kwargs, _timer=timer)
|
|
120
|
-
timer.stop_timer()
|
|
121
|
-
results["timer"] = timer.elapsed_time_str
|
|
122
|
-
return results
|
|
123
|
-
|
|
124
|
-
return decorator
|
|
1
|
+
__author__ = "Simon Nilsson; sronilsson@gmail.com"
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from typing import Literal
|
|
5
|
+
except:
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
import time
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
from typing import Optional
|
|
12
|
+
|
|
13
|
+
from simba.utils.enums import Defaults, TagNames
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def stdout_success(msg: str, source: Optional[str] = "", elapsed_time: Optional[str] = None) -> None:
|
|
17
|
+
"""
|
|
18
|
+
Helper to parse msg of completed operation to SimBA main interface.
|
|
19
|
+
|
|
20
|
+
:param str msg: Message to be parsed.
|
|
21
|
+
:param Optional[str] source: Optional string indicating the source method or function of the msg for logging.
|
|
22
|
+
:param Optional[str] elapsed_time: Optional string indicating the runtime of the completed operation.
|
|
23
|
+
:return None:
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
log_event(logger_name=f"{source}.{stdout_success.__name__}", log_type=TagNames.COMPLETE.value, msg=msg)
|
|
27
|
+
if elapsed_time:
|
|
28
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA COMPLETE: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.COMPLETE.value}")
|
|
29
|
+
else:
|
|
30
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA COMPLETE: {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.COMPLETE.value}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def stdout_warning(msg: str, elapsed_time: Optional[str] = None) -> None:
|
|
34
|
+
"""
|
|
35
|
+
Helper to parse warning msg to SimBA main interface.
|
|
36
|
+
|
|
37
|
+
:param str msg: Message to be parsed.
|
|
38
|
+
:param Optional[str] source: Optional string indicating the source method or function of the msg for logging.
|
|
39
|
+
:param elapsed_time: Optional string indicating the runtime.
|
|
40
|
+
:return None:
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
if elapsed_time:
|
|
44
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA WARNING: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.WARNING.value}")
|
|
45
|
+
else:
|
|
46
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA WARNING: {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.WARNING.value}")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def stdout_trash(msg: str, source: Optional[str] = "", elapsed_time: Optional[str] = None) -> None:
|
|
50
|
+
"""
|
|
51
|
+
Helper to parse msg of delete operation to SimBA main interface.
|
|
52
|
+
|
|
53
|
+
:param str msg: Message to be parsed.
|
|
54
|
+
:param Optional[str] source: Optional string indicating the source method or function of the operation for logging.
|
|
55
|
+
:param elapsed_time: Optional string indicating the runtime.
|
|
56
|
+
:return None:
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
log_event(logger_name=f"{source}.{stdout_trash.__name__}", log_type=TagNames.TRASH.value, msg=msg)
|
|
60
|
+
if elapsed_time:
|
|
61
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA COMPLETE: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.TRASH.value}")
|
|
62
|
+
else:
|
|
63
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA COMPLETE: {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.TRASH.value}")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def stdout_information(msg: str, source: Optional[str] = "", elapsed_time: Optional[str] = None) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Helper to parse information msg to SimBA main interface. E.g., how many monitors and their resolutions which is available.
|
|
69
|
+
|
|
70
|
+
:param str msg: Message to be parsed.
|
|
71
|
+
:param Optional[str] source: Optional string indicating the source method or function of the operation for logging.
|
|
72
|
+
:param elapsed_time: Optional string indicating the runtime.
|
|
73
|
+
:return None:
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
log_event(logger_name=f"{source}.{stdout_trash.__name__}", log_type=TagNames.INFORMATION.value, msg=msg)
|
|
77
|
+
if elapsed_time:
|
|
78
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA COMPLETE: {msg} (elapsed time: {elapsed_time}s) {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.INFORMATION.value}")
|
|
79
|
+
else:
|
|
80
|
+
print(f"[{datetime.now().strftime('%H:%M:%S')}] {msg} {Defaults.STR_SPLIT_DELIMITER.value}{TagNames.INFORMATION.value}")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class SimbaTimer(object):
|
|
84
|
+
"""Timer class for keeping track of start and end-times of calls"""
|
|
85
|
+
|
|
86
|
+
def __init__(self, start: bool = False):
|
|
87
|
+
if start:
|
|
88
|
+
self.start_timer()
|
|
89
|
+
|
|
90
|
+
def start_timer(self):
|
|
91
|
+
self.timer = time.time()
|
|
92
|
+
|
|
93
|
+
def stop_timer(self):
|
|
94
|
+
if not hasattr(self, "timer"):
|
|
95
|
+
self.elapsed_time = -1
|
|
96
|
+
self.elapsed_time_str = "-1"
|
|
97
|
+
else:
|
|
98
|
+
self.elapsed_time = round(time.time() - self.timer, 4)
|
|
99
|
+
self.elapsed_time_str = str(self.elapsed_time)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def log_event(logger_name: str, log_type: Literal["CLASS_INIT", "error", "warning"], msg: str):
|
|
103
|
+
logger = logging.getLogger(str(logger_name))
|
|
104
|
+
if log_type == TagNames.CLASS_INIT.value:
|
|
105
|
+
logger.info(f"{TagNames.CLASS_INIT.value}||{msg}")
|
|
106
|
+
elif log_type == TagNames.ERROR.value:
|
|
107
|
+
logger.error(f"{TagNames.ERROR.value}||{msg}")
|
|
108
|
+
elif log_type == TagNames.WARNING.value:
|
|
109
|
+
logger.warning(f"{TagNames.WARNING.value}||{msg}")
|
|
110
|
+
elif log_type == TagNames.TRASH.value:
|
|
111
|
+
logger.info(f"{TagNames.TRASH.value}||{msg}")
|
|
112
|
+
elif log_type == TagNames.COMPLETE.value:
|
|
113
|
+
logger.info(f"{TagNames.COMPLETE.value}||{msg}")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def perform_timing(func):
|
|
117
|
+
def decorator(*args, **kwargs):
|
|
118
|
+
timer = SimbaTimer(start=True)
|
|
119
|
+
results = func(*args, **kwargs, _timer=timer)
|
|
120
|
+
timer.stop_timer()
|
|
121
|
+
results["timer"] = timer.elapsed_time_str
|
|
122
|
+
return results
|
|
123
|
+
|
|
124
|
+
return decorator
|