@@ -79,6 +79,8 @@ def setUp(self):
7979 self .task = CatalogMatchTask (config = config )
8080 self .task .config .extraColumns .append ("sourceId" )
8181
82+ self .rng = np .random .default_rng (12345 )
83+
8284 self .skymap = self ._make_skymap ()
8385 self .tract = 9813
8486
@@ -89,11 +91,11 @@ def setUp(self):
8991 self .nStars = 1000
9092 starIds = np .arange (self .nStars )
9193 starRas = (
92- np . random .random (self .nStars ) * self .tractBbox .getWidth ().asDegrees ()
94+ self . rng .random (self .nStars ) * self .tractBbox .getWidth ().asDegrees ()
9395 + self .tractBbox .getLon ().getA ().asDegrees ()
9496 )
9597 starDecs = (
96- np . random .random (self .nStars ) * self .tractBbox .getHeight ().asDegrees ()
98+ self . rng .random (self .nStars ) * self .tractBbox .getHeight ().asDegrees ()
9799 + self .tractBbox .getLat ().getA ().asDegrees ()
98100 )
99101
@@ -181,13 +183,13 @@ def _make_objectCat(self, starIds, starRas, starDecs):
181183 sourceCat : `pd.DataFrame`
182184 Catalog containing the simulated stars
183185 """
184- x = np . random .random (self .nStars ) * 4000
185- y = np . random .random (self .nStars ) * 4000
186+ x = self . rng .random (self .nStars ) * 4000
187+ y = self . rng .random (self .nStars ) * 4000
186188 radecErr = 1.0 / (3600 * 10 ) # Let random scatter be about 1/10 arcsecond
187189 sourceDict = {
188190 "sourceId" : starIds ,
189- "coord_ra" : starRas + np . random . randn (self .nStars ) * radecErr ,
190- "coord_dec" : starDecs + np . random . randn (self .nStars ) * radecErr ,
191+ "coord_ra" : starRas + self . rng . standard_normal (self .nStars ) * radecErr ,
192+ "coord_dec" : starDecs + self . rng . standard_normal (self .nStars ) * radecErr ,
191193 "x" : x ,
192194 "y" : y ,
193195 }
0 commit comments