Skip to content

Commit 6208cdd

Browse files
authored
Merge pull request #250 from open-ephys/issue-249
Update tutorial/hardware example workflows
2 parents 187c43b + 61a5629 commit 6208cdd

35 files changed

+559
-181
lines changed

articles/hardware/breakout/heartbeat.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@ hardware: true
55
device: heartbeat
66
---
77

8-
ONIX has a single special device, called a heartbeat, that produces data at regular intervals and is always enabled.
9-
When data is read from the hardware by software, the reading thread will block until enough data has been produced by
10-
the hardware. If no devices are enabled, the software would block forever. The heartbeat prevents this from happening
11-
since it is always enabled and always producing data. In practice, you can ignore the heartbeat functionality. In any
12-
case, the following excerpt from the Breakout Board [example workflow](xref:breakout_workflow) demonstrates how to
13-
observe the heartbeat.
8+
ONIX has a single special device, called a heartbeat, that produces data at
9+
regular intervals and is always enabled. When data is read from the hardware by
10+
software, the reading thread will block until enough data has been produced by
11+
the hardware. If no devices are enabled, the software would block forever. The
12+
heartbeat prevents this from happening since it is always enabled and always
13+
producing data. In practice, you can ignore the heartbeat functionality. In any
14+
case, the following excerpt from the Breakout Board [example
15+
workflow](xref:breakout_workflow) demonstrates how to observe the heartbeat.
1416

1517
::: workflow
1618
![/workflows/hardware/breakout/heartbeat.bonsai workflow](../../../workflows/hardware/breakout/heartbeat.bonsai)
1719
:::
1820

1921
The <xref:OpenEphys.Onix1.HeartbeatData> operator generates a sequence of
20-
[HeartbeatDataFrames](xref:OpenEphys.Onix1.HeartbeatDataFrame). `HeartbeatData` emits `HeartbeatDataFrames` at a regular
21-
interval defined during <xref:breakout_configuration> using the <xref:OpenEphys.Onix1.ConfigureBreakoutBoard>'s
22-
`Heartbeat BeatsPerSecond` property (in our case 10 Hz). The `HeartbeatData`'s `DeviceName` property is set to
23-
"BreakoutBoard/Heartbeat". This links the `HeartbeatData` operator to the corresponding configuration operator. The
24-
[MemberSelector](xref:Bonsai.Expressions.MemberSelectorBuilder) operator selects the
25-
`Clock` member from the `HeartbeatDataFrame` so the user can visualize the number of clock cycles that have passed for
26-
a given heartbeat pulse if they double-click the `Clock` node.
22+
[HeartbeatDataFrames](xref:OpenEphys.Onix1.HeartbeatDataFrame). `HeartbeatData`
23+
emits `HeartbeatDataFrames` at a regular interval defined during
24+
<xref:breakout_configuration> using the
25+
<xref:OpenEphys.Onix1.ConfigureBreakoutBoard>'s `Heartbeat BeatsPerSecond`
26+
property (in our case 100 Hz, which is the minimum allowable frequency). The
27+
`HeartbeatData`'s `DeviceName` property is set to "BreakoutBoard/Heartbeat".
28+
This links the `HeartbeatData` operator to the corresponding configuration
29+
operator. The [MemberSelector](xref:Bonsai.Expressions.MemberSelectorBuilder)
30+
operator selects the `Clock` member from the `HeartbeatDataFrame` so the user
31+
can visualize the number of clock cycles that have passed for a given heartbeat
32+
pulse if they double-click the `Clock` node.

articles/hardware/rhs2116/rhs2116-record.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,32 @@ uid: rhs2116_record
33
title: Rhs2116 Recording
44
---
55

6-
The following excerpt from the HeadstageRhs2116 [example workflow](xref:rhs2116) demonstrates the
7-
Rhs2116 recording functionality by streaming and saving data from the Rhs2116 device.
6+
The following excerpt from the HeadstageRhs2116 [example workflow](xref:rhs2116)
7+
demonstrates the Rhs2116 recording functionality by streaming and saving data
8+
from the Rhs2116 device.
89

910
::: workflow
1011
![/workflows/hardware/rhs2116/rhs2116-record.bonsai workflow](../../../workflows/hardware/rhs2116/rhs2116-record.bonsai)
1112
:::
1213

13-
The <xref:OpenEphys.Onix1.Rhs2116Data> operator generates a sequence of
14-
<xref:OpenEphys.Onix1.Rhs2116DataFrame>s using the following settings:
15-
- The BufferSize property is set to 30. Each `Rhs2116DataFrame` will contain a [1 x 30 sample] Clock
16-
vector, a [32 channel x 30 sample] AmplifierData matrix, and a [32 channel x 30 sample] DcData
17-
matrix. This corresponds to 1 ms of data per data frame.
18-
- The DeviceName property is set to "HeadstageRhs2116/Rhs2116". This links `Rhs2116Data` to the
19-
Rhs2116s on the Headstage Rhs2116.
14+
The <xref:OpenEphys.Onix1.Rhs2116PairData> operator generates a sequence of
15+
[Rhs2116PairDataFrames](xref:OpenEphys.Onix1.Rhs2116DataFrame) using the following
16+
settings:
17+
- The BufferSize property is set to 30. Each `Rhs2116PairDataFrame` will contain a
18+
[1 x 30 sample] Clock vector, a [32 channel x 30 sample] AmplifierData matrix,
19+
a [32 channel x 30 sample] DcData matrix, and [1 channel x 30 sample] recovery
20+
mask vector. This corresponds to 1 ms of data per data frame.
21+
- The DeviceName property is set to "HeadstageRhs2116/Rhs2116". This links
22+
`Rhs2116PairData` to the Rhs2116s on the Headstage Rhs2116.
2023

21-
The relevant properties are extracted from the `Rhs2116DataFrame` by right-clicking the
22-
`Rhs2116Data` operator, and choosing the following Output members: Clock, AmplifierData, and DcData.
23-
The <xref:Bonsai.Dsp.MatrixWriter>s save the selected members to files with the following
24-
formats: `rhs2116pair-clock_<filecount>.raw`, `rhs2116pair-ac_<filecount>.raw`, and
25-
`rhs2116pair-dc_<filecount>.raw`, respectively.
24+
The relevant properties are extracted from the
25+
<xref:OpenEphys.Onix1.Rhs2116PairDataFrame> by right-clicking the `Rhs2116PairData`
26+
operator, and choosing the following Output members: Clock, AmplifierData, and
27+
DcData. The <xref:Bonsai.Dsp.MatrixWriter>s save the selected members to files
28+
with the following formats: `rhs2116pair-clock_<filecount>.raw`,
29+
`rhs2116pair-ac_<filecount>.raw`, `rhs2116pair-dc_<filecount>.raw`, and
30+
`rhs2116pair-recovery_<filecount>.raw` respectively.
2631

