Implicitly detecting sync pulses #95
-
Hi all, The documentation for pyControl data synchronization mentions implicitly detecting pyControl synchronization pulses, e.g. by recording the state of a pin once every time a frame is received. However, I've noticed that creates problems with some pulses being detected twice for subsequent frames. After making it so that no subsequent frames had sync pulses, I got some sessions with windows of 3 seconds or so where sync was not possible. So I was wondering about how to define the ideal length and mean interval of the synchronization pulses according to the frame rate when recording sync pulses implicitly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @jonpedros, It is not a problem to have sync pulse that last longer than a single frame as you can extract the frame numbers corresponding to the start of the pulses. Indeed it is good practice to ensure that each sync pulse lasts for longer than a single frame to guarentee that no sync pulses are missed. In Python, if you have a numpy array called frame_pin_state = np.array([0,0,1,1,0,0,1,0,0,0,1,1,1,0,0]) # Example data
pulse_start_frames = np.where(np.diff(frame_pin_state.astype(int)) == 1)[0] + 1 # Returns [2,6,10] for the example data. |
Beta Was this translation helpful? Give feedback.
Hi @jonpedros,
It is not a problem to have sync pulse that last longer than a single frame as you can extract the frame numbers corresponding to the start of the pulses. Indeed it is good practice to ensure that each sync pulse lasts for longer than a single frame to guarentee that no sync pulses are missed.
In Python, if you have a numpy array called
frame_pin_state
containing the state of the sync pulse signal on each frame (either as a binary True/False or integer 1/0), you can get the frame numbers corresponding start of the pulses with: