Experimental protocols#

yaml format. For experiment-specific settings.

Minimal example with camera and NI-daq:

maxduration: 90 # seconds
use_services: [GCM, DAQ]

GCM:  # Minimal example
  cam_type: Spinnaker  # for FLIR cameras, or: Basler, Ximea, Hamamatsu
  cam_serialnumber: 30959651
  frame_rate: 100.0  # frames per second
  frame_width: 640  # pixels
  frame_height: 200  # pixels
  frame_offx: 78  # pixels
  frame_offy: 10  # pixels
  shutter_speed: 5_000 # us=5ms
  callbacks:
    save_avi:  # save frames as avi using opencv VideoWriter
    save_timestamps:  # save timestamp for each frame to h5 file

DAQ:  # Minimal example
  samplingrate: 10000 # Hz
  shuffle: True # block-randomize order of stimuli for playback
  analog_chans_in: [ai0]
  analog_chans_out: [ao0, ao1]
  callbacks:
    save_h5:   # save data and timestamps as hdfs

General fields#

  • maxduration: 90 # seconds

  • use_services: [GCM, DAQ] # list services by their 3-letter abbreviations. only these will be run! See service-specific parameters below for valid names

  • serializer: pickle # OPTIONAL save default

Service specific parameters#

All services#

  • callbacks: (Optional) Must be set if you want to save or display aqcuired data. See below for which services accept which kinds of callbacks.

  • python_exe: anaconda/envs/my_special_env/python.exe: (Optional) Override global python_exe to run this service in a specific environment.

  • host: (Optional, Unused) Run this service on a different computer. Requires the following information:

    • name: 192.168.1.2: Name/IP address of remote computer

    • user: my_user_name: User name to for ssh login on the remote computer. Need to setup passwordless ssh.

    • python_exe: C:/miniconda/envs/etho/python.exe

    • savefolder: C:/Users/ncb/data

host:  # OPTIONAL individual services can run on specific hosts
    name: 192.168.1.42
    user: ncb
    python_exe: C:/miniconda/envs/etho/python.exe
    savefolder: C:/Users/ncb/data

National Instruments DAQ cards.#

Name of block must start with DAQ. If you want to use multiple NI-daq devices in a single experiment, create one block for each of them and add a suffix, e.g. DAQ1, DAQ2, etc. Minimal example:

DAQ:  # Minimal example
  samplingrate: 10000 # Hz
  shuffle: True # block-randomize order of stimuli for playback
  analog_chans_in: [ai0]
  analog_chans_out: [ao0, ao1]
  callbacks:
    save_h5:   # save data and timestamps as hdfs

Required#

  • samplingrate: 10000: Float or int in Hz.

  • analog_chans_in: [ai0, ai1, ai2]: Must specify at least one input channel, even if you do not want to record. Otherwise the DAQ system will not work for stupid technical reasons. FUTURE: define blocks [ai0:2], allow cross-channel tasks [Dev1/ai0, Dev2/ai0]

Optional#

  • device: Dev1: Name of NI-daq device to use. Check NI-MAX for a list of device names. Defaults to Dev1.

  • terminals: RSE: Terminal type for all analog channels. Allowed values: RSE, NRSE, Diff. Defaults to RSE.

  • shuffle: True: Block-randomize order of stimuli in playlist. Defaults to False.

  • clock_source: OnboardClock (Optional)

  • callbacks: Allowed values are: plot, plot_fast, save_h5, save_zarr, savedlp_h5. See [callbacks] for details.

  • analog_chans_in_info: ['left microphone', 'right microphone']: Description of the different channels so you know what’s what.

  • analog_chans_in_limits: [[0, 5], [0, 10], [-10, 10]]: Limits for analog channels. Defaults to 10 (sets limits to +/-10 for all analog channels). One of:

    • a single pos number specifying symmetrical limits for all channels, e.g. 5

    • a list of single pos numbers specifying symmetrical limits for each channel, e.g. [5, 10, 2]

    • a list of two numbers (first should be smaller than second) specifying upper and lower limit for each channel, e.g. [[0, 5], [0, 10], [-10, 10]]

  • analog_chans_out: ['ao0', 'ao1'] : Description of the different channels so you know what’s what.

  • analog_chans_out_info: ['left speaker', 'right speaker'] : Description of the different channels so you know what’s what.

  • digital_chans_out: [port0/line1, port0/line2, port0/line3]

  • digital_chans_out_info: ['start trigger', 'stop trigger', 'next trigger']: Description of the different channels so you know what’s what.

