free_water

Classes

Free_Water([stage_block, current_trial, …])

Randomly light up one of the ports, then dispense water when the subject pokes there

class Free_Water(stage_block=None, current_trial=0, reward=50, allow_repeat=False, **kwargs)[source]

Bases: autopilot.tasks.task.Task

Randomly light up one of the ports, then dispense water when the subject pokes there

Two stages:

  • waiting for response, and

  • reporting the response afterwards

Attributes

DATA

dict() -> new empty dictionary

HARDWARE

dict() -> new empty dictionary

PARAMS

Dictionary that remembers insertion order

PLOT

dict() -> new empty dictionary

STAGE_NAMES

Built-in mutable sequence.

Classes

TrialData()

Methods

end()

When shutting down, release all hardware objects and turn LEDs off.

response()

Just have to alert the Terminal that the current trial has ended and turn off any lights.

water(*args, **kwargs)

First stage of task - open a port if it’s poked.

Variables
  • target ('L', 'C', 'R') – The correct port

  • trial_counter (itertools.count) – Counts trials starting from current_trial specified as argument

  • triggers (dict) – Dictionary mapping triggered pins to callable methods.

  • num_stages (int) – number of stages in task (2)

  • stages (itertools.cycle) – iterator to cycle indefinitely through task stages.

Parameters
  • stage_block (threading.Event) – used to signal to the carrying Pilot that the current trial stage is over

  • current_trial (int) – If not zero, initial number of trial_counter

  • reward (int) – ms to open solenoids

  • allow_repeat (bool) – Whether the correct port is allowed to repeat between trials

  • **kwargs

STAGE_NAMES = ['water', 'response']
PARAMS = {'allow_repeat': {'tag': 'Allow Repeated Ports?', 'type': 'bool'}, 'reward': {'tag': 'Reward Duration (ms)', 'type': 'int'}}
DATA = {'target': {'plot': 'target', 'type': 'S1'}, 'timestamp': {'type': 'S26'}, 'trial_num': {'type': 'i32'}}
class TrialData

Bases: tables.description.IsDescription

columns = {'target': StringCol(itemsize=1, shape=(), dflt=b'', pos=None), 'timestamp': StringCol(itemsize=26, shape=(), dflt=b'', pos=None), 'trial_num': Int32Col(shape=(), dflt=0, pos=None)}
HARDWARE = {'LEDS': {'C': <class 'autopilot.hardware.gpio.LED_RGB'>, 'L': <class 'autopilot.hardware.gpio.LED_RGB'>, 'R': <class 'autopilot.hardware.gpio.LED_RGB'>}, 'POKES': {'C': <class 'autopilot.hardware.gpio.Digital_In'>, 'L': <class 'autopilot.hardware.gpio.Digital_In'>, 'R': <class 'autopilot.hardware.gpio.Digital_In'>}, 'PORTS': {'C': <class 'autopilot.hardware.gpio.Solenoid'>, 'L': <class 'autopilot.hardware.gpio.Solenoid'>, 'R': <class 'autopilot.hardware.gpio.Solenoid'>}}
PLOT = {'data': {'target': 'point'}}
water(*args, **kwargs)[source]

First stage of task - open a port if it’s poked.

Returns

Data dictionary containing:

'target': ('L', 'C', 'R') - correct response
'timestamp': isoformatted timestamp
'trial_num': number of current trial

Return type

dict

response()[source]

Just have to alert the Terminal that the current trial has ended and turn off any lights.

end()[source]

When shutting down, release all hardware objects and turn LEDs off.