Skip to content

Commit

Permalink
record time_ns in the TOC file
Browse files Browse the repository at this point in the history
needed for #7
  • Loading branch information
nzjrs committed Jan 16, 2021
1 parent c84ddd2 commit 068606c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion flyvr/audio/io_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ def EveryNCallback(self):
daq_output_num_samples_written=row[1],
daq_input_num_samples_read=row[2],
sound_output_num_samples_written=row[3],
video_output_num_frames=row[4])
video_output_num_frames=row[4],
# and a time for replay experiments
time_ns=tns)

self.WriteAnalogF64(self._data.shape[0], 0, DAQmx_Val_WaitInfinitely, DAQmx_Val_GroupByScanNumber,
self._data, daq.byref(self.read), None)
Expand Down
5 changes: 4 additions & 1 deletion flyvr/audio/sound_server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import time
import queue
import logging
import threading
Expand Down Expand Up @@ -384,7 +385,9 @@ def callback(outdata, frames, time_info, status):
daq_output_num_samples_written=row[1],
daq_input_num_samples_read=row[2],
sound_output_num_samples_written=row[3],
video_output_num_frames=row[4])
video_output_num_frames=row[4],
# and a time for replay experiments
time_ns=time.time_ns())

if len(data) < len(outdata):
outdata.fill(0)
Expand Down
3 changes: 2 additions & 1 deletion flyvr/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def signal_new_playlist_item(self, identifier, backend, **extra):
'video_output_num_frames': self._shmem_state.video_output_num_frames,
'daq_output_num_samples_written': self._shmem_state.daq_output_num_samples_written,
'daq_input_num_samples_read': self._shmem_state.daq_input_num_samples_read,
'fictrac_frame_num': self._fictrac_shmem_state.frame_cnt}
'fictrac_frame_num': self._fictrac_shmem_state.frame_cnt,
'time_ns': time.time_ns()}
msg.update(extra)
self._tx.process(**CommonMessages.build(CommonMessages.EXPERIMENT_PLAYLIST_ITEM, identifier, **msg))

Expand Down
5 changes: 4 additions & 1 deletion flyvr/video/video_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid
import time
import queue
import os.path
import logging
Expand Down Expand Up @@ -149,7 +150,9 @@ def play_item(self, identifier):
if self._flyvr_shared_state is not None:
self._flyvr_shared_state.signal_new_playlist_item(identifier, BACKEND_VIDEO,
producer_instance_n=producer_instance_n,
producer_playlist_n=self._child_playlist_n)
producer_playlist_n=self._child_playlist_n,
# and a time for replay experiments
time_ns=time.time_ns())

self._child_playlist_n += 1

Expand Down

0 comments on commit 068606c

Please sign in to comment.