diff --git a/tutorials/synching-ephys.md b/tutorials/synching-ephys.md index d2683382..dc9160c3 100644 --- a/tutorials/synching-ephys.md +++ b/tutorials/synching-ephys.md @@ -9,6 +9,10 @@ The general approach when synchronizing two independent data acquisition clocks ### **Exercise 1:** Synchronizing behaviour events with ephys +:::workflow +![Syncing ephys with behavior](~/workflows/syncing-ephys-behavior.bonsai) +::: + - Insert a `KeyDown` source. - Insert an `Equal` transform and set its `Value` to one of the keys. The output of this operator will toggle between `True` and `False` depending on whether the key press matches the specified key. - Insert a `DigitalOutput` sink and connect it to Arduino pin 13. @@ -22,6 +26,10 @@ The general approach when synchronizing two independent data acquisition clocks ### **Exercise 2:** Synchronizing video with ephys using an LED +:::workflow +![Syncing ephys with video](~/workflows/syncing-ephys-video.bonsai) +::: + - Using the workflow from the previous exercise, insert a `CameraCapture` source and point the camera such that you can see clearly both the LED and the computer keyboard. - Insert a `VideoWriter` sink and configure the `FileName` with a path ending in `.avi`. - Insert a `Crop` transform and set the `RegionOfInterest` property to a small area around the LED. @@ -53,6 +61,10 @@ However, you can take advantage of the fact that all pixels in a frame are prese In this exercise you will track the display of a very simple visual stimulus: a transition between black and white. +:::workflow +![Syncing ephys with visual stimulus](~/workflows/syncing-ephys-visual.bonsai) +::: + - Insert a `SolidColor` source and set its `Size` property to a positive value, e.g. 100,100. - Insert a `Timer` source and set the `Period` to one second. - Insert a `Mod` transform and set its `Value` property to 2. diff --git a/workflows/syncing-ephys-behavior.bonsai b/workflows/syncing-ephys-behavior.bonsai new file mode 100644 index 00000000..21f7c84d --- /dev/null +++ b/workflows/syncing-ephys-behavior.bonsai @@ -0,0 +1,79 @@ + + + + + + + Arduino + COM1 + 57600 + 19 + + + + + Space + false + + + + + Space + + + + + Arduino + 13 + + + + + main.bit + SampleRate20000Hz + false + 0.1 + 7500 + 1 + true + + + + + + + + BoardAdcData + + + + + 0 + + + + + + test.bin + None + false + ColumnMajor + + + + + + + + + + + + \ No newline at end of file diff --git a/workflows/syncing-ephys-behavior.svg b/workflows/syncing-ephys-behavior.svg new file mode 100644 index 00000000..78217629 --- /dev/null +++ b/workflows/syncing-ephys-behavior.svg @@ -0,0 +1,111 @@ + + +]> + + + + + + + + + + + + + + Arduino + + + + + + DigitalOutput + + + + + + MatrixWriter + + + + + + + Equal + + + + + Select + + + Channels + + + + + + + KeyDown + + + + + + + BoardAdc + + + Data + + + + + + + + Rhd2000Eval + + + Board + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/workflows/syncing-ephys-led.svg b/workflows/syncing-ephys-led.svg new file mode 100644 index 00000000..4f4e40b3 --- /dev/null +++ b/workflows/syncing-ephys-led.svg @@ -0,0 +1,99 @@ + + +]> + + + + + + + + + + + + + + + + + + + + VideoWriter + + + + + + + + CsvWriter + + + + + + + + Val0 + + + + + + Sum + + + + + + + Grayscale + + + + + + + Crop + + + + + + + Camera + + + Capture + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/workflows/syncing-ephys-video.bonsai b/workflows/syncing-ephys-video.bonsai new file mode 100644 index 00000000..26c49f07 --- /dev/null +++ b/workflows/syncing-ephys-video.bonsai @@ -0,0 +1,67 @@ + + + + + + + 0 + + + + + + test.avi + None + true + false + FMP4 + 30 + + 0 + 0 + + NearestNeighbor + + + + + + 100 + 100 + 100 + 100 + + + + + + + + + + + Val0 + + + led-brightness.csv + false + false + None + false + + + + + + + + + + + + \ No newline at end of file diff --git a/workflows/syncing-ephys-visual.bonsai b/workflows/syncing-ephys-visual.bonsai new file mode 100644 index 00000000..22ff2c67 --- /dev/null +++ b/workflows/syncing-ephys-visual.bonsai @@ -0,0 +1,75 @@ + + + + + + + PT0S + PT1S + + + + + 2 + + + + + 255 + + + + + + + + + + + 100 + 100 + + U8 + 3 + + 255 + 255 + 255 + 255 + + + + + + main.bit + SampleRate20000Hz + false + 0.1 + 7500 + 1 + true + + + + + + + + BoardAdcData + + + + + + + + + + + \ No newline at end of file diff --git a/workflows/syncing-ephys-visual.svg b/workflows/syncing-ephys-visual.svg new file mode 100644 index 00000000..7cb1c720 --- /dev/null +++ b/workflows/syncing-ephys-visual.svg @@ -0,0 +1,99 @@ + + +]> + + + + + + + + + + + + + + + SolidColor + + + + + + + BoardAdc + + + Data + + + + + + + Color + + + + + + + + Rhd2000Eval + + + Board + + + + + + + Multiply + + + + + + + Mod + + + + + + Timer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file