Skip to content

Commit

Permalink
Use a poisson number here
Browse files Browse the repository at this point in the history
  • Loading branch information
jzuhone committed Jun 22, 2017
1 parent c7e1a12 commit 9ffc374
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions soxs/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def detect_events(self, events, exp_time, flux, refband, prng=None):
earea = self.interpolate_area(energy).value
idxs = np.logical_and(energy >= refband[0], energy <= refband[1])
rate = flux/(energy[idxs].sum()*erg_per_keV)*earea[idxs].sum()
n_ph = np.modf(rate*exp_time)
n_ph = np.int64(n_ph[1]) + np.int64(n_ph[0] >= prng.uniform())
n_ph = prng.poisson(lam=rate*exp_time)
fak = float(n_ph)/energy.size
if fak > 1.0:
mylog.error("Number of events in sample: %d, Number of events wanted: %d" % (energy.size, n_ph))
Expand Down

0 comments on commit 9ffc374

Please sign in to comment.