From 297174c7f4018227ad60cc728bfde3d440cd4222 Mon Sep 17 00:00:00 2001 From: Eric Denovellis Date: Tue, 1 May 2018 12:09:14 -0400 Subject: [PATCH] Handle nan in position --- replay_identification/multiunit_likelihood.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/replay_identification/multiunit_likelihood.py b/replay_identification/multiunit_likelihood.py index 9c70cad..156a73f 100644 --- a/replay_identification/multiunit_likelihood.py +++ b/replay_identification/multiunit_likelihood.py @@ -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)