Skip to content

Commit

Permalink
fix lower poisson rate artifact at beginning of interval
Browse files Browse the repository at this point in the history
  • Loading branch information
samnemo committed Nov 26, 2019
1 parent cdeaaa7 commit 90d992a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ def __create_extpois (self):
# values MUST be sorted for VecStim()!
# start the initial value
if lamtha > 0.:
t_gen = t0 + self.__t_wait(lamtha)
val_pois = np.array([])
if t_gen < T: np.append(val_pois, t_gen)
# vals are guaranteed to be monotonically increasing, no need to sort
val_pois = np.array([])
t_gen = t0 - lamtha * 2 # start before t0 to remove artifact of lower event rate at start of period
while t_gen < T:
# so as to not clobber confusingly base off of t_gen ...
t_gen += self.__t_wait(lamtha)
if t_gen < T: val_pois = np.append(val_pois, t_gen)
t_gen += self.__t_wait(lamtha) # move forward by the wait time (so as to not clobber base off of t_gen)
if t_gen >= t0 and t_gen < T: # make sure event time is within the specified interval
# vals are guaranteed to be monotonically increasing, no need to sort
val_pois = np.append(val_pois, t_gen)
else:
val_pois = np.array([])
# checks the distribution stats
Expand Down

0 comments on commit 90d992a

Please sign in to comment.