Commit 4ea6263f authored by teresa.bister's avatar teresa.bister
Browse files

[simulations] fix bug with rmax (wrong rmax to distance bin conversion)

parent 6e11ee2e
Pipeline #406475 failed with stages
...@@ -732,7 +732,7 @@ class SourceBound(BaseSimulation): ...@@ -732,7 +732,7 @@ class SourceBound(BaseSimulation):
dis_idx = np.argmin(np.abs(np.atleast_1d(self.universe.rmax)[None] - self.dis_bins[:, None]), axis=0) dis_idx = np.argmin(np.abs(np.atleast_1d(self.universe.rmax)[None] - self.dis_bins[:, None]), axis=0)
# loop over all occuring distance bins and fill events of the respective sets # loop over all occuring distance bins and fill events of the respective sets
for _dis in np.sort(np.unique(dis_idx)): for _dis in np.sort(np.unique(dis_idx)):
arrival_mat_far[self.dis_bins < _dis] = 0 # set probabilities inside rmax to zero arrival_mat_far[0:_dis] = 0 # set probabilities inside rmax to zero
mask_pick = ~mask_close & (dis_idx == _dis)[:, np.newaxis] # select background events of respective set mask_pick = ~mask_close & (dis_idx == _dis)[:, np.newaxis] # select background events of respective set
n_pick = np.sum(mask_pick) n_pick = np.sum(mask_pick)
arrival_mat_far /= arrival_mat_far.sum() # normalize arrival matrix to then draw random samples arrival_mat_far /= arrival_mat_far.sum() # normalize arrival matrix to then draw random samples
...@@ -1225,7 +1225,8 @@ class SourceScenario: ...@@ -1225,7 +1225,8 @@ class SourceScenario:
vecs = coord.eq2gal(coord.ang2vec(np.deg2rad(data['ra']), np.deg2rad(data['dec']))) vecs = coord.eq2gal(coord.ang2vec(np.deg2rad(data['ra']), np.deg2rad(data['dec'])))
flux = data['flux'] * 100 / np.sum(data['flux']) flux = data['flux'] * 100 / np.sum(data['flux'])
return vecs, flux, data['distance'], data['names'] names = np.array([data['names'][i].decode('UTF-8') for i in range(len(data['names']))]).flatten()
return vecs, flux, data['distance'], names
@staticmethod @staticmethod
def agn_3fhl(): def agn_3fhl():
...@@ -1238,7 +1239,8 @@ class SourceScenario: ...@@ -1238,7 +1239,8 @@ class SourceScenario:
vecs = coord.eq2gal(coord.ang2vec(np.deg2rad(data['ra']), np.deg2rad(data['dec']))) vecs = coord.eq2gal(coord.ang2vec(np.deg2rad(data['ra']), np.deg2rad(data['dec'])))
flux = data['flux'] * 100 / np.sum(data['flux']) flux = data['flux'] * 100 / np.sum(data['flux'])
return vecs, flux, data['distance'], data['names'] names = np.array([data['names'][i].decode('UTF-8') for i in range(len(data['names']))]).flatten()
return vecs, flux, data['distance'], names
@staticmethod @staticmethod
def gamma_agn(): def gamma_agn():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment