Olfactometer

class pphelper.hardware.Olfactometer(ni_lines=u'Dev1/port0/line0:7', ni_trigger_line=None, ni_task_name=u'Olfactometer', use_threads=True)

Bases: pphelper.hardware._StimulationApparatus

Provides an interface to the ValveLink devices used to control olfactometers.

add_stimulus(name, bitmask, duration=1, bitmask_offset=None, trigger_time=None, replace=False, **kwargs)

Add a stimulus to the stimulus set of this apparatus.

Parameters:
  • name (string) – A unique identifier of the stimulus to add.
  • bitmask (array_like) – The bitmask specifying the valve positions required to present this stimulus.
  • duration (float, optional) – The duration of the stimulation, specified in seconds. Defaults to 1 second.
  • bitmask_offset (array_like, optional) – The bitmask specifying the valve positions after the stimulation has finished. If not specified, all valves will be closed at the end of the stimulation.
  • trigger_time (float, optional) – The time (in terms of the psychopy.core.getTime timebase) at which the stimulation should be triggered. If None, trigger immediately. Defaults to None.
  • replace (bool, optional) – Whether an already existing stimulus of the same name should be replaced or not. Defaults to False.

Notes

Any additional keyword arguments will be added as additional stimulus properties.

See also

remove_stimulus(), select_stimulus(), stimulate()

remove_stimulus(name)

Remove the specified stimulus, identified by its unique name, from the stimulus list.

Parameters:name (string) – The unique name of the stimulus to remove.
select_stimulus(name)

Select the specified stimulus for the next stimulation.

Parameters:name (string) – The unique name of the stimulus to select.
stimulate(blocking_wait=False)

Start the stimulation with the currently selected stimulus.

The trigger pulse will open the valves. They are then left open for the intended duration of the stimulus. After that, they will be switched to the offset state specified by the stimulus.

Parameters:blocking_wait (bool, optional) – Specifies whether the stimulation thread should be joined or not, i.e. whether we should wait for it to finish (blocking other operations), or return immediately. This parameter will be ignored if threads are not used for stimulation. Defaults to False, i.e. non-blocking behavior.

See also

add_stimulus(), select_stimulus()

Notes

stimulate invokes _stimulate, which itself unsets the currently selected stimulus at the end of the stimulation. You have to invoke select_stimulus again before you can call stimulate again.

stimuli

A list of all stimuli added to this stimulation apparatus.

See also

add_stimulus, remove_stimulus

stimulus

The currently selected stimulus.

This stimulus will be presented when invoking stimulate. It can be set using select_stimulus.

See also

select_stimulus, stimulate