simba-uw-tf-dev 4.6.4__py3-none-any.whl → 4.6.6__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.
Files changed (33) hide show
  1. simba/data_processors/cuda/geometry.py +45 -27
  2. simba/data_processors/cuda/image.py +1620 -1600
  3. simba/data_processors/cuda/statistics.py +17 -9
  4. simba/data_processors/egocentric_aligner.py +24 -6
  5. simba/data_processors/kleinberg_calculator.py +6 -2
  6. simba/feature_extractors/feature_subsets.py +12 -5
  7. simba/feature_extractors/straub_tail_analyzer.py +0 -2
  8. simba/mixins/statistics_mixin.py +9 -2
  9. simba/sandbox/analyze_runtimes.py +30 -0
  10. simba/sandbox/cuda/egocentric_rotator.py +374 -374
  11. simba/sandbox/proboscis_to_tip.py +28 -0
  12. simba/sandbox/test_directionality.py +47 -0
  13. simba/sandbox/test_nonstatic_directionality.py +27 -0
  14. simba/sandbox/test_pycharm_cuda.py +51 -0
  15. simba/sandbox/test_simba_install.py +41 -0
  16. simba/sandbox/test_static_directionality.py +26 -0
  17. simba/sandbox/test_static_directionality_2d.py +26 -0
  18. simba/sandbox/verify_env.py +42 -0
  19. simba/ui/pop_ups/fsttc_pop_up.py +27 -25
  20. simba/ui/pop_ups/kleinberg_pop_up.py +3 -2
  21. simba/utils/data.py +0 -1
  22. simba/utils/errors.py +441 -440
  23. simba/utils/lookups.py +1203 -1203
  24. simba/utils/read_write.py +38 -13
  25. simba/video_processors/egocentric_video_rotator.py +41 -36
  26. simba/video_processors/video_processing.py +5247 -5233
  27. simba/video_processors/videos_to_frames.py +41 -31
  28. {simba_uw_tf_dev-4.6.4.dist-info → simba_uw_tf_dev-4.6.6.dist-info}/METADATA +2 -2
  29. {simba_uw_tf_dev-4.6.4.dist-info → simba_uw_tf_dev-4.6.6.dist-info}/RECORD +33 -24
  30. {simba_uw_tf_dev-4.6.4.dist-info → simba_uw_tf_dev-4.6.6.dist-info}/LICENSE +0 -0
  31. {simba_uw_tf_dev-4.6.4.dist-info → simba_uw_tf_dev-4.6.6.dist-info}/WHEEL +0 -0
  32. {simba_uw_tf_dev-4.6.4.dist-info → simba_uw_tf_dev-4.6.6.dist-info}/entry_points.txt +0 -0
  33. {simba_uw_tf_dev-4.6.4.dist-info → simba_uw_tf_dev-4.6.6.dist-info}/top_level.txt +0 -0