Callbacks#

  • save_h5: save data as hdfs (has no params) - analog data and timestamps (every second?).

  • save_zarr: save data as zarr (has no params) - analog data and timestamps (every second?).

  • plot_fast: plot traces using pyqtgraph. Can select which channels to plot by providing the zero-based indices of the analog input channels with channels_to_plot. E.g channels_to_plot: [0, 1, 2] will plot the first three analog input channels.

  • plot: Alternativel, plot traces using matplotlib (slower). Can select which input channels are plotted with channels_to_plot (see above).

callbacks:
  save_h5:   # save data as hdfs (has no params)
  plot_fast:  # plot traces using pyqtgraph
    channels_to_plot: [0, 1, 2]  # plot the first three input channels

Camera#

Generic camera interface with different backends. Name of block must start with GCM. If you want to use multiple cameras in a single experiment, create one block for each of them and add a suffix, e.g. GCM1, GCM2, etc. Minimal example:

GCM:  # Minimal example
  cam_type: Spinnaker  # for FLIR cameras, or: Basler, Ximea, Hamamatsu
  cam_serialnumber: 30959651
  frame_rate: 100.0  # frames per second
  frame_width: 640  # pixels
  frame_height: 200  # pixels
  frame_offx: 78  # pixels
  frame_offy: 10  # pixels
  shutter_speed: 5_000 # us=5ms
  callbacks:
    save_avi:  # save frames as avi using opencv VideoWriter
    save_timestamps:  # save timestamp for each frame to h5 file

Required#

  • cam_type: Ximea or Spinnaker (for FLIR cameras) or Basler or Hamamatsu

  • cam_serialnumber: 30959651:

  • frame_rate: 100.0: frames per second

  • frame_width: 640: pixels

  • frame_height: 200: pixels

  • shutter_speed: 5_000: Exposure time in microseconds.

Optional#

  • frame_offx: 78: x-offset of ROI in pixels. Defaults to 0.

  • frame_offy: 10: y-offset of ROI in pixels. Defaults to 0.

  • binning: 1: Set horz and vert frame binning. Defaults to 1 (no binning). Typically, 1, 2, 4 is available. Not supported by all camera types.

  • brightness: 0.0: Brightness. Defaults to 0

  • gamma: 1.0: Gamma value. Defaults to 1

  • gain: 0.0: Digital gain. Defaults to 0

  • optimize_auto_exposure: False: Defaults to False

  • external_trigger: False: Defaults to False

Callbacks#

  • disp: # plot frames using opencv

  • disp_fast: # plot frames using pyqtgraph (faster?)

  • save_timestamps: # save timestamps for each frame to h5 file

  • save_avi: save frames as avi using opencv VideoWriter (has no params)

  • save_avi_vidgear: save frames as avi using VidGear ffmpeg_params: # configure ffmpeg backend - need to prepend - to each param -crf: 16

  • save_avi_fast # or save frames as avi using Nvidia’s GPU-based VideoProcessingFramework VPF_bin_path: C:/Users/ncb/vpf/bin3.7 path to the directory containing the binaries for VPF

  • saveimg_h5 Save frames as h5 file.

  • save_ffmpegcv

callbacks:
  save_avi:   # save video file
  save_timestamps:   # save frame timestamps
  disp_fast:  # plot traces using pyqtgraph

Misc services#

THUA:
  pin ???

CAM:  # pi camera
  framerate: 30 # frames per second
  framewidth: 1000 # pixels
  frameheight: 1000 # pixels
  shutterspeed: 10000 # ns=10ms
  annotate_frame_num: False # print frame number in each frame
  # currently unused picamera options but probably useful
  exposuremode: 'fixedfps'
  video_denoise: False

THU: # pi temperature and humidity sensor
  pin: 17 # GPIO PIN for read out
  interval: 20 # seconds, log temperature and humidity every 20 seconds

OPT2:  # pi opto led control
  pin: [25, 24]  # red and green led channel
  playlist_channels: [2, 3]

SND:  # pi sound playback via pygame
  samplingrate: 44100  # Hz
  shuffle: False  # block-randomize order of stimuli for playback
  ledamp: 1300  # amplitude of the IR LED used for syncing audio and video
  playlist_channels: [0, 1]

REL:  # pi relay control (for backlight and illumination)
  pin: 22

DLP:  # DLP projector
  warpfile: 'Z:/#Data/flyball/projector/warpmesh_1140x912.data'
  use_warping: False
  callbacks:
    savedlp_h5:  # save per-frame stimulus parameters to `_dlp.h5`
  runners:
    LED_blinker:
      object: 'Rect'  # should be the classname: `psychopy.visuals.NAME`
      led_frame: 360
      led_duration: 180

Callbacks#

Time series data#

save_h5, plot_fast

Image data#

disp, disp_fast, save_timestamps, save_avi