-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
This class is the starting point of an experiment. Its most important methods are start() and stop() for starting and stopping of an experimental session.
The constructor is:
ExperimentController(config)
config is a struct with the following fields:
-
audioPlayer- an instance ofAudioPlayer -
audioObjectGenerator- an instance ofAudioObjectGenerator -
ioDevice- an instance ofInputOutputDevice -
pins- a struct with the fields:-
sensor, which contains a number identifying a channel at which theInputOutputDevicereceives inputs. -
feeder, which contains a number identifying a channel of theInputOutputDeviceto which a give-reward-signal can be sent.
-
An important property of ExperimentController is maxReactionTime. maxReactionTime defines the length of the time window during which responses of the subject will be taken into account. The time window starts with the onset of the last played Stimulus (this point in time is stored within the property lastAOTime of AudioPlayer). A response that was made within maxReactionTime will be classified as hit or false alarm, depending on the trial involved being a target or a non-target (sham or catch) trial. Responses that happen outside the time window are ignored.
AudioObjectGenerator is just very basic iterator interface. The method next() provides the next AudioObject to be played by the AudioPlayer. The kind of AudioObject determines what will be played.
This is the base class for something that can be played by an AudioPlayer. The properties are:
-
id- an arbitrary string identifying a single instance -
startDelay- This is the random waiting interval that the subject has to wait before theAudioObjectactually will be played. -
duration- how long theAudioObjectlasts. This property is used so that theExperimentControllerdoes not start a newAudioObjectwhile an old one is still playing.
The method getEvent() returns a ExperimentEventData object that characterizes the AudioObject. It is similar function as the toString() method in Java.
AudioObjects whereupon the subject's reaction is critical, inherit from Stimulus. Therefore, Stimulus has the additional property target. target must be of the enumeration type Target, which defines the constants:
-
Yes_Reward- it is a target and a response should be rewarded -
Yes_NoRewardit is a target, but a response should not be rewarded -
Noit is not a target, a response will not be rewarded
Subclasses of Stimulus define further properties that are used by the AudioPlayer to create the sound corresponding to the Stimulus. E. g. the class ToneStimulus defines the properties frequency and level.
Attention: Although catch trials typically do not require the AudioPlayer to create sound samples for them, they are still sent to the AudioPlayer. And because responses are critical for catch trials, catch trials must inherit from Stimulus and the property target must be set to Target.No. You can use NullStimulus as an implementation for catch trials. Often the only thing an AudioPlayer does after receiving a catch trial is to actualize lastAOTime.
This class makes the sound. It plays AudioObjects and potentially other things e. g. background noise (like ContinuousBgndAudioPlayer does) for distraction or masking.
The methods it must implement are:
-
start()- to start the sound -
stop()- to stop the sound -
playAudioObject()- to play anAudioObject
It also must actualize the property lastAOTime which contains the system time point, when the last AudioObject was played. This time must correspond as exact as possible to the time when the AudioObject actually was emitted by the loudspeakers or headphones.
This class represents the software interface of a physical or a software-emulated I/O device. Its interface is best adapted to the Arduino (the actual implementation of InputOutputDevice to be used with an Arduino is ArduinoDevice). It has two methods:
-
send(pin, value)- use this function to send a value to the specified pin of the I/O device.ExperimentControlleruses this function to send a trigger pulse to the pin specified inExperimentController.pins.feederfor releasing rewards. -
signalEvent(pin, value)- this function should be called, when the I/O device registered subject inputs (e. g. subject signals ready state or subject responds). Each call to this function will trigger aDataReceivedevent with anInputDeviceDatadata object that contains the pin involved and the new value.ExperimentControllerlistens to these events. At the moment, it only reacts upon events that involve the pin specified inExperimentController.pins.sensor. A value of 1 at this pins signals that the subject is ready. A change to 0 signals a response.