simba/utils/errors.py CHANGED
@@ -1,440 +1,441 @@
1
- __author__ = "Simon Nilsson; sronilsson@gmail.com"
2
-
3
- from tkinter import messagebox as mb
4
-
5
- from simba.utils.enums import Defaults, TagNames
6
- from simba.utils.printing import log_event
7
-
8
- WINDOW_TITLE = "SIMBA ERROR"
9
-
10
-
11
- class SimbaError(Exception):
12
- def __init__(self, msg: str, source: str = " ", show_window: bool = False):
13
- self.msg, self.source, self.show_window = msg, source, show_window
14
- self.print_and_log_error()
15
-
16
- def __str__(self):
17
- return self.msg
18
-
19
- def print_and_log_error(self):
20
- log_event(logger_name=f"{self.source}.{self.__class__.__name__}", log_type=TagNames.ERROR.value,msg=self.msg)
21
- print(f"{self.msg}{Defaults.STR_SPLIT_DELIMITER.value}{TagNames.ERROR.value}")
22
- if self.show_window:
23
- mb.showerror(title=WINDOW_TITLE, message=self.msg)
24
-
25
-
26
- class NoSpecifiedOutputError(SimbaError):
27
- def __init__(self, msg: str, source: str = "", show_window: bool = True):
28
- super().__init__(msg=msg, source=source, show_window=show_window)
29
-
30
-
31
- class ROICoordinatesNotFoundError(SimbaError):
32
- def __init__(self, expected_file_path: str, source: str = "", show_window: bool = False):
33
- msg = f"SIMBA ROI COORDINATES ERROR: No ROI coordinates found. Please use the [ROI] tab to define ROIs. Expected at location {expected_file_path}"
34
- super().__init__(msg=msg, source=source, show_window=show_window)
35
-
36
-
37
- class NoChoosenClassifierError(SimbaError):
38
- def __init__(self, source: str = "", show_window: bool = False):
39
- msg = f"Select at least one classifier"
40
- super().__init__(msg=msg, source=source, show_window=show_window)
41
-
42
-
43
- class NoChoosenROIError(SimbaError):
44
- def __init__(self, source: str = "", show_window: bool = False):
45
- msg = f"Please select at least one ROI."
46
- super().__init__(msg=msg, source=source, show_window=show_window)
47
-
48
-
49
- class NoChoosenMeasurementError(SimbaError):
50
- def __init__(self, source: str = "", show_window: bool = False):
51
- msg = "SIMBA NoChoosenMeasurementError ERROR: Please select at least one measurement to calculate descriptive statistics for."
52
- super().__init__(msg=msg, source=source, show_window=show_window)
53
-
54
-
55
- class NoDataError(SimbaError):
56
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
57
- msg = f"SIMBA NO DATA ERROR: {msg}"
58
- super().__init__(msg=msg, source=source, show_window=show_window)
59
-
60
-
61
- class SamplingError(SimbaError):
62
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
63
- msg = f"SIMBA SAMPLING ERROR: {msg}"
64
- super().__init__(msg=msg, source=source, show_window=show_window)
65
-
66
-
67
- class PermissionError(SimbaError):
68
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
69
- msg = f"SIMBA PERMISSION ERROR: {msg}"
70
- super().__init__(msg=msg, source=source, show_window=show_window)
71
-
72
-
73
- class NoROIDataError(SimbaError):
74
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
75
- msg = f"SIMBA NO ROI DATA ERROR: {msg}"
76
- super().__init__(msg=msg, source=source, show_window=show_window)
77
-
78
-
79
- class MixedMosaicError(SimbaError):
80
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
81
- msg = f"SIMBA MixedMosaicError ERROR: {msg}"
82
- super().__init__(msg=msg, source=source, show_window=show_window)
83
-
84
-
85
- class ClassifierInferenceError(SimbaError):
86
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
87
- msg = f"SIMBA CLASSIFIER INFERENCE ERROR: {msg}"
88
- super().__init__(msg=msg, source=source, show_window=show_window)
89
-
90
-
91
- class AnimalNumberError(SimbaError):
92
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
93
- msg = f"SIMBA ANIMAL NUMBER ERROR: {msg}"
94
- super().__init__(msg=msg, source=source, show_window=show_window)
95
-
96
-
97
- class InvalidFilepathError(SimbaError):
98
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
99
- msg = f"SIMBA INVALID FILE PATH ERROR: {msg}"
100
- super().__init__(msg=msg, source=source, show_window=show_window)
101
-
102
-
103
- class NoFilesFoundError(SimbaError):
104
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
105
- msg = f"SIMBA NO FILES FOUND ERROR: {msg}"
106
- super().__init__(msg=msg, source=source, show_window=show_window)
107
-
108
-
109
- class DataHeaderError(SimbaError):
110
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
111
- msg = f"SIMBA DATA HEADER ERROR: {msg}"
112
- super().__init__(msg=msg, source=source, show_window=show_window)
113
-
114
-
115
- class NotDirectoryError(SimbaError):
116
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
117
- msg = f"SIMBA NOT A DIRECTORY ERROR: {msg}"
118
- super().__init__(msg=msg, source=source, show_window=show_window)
119
-
120
-
121
- class DirectoryExistError(SimbaError):
122
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
123
- msg = f"SIMBA DIRECTORY ALREADY EXIST ERROR: {msg}"
124
- super().__init__(msg=msg, source=source, show_window=show_window)
125
-
126
-
127
- class FileExistError(SimbaError):
128
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
129
- msg = f"SIMBA FILE EXIST ERROR: {msg}"
130
- super().__init__(msg=msg, source=source, show_window=show_window)
131
-
132
-
133
- class FrameRangeError(SimbaError):
134
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
135
- msg = f"SIMBA FRAME RANGE ERROR: {msg}"
136
- super().__init__(msg=msg, source=source, show_window=show_window)
137
-
138
-
139
- class AdvancedLabellingError(SimbaError):
140
- def __init__(
141
- self,
142
- frame: str,
143
- lbl_lst: list,
144
- unlabel_lst: list,
145
- source: str = "",
146
- show_window: bool = False,
147
- ):
148
- msg = (
149
- "SIMBA ADVANCED LABELLING ERROR: In advanced labelling of multiple behaviors, any annotated frame cannot have some "
150
- "behaviors annotated as present/absent, while other behaviors are un-labelled. All behaviors need "
151
- "labels for a frame with one or more labels. In frame {}, behaviors {} are labelled, while behaviors "
152
- "{} are un-labelled.".format(str(frame), lbl_lst, unlabel_lst)
153
- )
154
- super().__init__(msg=msg, source=source, show_window=show_window)
155
-
156
-
157
- class InvalidHyperparametersFileError(SimbaError):
158
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
159
- msg = f"SIMBA HYPERPARAMETER FILE ERROR: {msg}"
160
- super().__init__(msg=msg, source=source, show_window=show_window)
161
-
162
-
163
- class InvalidVideoFileError(SimbaError):
164
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
165
- msg = f"SIMBA VIDEO FILE ERROR: {msg}"
166
- super().__init__(msg=msg, source=source, show_window=show_window)
167
-
168
-
169
- class InvalidFileTypeError(SimbaError):
170
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
171
- msg = f"SIMBA INVALID FILE TYPE ERROR: {msg}"
172
- super().__init__(msg=msg, source=source, show_window=show_window)
173
-
174
-
175
- class FaultyTrainingSetError(SimbaError):
176
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
177
- msg = f"SIMBA INVALID ML TRAINING SET ERROR: {msg}"
178
- super().__init__(msg=msg, source=source, show_window=show_window)
179
-
180
-
181
- class CountError(SimbaError):
182
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
183
- msg = f"SIMBA COUNT ERROR: {msg}"
184
- super().__init__(msg=msg, source=source, show_window=show_window)
185
-
186
-
187
- class FeatureNumberMismatchError(SimbaError):
188
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
189
- msg = f"SIMBA FEATURE NUMBER MISMATCH ERROR: {msg}"
190
- super().__init__(msg=msg, source=source, show_window=show_window)
191
-
192
-
193
- class DuplicationError(SimbaError):
194
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
195
- msg = f"SIMBA DUPLICATION ERROR: {msg}"
196
- super().__init__(msg=msg, source=source, show_window=show_window)
197
-
198
-
199
- class InvalidInputError(SimbaError):
200
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
201
- msg = f"SIMBA VALUE ERROR: {msg}"
202
- super().__init__(msg=msg, source=source, show_window=show_window)
203
-
204
-
205
- class IntegerError(SimbaError):
206
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
207
- msg = f"SIMBA INTEGER ERROR: {msg}"
208
- super().__init__(msg=msg, source=source, show_window=show_window)
209
-
210
-
211
- class StringError(SimbaError):
212
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
213
- msg = f"SIMBA STRING ERROR: {msg}"
214
- super().__init__(msg=msg, source=source, show_window=show_window)
215
-
216
-
217
- class FloatError(SimbaError):
218
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
219
- msg = f"SIMBA FLOAT ERROR: {msg}"
220
- super().__init__(msg=msg, source=source, show_window=show_window)
221
-
222
-
223
- class MissingProjectConfigEntryError(SimbaError):
224
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
225
- msg = f"SIMBA MISSING PROJECT CONFIG ENTRY ERROR: {msg}"
226
- super().__init__(msg=msg, source=source, show_window=show_window)
227
-
228
-
229
- class MissingColumnsError(SimbaError):
230
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
231
- msg = f"SIMBA MISSING COLUMN ERROR: {msg}"
232
- super().__init__(msg=msg, source=source, show_window=show_window)
233
-
234
-
235
- class CorruptedFileError(SimbaError):
236
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
237
- msg = f"SIMBA READ FILE ERROR: {msg}"
238
- super().__init__(msg=msg, source=source, show_window=show_window)
239
-
240
-
241
- class ParametersFileError(SimbaError):
242
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
243
- msg = f"SIMBA VIDEO PARAMETERS FILE ERROR: {msg}"
244
- super().__init__(msg=msg, source=source, show_window=show_window)
245
-
246
-
247
- class ColumnNotFoundError(SimbaError):
248
- def __init__(
249
- self,
250
- column_name: str,
251
- file_name: str,
252
- source: str = "",
253
- show_window: bool = False,
254
- ):
255
- msg = f"SIMBA ERROR: Field name {column_name} could not be found in file {file_name}"
256
- super().__init__(msg=msg, source=source, show_window=show_window)
257
-
258
-
259
- class BodypartColumnNotFoundError(SimbaError):
260
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
261
- msg = f"SIMBA BODY_PART COLUMN NOT FOUND ERROR: {msg}"
262
- super().__init__(msg=msg, source=source, show_window=show_window)
263
-
264
-
265
- class AnnotationFileNotFoundError(SimbaError):
266
- def __init__(self, video_name: str, source: str = "", show_window: bool = False):
267
- msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: NO ANNOTATION DATA FOR VIDEO {video_name} FOUND"
268
- super().__init__(msg=msg, source=source, show_window=show_window)
269
-
270
-
271
- class DirectoryNotEmptyError(SimbaError):
272
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
273
- msg = f"SIMBA DIRECTORY NOT EMPTY ERROR: {msg}"
274
- super().__init__(msg=msg, source=source, show_window=show_window)
275
-
276
-
277
- #####
278
-
279
-
280
- class ThirdPartyAnnotationFileNotFoundError(SimbaError):
281
- def __init__(self, video_name: str, source: str = "", show_window: bool = False):
282
- msg = f"SIMBA ERROR: Could not find file in project_folder/csv/features_extracted directory representing annotations for video {video_name}"
283
- super().__init__(msg=msg, source=source, show_window=show_window)
284
-
285
-
286
- class ThirdPartyAnnotationsFpsConflictError(SimbaError):
287
- def __init__(
288
- self,
289
- video_name: str,
290
- annotation_fps: int,
291
- video_fps: int,
292
- source: str = "",
293
- show_window: bool = False,
294
- ):
295
- msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: The FPS for video {video_name} is set to {str(video_fps)} in SimBA and {str(annotation_fps)} in the annotation file"
296
- super().__init__(msg=msg, source=source, show_window=show_window)
297
-
298
-
299
- class ThirdPartyAnnotationsMissingAnnotationsError(SimbaError):
300
- def __init__(
301
- self,
302
- video_name: str,
303
- clf_names: list,
304
- source: str = "",
305
- show_window: bool = False,
306
- ):
307
- msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: No annotations detected for SimBA classifier(s) named {clf_names} for video {video_name}"
308
- super().__init__(msg=msg, source=source, show_window=show_window)
309
-
310
-
311
- class ThirdPartyAnnotationOverlapError(SimbaError):
312
- def __init__(
313
- self,
314
- video_name: str,
315
- clf_name: str,
316
- source: str = "",
317
- show_window: bool = False,
318
- ):
319
- msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: The annotations for behavior {clf_name} in video {video_name} contains behavior start events that are initiated PRIOR to the PRECEDING behavior event ending. SimBA requires a specific behavior event to end before another behavior event can start."
320
- super().__init__(msg=msg, source=source, show_window=show_window)
321
-
322
-
323
- class ThirdPartyAnnotationsAdditionalClfError(SimbaError):
324
- def __init__(
325
- self,
326
- video_name: str,
327
- clf_names: list,
328
- source: str = "",
329
- show_window: bool = False,
330
- ):
331
- msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: Annotations file for video {video_name} has annotations for the following behaviors {clf_names} that are NOT classifiers named in the SimBA project."
332
- super().__init__(msg=msg, source=source, show_window=show_window)
333
-
334
-
335
- class ThirdPartyAnnotationEventCountError(SimbaError):
336
- def __init__(
337
- self,
338
- video_name: str,
339
- clf_name: str,
340
- start_event_cnt: int,
341
- stop_event_cnt: int,
342
- source: str = "",
343
- show_window: bool = False,
344
- ):
345
- msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: The annotations for behavior {clf_name} in video {video_name} contains {str(start_event_cnt)} start events and {str(stop_event_cnt)} stop events. SimBA requires the number of stop and start event counts to be equal."
346
- super().__init__(msg=msg, source=source, show_window=show_window)
347
-
348
-
349
- class ThirdPartyAnnotationsClfMissingError(SimbaError):
350
- def __init__(
351
- self,
352
- video_name: str,
353
- clf_name: str,
354
- source: str = "",
355
- show_window: bool = False,
356
- ):
357
- msg = f"SIMBA THIRD-PARTY ANNOTATION WARNING: No annotations detected for video {video_name} and behavior {clf_name}."
358
- super().__init__(msg=msg, source=source, show_window=show_window)
359
-
360
-
361
- class ThirdPartyAnnotationsOutsidePoseEstimationDataError(SimbaError):
362
- def __init__(
363
- self,
364
- video_name: str,
365
- frm_cnt: int,
366
- clf_name: str or None = None,
367
- annotation_frms: int or None = None,
368
- first_error_frm: int or None = None,
369
- ambiguous_cnt: int or None = None,
370
- source: str = "",
371
- show_window: bool = False,
372
- ):
373
-
374
- if clf_name:
375
- msg = (
376
- f"SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior {clf_name} in video "
377
- f"{video_name} that are annotated to occur at times which is not present in the "
378
- f"video data you imported into SIMBA. The video you imported to SimBA has {str(frm_cnt)} frames. "
379
- f"However, in BORIS, you have annotated {clf_name} to happen at frame number {str(first_error_frm)}. "
380
- f"These ambiguous annotations occur in {str(ambiguous_cnt)} different frames for video {video_name} that SimBA will **remove** by default. "
381
- f"Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate."
382
- )
383
- else:
384
- msg = f"SIMBA THIRD-PARTY ANNOTATION WARNING: The annotations for video {video_name} contain data for {str(annotation_frms)} frames. The pose-estimation features for the same video contain data for {str(frm_cnt)} frames."
385
-
386
- super().__init__(msg=msg, source=source, show_window=show_window)
387
-
388
-
389
- class FFMPEGCodecGPUError(SimbaError):
390
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
391
- msg = f"SIMBA FFMPEG CODEC ERROR: {msg}"
392
- super().__init__(msg=msg, source=source, show_window=show_window)
393
-
394
-
395
- class FFMPEGNotFoundError(SimbaError):
396
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
397
- msg = f"SIMBA FFMPEG NOT FOUND ERROR: {msg}"
398
- super().__init__(msg=msg, source=source, show_window=show_window)
399
-
400
-
401
- class ArrayError(SimbaError):
402
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
403
- msg = f"SIMBA ARRAY SIZE ERROR: {msg}"
404
- super().__init__(msg=msg, source=source, show_window=show_window)
405
-
406
- class ResolutionError(SimbaError):
407
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
408
- msg = f"SIMBA RESOLUTION ERROR: {msg}"
409
- super().__init__(msg=msg, source=source, show_window=show_window)
410
-
411
-
412
- class SimBAModuleNotFoundError(SimbaError):
413
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
414
- msg = f"SIMBA MODULE NOT FOUND ERROR: {msg}"
415
- super().__init__(msg=msg, source=source, show_window=show_window)
416
-
417
-
418
- class SimBAGPUError(SimbaError):
419
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
420
- msg = f"SIMBA GPU ERROR: {msg}"
421
- super().__init__(msg=msg, source=source, show_window=show_window)
422
-
423
-
424
- class SimBAPAckageVersionError(SimbaError):
425
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
426
- msg = f"SIMBA PACKAGE VERSION ERROR: {msg}"
427
- super().__init__(msg=msg, source=source, show_window=show_window)
428
-
429
-
430
- class CropError(SimbaError):
431
- def __init__(self, msg: str, source: str = "", show_window: bool = False):
432
- msg = f"SIMBA CROP ERROR: {msg}"
433
- super().__init__(msg=msg, source=source, show_window=show_window)
434
-
435
- # test = NoSpecifiedOutputError(msg='test', source='test.method')
436
- # test = FFMPEGNotFoundError(msg='323')
437
-
438
- # class NoSpecifiedOutputError(SimbaError):
439
- # @log_error_decorator()
440
- # def __init__(self, msg: str, source: str = '', show_window: bool = True):
1
+ __author__ = "Simon Nilsson; sronilsson@gmail.com"
2
+
3
+ from datetime import datetime
4
+ from tkinter import messagebox as mb
5
+
6
+ from simba.utils.enums import Defaults, TagNames
7
+ from simba.utils.printing import log_event
8
+
9
+ WINDOW_TITLE = "SIMBA ERROR"
10
+
11
+
12
+ class SimbaError(Exception):
13
+ def __init__(self, msg: str, source: str = " ", show_window: bool = False):
14
+ self.msg, self.source, self.show_window = msg, source, show_window
15
+ self.print_and_log_error()
16
+
17
+ def __str__(self):
18
+ return self.msg
19
+
20
+ def print_and_log_error(self):
21
+ log_event(logger_name=f"{self.source}.{self.__class__.__name__}", log_type=TagNames.ERROR.value,msg=self.msg)
22
+ print(f"[{datetime.now().strftime('%H:%M:%S')}] {self.msg}{Defaults.STR_SPLIT_DELIMITER.value}{TagNames.ERROR.value}")
23
+ if self.show_window:
24
+ mb.showerror(title=WINDOW_TITLE, message=self.msg)
25
+
26
+
27
+ class NoSpecifiedOutputError(SimbaError):
28
+ def __init__(self, msg: str, source: str = "", show_window: bool = True):
29
+ super().__init__(msg=msg, source=source, show_window=show_window)
30
+
31
+
32
+ class ROICoordinatesNotFoundError(SimbaError):
33
+ def __init__(self, expected_file_path: str, source: str = "", show_window: bool = False):
34
+ msg = f"[{datetime.now().strftime('%H:%M:%S')}] SIMBA ROI COORDINATES ERROR: No ROI coordinates found. Please use the [ROI] tab to define ROIs. Expected at location {expected_file_path}"
35
+ super().__init__(msg=msg, source=source, show_window=show_window)
36
+
37
+
38
+ class NoChoosenClassifierError(SimbaError):
39
+ def __init__(self, source: str = "", show_window: bool = False):
40
+ msg = f"Select at least one classifier"
41
+ super().__init__(msg=msg, source=source, show_window=show_window)
42
+
43
+
44
+ class NoChoosenROIError(SimbaError):
45
+ def __init__(self, source: str = "", show_window: bool = False):
46
+ msg = f"Please select at least one ROI."
47
+ super().__init__(msg=msg, source=source, show_window=show_window)
48
+
49
+
50
+ class NoChoosenMeasurementError(SimbaError):
51
+ def __init__(self, source: str = "", show_window: bool = False):
52
+ msg = "SIMBA NoChoosenMeasurementError ERROR: Please select at least one measurement to calculate descriptive statistics for."
53
+ super().__init__(msg=msg, source=source, show_window=show_window)
54
+
55
+
56
+ class NoDataError(SimbaError):
57
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
58
+ msg = f"SIMBA NO DATA ERROR: {msg}"
59
+ super().__init__(msg=msg, source=source, show_window=show_window)
60
+
61
+
62
+ class SamplingError(SimbaError):
63
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
64
+ msg = f"SIMBA SAMPLING ERROR: {msg}"
65
+ super().__init__(msg=msg, source=source, show_window=show_window)
66
+
67
+
68
+ class PermissionError(SimbaError):
69
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
70
+ msg = f"SIMBA PERMISSION ERROR: {msg}"
71
+ super().__init__(msg=msg, source=source, show_window=show_window)
72
+
73
+
74
+ class NoROIDataError(SimbaError):
75
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
76
+ msg = f"SIMBA NO ROI DATA ERROR: {msg}"
77
+ super().__init__(msg=msg, source=source, show_window=show_window)
78
+
79
+
80
+ class MixedMosaicError(SimbaError):
81
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
82
+ msg = f"SIMBA MixedMosaicError ERROR: {msg}"
83
+ super().__init__(msg=msg, source=source, show_window=show_window)
84
+
85
+
86
+ class ClassifierInferenceError(SimbaError):
87
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
88
+ msg = f"SIMBA CLASSIFIER INFERENCE ERROR: {msg}"
89
+ super().__init__(msg=msg, source=source, show_window=show_window)
90
+
91
+
92
+ class AnimalNumberError(SimbaError):
93
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
94
+ msg = f"SIMBA ANIMAL NUMBER ERROR: {msg}"
95
+ super().__init__(msg=msg, source=source, show_window=show_window)
96
+
97
+
98
+ class InvalidFilepathError(SimbaError):
99
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
100
+ msg = f"SIMBA INVALID FILE PATH ERROR: {msg}"
101
+ super().__init__(msg=msg, source=source, show_window=show_window)
102
+
103
+
104
+ class NoFilesFoundError(SimbaError):
105
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
106
+ msg = f"SIMBA NO FILES FOUND ERROR: {msg}"
107
+ super().__init__(msg=msg, source=source, show_window=show_window)
108
+
109
+
110
+ class DataHeaderError(SimbaError):
111
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
112
+ msg = f"SIMBA DATA HEADER ERROR: {msg}"
113
+ super().__init__(msg=msg, source=source, show_window=show_window)
114
+
115
+
116
+ class NotDirectoryError(SimbaError):
117
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
118
+ msg = f"SIMBA NOT A DIRECTORY ERROR: {msg}"
119
+ super().__init__(msg=msg, source=source, show_window=show_window)
120
+
121
+
122
+ class DirectoryExistError(SimbaError):
123
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
124
+ msg = f"SIMBA DIRECTORY ALREADY EXIST ERROR: {msg}"
125
+ super().__init__(msg=msg, source=source, show_window=show_window)
126
+
127
+
128
+ class FileExistError(SimbaError):
129
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
130
+ msg = f"SIMBA FILE EXIST ERROR: {msg}"
131
+ super().__init__(msg=msg, source=source, show_window=show_window)
132
+
133
+
134
+ class FrameRangeError(SimbaError):
135
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
136
+ msg = f"SIMBA FRAME RANGE ERROR: {msg}"
137
+ super().__init__(msg=msg, source=source, show_window=show_window)
138
+
139
+
140
+ class AdvancedLabellingError(SimbaError):
141
+ def __init__(
142
+ self,
143
+ frame: str,
144
+ lbl_lst: list,
145
+ unlabel_lst: list,
146
+ source: str = "",
147
+ show_window: bool = False,
148
+ ):
149
+ msg = (
150
+ "SIMBA ADVANCED LABELLING ERROR: In advanced labelling of multiple behaviors, any annotated frame cannot have some "
151
+ "behaviors annotated as present/absent, while other behaviors are un-labelled. All behaviors need "
152
+ "labels for a frame with one or more labels. In frame {}, behaviors {} are labelled, while behaviors "
153
+ "{} are un-labelled.".format(str(frame), lbl_lst, unlabel_lst)
154
+ )
155
+ super().__init__(msg=msg, source=source, show_window=show_window)
156
+
157
+
158
+ class InvalidHyperparametersFileError(SimbaError):
159
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
160
+ msg = f"SIMBA HYPERPARAMETER FILE ERROR: {msg}"
161
+ super().__init__(msg=msg, source=source, show_window=show_window)
162
+
163
+
164
+ class InvalidVideoFileError(SimbaError):
165
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
166
+ msg = f"SIMBA VIDEO FILE ERROR: {msg}"
167
+ super().__init__(msg=msg, source=source, show_window=show_window)
168
+
169
+
170
+ class InvalidFileTypeError(SimbaError):
171
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
172
+ msg = f"SIMBA INVALID FILE TYPE ERROR: {msg}"
173
+ super().__init__(msg=msg, source=source, show_window=show_window)
174
+
175
+
176
+ class FaultyTrainingSetError(SimbaError):
177
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
178
+ msg = f"SIMBA INVALID ML TRAINING SET ERROR: {msg}"
179
+ super().__init__(msg=msg, source=source, show_window=show_window)
180
+
181
+
182
+ class CountError(SimbaError):
183
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
184
+ msg = f"SIMBA COUNT ERROR: {msg}"
185
+ super().__init__(msg=msg, source=source, show_window=show_window)
186
+
187
+
188
+ class FeatureNumberMismatchError(SimbaError):
189
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
190
+ msg = f"SIMBA FEATURE NUMBER MISMATCH ERROR: {msg}"
191
+ super().__init__(msg=msg, source=source, show_window=show_window)
192
+
193
+
194
+ class DuplicationError(SimbaError):
195
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
196
+ msg = f"SIMBA DUPLICATION ERROR: {msg}"
197
+ super().__init__(msg=msg, source=source, show_window=show_window)
198
+
199
+
200
+ class InvalidInputError(SimbaError):
201
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
202
+ msg = f"SIMBA VALUE ERROR: {msg}"
203
+ super().__init__(msg=msg, source=source, show_window=show_window)
204
+
205
+
206
+ class IntegerError(SimbaError):
207
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
208
+ msg = f"SIMBA INTEGER ERROR: {msg}"
209
+ super().__init__(msg=msg, source=source, show_window=show_window)
210
+
211
+
212
+ class StringError(SimbaError):
213
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
214
+ msg = f"SIMBA STRING ERROR: {msg}"
215
+ super().__init__(msg=msg, source=source, show_window=show_window)
216
+
217
+
218
+ class FloatError(SimbaError):
219
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
220
+ msg = f"SIMBA FLOAT ERROR: {msg}"
221
+ super().__init__(msg=msg, source=source, show_window=show_window)
222
+
223
+
224
+ class MissingProjectConfigEntryError(SimbaError):
225
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
226
+ msg = f"SIMBA MISSING PROJECT CONFIG ENTRY ERROR: {msg}"
227
+ super().__init__(msg=msg, source=source, show_window=show_window)
228
+
229
+
230
+ class MissingColumnsError(SimbaError):
231
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
232
+ msg = f"SIMBA MISSING COLUMN ERROR: {msg}"
233
+ super().__init__(msg=msg, source=source, show_window=show_window)
234
+
235
+
236
+ class CorruptedFileError(SimbaError):
237
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
238
+ msg = f"SIMBA READ FILE ERROR: {msg}"
239
+ super().__init__(msg=msg, source=source, show_window=show_window)
240
+
241
+
242
+ class ParametersFileError(SimbaError):
243
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
244
+ msg = f"SIMBA VIDEO PARAMETERS FILE ERROR: {msg}"
245
+ super().__init__(msg=msg, source=source, show_window=show_window)
246
+
247
+
248
+ class ColumnNotFoundError(SimbaError):
249
+ def __init__(
250
+ self,
251
+ column_name: str,
252
+ file_name: str,
253
+ source: str = "",
254
+ show_window: bool = False,
255
+ ):
256
+ msg = f"SIMBA ERROR: Field name {column_name} could not be found in file {file_name}"
257
+ super().__init__(msg=msg, source=source, show_window=show_window)
258
+
259
+
260
+ class BodypartColumnNotFoundError(SimbaError):
261
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
262
+ msg = f"SIMBA BODY_PART COLUMN NOT FOUND ERROR: {msg}"
263
+ super().__init__(msg=msg, source=source, show_window=show_window)
264
+
265
+
266
+ class AnnotationFileNotFoundError(SimbaError):
267
+ def __init__(self, video_name: str, source: str = "", show_window: bool = False):
268
+ msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: NO ANNOTATION DATA FOR VIDEO {video_name} FOUND"
269
+ super().__init__(msg=msg, source=source, show_window=show_window)
270
+
271
+
272
+ class DirectoryNotEmptyError(SimbaError):
273
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
274
+ msg = f"SIMBA DIRECTORY NOT EMPTY ERROR: {msg}"
275
+ super().__init__(msg=msg, source=source, show_window=show_window)
276
+
277
+
278
+ #####
279
+
280
+
281
+ class ThirdPartyAnnotationFileNotFoundError(SimbaError):
282
+ def __init__(self, video_name: str, source: str = "", show_window: bool = False):
283
+ msg = f"SIMBA ERROR: Could not find file in project_folder/csv/features_extracted directory representing annotations for video {video_name}"
284
+ super().__init__(msg=msg, source=source, show_window=show_window)
285
+
286
+
287
+ class ThirdPartyAnnotationsFpsConflictError(SimbaError):
288
+ def __init__(
289
+ self,
290
+ video_name: str,
291
+ annotation_fps: int,
292
+ video_fps: int,
293
+ source: str = "",
294
+ show_window: bool = False,
295
+ ):
296
+ msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: The FPS for video {video_name} is set to {str(video_fps)} in SimBA and {str(annotation_fps)} in the annotation file"
297
+ super().__init__(msg=msg, source=source, show_window=show_window)
298
+
299
+
300
+ class ThirdPartyAnnotationsMissingAnnotationsError(SimbaError):
301
+ def __init__(
302
+ self,
303
+ video_name: str,
304
+ clf_names: list,
305
+ source: str = "",
306
+ show_window: bool = False,
307
+ ):
308
+ msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: No annotations detected for SimBA classifier(s) named {clf_names} for video {video_name}"
309
+ super().__init__(msg=msg, source=source, show_window=show_window)
310
+
311
+
312
+ class ThirdPartyAnnotationOverlapError(SimbaError):
313
+ def __init__(
314
+ self,
315
+ video_name: str,
316
+ clf_name: str,
317
+ source: str = "",
318
+ show_window: bool = False,
319
+ ):
320
+ msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: The annotations for behavior {clf_name} in video {video_name} contains behavior start events that are initiated PRIOR to the PRECEDING behavior event ending. SimBA requires a specific behavior event to end before another behavior event can start."
321
+ super().__init__(msg=msg, source=source, show_window=show_window)
322
+
323
+
324
+ class ThirdPartyAnnotationsAdditionalClfError(SimbaError):
325
+ def __init__(
326
+ self,
327
+ video_name: str,
328
+ clf_names: list,
329
+ source: str = "",
330
+ show_window: bool = False,
331
+ ):
332
+ msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: Annotations file for video {video_name} has annotations for the following behaviors {clf_names} that are NOT classifiers named in the SimBA project."
333
+ super().__init__(msg=msg, source=source, show_window=show_window)
334
+
335
+
336
+ class ThirdPartyAnnotationEventCountError(SimbaError):
337
+ def __init__(
338
+ self,
339
+ video_name: str,
340
+ clf_name: str,
341
+ start_event_cnt: int,
342
+ stop_event_cnt: int,
343
+ source: str = "",
344
+ show_window: bool = False,
345
+ ):
346
+ msg = f"SIMBA THIRD-PARTY ANNOTATION ERROR: The annotations for behavior {clf_name} in video {video_name} contains {str(start_event_cnt)} start events and {str(stop_event_cnt)} stop events. SimBA requires the number of stop and start event counts to be equal."
347
+ super().__init__(msg=msg, source=source, show_window=show_window)
348
+
349
+
350
+ class ThirdPartyAnnotationsClfMissingError(SimbaError):
351
+ def __init__(
352
+ self,
353
+ video_name: str,
354
+ clf_name: str,
355
+ source: str = "",
356
+ show_window: bool = False,
357
+ ):
358
+ msg = f"SIMBA THIRD-PARTY ANNOTATION WARNING: No annotations detected for video {video_name} and behavior {clf_name}."
359
+ super().__init__(msg=msg, source=source, show_window=show_window)
360
+
361
+
362
+ class ThirdPartyAnnotationsOutsidePoseEstimationDataError(SimbaError):
363
+ def __init__(
364
+ self,
365
+ video_name: str,
366
+ frm_cnt: int,
367
+ clf_name: str or None = None,
368
+ annotation_frms: int or None = None,
369
+ first_error_frm: int or None = None,
370
+ ambiguous_cnt: int or None = None,
371
+ source: str = "",
372
+ show_window: bool = False,
373
+ ):
374
+
375
+ if clf_name:
376
+ msg = (
377
+ f"SIMBA THIRD-PARTY ANNOTATION WARNING: SimBA found THIRD-PARTY annotations for behavior {clf_name} in video "
378
+ f"{video_name} that are annotated to occur at times which is not present in the "
379
+ f"video data you imported into SIMBA. The video you imported to SimBA has {str(frm_cnt)} frames. "
380
+ f"However, in BORIS, you have annotated {clf_name} to happen at frame number {str(first_error_frm)}. "
381
+ f"These ambiguous annotations occur in {str(ambiguous_cnt)} different frames for video {video_name} that SimBA will **remove** by default. "
382
+ f"Please make sure you imported the same video as you annotated in BORIS into SimBA and the video is registered with the correct frame rate."
383
+ )
384
+ else:
385
+ msg = f"SIMBA THIRD-PARTY ANNOTATION WARNING: The annotations for video {video_name} contain data for {str(annotation_frms)} frames. The pose-estimation features for the same video contain data for {str(frm_cnt)} frames."
386
+
387
+ super().__init__(msg=msg, source=source, show_window=show_window)
388
+
389
+
390
+ class FFMPEGCodecGPUError(SimbaError):
391
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
392
+ msg = f"SIMBA FFMPEG CODEC ERROR: {msg}"
393
+ super().__init__(msg=msg, source=source, show_window=show_window)
394
+
395
+
396
+ class FFMPEGNotFoundError(SimbaError):
397
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
398
+ msg = f"SIMBA FFMPEG NOT FOUND ERROR: {msg}"
399
+ super().__init__(msg=msg, source=source, show_window=show_window)
400
+
401
+
402
+ class ArrayError(SimbaError):
403
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
404
+ msg = f"SIMBA ARRAY SIZE ERROR: {msg}"
405
+ super().__init__(msg=msg, source=source, show_window=show_window)
406
+
407
+ class ResolutionError(SimbaError):
408
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
409
+ msg = f"SIMBA RESOLUTION ERROR: {msg}"
410
+ super().__init__(msg=msg, source=source, show_window=show_window)
411
+
412
+
413
+ class SimBAModuleNotFoundError(SimbaError):
414
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
415
+ msg = f"SIMBA MODULE NOT FOUND ERROR: {msg}"
416
+ super().__init__(msg=msg, source=source, show_window=show_window)
417
+
418
+
419
+ class SimBAGPUError(SimbaError):
420
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
421
+ msg = f"SIMBA GPU ERROR: {msg}"
422
+ super().__init__(msg=msg, source=source, show_window=show_window)
423
+
424
+
425
+ class SimBAPAckageVersionError(SimbaError):
426
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
427
+ msg = f"SIMBA PACKAGE VERSION ERROR: {msg}"
428
+ super().__init__(msg=msg, source=source, show_window=show_window)
429
+
430
+
431
+ class CropError(SimbaError):
432
+ def __init__(self, msg: str, source: str = "", show_window: bool = False):
433
+ msg = f"SIMBA CROP ERROR: {msg}"
434
+ super().__init__(msg=msg, source=source, show_window=show_window)
435
+
436
+ # test = NoSpecifiedOutputError(msg='test', source='test.method')
437
+ # test = FFMPEGNotFoundError(msg='323')
438
+
439
+ # class NoSpecifiedOutputError(SimbaError):
440
+ # @log_error_decorator()
441
+ # def __init__(self, msg: str, source: str = '', show_window: bool = True):