pyoperant.behavior.two_alt_choice module

class pyoperant.behavior.two_alt_choice.TwoAltChoiceExp(*args, **kwargs)[source]

Bases: pyoperant.behavior.base.BaseExp

A two alternative choice experiment

req_panel_attr

list

list of the panel attributes that are required for this behavior

fields_to_save

list

list of the fields of the Trial object that will be saved

trials

list

all of the trials that have run

shaper

Shaper

the protocol for shaping

parameters

dict

all additional parameters for the experiment

data_csv

string

path to csv file to save data

reinf_sched

object

does logic on reinforcement

analyze_trial()[source]
check_session_schedule()[source]

Check the session schedule

Returns:True if sessions should be running
Return type:bool
consequence_main()[source]
consequence_post()[source]
consequence_pre()[source]
get_stimuli(**conditions)[source]

Get the trial’s stimuli from the conditions

Returns:stim, epochs
Return type:Event, list
make_data_csv()[source]

Create the csv file to save trial data

This creates a new csv file at experiment.data_csv and writes a header row with the fields in experiment.fields_to_save

new_trial(conditions=None)[source]

Creates a new trial and appends it to the trial list

If self.do_correction is True, then the conditions are ignored and a new trial is created which copies the conditions of the last trial.

Parameters:conditions (dict) – The conditions dict must have a ‘class’ key, which specifys the trial class. The entire dict is passed to exp.get_stimuli() as keyword arguments and saved to the trial annotations.
punish_main()[source]
punish_post()[source]
punish_pre()[source]
response_main()[source]
response_post()[source]
response_pre()[source]
reward_main()[source]
reward_post()[source]
reward_pre()[source]
run_trial()[source]
save_trial(trial)[source]

write trial results to CSV

secondary_reinforcement(value=1.0)[source]
session_main()[source]

Runs the sessions

Inside of session_main, we loop through sessions and through the trials within them. This relies heavily on the ‘block_design’ parameter, which controls trial conditions and the selection of queues to generate trial conditions.

session_post()[source]

Closes out the sessions

session_pre()[source]

Runs before the session starts

For each stimulus class, if there is a component associated with it, that component is mapped onto experiment.class_assoc[class]. For example, if the left port is registered with the ‘L’ class, you can access the response port through experiment.class_assoc[‘L’].

stimulus_main()[source]
stimulus_post()[source]
stimulus_pre()[source]
trial_post()[source]

things to do at the end of a trial

trial_pre()[source]

this is where we initialize a trial

update_adaptive_queue(presented=True)[source]