open-ephys / Bonsai.Miniscope

Bonsai package for controlling headborne, calcium imaging miniscopes
12 stars 6 forks source link

Add support for DAQ hardware I/O Input trigger #9

Open ChucklesOnGitHub opened 1 year ago

ChucklesOnGitHub commented 1 year ago

In the Miniscope DAQ-QT software, setting the input from low to high in the DAQ Input trigger I/O channel starts the recording and high to low stops the recording.

After acquisition is stopped, miniscope LED stays on in both Bonsai and Miniscope DAQ-QT. In the DAQ-QT soft triggerable mode, the scope LED is turned on and off.

ChucklesOnGitHub commented 10 months ago

Thanks Jon for adding the hardware trigger functionality in version 1.3.0. It seems the program now stops the incoming stream of data when the Input Trigger line on the Miniscope DAQ is set to HIGH. This is different from the Miniscope-DAQ-QT implementation, I'm guessing because they have a separate triggerable mode and in Bonsai the miniscope acquisition just starts when you start the workflow. The other difference in functionality is that when the DAQ is triggered the LED does not toggle on and off. We should consider adding this.

Here is a diagram of both implementatations as far as I can see:

image image

jonnew commented 10 months ago

OK, I've redone this functionality in 32b5377. Now the state of the trigger input pin is packaged with the output type of the MiniscopeV4 node. It can then be used upstream to gate the frames, make new files or whatever. Additionally, I added a new property "LEDRespectsTrigger". If set to true, the LED will turn off when the trigger input is low. Additionally, I updated the ExampleWorkflows folder with a workflow that shows how to use the new Trigger field of output frames to gate the frame stream.

image

jonnew commented 10 months ago

I updated the package as well, you should be able to update in the package Bonsai package manager to test