27-
> [!TIP]
32+
> [!TIP]
2833
> For more details about configuring the Rhs2116 and its data, read the
29-
> [datasheet](https://intantech.com/files/Intan_RHS2116_datasheet.pdf).
34+
> [datasheet](https://intantech.com/files/Intan_RHS2116_datasheet.pdf).

src/bonsai-onix1

Submodule bonsai-onix1 updated 35 files

workflows/hardware/breakout/breakout.bonsai

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.5"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
55
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
@@ -18,10 +18,9 @@
1818
<Combinator xsi:type="onix1:ConfigureBreakoutBoard">
1919
<onix1:Name>BreakoutBoard</onix1:Name>
2020
<onix1:Heartbeat>
21-
<onix1:DeviceName>BreakoutBoard/Heartbeat</onix1:DeviceName>
21+
<onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
2222
<onix1:DeviceAddress>0</onix1:DeviceAddress>
23-
<onix1:Enable>true</onix1:Enable>
24-
<onix1:BeatsPerSecond>10</onix1:BeatsPerSecond>
23+
<onix1:BeatsPerSecond>100</onix1:BeatsPerSecond>
2524
</onix1:Heartbeat>
2625
<onix1:AnalogIO>
2726
<onix1:DeviceName>BreakoutBoard/AnalogIO</onix1:DeviceName>
@@ -56,6 +55,8 @@
5655
<onix1:DeviceName>BreakoutBoard/DigitalIO</onix1:DeviceName>
5756
<onix1:DeviceAddress>7</onix1:DeviceAddress>
5857
<onix1:Enable>true</onix1:Enable>
58+
<onix1:DeadTime>0</onix1:DeadTime>
59+
<onix1:SampleRate xsi:nil="true" />
5960
</onix1:DigitalIO>
6061
<onix1:ClockOutput>
6162
<onix1:DeviceName>BreakoutBoard/OutputClock</onix1:DeviceName>
@@ -248,7 +249,7 @@
248249
<io:Selector>Clock,HarpTime</io:Selector>
249250
</Expression>
250251
<Expression xsi:type="Combinator">
251-
<Combinator xsi:type="onix1:OutputClockData">
252+
<Combinator xsi:type="onix1:OutputClockHardwareParameters">
252253
<onix1:DeviceName>BreakoutBoard/OutputClock</onix1:DeviceName>
253254
</Combinator>
254255
</Expression>
@@ -269,7 +270,7 @@
269270
</Expression>
270271
<Expression xsi:type="Combinator">
271272
<Combinator xsi:type="onix1:HeartbeatData">
272-
<onix1:DeviceName>BreakoutBoard/Heartbeat</onix1:DeviceName>
273+
<onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
273274
</Combinator>
274275
</Expression>
275276
<Expression xsi:type="MemberSelector">

workflows/hardware/breakout/clock-output.bonsai

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.5"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
4+
xmlns:p1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
55
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
66
xmlns="https://bonsai-rx.org/2018/workflow">
77
<Workflow>
88
<Nodes>
99
<Expression xsi:type="Combinator">
10-
<Combinator xsi:type="onix1:OutputClockData">
11-
<onix1:DeviceName>BreakoutBoard/OutputClock</onix1:DeviceName>
10+
<Combinator xsi:type="p1:OutputClockHardwareParameters">
11+
<p1:DeviceName>BreakoutBoard/OutputClock</p1:DeviceName>
1212
</Combinator>
1313
</Expression>
1414
<Expression xsi:type="io:CsvWriter">

workflows/hardware/breakout/configuration.bonsai

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.5"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
5+
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
6+
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
57
xmlns="https://bonsai-rx.org/2018/workflow">
68
<Workflow>
79
<Nodes>
@@ -15,10 +17,10 @@
1517
<Combinator xsi:type="onix1:ConfigureBreakoutBoard">
1618
<onix1:Name>BreakoutBoard</onix1:Name>
1719
<onix1:Heartbeat>
18-
<onix1:DeviceName>BreakoutBoard/Heartbeat</onix1:DeviceName>
20+
<onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
1921
<onix1:DeviceAddress>0</onix1:DeviceAddress>
2022
<onix1:Enable>true</onix1:Enable>
21-
<onix1:BeatsPerSecond>10</onix1:BeatsPerSecond>
23+
<onix1:BeatsPerSecond>100</onix1:BeatsPerSecond>
2224
</onix1:Heartbeat>
2325
<onix1:AnalogIO>
2426
<onix1:DeviceName>BreakoutBoard/AnalogIO</onix1:DeviceName>
@@ -57,7 +59,7 @@
5759
<onix1:ClockOutput>
5860
<onix1:DeviceName>BreakoutBoard/OutputClock</onix1:DeviceName>
5961
<onix1:DeviceAddress>5</onix1:DeviceAddress>
60-
<onix1:ClockGate>false</onix1:ClockGate>
62+
<onix1:ClockGate>true</onix1:ClockGate>
6163
<onix1:Frequency>1000000</onix1:Frequency>
6264
<onix1:DutyCycle>50</onix1:DutyCycle>
6365
<onix1:Delay>0</onix1:Delay>
@@ -82,10 +84,23 @@
8284
<onix1:WriteSize>2048</onix1:WriteSize>
8385
</Combinator>
8486
</Expression>
87+
<Expression xsi:type="Combinator">
88+
<Combinator xsi:type="rx:Timestamp" />
89+
</Expression>
90+
<Expression xsi:type="io:CsvWriter">
91+
<io:FileName>start-time_.csv</io:FileName>
92+
<io:Append>false</io:Append>
93+
<io:Overwrite>false</io:Overwrite>
94+
<io:Suffix>FileCount</io:Suffix>
95+
<io:IncludeHeader>false</io:IncludeHeader>
96+
<io:Selector>Timestamp,Value</io:Selector>
97+
</Expression>
8598
</Nodes>
8699
<Edges>
87100
<Edge From="0" To="1" Label="Source1" />
88101
<Edge From="1" To="2" Label="Source1" />
102+
<Edge From="1" To="3" Label="Source1" />
103+
<Edge From="3" To="4" Label="Source1" />
89104
</Edges>
90105
</Workflow>
91106
</WorkflowBuilder>
Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,69 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.5"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
5-
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
5+
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
66
xmlns="https://bonsai-rx.org/2018/workflow">
77
<Workflow>
88
<Nodes>
99
<Expression xsi:type="Combinator">
10-
<Combinator xsi:type="onix1:DigitalInput" />
11-
</Expression>
12-
<Expression xsi:type="io:CsvWriter">
13-
<io:FileName>digital-data_.csv</io:FileName>
14-
<io:Delimiter>;</io:Delimiter>
15-
<io:ListSeparator />
16-
<io:Append>false</io:Append>
17-
<io:Overwrite>false</io:Overwrite>
18-
<io:Suffix>FileCount</io:Suffix>
19-
<io:IncludeHeader>false</io:IncludeHeader>
20-
<io:Selector>Clock,DigitalInputs,Buttons</io:Selector>
10+
<Combinator xsi:type="onix1:DigitalInput">
11+
<onix1:DeviceName>BreakoutBoard/DigitalIO</onix1:DeviceName>
12+
</Combinator>
2113
</Expression>
2214
<Expression xsi:type="MemberSelector">
2315
<Selector>DigitalInputs</Selector>
2416
</Expression>
17+
<Expression xsi:type="Combinator">
18+
<Combinator xsi:type="dsp:MatrixWriter">
19+
<dsp:Path>digital-pins_.raw</dsp:Path>
20+
<dsp:Suffix>FileCount</dsp:Suffix>
21+
<dsp:Overwrite>false</dsp:Overwrite>
22+
<dsp:Layout>ColumnMajor</dsp:Layout>
23+
</Combinator>
24+
</Expression>
2525
<Expression xsi:type="HasFlag">
2626
<Operand xsi:type="WorkflowProperty" TypeArguments="onix1:DigitalPortState">
27-
<Value>Pin1</Value>
27+
<Value>Pin0</Value>
2828
</Operand>
2929
</Expression>
3030
<Expression xsi:type="MemberSelector">
3131
<Selector>Buttons</Selector>
3232
</Expression>
33+
<Expression xsi:type="Combinator">
34+
<Combinator xsi:type="dsp:MatrixWriter">
35+
<dsp:Path>digital-buttons_.raw</dsp:Path>
36+
<dsp:Suffix>FileCount</dsp:Suffix>
37+
<dsp:Overwrite>false</dsp:Overwrite>
38+
<dsp:Layout>ColumnMajor</dsp:Layout>
39+
</Combinator>
40+
</Expression>
3341
<Expression xsi:type="HasFlag">
3442
<Operand xsi:type="WorkflowProperty" TypeArguments="onix1:BreakoutButtonState">
3543
<Value>Triangle X</Value>
3644
</Operand>
3745
</Expression>
46+
<Expression xsi:type="MemberSelector">
47+
<Selector>Clock</Selector>
48+
</Expression>
49+
<Expression xsi:type="Combinator">
50+
<Combinator xsi:type="dsp:MatrixWriter">
51+
<dsp:Path>digital-clock_.raw</dsp:Path>
52+
<dsp:Suffix>FileCount</dsp:Suffix>
53+
<dsp:Overwrite>false</dsp:Overwrite>
54+
<dsp:Layout>ColumnMajor</dsp:Layout>
55+
</Combinator>
56+
</Expression>
3857
</Nodes>
3958
<Edges>
4059
<Edge From="0" To="1" Label="Source1" />
60+
<Edge From="0" To="4" Label="Source1" />
61+
<Edge From="0" To="7" Label="Source1" />
4162
<Edge From="1" To="2" Label="Source1" />
42-
<Edge From="1" To="4" Label="Source1" />
4363
<Edge From="2" To="3" Label="Source1" />
4464
<Edge From="4" To="5" Label="Source1" />
65+
<Edge From="5" To="6" Label="Source1" />
66+
<Edge From="7" To="8" Label="Source1" />
4567
</Edges>
4668
</Workflow>
4769
</WorkflowBuilder>

workflows/hardware/breakout/heartbeat.bonsai

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.5"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
55
xmlns="https://bonsai-rx.org/2018/workflow">
66
<Workflow>
77
<Nodes>
88
<Expression xsi:type="Combinator">
99
<Combinator xsi:type="onix1:HeartbeatData">
10-
<onix1:DeviceName>BreakoutBoard/Heartbeat</onix1:DeviceName>
10+
<onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
1111
</Combinator>
1212
</Expression>
1313
<Expression xsi:type="MemberSelector">

workflows/hardware/hs64/configuration.bonsai

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.5"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
55
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
@@ -17,10 +17,10 @@
1717
<Combinator xsi:type="onix1:ConfigureBreakoutBoard">
1818
<onix1:Name>BreakoutBoard</onix1:Name>
1919
<onix1:Heartbeat>
20-
<onix1:DeviceName>BreakoutBoard/Heartbeat</onix1:DeviceName>
20+
<onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
2121
<onix1:DeviceAddress>0</onix1:DeviceAddress>
2222
<onix1:Enable>true</onix1:Enable>
23-
<onix1:BeatsPerSecond>10</onix1:BeatsPerSecond>
23+
<onix1:BeatsPerSecond>100</onix1:BeatsPerSecond>
2424
</onix1:Heartbeat>
2525
<onix1:AnalogIO>
2626
<onix1:DeviceName>BreakoutBoard/AnalogIO</onix1:DeviceName>
@@ -73,7 +73,7 @@
7373
<onix1:MemoryMonitor>
7474
<onix1:DeviceName>BreakoutBoard/MemoryMonitor</onix1:DeviceName>
7575
<onix1:DeviceAddress>10</onix1:DeviceAddress>
76-
<onix1:Enable>true</onix1:Enable>
76+
<onix1:Enable>false</onix1:Enable>
7777
<onix1:SamplesPerSecond>10</onix1:SamplesPerSecond>
7878
</onix1:MemoryMonitor>
7979
</Combinator>
@@ -85,7 +85,7 @@
8585
<onix1:DeviceName>Headstage64/Rhd2164</onix1:DeviceName>
8686
<onix1:DeviceAddress>256</onix1:DeviceAddress>
8787
<onix1:Enable>true</onix1:Enable>
88-
<onix1:DspCutoff>Dsp146mHz</onix1:DspCutoff>
88+
<onix1:DspCutoff>Off</onix1:DspCutoff>
8989
<onix1:AnalogLowCutoff>Low100mHz</onix1:AnalogLowCutoff>
9090
<onix1:AnalogHighCutoff>High10000Hz</onix1:AnalogHighCutoff>
9191
</onix1:Rhd2164>
@@ -108,7 +108,9 @@
108108
<onix1:DeviceAddress>260</onix1:DeviceAddress>
109109
</onix1:OpticalStimulator>
110110
<onix1:Port>PortA</onix1:Port>
111-
<onix1:PortVoltage xsi:nil="true" />
111+
<onix1:PortVoltage>
112+
<onix1:Requested xsi:nil="true" />
113+
</onix1:PortVoltage>
112114
</Combinator>
113115
</Expression>
114116
<Expression xsi:type="Combinator">

0 commit comments

Comments
 (0)