Conversation
We get the time at which the stimulus presentation changes from `stimulus_presentations`. But if no rows are returned from the table when we join on change frame, the list of rows are empty, so indexing is impossible, and we were getting an indexing error. Now if no rows are returned we just return NaN.
corbennett
left a comment
There was a problem hiding this comment.
This code looks fine. What sessions are failing in this way? I'm a bit surprised there are cases where there aren't matches in the stim table for the change frame in the trials table. In any case, we can close this. I'll open a new issue if needed.
|
This is starting to get concerning. I changed the function to count how many values there are and all of the rows are zero. I'm gonna hold off on merging this for now. def count_start_times(row):
table = stimulus_presentations
change_frame = row['change_frame']
if np.isnan(change_frame):
return np.nan
start_times_len = len(table[table.start_time == change_frame]['start_time'].values)
return start_times_len
n_start_times = trials.apply(count_start_times, axis=1)
print(f'number of zero entries: {np.count_nonzero(n_start_times == 0)}')
print(f'total entries: {len(n_start_times)}')Am I doing something wrong??? |
There's a small bug in this function that explains this result: start_times_len = len(table[table.start_time == change_frame]['start_time'].values)should be start_times_len = len(table[table.start_frame == change_frame]['start_time'].values) |
|
We'll look into this more in a separate issue. |
We get the time at which the stimulus presentation changes from
stimulus_presentations. But if no rows are returned from the table when we join on change frame, the list of rows are empty, so indexing is impossible, and we were getting an indexing error.Now if no rows are returned we just return NaN.
Fixes #88 .