allensdk.brain_observatory.behavior.trials_processing module¶
-
allensdk.brain_observatory.behavior.trials_processing.
calculate_reward_rate
(response_latency=None, starttime=None, window=0.75, trial_window=25, initial_trials=10)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
create_extended_trials
(trials=None, metadata=None, time=None, licks=None)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
find_licks
(reward_times, licks, window=3.5)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
get_change_time_frame_response_latency
(trial)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
get_even_sampling
(data)[source]¶ Get status of even_sampling
Parameters: - data: Mapping
foraging2 experiment output data
Returns: - bool:
True if even_sampling is enabled
-
allensdk.brain_observatory.behavior.trials_processing.
get_image_info_from_trial
(trial_log, ti)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
get_ori_info_from_trial
(trial_log, ti)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
get_response_latency
(change_event, trial)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
get_stimulus_attr_changes
(stim_dict, change_frame, first_frame, last_frame)[source]¶ Notes
- assumes only two stimuli are ever shown
- converts attr_names to lowercase
- gets the net attr changes from the start of a trial to the end of a trial
-
allensdk.brain_observatory.behavior.trials_processing.
get_trial_image_names
(trial, stimuli)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
get_trial_lick_times
(lick_times, start_time, stop_time)[source]¶ extract lick times in time range
-
allensdk.brain_observatory.behavior.trials_processing.
get_trial_reward_time
(rebased_reward_times, start_time, stop_time)[source]¶ extract reward times in time range
-
allensdk.brain_observatory.behavior.trials_processing.
get_trial_timing
(event_dict, stimulus_presentations_df, licks, go, catch, auto_rewarded, hit, false_alarm)[source]¶ extract trial timing data
content of trial log depends on trial type depends on trial type and response type go, catch, auto_rewarded, hit, false_alarm must be passed as booleans to disambiguate trial and response type
on go or auto_rewarded trials, extract the stimulus_changed time on catch trials, extract the sham_change time
on hit trials, extract the response time from the hit entry in event_dict on false_alarm trials, extract the response time from the false_alarm entry in event_dict
-
allensdk.brain_observatory.behavior.trials_processing.
get_trials
(data, licks_df, rewards_df, stimulus_presentations_df, rebase)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
local_time
(iso_timestamp, timezone=None)[source]¶
-
allensdk.brain_observatory.behavior.trials_processing.
resolve_initial_image
(stimuli, start_frame)[source]¶ Attempts to resolve the initial image for a given start_frame for a trial
Parameters: - stimuli: Mapping
foraging2 shape stimuli mapping
- start_frame: int
start frame of the trial
Returns: - initial_image_category_name: str
stimulus category of initial image
- initial_image_group: str
group name of the initial image
- initial_image_name: str
name of the initial image
-
allensdk.brain_observatory.behavior.trials_processing.
trial_data_from_log
(trial)[source]¶ Infer trial logic from trial log. Returns a dictionary.
- reward volume: volume of water delivered on the trial, in mL
Each of the following values is boolean:
Trial category values are mutually exclusive * go: trial was a go trial (trial with a stimulus change) * catch: trial was a catch trial (trial with a sham stimulus change)
stimulus_change/sham_change are mutually exclusive * stimulus_change: did the stimulus change (True on ‘go’ trials) * sham_change: stimulus did not change, but response was evaluated (True on ‘catch’ trials)
Each trial can be one (and only one) of the following: * hit (stimulus changed, animal responded in response window) * miss (stimulus changed, animal did not respond in response window) * false_alarm (stimulus did not change, animal responded in response window) * correct_reject (stimulus did not change, animal did not respond in response window) * aborted (animal responded before change time) * auto_rewarded (reward was automatically delivered following the change. This will bias the animals choice and should not be categorized as hit/miss)