murthylab / fly-vr

FlyVR is code for design and control of multisensory virtual reality experiments for flies.
https://github.com/murthylab/fly-vr
3 stars 5 forks source link

daq backend starts immediately in allinone launcher #9

Closed nzjrs closed 3 years ago

nzjrs commented 3 years ago

or at least the accounting of when things occur is incorrect?

because of how the data_generator works, maybe we have to signal_new_playlist_item before the chunk is callback'd to the daq buffer?

retroduce

configuration:
  analog_in_channels:
    0: 'Sound'
    1: 'Copy of AO0'
  analog_out_channels:
    0: 'Opto'
  projector_disable: true
  fictrac_config: 'C:/Users/John Stowers/Downloads/Dudi_ShareWithJohn_flyVR/DSX_VR2P_IPIshort_2018/180719_103/180719_103_output.h5'
  delay: 3
playlist:
  daq:
  - Delay-1s:
      attenuator: null
      amplitude: 0.0
      duration: 1000
      name: constant
      post_silence: 0
      pre_silence: 0
      sample_rate: 10000
  - Opto1090-9-1:
      amplitude_a: 9.0
      duration_a: 1000
      amplitude_b: 0.0
      duration_b: 2000
      name: pulse
      post_silence: 1000
      pre_silence: 1000
      sample_rate: 10000

notice that in the toc file Opto1090-9-1 plays immediately after Delay

- {"item": "Delay-1s", "backend": "daq", "sound_output_num_samples_written": 0, "video_output_num_frames": 0, "daq_output_num_samples_written": 5000, "fictrac_frame_num": 4850}
- {"item": "Opto1090-9-1", "backend": "daq", "sound_output_num_samples_written": 0, "video_output_num_frames": 0, "daq_output_num_samples_written": 15000, "fictrac_frame_num": 4852}
nzjrs commented 3 years ago

actually everywhere. I guess we need to send this information from the SampleChunk (when we detect it changes)

C:\Users\John Stowers\Documents\GitHub\fly-vr (master -> origin)
(venv) λ flyvr-daq.exe --config tests\sample_data\v2\john_rig_only_daq.yml -v
flyvr.daq                               : INFO     starting DAQ process
flyvr.audio.AudioStimPlaylist           : DEBUG    playlist item: Delay (<flyvr.audio.stimuli.ConstantStim object at 0x0000027D9D776148>)
flyvr.audio.AudioStimPlaylist           : DEBUG    playlist item: Opto1090-9-1 (<flyvr.audio.stimuli.PulseStim object at 0x0000027D9D6CC088>)
flyvr.audio.AudioStimPlaylist           : DEBUG    playlist item: Opto1090-8-1 (<flyvr.audio.stimuli.PulseStim object at 0x0000027D9D6E4888>)
flyvr.audio.AudioStimPlaylist           : DEBUG    playlist item: Opto1090-7-1 (<flyvr.audio.stimuli.PulseStim object at 0x0000027D9D6E6C08>)
flyvr.audio.AudioStimPlaylist           : INFO     playlist paused: False order: <Randomizer([Delay, [...]],mode=none,repeat=1>
flyvr.audio.AudioStimPlaylist           : INFO     playing item: Delay
flyvr.daq                               : INFO     initializing DAQ Tasks
flyvr.daq.IOTask                        : INFO     DAQ:Dev1: analogoutput/['ao0'] (limits: 10.0, SR: 10000, nSamp/ch: 5000, nSamp/event: 250, RSE: True)
flyvr.daq.IOTask                        : INFO     DAQ:Dev1: analoginput/['ai0', 'ai1'] (limits: 10.0, SR: 10000, nSamp/ch: 10000, nSamp/event: 10000, RSE: True)
flyvr.common.SharedState(in='daq')      : INFO     signaling daq ready
flyvr.daq                               : INFO     starting DAQ tasks
nzjrs commented 3 years ago

I noticed this because of the incorrect buffer size for the output (5000) but it was nevertheless also fixed with chunk provenance in https://github.com/murthylab/fly-vr/commit/9d87ca8924328b5598e61789c31c35065f3e6885