Stages¶
The stages of the experiment.
-
class
vet_cond.stages.
RootStage
(**kwargs)¶ Bases:
cplcom.moa.stages.ConfigStageBase
The root stage of the experiment.
-
animal_id
¶ The animal name acquired form the GUI.
-
ffwriters
= []¶ A list of
FFPyWriterDevice
instances equal to the number of trials, with each instance being a writer for the corresponding trial. They are all created at once at the start of running the subject.
-
frame_ts
= 0¶ The video time at the most recent frame.
-
iti_range
¶ The ITI range from
trial_opts
for this animal.
-
log_name_pat
¶ The pattern that will be used to generate the log filenames for each trial. It is generated as follows:
strftime(log_name_pat.format(**{'animal': animal_id}))
Which basically means that all instances of
{animal}
is replaced by the animal name given in the GUI. Then, it’s is passed to strftime that formats any time parameters to get the log name used for that animal.If the filename matches an existing file, the new data will be appended to that file.
-
mcdaq
¶ The Switch and Sense device,
DAQOutDevice
when using actual hardware, or aDAQOutDeviceSim
whensimulate
the hardware.
-
posthab
¶ The amount of time to wait before finishing for the animal after the end of trials.
-
postrecord
¶ The amount of time after each trial which video should continue to be recorded. It is in addition to any ITI.
-
prehab
¶ The amount of time to wait habituating the animal before the start of trials.
-
prerecord
¶ The amount of time before each trial when video should be started being recorded. It is in addition to any ITI.
-
record_start
()¶ Called at the start of each recording to init the recorders.
-
record_stop
()¶ Called at the end of each recording to stop the recorders.
-
record_video
¶ Whether video should be recorded for this experiment.
-
rtv
¶ The RTV video acquisition device
RTVChan
when using actual hardware, or aFFPyPlayerDevice
whensimulate
the hardware.
-
shock_delay
¶ The shock delay from
trial_opts
for this animal.
-
shock_duration
¶ The shock duration from
trial_opts
for this animal.
-
simulate
¶ Whether the user has chosen to simulate the experiment. When
True
, no actual hardware is required and all the hardware will be emulated by software and virtual devices. E.g. a video player for the video acquisition system.
-
tone_delay
¶ The tone delay from
trial_opts
for this animal.
-
tone_duration
¶ The tone duration from
trial_opts
for this animal.
-
tracker
= None¶ The
ObjectStateTracker
instance used to process the device activation and deactivation during startup and shutdown.
-
trial_duration
¶ The trial duration from
trial_opts
for this animal.
-
trial_opts
¶ A dictionary that describes the available experiments, which will be available from the GUI to choose from.
The keys are name of the experiment types and its values are dictionaries describing the structure of each experiment type.
The structure dictionaries each has the following keys:
- repeat: int
- The number of trials for that experiment.
- shock: 2-tuple of floats
- The first element is the delay from the start of the trial until the shock start. The second element is the duration of the shock after that delay. A duration of zero will disable the shock.
- tone: 2-tuple of floats
- The first element is the delay from the start of the trial until the tone starts. The second element is the duration of the tone after that delay. A duration of zero will disable the tone.
- iti: 2-tuple of floats
- The minimum and maximum duration of the ITI. A value will be chosen uniformly at random from that range.
- duration: float
- The duration of the trial.
-
trial_repeat
¶ The number of trials from
trial_opts
for this animal.
-
trial_stats
¶ Trials stats of the tone, shock, and trial start and end times in video time use for the log.
-
trial_type
¶ The experiment type from
trial_opts
for this animal.
-
update_time
(key)¶ Updates trial stats when an event occurs.
-
video_callback
(*largs)¶ Called for each frame read from the viceo device.
-
video_name_pat
¶ The pattern that will be used to generate the video filenames for each trial. It is generated as follows:
name = strftime(video_name_pat.format(**{'trial': trial_number, 'animal': animal_id}))
Which basically means that all instances of
{trial}
is replaced by the current trial number and{animal}
is replaced by the animal name given in the GUI. Then, it’s is passed to strftime that formats any time parameters to get the name used for that trial/animal.If the filename already exists an error will be raised.
-