1
- #import math
2
- #import numpy as np
3
- #import os
4
- #import tempfile
5
- #import pytest
1
+ # import math
2
+ # import numpy as np
3
+ # import os
4
+ # import tempfile
5
+ # import pytest
6
6
#
7
- #from kbmod.fake_data.fake_data_creator import *
8
- #from kbmod.run_search import *
9
- #from kbmod.search import *
10
- #from kbmod.wcs_utils import make_fake_wcs
11
- #from kbmod.work_unit import WorkUnit
7
+ # from kbmod.fake_data.fake_data_creator import *
8
+ # from kbmod.run_search import *
9
+ # from kbmod.search import *
10
+ # from kbmod.wcs_utils import make_fake_wcs
11
+ # from kbmod.work_unit import WorkUnit
12
12
13
13
from utils .utils_for_tests import get_absolute_demo_data_path
14
14
@@ -32,15 +32,17 @@ def test_empty(self):
32
32
# create the most permissive search configs you can come up with
33
33
# all values in these images are zeros, we should not be returning
34
34
# anything
35
- config = SearchConfiguration .from_dict ({
36
- "average_angle" : 0.0 ,
37
- "v_arr" : [10 , 20 , 10 ],
38
- "lh_level" : 0.1 ,
39
- "num_obs" : 1 ,
40
- "do_mask" : False ,
41
- "do_clustering" : True ,
42
- "do_stamp_filter" : False
43
- })
35
+ config = SearchConfiguration .from_dict (
36
+ {
37
+ "average_angle" : 0.0 ,
38
+ "v_arr" : [10 , 20 , 10 ],
39
+ "lh_level" : 0.1 ,
40
+ "num_obs" : 1 ,
41
+ "do_mask" : False ,
42
+ "do_clustering" : True ,
43
+ "do_stamp_filter" : False ,
44
+ }
45
+ )
44
46
45
47
ic = ImageCollection .fromTargets (hduls , force = "TestDataStd" )
46
48
wu = ic .toWorkUnit (search_config = config )
@@ -80,21 +82,23 @@ def setUp(self):
80
82
"vy" : self .vys ,
81
83
}
82
84
83
- self .config = SearchConfiguration .from_dict ({
84
- "generator_config" : {
85
- "name" : "VelocityGridSearch" ,
86
- "min_vx" : self .vxs [0 ],
87
- "max_vx" : self .vxs [1 ],
88
- "min_vy" : self .vys [0 ],
89
- "max_vy" : self .vys [1 ],
90
- "vx_steps" : 50 ,
91
- "vy_steps" : 50 ,
92
- },
93
- "num_obs" : 10 ,
94
- "do_mask" : False ,
95
- "do_clustering" : True ,
96
- "do_stamp_filter" : False
97
- })
85
+ self .config = SearchConfiguration .from_dict (
86
+ {
87
+ "generator_config" : {
88
+ "name" : "VelocityGridSearch" ,
89
+ "min_vx" : self .vxs [0 ],
90
+ "max_vx" : self .vxs [1 ],
91
+ "min_vy" : self .vys [0 ],
92
+ "max_vy" : self .vys [1 ],
93
+ "vx_steps" : 50 ,
94
+ "vy_steps" : 50 ,
95
+ },
96
+ "num_obs" : 10 ,
97
+ "do_mask" : False ,
98
+ "do_clustering" : True ,
99
+ "do_stamp_filter" : False ,
100
+ }
101
+ )
98
102
99
103
def test_search (self ):
100
104
# Mock the data and repeat tests. The random catalog
@@ -114,10 +118,11 @@ def test_search(self):
114
118
for res in results :
115
119
diff = abs (obj_cat .table ["y_mean" ] - res ["y" ])
116
120
obj = obj_cat .table [diff == diff .min ()]
117
- self .assertLessEqual (abs (obj ["x_mean" ]- res ["x" ]), 5 )
118
- self .assertLessEqual (abs (obj ["y_mean" ]- res ["y" ]), 5 )
119
- self .assertLessEqual (abs (obj ["vx" ]- res ["vx" ]), 5 )
120
- self .assertLessEqual (abs (obj ["vy" ]- res ["vy" ]), 5 )
121
+ self .assertLessEqual (abs (obj ["x_mean" ] - res ["x" ]), 5 )
122
+ self .assertLessEqual (abs (obj ["y_mean" ] - res ["y" ]), 5 )
123
+ self .assertLessEqual (abs (obj ["vx" ] - res ["vx" ]), 5 )
124
+ self .assertLessEqual (abs (obj ["vy" ] - res ["vy" ]), 5 )
125
+
121
126
122
127
####
123
128
@@ -129,7 +134,7 @@ def test_search(self):
129
134
# (instead of RawImages), but hopefully we can deduplicate all this by making
130
135
# these operations into functions and calling on the .image attribute
131
136
# apply_stamp_filter for example is literal copy of the C++ code in RawImage?
132
- #class test_end_to_end(pytest.TestCase):
137
+ # class test_end_to_end(pytest.TestCase):
133
138
# def setUp(self):
134
139
# # Define the path for the data.
135
140
# im_filepath = get_absolute_demo_data_path("demo")
0 commit comments