simba-uw-tf-dev 4.6.7__py3-none-any.whl → 4.6.8__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.
Potentially problematic release.
This version of simba-uw-tf-dev might be problematic. Click here for more details.
- simba/assets/.recent_projects.txt +1 -0
- simba/data_processors/circling_detector.py +30 -13
- simba/data_processors/cuda/image.py +42 -18
- simba/data_processors/cuda/statistics.py +2 -3
- simba/data_processors/freezing_detector.py +54 -50
- simba/feature_extractors/mitra_feature_extractor.py +2 -2
- simba/mixins/config_reader.py +5 -2
- simba/mixins/plotting_mixin.py +28 -10
- simba/outlier_tools/skip_outlier_correction.py +1 -1
- simba/plotting/gantt_creator.py +29 -10
- simba/plotting/gantt_creator_mp.py +50 -17
- simba/sandbox/analyze_runtimes.py +30 -30
- simba/sandbox/test_directionality.py +47 -47
- simba/sandbox/test_nonstatic_directionality.py +27 -27
- simba/sandbox/test_pycharm_cuda.py +51 -51
- simba/sandbox/test_simba_install.py +41 -41
- simba/sandbox/test_static_directionality.py +26 -26
- simba/sandbox/test_static_directionality_2d.py +26 -26
- simba/sandbox/verify_env.py +42 -42
- simba/ui/pop_ups/clf_plot_pop_up.py +2 -2
- simba/ui/pop_ups/gantt_pop_up.py +31 -6
- simba/ui/pop_ups/video_processing_pop_up.py +1 -1
- simba/video_processors/video_processing.py +1 -1
- {simba_uw_tf_dev-4.6.7.dist-info → simba_uw_tf_dev-4.6.8.dist-info}/METADATA +1 -1
- {simba_uw_tf_dev-4.6.7.dist-info → simba_uw_tf_dev-4.6.8.dist-info}/RECORD +29 -29
- {simba_uw_tf_dev-4.6.7.dist-info → simba_uw_tf_dev-4.6.8.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.6.7.dist-info → simba_uw_tf_dev-4.6.8.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.6.7.dist-info → simba_uw_tf_dev-4.6.8.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.6.7.dist-info → simba_uw_tf_dev-4.6.8.dist-info}/top_level.txt +0 -0
|
@@ -8,16 +8,37 @@ import gc
|
|
|
8
8
|
import multiprocessing
|
|
9
9
|
import os
|
|
10
10
|
import platform
|
|
11
|
+
import sys
|
|
11
12
|
from copy import deepcopy
|
|
12
13
|
from typing import List, Optional, Union
|
|
13
14
|
|
|
14
15
|
import cv2
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
is_pycharm_ipython = True
|
|
18
|
+
try:
|
|
19
|
+
module_names = list(sys.modules.keys())
|
|
20
|
+
if any('pydev' in str(mod).lower() for mod in module_names):
|
|
21
|
+
is_pycharm_ipython = True
|
|
22
|
+
elif 'IPython' in sys.modules or 'ipython' in sys.modules:
|
|
23
|
+
is_pycharm_ipython = True
|
|
24
|
+
else:
|
|
25
|
+
is_pycharm_ipython = False
|
|
26
|
+
except Exception:
|
|
27
|
+
is_pycharm_ipython = True
|
|
28
|
+
|
|
29
|
+
if not is_pycharm_ipython:
|
|
30
|
+
if 'MPLBACKEND' not in os.environ: os.environ['MPLBACKEND'] = 'Agg'
|
|
31
|
+
try:
|
|
32
|
+
import matplotlib
|
|
33
|
+
matplotlib.use('Agg', force=False)
|
|
34
|
+
except (RecursionError, RuntimeError, ValueError, SystemError):
|
|
35
|
+
import matplotlib
|
|
36
|
+
else:
|
|
37
|
+
import matplotlib
|
|
38
|
+
|
|
16
39
|
import numpy as np
|
|
17
40
|
import pandas as pd
|
|
18
41
|
|
|
19
|
-
matplotlib.use('Agg')
|
|
20
|
-
|
|
21
42
|
from simba.mixins.config_reader import ConfigReader
|
|
22
43
|
from simba.mixins.plotting_mixin import PlottingMixin
|
|
23
44
|
from simba.utils.checks import (
|
|
@@ -28,6 +49,7 @@ from simba.utils.data import (create_color_palette, detect_bouts, get_cpu_pool,
|
|
|
28
49
|
terminate_cpu_pool)
|
|
29
50
|
from simba.utils.enums import Formats, Options
|
|
30
51
|
from simba.utils.errors import NoSpecifiedOutputError
|
|
52
|
+
from simba.utils.lookups import get_fonts
|
|
31
53
|
from simba.utils.printing import SimbaTimer, stdout_success
|
|
32
54
|
from simba.utils.read_write import (concatenate_videos_in_folder,
|
|
33
55
|
create_directory, find_core_cnt,
|
|
@@ -51,6 +73,7 @@ def gantt_creator_mp(data: np.array,
|
|
|
51
73
|
width: int,
|
|
52
74
|
height: int,
|
|
53
75
|
font_size: int,
|
|
76
|
+
font: str,
|
|
54
77
|
font_rotation: int,
|
|
55
78
|
palette: np.ndarray,
|
|
56
79
|
hhmmss: bool):
|
|
@@ -72,6 +95,7 @@ def gantt_creator_mp(data: np.array,
|
|
|
72
95
|
width=width,
|
|
73
96
|
height=height,
|
|
74
97
|
font_size=font_size,
|
|
98
|
+
font=font,
|
|
75
99
|
font_rotation=font_rotation,
|
|
76
100
|
video_name=video_name,
|
|
77
101
|
save_path=None,
|
|
@@ -139,9 +163,11 @@ class GanttCreatorMultiprocess(ConfigReader, PlottingMixin):
|
|
|
139
163
|
height: int = 480,
|
|
140
164
|
font_size: int = 8,
|
|
141
165
|
font_rotation: int = 45,
|
|
166
|
+
font: Optional[str] = None,
|
|
142
167
|
palette: str = 'Set1',
|
|
143
168
|
core_cnt: int = -1,
|
|
144
|
-
hhmmss: bool = False
|
|
169
|
+
hhmmss: bool = False,
|
|
170
|
+
clf_names: Optional[List[str]] = None):
|
|
145
171
|
|
|
146
172
|
check_file_exist_and_readable(file_path=config_path)
|
|
147
173
|
if (not frame_setting) and (not video_setting) and (not last_frm_setting):
|
|
@@ -157,6 +183,8 @@ class GanttCreatorMultiprocess(ConfigReader, PlottingMixin):
|
|
|
157
183
|
check_int(name=f"{self.__class__.__name__} core_cnt",value=core_cnt, min_value=-1, unaccepted_vals=[0], max_value=find_core_cnt()[0])
|
|
158
184
|
self.core_cnt = find_core_cnt()[0] if core_cnt == -1 or core_cnt > find_core_cnt()[0] else core_cnt
|
|
159
185
|
self.width, self.height, self.font_size, self.font_rotation, self.hhmmss = width, height, font_size, font_rotation, hhmmss
|
|
186
|
+
if font is not None:
|
|
187
|
+
check_str(name=f'{self.__class__.__name__} font', value=font, options=list(get_fonts().keys()), raise_error=True)
|
|
160
188
|
ConfigReader.__init__(self, config_path=config_path, create_logger=False)
|
|
161
189
|
if isinstance(data_paths, list):
|
|
162
190
|
check_valid_lst(data=data_paths, source=f'{self.__class__.__name__} data_paths', valid_dtypes=(str,), min_len=1)
|
|
@@ -166,9 +194,12 @@ class GanttCreatorMultiprocess(ConfigReader, PlottingMixin):
|
|
|
166
194
|
else:
|
|
167
195
|
data_paths = deepcopy(self.machine_results_paths)
|
|
168
196
|
for file_path in data_paths: check_file_exist_and_readable(file_path=file_path)
|
|
197
|
+
if clf_names is not None:
|
|
198
|
+
check_valid_lst(data=clf_names, source=f'{self.__class__.__name__} clf_names', valid_dtypes=(str,), valid_values=self.clf_names, min_len=1, raise_error=True)
|
|
199
|
+
self.clf_names = clf_names
|
|
169
200
|
PlottingMixin.__init__(self)
|
|
170
201
|
self.clr_lst = create_color_palette(pallete_name=palette, increments=len(self.body_parts_lst) + 1, as_int=True, as_rgb_ratio=True)
|
|
171
|
-
self.frame_setting, self.video_setting, self.data_paths, self.last_frm_setting = frame_setting, video_setting,data_paths, last_frm_setting
|
|
202
|
+
self.frame_setting, self.video_setting, self.data_paths, self.last_frm_setting, self.font = frame_setting, video_setting,data_paths, last_frm_setting, font
|
|
172
203
|
if not os.path.exists(self.gantt_plot_dir): os.makedirs(self.gantt_plot_dir)
|
|
173
204
|
if platform.system() == "Darwin":
|
|
174
205
|
multiprocessing.set_start_method("spawn", force=True)
|
|
@@ -206,6 +237,7 @@ class GanttCreatorMultiprocess(ConfigReader, PlottingMixin):
|
|
|
206
237
|
font_size=self.font_size,
|
|
207
238
|
font_rotation=self.font_rotation,
|
|
208
239
|
video_name=self.video_name,
|
|
240
|
+
font=self.font,
|
|
209
241
|
save_path=os.path.join(self.gantt_plot_dir, f"{self.video_name}_final_image.png"),
|
|
210
242
|
palette=self.clr_lst,
|
|
211
243
|
hhmmss=self.hhmmss)
|
|
@@ -225,6 +257,7 @@ class GanttCreatorMultiprocess(ConfigReader, PlottingMixin):
|
|
|
225
257
|
width=self.width,
|
|
226
258
|
height=self.height,
|
|
227
259
|
font_size=self.font_size,
|
|
260
|
+
font=self.font,
|
|
228
261
|
font_rotation=self.font_rotation,
|
|
229
262
|
video_name=self.video_name,
|
|
230
263
|
palette=self.clr_lst,
|
|
@@ -254,18 +287,18 @@ class GanttCreatorMultiprocess(ConfigReader, PlottingMixin):
|
|
|
254
287
|
# font_rotation= 45)
|
|
255
288
|
# test.run()
|
|
256
289
|
|
|
257
|
-
if __name__ == "__main__":
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
290
|
+
# if __name__ == "__main__":
|
|
291
|
+
# test = GanttCreatorMultiprocess(config_path=r"D:\troubleshooting\maplight_ri\project_folder\project_config.ini",
|
|
292
|
+
# frame_setting=False,
|
|
293
|
+
# video_setting=True,
|
|
294
|
+
# data_paths=r"D:\troubleshooting\maplight_ri\project_folder\csv\machine_results\Trial_1_C24_D1_1.csv",
|
|
295
|
+
# last_frm_setting=False,
|
|
296
|
+
# width=640,
|
|
297
|
+
# height= 480,
|
|
298
|
+
# font_size=10,
|
|
299
|
+
# font_rotation= 45,
|
|
300
|
+
# core_cnt=16)
|
|
301
|
+
# test.run()
|
|
269
302
|
|
|
270
303
|
|
|
271
304
|
# test = GanttCreatorMultiprocess(config_path='/Users/simon/Desktop/envs/simba/troubleshooting/RAT_NOR/project_folder/project_config.ini',
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"""Analyze runtime statistics for directionality_to_nonstatic_target"""
|
|
2
|
-
import numpy as np
|
|
3
|
-
from collections import defaultdict
|
|
4
|
-
|
|
5
|
-
# Parse the runtime data
|
|
6
|
-
data = {
|
|
7
|
-
10000: [0.4389, 0.0008, 0.0012],
|
|
8
|
-
100000: [0.0063, 0.0052, 0.0052],
|
|
9
|
-
1000000: [0.0768, 0.0306, 0.0239],
|
|
10
|
-
10000000: [0.2195, 0.2122, 0.2083],
|
|
11
|
-
50000000: [1.8936, 1.5664, 1.2548]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
# Calculate statistics
|
|
15
|
-
print("=" * 80)
|
|
16
|
-
print(f"{'Observations':<15} {'Mean (s)':<12} {'Std (s)':<12} {'Min (s)':<12} {'Max (s)':<12} {'Throughput (M obs/s)':<20}")
|
|
17
|
-
print("=" * 80)
|
|
18
|
-
|
|
19
|
-
for obs_count in sorted(data.keys()):
|
|
20
|
-
times = np.array(data[obs_count])
|
|
21
|
-
mean_time = np.mean(times)
|
|
22
|
-
std_time = np.std(times)
|
|
23
|
-
min_time = np.min(times)
|
|
24
|
-
max_time = np.max(times)
|
|
25
|
-
throughput = obs_count / (mean_time * 1_000_000) # Million observations per second
|
|
26
|
-
|
|
27
|
-
print(f"{obs_count:<15,} {mean_time:<12.4f} {std_time:<12.4f} {min_time:<12.4f} {max_time:<12.4f} {throughput:<20.2f}")
|
|
28
|
-
|
|
29
|
-
print("=" * 80)
|
|
30
|
-
print("\nNote: First run typically includes JIT compilation overhead (especially for 10k observations)")
|
|
1
|
+
"""Analyze runtime statistics for directionality_to_nonstatic_target"""
|
|
2
|
+
import numpy as np
|
|
3
|
+
from collections import defaultdict
|
|
4
|
+
|
|
5
|
+
# Parse the runtime data
|
|
6
|
+
data = {
|
|
7
|
+
10000: [0.4389, 0.0008, 0.0012],
|
|
8
|
+
100000: [0.0063, 0.0052, 0.0052],
|
|
9
|
+
1000000: [0.0768, 0.0306, 0.0239],
|
|
10
|
+
10000000: [0.2195, 0.2122, 0.2083],
|
|
11
|
+
50000000: [1.8936, 1.5664, 1.2548]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# Calculate statistics
|
|
15
|
+
print("=" * 80)
|
|
16
|
+
print(f"{'Observations':<15} {'Mean (s)':<12} {'Std (s)':<12} {'Min (s)':<12} {'Max (s)':<12} {'Throughput (M obs/s)':<20}")
|
|
17
|
+
print("=" * 80)
|
|
18
|
+
|
|
19
|
+
for obs_count in sorted(data.keys()):
|
|
20
|
+
times = np.array(data[obs_count])
|
|
21
|
+
mean_time = np.mean(times)
|
|
22
|
+
std_time = np.std(times)
|
|
23
|
+
min_time = np.min(times)
|
|
24
|
+
max_time = np.max(times)
|
|
25
|
+
throughput = obs_count / (mean_time * 1_000_000) # Million observations per second
|
|
26
|
+
|
|
27
|
+
print(f"{obs_count:<15,} {mean_time:<12.4f} {std_time:<12.4f} {min_time:<12.4f} {max_time:<12.4f} {throughput:<20.2f}")
|
|
28
|
+
|
|
29
|
+
print("=" * 80)
|
|
30
|
+
print("\nNote: First run typically includes JIT compilation overhead (especially for 10k observations)")
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"""Test directionality_to_nonstatic_target function"""
|
|
2
|
-
import sys
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
print(f"Python: {sys.executable}")
|
|
6
|
-
print("="*60)
|
|
7
|
-
|
|
8
|
-
try:
|
|
9
|
-
from simba.data_processors.cuda.geometry import directionality_to_nonstatic_target
|
|
10
|
-
print("✓ Function imported successfully")
|
|
11
|
-
except Exception as e:
|
|
12
|
-
print(f"✗ Error importing function: {e}")
|
|
13
|
-
import traceback
|
|
14
|
-
traceback.print_exc()
|
|
15
|
-
sys.exit(1)
|
|
16
|
-
|
|
17
|
-
# Create test data
|
|
18
|
-
print("\nCreating test data...")
|
|
19
|
-
left_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
20
|
-
right_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
21
|
-
nose = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
22
|
-
target = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
23
|
-
|
|
24
|
-
print(f"left_ear shape: {left_ear.shape}, dtype: {left_ear.dtype}")
|
|
25
|
-
print(f"right_ear shape: {right_ear.shape}, dtype: {right_ear.dtype}")
|
|
26
|
-
print(f"nose shape: {nose.shape}, dtype: {nose.dtype}")
|
|
27
|
-
print(f"target shape: {target.shape}, dtype: {target.dtype}")
|
|
28
|
-
|
|
29
|
-
# Test the function
|
|
30
|
-
print("\nTesting directionality_to_nonstatic_target...")
|
|
31
|
-
try:
|
|
32
|
-
result = directionality_to_nonstatic_target(
|
|
33
|
-
left_ear=left_ear,
|
|
34
|
-
right_ear=right_ear,
|
|
35
|
-
nose=nose,
|
|
36
|
-
target=target
|
|
37
|
-
)
|
|
38
|
-
print(f"✓ SUCCESS! Result shape: {result.shape}")
|
|
39
|
-
print(f"Result: {result}")
|
|
40
|
-
except Exception as e:
|
|
41
|
-
print(f"✗ Error running function: {e}")
|
|
42
|
-
import traceback
|
|
43
|
-
traceback.print_exc()
|
|
44
|
-
sys.exit(1)
|
|
45
|
-
|
|
46
|
-
print("\n" + "="*60)
|
|
47
|
-
print("Test passed!")
|
|
1
|
+
"""Test directionality_to_nonstatic_target function"""
|
|
2
|
+
import sys
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
print(f"Python: {sys.executable}")
|
|
6
|
+
print("="*60)
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
from simba.data_processors.cuda.geometry import directionality_to_nonstatic_target
|
|
10
|
+
print("✓ Function imported successfully")
|
|
11
|
+
except Exception as e:
|
|
12
|
+
print(f"✗ Error importing function: {e}")
|
|
13
|
+
import traceback
|
|
14
|
+
traceback.print_exc()
|
|
15
|
+
sys.exit(1)
|
|
16
|
+
|
|
17
|
+
# Create test data
|
|
18
|
+
print("\nCreating test data...")
|
|
19
|
+
left_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
20
|
+
right_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
21
|
+
nose = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
22
|
+
target = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
23
|
+
|
|
24
|
+
print(f"left_ear shape: {left_ear.shape}, dtype: {left_ear.dtype}")
|
|
25
|
+
print(f"right_ear shape: {right_ear.shape}, dtype: {right_ear.dtype}")
|
|
26
|
+
print(f"nose shape: {nose.shape}, dtype: {nose.dtype}")
|
|
27
|
+
print(f"target shape: {target.shape}, dtype: {target.dtype}")
|
|
28
|
+
|
|
29
|
+
# Test the function
|
|
30
|
+
print("\nTesting directionality_to_nonstatic_target...")
|
|
31
|
+
try:
|
|
32
|
+
result = directionality_to_nonstatic_target(
|
|
33
|
+
left_ear=left_ear,
|
|
34
|
+
right_ear=right_ear,
|
|
35
|
+
nose=nose,
|
|
36
|
+
target=target
|
|
37
|
+
)
|
|
38
|
+
print(f"✓ SUCCESS! Result shape: {result.shape}")
|
|
39
|
+
print(f"Result: {result}")
|
|
40
|
+
except Exception as e:
|
|
41
|
+
print(f"✗ Error running function: {e}")
|
|
42
|
+
import traceback
|
|
43
|
+
traceback.print_exc()
|
|
44
|
+
sys.exit(1)
|
|
45
|
+
|
|
46
|
+
print("\n" + "="*60)
|
|
47
|
+
print("Test passed!")
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"""Test directionality_to_nonstatic_target with int64"""
|
|
2
|
-
import numpy as np
|
|
3
|
-
from simba.data_processors.cuda.geometry import directionality_to_nonstatic_target
|
|
4
|
-
|
|
5
|
-
print("Testing directionality_to_nonstatic_target with int64...")
|
|
6
|
-
|
|
7
|
-
left_ear = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
8
|
-
right_ear = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
9
|
-
nose = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
10
|
-
target = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
11
|
-
|
|
12
|
-
print(f"Arrays shape: {left_ear.shape}, dtype: {left_ear.dtype}")
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
result = directionality_to_nonstatic_target(
|
|
16
|
-
left_ear=left_ear,
|
|
17
|
-
right_ear=right_ear,
|
|
18
|
-
nose=nose,
|
|
19
|
-
target=target,
|
|
20
|
-
verbose=True
|
|
21
|
-
)
|
|
22
|
-
print(f"✓ SUCCESS! Result shape: {result.shape}, dtype: {result.dtype}")
|
|
23
|
-
print(f"First 5 results:\n{result[:5]}")
|
|
24
|
-
except Exception as e:
|
|
25
|
-
print(f"✗ Error: {e}")
|
|
26
|
-
import traceback
|
|
27
|
-
traceback.print_exc()
|
|
1
|
+
"""Test directionality_to_nonstatic_target with int64"""
|
|
2
|
+
import numpy as np
|
|
3
|
+
from simba.data_processors.cuda.geometry import directionality_to_nonstatic_target
|
|
4
|
+
|
|
5
|
+
print("Testing directionality_to_nonstatic_target with int64...")
|
|
6
|
+
|
|
7
|
+
left_ear = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
8
|
+
right_ear = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
9
|
+
nose = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
10
|
+
target = np.random.randint(0, 500, (100, 2)).astype(np.int64)
|
|
11
|
+
|
|
12
|
+
print(f"Arrays shape: {left_ear.shape}, dtype: {left_ear.dtype}")
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
result = directionality_to_nonstatic_target(
|
|
16
|
+
left_ear=left_ear,
|
|
17
|
+
right_ear=right_ear,
|
|
18
|
+
nose=nose,
|
|
19
|
+
target=target,
|
|
20
|
+
verbose=True
|
|
21
|
+
)
|
|
22
|
+
print(f"✓ SUCCESS! Result shape: {result.shape}, dtype: {result.dtype}")
|
|
23
|
+
print(f"First 5 results:\n{result[:5]}")
|
|
24
|
+
except Exception as e:
|
|
25
|
+
print(f"✗ Error: {e}")
|
|
26
|
+
import traceback
|
|
27
|
+
traceback.print_exc()
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"""Test script to verify PyCharm CUDA environment setup"""
|
|
2
|
-
import sys
|
|
3
|
-
print(f"Python version: {sys.version}")
|
|
4
|
-
print(f"Python path: {sys.executable}")
|
|
5
|
-
|
|
6
|
-
try:
|
|
7
|
-
from numba import cuda
|
|
8
|
-
print(f"\nNumba CUDA available: {cuda.is_available()}")
|
|
9
|
-
if cuda.is_available():
|
|
10
|
-
print(f"CUDA devices: {len(cuda.gpus)}")
|
|
11
|
-
except Exception as e:
|
|
12
|
-
print(f"\nError importing numba.cuda: {e}")
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
import cupy as cp
|
|
16
|
-
print(f"CuPy version: {cp.__version__}")
|
|
17
|
-
# Test CuPy
|
|
18
|
-
x = cp.array([1, 2, 3, 4, 5])
|
|
19
|
-
print(f"CuPy test array: {x.get()}")
|
|
20
|
-
except Exception as e:
|
|
21
|
-
print(f"Error importing cupy: {e}")
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
import numpy as np
|
|
25
|
-
print(f"NumPy version: {np.__version__}")
|
|
26
|
-
except Exception as e:
|
|
27
|
-
print(f"Error importing numpy: {e}")
|
|
28
|
-
|
|
29
|
-
try:
|
|
30
|
-
import cv2
|
|
31
|
-
print(f"OpenCV version: {cv2.__version__}")
|
|
32
|
-
except Exception as e:
|
|
33
|
-
print(f"Error importing cv2: {e}")
|
|
34
|
-
|
|
35
|
-
# Test SimBA CUDA imports
|
|
36
|
-
try:
|
|
37
|
-
from simba.data_processors.cuda.geometry import is_inside_rectangle
|
|
38
|
-
print("\n✓ Successfully imported simba.data_processors.cuda.geometry")
|
|
39
|
-
|
|
40
|
-
# Quick test
|
|
41
|
-
test_points = np.array([[150, 150], [300, 300], [50, 50]], dtype=np.int32)
|
|
42
|
-
test_rect = np.array([[100, 100], [400, 400]], dtype=np.int32)
|
|
43
|
-
result = is_inside_rectangle(x=test_points, y=test_rect)
|
|
44
|
-
print(f"✓ is_inside_rectangle test passed: {result}")
|
|
45
|
-
except Exception as e:
|
|
46
|
-
print(f"\n✗ Error importing SimBA CUDA functions: {e}")
|
|
47
|
-
import traceback
|
|
48
|
-
traceback.print_exc()
|
|
49
|
-
|
|
50
|
-
print("\n" + "="*50)
|
|
51
|
-
print("Environment check complete!")
|
|
1
|
+
"""Test script to verify PyCharm CUDA environment setup"""
|
|
2
|
+
import sys
|
|
3
|
+
print(f"Python version: {sys.version}")
|
|
4
|
+
print(f"Python path: {sys.executable}")
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
from numba import cuda
|
|
8
|
+
print(f"\nNumba CUDA available: {cuda.is_available()}")
|
|
9
|
+
if cuda.is_available():
|
|
10
|
+
print(f"CUDA devices: {len(cuda.gpus)}")
|
|
11
|
+
except Exception as e:
|
|
12
|
+
print(f"\nError importing numba.cuda: {e}")
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
import cupy as cp
|
|
16
|
+
print(f"CuPy version: {cp.__version__}")
|
|
17
|
+
# Test CuPy
|
|
18
|
+
x = cp.array([1, 2, 3, 4, 5])
|
|
19
|
+
print(f"CuPy test array: {x.get()}")
|
|
20
|
+
except Exception as e:
|
|
21
|
+
print(f"Error importing cupy: {e}")
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
import numpy as np
|
|
25
|
+
print(f"NumPy version: {np.__version__}")
|
|
26
|
+
except Exception as e:
|
|
27
|
+
print(f"Error importing numpy: {e}")
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
import cv2
|
|
31
|
+
print(f"OpenCV version: {cv2.__version__}")
|
|
32
|
+
except Exception as e:
|
|
33
|
+
print(f"Error importing cv2: {e}")
|
|
34
|
+
|
|
35
|
+
# Test SimBA CUDA imports
|
|
36
|
+
try:
|
|
37
|
+
from simba.data_processors.cuda.geometry import is_inside_rectangle
|
|
38
|
+
print("\n✓ Successfully imported simba.data_processors.cuda.geometry")
|
|
39
|
+
|
|
40
|
+
# Quick test
|
|
41
|
+
test_points = np.array([[150, 150], [300, 300], [50, 50]], dtype=np.int32)
|
|
42
|
+
test_rect = np.array([[100, 100], [400, 400]], dtype=np.int32)
|
|
43
|
+
result = is_inside_rectangle(x=test_points, y=test_rect)
|
|
44
|
+
print(f"✓ is_inside_rectangle test passed: {result}")
|
|
45
|
+
except Exception as e:
|
|
46
|
+
print(f"\n✗ Error importing SimBA CUDA functions: {e}")
|
|
47
|
+
import traceback
|
|
48
|
+
traceback.print_exc()
|
|
49
|
+
|
|
50
|
+
print("\n" + "="*50)
|
|
51
|
+
print("Environment check complete!")
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"""Test SimBA installation in conda environment"""
|
|
2
|
-
import sys
|
|
3
|
-
print(f"Python: {sys.executable}")
|
|
4
|
-
|
|
5
|
-
try:
|
|
6
|
-
import simba
|
|
7
|
-
print("✓ SimBA imported successfully!")
|
|
8
|
-
except Exception as e:
|
|
9
|
-
print(f"✗ Error importing SimBA: {e}")
|
|
10
|
-
import traceback
|
|
11
|
-
traceback.print_exc()
|
|
12
|
-
sys.exit(1)
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
from simba.data_processors.cuda.geometry import is_inside_rectangle
|
|
16
|
-
print("✓ CUDA geometry functions imported!")
|
|
17
|
-
except Exception as e:
|
|
18
|
-
print(f"✗ Error importing CUDA functions: {e}")
|
|
19
|
-
import traceback
|
|
20
|
-
traceback.print_exc()
|
|
21
|
-
sys.exit(1)
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
import cupy as cp
|
|
25
|
-
import numpy as np
|
|
26
|
-
print(f"✓ CuPy {cp.__version__} available")
|
|
27
|
-
|
|
28
|
-
# Quick test
|
|
29
|
-
test_points = np.array([[150, 150], [300, 300], [50, 50]], dtype=np.int32)
|
|
30
|
-
test_rect = np.array([[100, 100], [400, 400]], dtype=np.int32)
|
|
31
|
-
result = is_inside_rectangle(x=test_points, y=test_rect)
|
|
32
|
-
print(f"✓ CUDA function test passed: {result}")
|
|
33
|
-
except Exception as e:
|
|
34
|
-
print(f"✗ Error testing CUDA: {e}")
|
|
35
|
-
import traceback
|
|
36
|
-
traceback.print_exc()
|
|
37
|
-
sys.exit(1)
|
|
38
|
-
|
|
39
|
-
print("\n" + "="*50)
|
|
40
|
-
print("All tests passed! SimBA is ready to use.")
|
|
41
|
-
print("="*50)
|
|
1
|
+
"""Test SimBA installation in conda environment"""
|
|
2
|
+
import sys
|
|
3
|
+
print(f"Python: {sys.executable}")
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import simba
|
|
7
|
+
print("✓ SimBA imported successfully!")
|
|
8
|
+
except Exception as e:
|
|
9
|
+
print(f"✗ Error importing SimBA: {e}")
|
|
10
|
+
import traceback
|
|
11
|
+
traceback.print_exc()
|
|
12
|
+
sys.exit(1)
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from simba.data_processors.cuda.geometry import is_inside_rectangle
|
|
16
|
+
print("✓ CUDA geometry functions imported!")
|
|
17
|
+
except Exception as e:
|
|
18
|
+
print(f"✗ Error importing CUDA functions: {e}")
|
|
19
|
+
import traceback
|
|
20
|
+
traceback.print_exc()
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
import cupy as cp
|
|
25
|
+
import numpy as np
|
|
26
|
+
print(f"✓ CuPy {cp.__version__} available")
|
|
27
|
+
|
|
28
|
+
# Quick test
|
|
29
|
+
test_points = np.array([[150, 150], [300, 300], [50, 50]], dtype=np.int32)
|
|
30
|
+
test_rect = np.array([[100, 100], [400, 400]], dtype=np.int32)
|
|
31
|
+
result = is_inside_rectangle(x=test_points, y=test_rect)
|
|
32
|
+
print(f"✓ CUDA function test passed: {result}")
|
|
33
|
+
except Exception as e:
|
|
34
|
+
print(f"✗ Error testing CUDA: {e}")
|
|
35
|
+
import traceback
|
|
36
|
+
traceback.print_exc()
|
|
37
|
+
sys.exit(1)
|
|
38
|
+
|
|
39
|
+
print("\n" + "="*50)
|
|
40
|
+
print("All tests passed! SimBA is ready to use.")
|
|
41
|
+
print("="*50)
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"""Test directionality_to_static_targets function"""
|
|
2
|
-
import numpy as np
|
|
3
|
-
from simba.data_processors.cuda.geometry import directionality_to_static_targets
|
|
4
|
-
|
|
5
|
-
print("Testing directionality_to_static_targets...")
|
|
6
|
-
|
|
7
|
-
left_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
8
|
-
right_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
9
|
-
nose = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
10
|
-
target = np.array([250, 250], dtype=np.int32)
|
|
11
|
-
|
|
12
|
-
print(f"target shape: {target.shape}, dtype: {target.dtype}")
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
result = directionality_to_static_targets(
|
|
16
|
-
left_ear=left_ear,
|
|
17
|
-
right_ear=right_ear,
|
|
18
|
-
nose=nose,
|
|
19
|
-
target=target
|
|
20
|
-
)
|
|
21
|
-
print(f"✓ SUCCESS! Result shape: {result.shape}")
|
|
22
|
-
print(f"Result:\n{result}")
|
|
23
|
-
except Exception as e:
|
|
24
|
-
print(f"✗ Error: {e}")
|
|
25
|
-
import traceback
|
|
26
|
-
traceback.print_exc()
|
|
1
|
+
"""Test directionality_to_static_targets function"""
|
|
2
|
+
import numpy as np
|
|
3
|
+
from simba.data_processors.cuda.geometry import directionality_to_static_targets
|
|
4
|
+
|
|
5
|
+
print("Testing directionality_to_static_targets...")
|
|
6
|
+
|
|
7
|
+
left_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
8
|
+
right_ear = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
9
|
+
nose = np.random.randint(0, 500, (10, 2)).astype(np.int32)
|
|
10
|
+
target = np.array([250, 250], dtype=np.int32)
|
|
11
|
+
|
|
12
|
+
print(f"target shape: {target.shape}, dtype: {target.dtype}")
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
result = directionality_to_static_targets(
|
|
16
|
+
left_ear=left_ear,
|
|
17
|
+
right_ear=right_ear,
|
|
18
|
+
nose=nose,
|
|
19
|
+
target=target
|
|
20
|
+
)
|
|
21
|
+
print(f"✓ SUCCESS! Result shape: {result.shape}")
|
|
22
|
+
print(f"Result:\n{result}")
|
|
23
|
+
except Exception as e:
|
|
24
|
+
print(f"✗ Error: {e}")
|
|
25
|
+
import traceback
|
|
26
|
+
traceback.print_exc()
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"""Test directionality_to_static_targets with correct 1D target"""
|
|
2
|
-
import numpy as np
|
|
3
|
-
from simba.data_processors.cuda.geometry import directionality_to_static_targets
|
|
4
|
-
|
|
5
|
-
print("Testing directionality_to_static_targets with 1D target (correct)...")
|
|
6
|
-
|
|
7
|
-
left_ear = np.random.randint(0, 500, (100, 2)).astype(np.int32)
|
|
8
|
-
right_ear = np.random.randint(0, 500, (100, 2)).astype(np.int32)
|
|
9
|
-
nose = np.random.randint(0, 500, (100, 2)).astype(np.int32)
|
|
10
|
-
target = np.array([250, 250], dtype=np.int32) # 1D array for static target
|
|
11
|
-
|
|
12
|
-
print(f"target shape: {target.shape}, dtype: {target.dtype}")
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
result = directionality_to_static_targets(
|
|
16
|
-
left_ear=left_ear,
|
|
17
|
-
right_ear=right_ear,
|
|
18
|
-
nose=nose,
|
|
19
|
-
target=target
|
|
20
|
-
)
|
|
21
|
-
print(f"✓ SUCCESS! Result shape: {result.shape}")
|
|
22
|
-
print(f"First 5 results:\n{result[:5]}")
|
|
23
|
-
except Exception as e:
|
|
24
|
-
print(f"✗ Error: {e}")
|
|
25
|
-
import traceback
|
|
26
|
-
traceback.print_exc()
|
|
1
|
+
"""Test directionality_to_static_targets with correct 1D target"""
|
|
2
|
+
import numpy as np
|
|
3
|
+
from simba.data_processors.cuda.geometry import directionality_to_static_targets
|
|
4
|
+
|
|
5
|
+
print("Testing directionality_to_static_targets with 1D target (correct)...")
|
|
6
|
+
|
|
7
|
+
left_ear = np.random.randint(0, 500, (100, 2)).astype(np.int32)
|
|
8
|
+
right_ear = np.random.randint(0, 500, (100, 2)).astype(np.int32)
|
|
9
|
+
nose = np.random.randint(0, 500, (100, 2)).astype(np.int32)
|
|
10
|
+
target = np.array([250, 250], dtype=np.int32) # 1D array for static target
|
|
11
|
+
|
|
12
|
+
print(f"target shape: {target.shape}, dtype: {target.dtype}")
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
result = directionality_to_static_targets(
|
|
16
|
+
left_ear=left_ear,
|
|
17
|
+
right_ear=right_ear,
|
|
18
|
+
nose=nose,
|
|
19
|
+
target=target
|
|
20
|
+
)
|
|
21
|
+
print(f"✓ SUCCESS! Result shape: {result.shape}")
|
|
22
|
+
print(f"First 5 results:\n{result[:5]}")
|
|
23
|
+
except Exception as e:
|
|
24
|
+
print(f"✗ Error: {e}")
|
|
25
|
+
import traceback
|
|
26
|
+
traceback.print_exc()
|