adds bunch of NaN's and occasionally some trials_id. It is because inside the method it is looking for 'change_time' of trials that are within 1 s apart from stimulus 'start_time'. If the purpose is to curate go trials only, the name of the method does not clearly state it.
Given its usage in add_trials_data_to_stimulus_presentations_table, again used in get_annotated_stimulus_presentations, it does not seem to perform as it is supposed to. For example, add_trials_data_to_stimulus_presentations_table does not log any 'aborted' trials.
A better approach is written inside annotate_stimuli.
for idx, row in stimulus_presentations.iterrows():
# trials_id is last trials_id with start_time <= stimulus_time
try:
trials_id = trials.loc[:row['start_time']].iloc[-1]['trials_id']
except IndexError:
trials_id = -1
stimulus_presentations.at[idx, 'trials_id'] = trials_id
/visual_behavior_ophys/data_formatting.py def
add_trials_id_to_stimulus_presentations
(stimulus_presentations, trials):adds bunch of NaN's and occasionally some trials_id. It is because inside the method it is looking for 'change_time' of trials that are within 1 s apart from stimulus 'start_time'. If the purpose is to curate go trials only, the name of the method does not clearly state it.
Given its usage in
add_trials_data_to_stimulus_presentations_table
, again used inget_annotated_stimulus_presentations
, it does not seem to perform as it is supposed to. For example,add_trials_data_to_stimulus_presentations_table
does not log any 'aborted' trials.A better approach is written inside
annotate_stimuli
.