Skip to content

Commit

Permalink
Handle nan in position
Browse files Browse the repository at this point in the history
  • Loading branch information
edeno committed May 1, 2018
1 parent 1f433ae commit 297174c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions replay_identification/multiunit_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ def multiunit_likelihood_ratio(multiunit, position, place_bin_centers,
joint_mark_intensity_functions, ground_process_intensity,
time_bin_size)
bin_ind = np.digitize(position, place_bins)
is_nan = np.isnan(np.squeeze(position))
bin_ind[is_nan] = 0
no_replay_log_likelihood = replay_log_likelihood[
(np.arange(n_time), bin_ind - 1)][:, np.newaxis]
no_replay_log_likelihood[is_nan] = np.nan

return np.exp(replay_log_likelihood - no_replay_log_likelihood)

Expand Down

0 comments on commit 297174c

Please sign in to comment.