Skip to content

Commit 0b88c8a

Browse files
Flakify
1 parent a7cf50e commit 0b88c8a

File tree

3 files changed

+47
-42
lines changed

3 files changed

+47
-42
lines changed

src/kbmod/mocking/catalogs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ def static(self, **kwargs):
156156
return self.table.copy()
157157

158158
def next(self, dt, **kwargs):
159-
self._realization["x_mean"] = self.table["x_mean"] + self.current*self._realization["vx"] * dt
160-
self._realization["y_mean"] = self.table["y_mean"] + self.current*self._realization["vy"] * dt
159+
self._realization["x_mean"] = self.table["x_mean"] + self.current * self._realization["vx"] * dt
160+
self._realization["y_mean"] = self.table["y_mean"] + self.current * self._realization["vy"] * dt
161161
self.current += 1
162162
return self._realization.copy()
163163

src/kbmod/mocking/fits_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def mock(self, n=1, obj_cats=None, **kwargs):
537537
# zip will attempt to iterate over the next available dimension, and
538538
# that's rows of the image and the table - we don't want that.
539539
if obj_cats is not None:
540-
pairs = ([(images[0], obj_cats[0])] if n == 1 else zip(images, obj_cats))
540+
pairs = [(images[0], obj_cats[0])] if n == 1 else zip(images, obj_cats)
541541
for i, (img, cat) in enumerate(pairs):
542542
add_model_objects(img, cat, self.config.model(x_stddev=1, y_stddev=1))
543543

tests/test_end_to_end.py

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
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
66
#
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
1212

1313
from utils.utils_for_tests import get_absolute_demo_data_path
1414

@@ -32,15 +32,17 @@ def test_empty(self):
3232
# create the most permissive search configs you can come up with
3333
# all values in these images are zeros, we should not be returning
3434
# 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+
)
4446

4547
ic = ImageCollection.fromTargets(hduls, force="TestDataStd")
4648
wu = ic.toWorkUnit(search_config=config)
@@ -80,21 +82,23 @@ def setUp(self):
8082
"vy": self.vys,
8183
}
8284

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+
)
98102

99103
def test_search(self):
100104
# Mock the data and repeat tests. The random catalog
@@ -114,10 +118,11 @@ def test_search(self):
114118
for res in results:
115119
diff = abs(obj_cat.table["y_mean"] - res["y"])
116120
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+
121126

122127
####
123128

@@ -129,7 +134,7 @@ def test_search(self):
129134
# (instead of RawImages), but hopefully we can deduplicate all this by making
130135
# these operations into functions and calling on the .image attribute
131136
# 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):
133138
# def setUp(self):
134139
# # Define the path for the data.
135140
# im_filepath = get_absolute_demo_data_path("demo")

0 commit comments

Comments
 (0)