Skip to content

Commit 75eaef9

Browse files
committed
Documentation for GPO trigger and stimulator reports
1 parent c2612fe commit 75eaef9

16 files changed

+662
-117
lines changed

articles/hardware/hs64/estim.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,42 @@ uid: hs64_estim
33
title: Headstage 64 Electrical Stimulation
44
---
55

6-
The following excerpt from the Headstage 64 [example workflow](xref:hs64_workflow) demonstrates electrical stimulation by
7-
triggering a train of pulses following a press of the △ key on the breakout board.
6+
The following excerpt from the Headstage 64 [example
7+
workflow](xref:hs64_workflow) demonstrates electrical stimulation by triggering
8+
a train of pulses following a press of the △ key on the breakout board.
89

910
::: workflow
1011
![/workflows/hardware/hs64/estim.bonsai workflow](../../../workflows/hardware/hs64/estim.bonsai)
1112
:::
1213

1314
The <xref:OpenEphys.Onix1.DigitalInput> operator generates a sequence of
14-
[DigitalInputDataFrames](xref:OpenEphys.Onix1.DigitalInputDataFrame). Although the digital inputs
15-
are sampled at 4 Mhz, these data frames are only emitted when the port status changes (i.e., when a
16-
pin, button, or switch is toggled). In the Breakout Board example workflow, the `DigitalInput`'s
17-
`DeviceName` property is set to "BreakoutBoard/DigitalInput". This links the `DigitalInput` operator
18-
to the corresponding configuration operator.
15+
[DigitalInputDataFrames](xref:OpenEphys.Onix1.DigitalInputDataFrame). Although
16+
the digital inputs are sampled at 4 Mhz, these data frames are only emitted when
17+
the port status changes (i.e., when a pin, button, or switch is toggled). In the
18+
Headstage 64 example workflow, the `DigitalInput`'s `DeviceName` property is
19+
set to "BreakoutBoard/DigitalInput". This links the `DigitalInput` operator to
20+
the corresponding configuration operator.
1921

20-
<xref:OpenEphys.Onix1.BreakoutButtonState> is selected from the `DigitalInputDataFrame`. It is an enumerator with values
21-
that correspond to bit positions of the breakout board's digital port. When this type is connected to a `HasFlags`
22-
operator, the enumerated values appear in the `HasFlags`'s `Value` property's dropdown menu. Because `HasFlags`'s
23-
`Value` is set to "Triangle", its output is "True" when the selected `BreakoutButtonState` bit field contains the
24-
"Triangle" flag.
22+
<xref:OpenEphys.Onix1.BreakoutButtonState> is selected from the
23+
`DigitalInputDataFrame`. It is an enumerator with values that correspond to bit
24+
positions of the breakout board's digital port. When this type is connected to a
25+
`HasFlags` operator, the enumerated values appear in the `HasFlags`'s `Value`
26+
property's dropdown menu. Because `HasFlags`'s `Value` is set to "Triangle", its
27+
output is "True" when the selected `BreakoutButtonState` bit field contains the
28+
"Triangle" flag. The <xref:Bonsai.Reactive.DistinctUntilChanged> operator only
29+
allows passes an item in its input sequence if it's different from the previous
30+
item in the input sequence. The <xref:Bonsai.Reactive.Condition> operator only
31+
passes an item in its input sequence if `Condition`'s internal logic is "True".
32+
In this case, `Condition` has no internal logic (which can be inspected by
33+
selecting the node and pressing <kbd>Ctrl+Enter</kbd>), so it uses the value of
34+
the Boolean in its input sequence to decide whether or not to pass a value. The
35+
<xref:Bonsai.Expressions.DoubleProperty> operator emits a value determined by
36+
its `Value` property whenever it receives an item in its input sequence. T This
37+
value is used to determine the delay between triggering the stimulus and
38+
delivery of the stimulus. When `Double`'s `Value` property is set to zero, there
39+
is no such delay.
2540

26-
When the <xref:OpenEphys.Onix1.Headstage64ElectricalStimulatorTrigger> operator receives a "True" value in its input
27-
sequence, a stimulus waveform is triggered. The waveform can be modified by editing the
41+
When the <xref:OpenEphys.Onix1.Headstage64ElectricalStimulatorTrigger> operator
42+
receives a "True" value in its input sequence, a stimulus waveform is triggered.
43+
The waveform can be modified by editing the
2844
`Headstage64ElectricalStimulatorTrig` operator's properties.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
uid: hs64_gpo-trigger
3+
title: Headstage 64 GPO Trigger
4+
---
5+
6+
The following excerpt from the Headstage 64 [example
7+
workflow](xref:hs64_workflow) demonstrates triggering a stimulus following a
8+
press of the □ key on the breakout board. The GPO trigger uses a pin on the
9+
headstage to trigger stimulus more instantaneously than other trigger methods
10+
that write to a register on the hardware which takes more time. However, this
11+
trigger operator does not provide stimulus feedback as discussed in
12+
<xref:hs64_stimulator-data> nor is it capable of distinguishing between applying
13+
optical or electrical stimulus. If you want to use the GPO trigger to only
14+
trigger electrical stimulus, the electrical stimulator should be the only
15+
stimulator device armed on the headstage. If you want to use the GPO trigger to
16+
only trigger optical stimulus, the optical stimulator should be the only
17+
stimulator device armed on the headstage.
18+
19+
::: workflow
20+
![/workflows/hardware/hs64/gpo-trigger.bonsai workflow](../../../workflows/hardware/hs64/gpo-trigger.bonsai)
21+
:::
22+
23+
The <xref:OpenEphys.Onix1.DigitalInput> operator generates a sequence of
24+
[DigitalInputDataFrames](xref:OpenEphys.Onix1.DigitalInputDataFrame). Although
25+
the digital inputs are sampled at 4 Mhz, these data frames are only emitted when
26+
the port status changes (i.e., when a pin, button, or switch is toggled). In the
27+
Breakout Board example workflow, the `DigitalInput`'s `DeviceName` property is
28+
set to "BreakoutBoard/DigitalInput". This links the `DigitalInput` operator to
29+
the corresponding configuration operator.
30+
31+
<xref:OpenEphys.Onix1.BreakoutButtonState> is selected from the
32+
`DigitalInputDataFrame`. It is an enumerator with values that correspond to bit
33+
positions of the breakout board's digital port. When this type is connected to a
34+
`HasFlags` operator, the enumerated values appear in the `HasFlags`'s `Value`
35+
property's dropdown menu. Because `HasFlags`'s `Value` is set to "Square", its
36+
output is "True" when the selected `BreakoutButtonState` bit field contains the
37+
"Square" flag. The <xref:Bonsai.Reactive.DistinctUntilChanged> operator only
38+
allows passes an item in its input sequence if it's different from the previous
39+
item in the input sequence. The <xref:Bonsai.Reactive.Condition> operator only
40+
passes an item in its input sequence if `Condition`'s internal logic
41+
is "True". In this case, `Condition` has no internal logic (which can
42+
be inspected by selecting the node and pressing <kbd>Ctrl+Enter</kbd>), so it
43+
uses the value of the Boolean in its input sequence to decide whether or not to
44+
pass a value.
45+
46+
When the <xref:OpenEphys.Onix1.Headstage64ElectricalStimulatorTrigger> operator
47+
receives a "True" value in its input sequence, a stimulus waveform is triggered.
48+
The waveform can be modified by editing the
49+
`Headstage64ElectricalStimulatorTrig` operator's properties.

articles/hardware/hs64/ostim.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,42 @@ uid: hs64_ostim
33
title: Headstage 64 Optical Stimulation
44
---
55

6-
The following excerpt from the Headstage64 [example workflow](xref:hs64_workflow) demonstrates optical stimulation by
7-
triggering a train of pulses following a press of the ◯ key on the breakout board.
6+
The following excerpt from the Headstage64 [example
7+
workflow](xref:hs64_workflow) demonstrates optical stimulation by triggering a
8+
train of pulses following a press of the ◯ key on the breakout board.
89

910
::: workflow
1011
![/workflows/hardware/hs64/ostim.bonsai workflow](../../../workflows/hardware/hs64/ostim.bonsai)
1112
:::
1213

1314
The <xref:OpenEphys.Onix1.DigitalInput> operator generates a sequence of
14-
[DigitalInputDataFrames](xref:OpenEphys.Onix1.DigitalInputDataFrame). Although the digital inputs
15-
are sampled at 4 Mhz, these data frames are only emitted when the port status changes (i.e., when a
16-
pin, button, or switch is toggled). In the Breakout Board example workflow, the `DigitalInput`'s
17-
`DeviceName` property is set to "BreakoutBoard/DigitalInput". This links the `DigitalInput` operator
18-
to the corresponding configuration operator.
15+
[DigitalInputDataFrames](xref:OpenEphys.Onix1.DigitalInputDataFrame). Although
16+
the digital inputs are sampled at 4 Mhz, these data frames are only emitted when
17+
the port status changes (i.e., when a pin, button, or switch is toggled). In the
18+
Headstage 64 example workflow, the `DigitalInput`'s `DeviceName` property is
19+
set to "BreakoutBoard/DigitalInput". This links the `DigitalInput` operator to
20+
the corresponding configuration operator.
1921

20-
<xref:OpenEphys.Onix1.BreakoutButtonState> is selected from the `DigitalInputDataFrame`. It is an enumerator with values
21-
that correspond to bit positions of the breakout board's digital port. When this type is connected to a `HasFlags`
22-
operator, the enumerated values appear in the `HasFlags`'s `Value` property's dropdown menu. Because `HasFlags`'s
23-
`Value` is set to "Circle", its output is "True" when the selected `BreakoutButtonState` bit field contains the
24-
"Circle" flag.
22+
<xref:OpenEphys.Onix1.BreakoutButtonState> is selected from the
23+
`DigitalInputDataFrame`. It is an enumerator with values that correspond to bit
24+
positions of the breakout board's digital port. When this type is connected to a
25+
`HasFlags` operator, the enumerated values appear in the `HasFlags`'s `Value`
26+
property's dropdown menu. Because `HasFlags`'s `Value` is set to "Circle", its
27+
output is "True" when the selected `BreakoutButtonState` bit field contains the
28+
"Circle" flag. The <xref:Bonsai.Reactive.DistinctUntilChanged> operator only
29+
allows passes an item in its input sequence if it's different from the previous
30+
item in the input sequence. The <xref:Bonsai.Reactive.Condition> operator only
31+
passes an item in its input sequence if `Condition`'s internal logic is "True".
32+
In this case, `Condition` has no internal logic (which can be inspected by
33+
selecting the node and pressing <kbd>Ctrl+Enter</kbd>), so it uses the value of
34+
the Boolean in its input sequence to decide whether or not to pass a value. The
35+
<xref:Bonsai.Expressions.DoubleProperty> operator emits a value determined by
36+
its `Value` property whenever it receives an item in its input sequence. This
37+
value is used to determine the delay between triggering the stimulus and
38+
delivery of the stimulus. When `Double`'s `Value` property is set to zero, there
39+
is no such delay.
2540

26-
When the <xref:OpenEphys.Onix1.Headstage64OpticalStimulatorTrigger> operator receives a "True" value in its input
27-
sequence, a stimulus waveform is triggered. The waveform can be modified by editing the
28-
`Headstage64OpticalStimulatorTrig` operator's properties.
41+
When the <xref:OpenEphys.Onix1.Headstage64OpticalStimulatorTrigger> operator
42+
receives a "True" value in its input sequence, a stimulus waveform is triggered.
43+
The waveform can be modified by editing the `Headstage64OpticalStimulatorTrig`
44+
operator's properties.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
uid: hs64_stimulator-data
3+
title: Headstage 64 Stimulator Data
4+
---
5+
6+
The following excerpt from the Headstage 64 [example
7+
workflow](xref:hs64_workflow) demonstrates how to save the waveform parameters
8+
and the hardware timestamp of every stimulus delivered as described in the
9+
<xref:hs64_estim>, <xref:hs64_ostim>, and <xref:hs64_gpo-trigger> articles.
10+
11+
::: workflow
12+
![/workflows/hardware/hs64/stimulator-data.bonsai workflow](../../../workflows/hardware/hs64/stimulator-data.bonsai)
13+
:::
14+
15+
The <xref:OpenEphys.Onix1.Headstage64ElectricalStimulatorData> operator
16+
generates a sequence of
17+
[Headstage64ElectricalStimulatorDataFrames](xref:OpenEphys.Onix1.Headstage64ElectricalStimulatorDataFrame)
18+
which contain data about when an electrical stimulus was delivered and the
19+
corresponding electrical stimulation waveform. A frame is emitted when an
20+
electrical stimulus is delivered. In the Headstage 64 example workflow, the
21+
`Headstage64ElectricalStimulatorData`'s `DeviceName` property is set to
22+
"Headstage64/Headstage64ElectricalStimulator". This links the
23+
`Headstage64ElectricalStimulatorData` operator to the corresponding
24+
configuration operator. Frames from this operators are saved to a file named
25+
"estim_.csv" using a <xref:Bonsai.IO.CsvWriter>.
26+
27+
The <xref:OpenEphys.Onix1.Headstage64OpticalStimulatorData> operator generates a
28+
sequence of
29+
[Headstage64OpticalStimulatorDataFrames](xref:OpenEphys.Onix1.Headstage64OpticalStimulatorDataFrame)
30+
which contain data about when an optical stimulus was delivered and the
31+
corresponding optical stimulation waveform. A frame is emitted when an optical
32+
stimulus is delivered. In the Headstage 64 example workflow, the
33+
`Headstage64OpticalStimulatorData`'s `DeviceName` property is set to
34+
"Headstage64/Headstage64OpticalStimulator". This links the
35+
`Headstage64OpticalStimulatorData` operator to the corresponding configuration
36+
operator. Frames from this operators are saved to a file named "ostim_.csv"
37+
using a `CsvWriter`.
38+

articles/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
href: hardware/hs64/estim.md
7676
- name: Optical Stimulation
7777
href: hardware/hs64/ostim.md
78+
- name: GPO Trigger
79+
href: hardware/hs64/gpo-trigger.md
80+
- name: Stimulator Data
81+
href: hardware/hs64/stimulator-data.md
7882
- name: Memory Monitor
7983
href: hardware/hs64/memory-monitor.md
8084
- href: hardware/hs64/load-data.md

workflows/hardware/hs64/estim.bonsai

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,27 @@
2222
<Expression xsi:type="Combinator">
2323
<Combinator xsi:type="rx:DistinctUntilChanged" />
2424
</Expression>
25+
<Expression xsi:type="rx:Condition">
26+
<Workflow>
27+
<Nodes>
28+
<Expression xsi:type="WorkflowInput">
29+
<Name>Source1</Name>
30+
</Expression>
31+
<Expression xsi:type="WorkflowOutput" />
32+
</Nodes>
33+
<Edges>
34+
<Edge From="0" To="1" Label="Source1" />
35+
</Edges>
36+
</Workflow>
37+
</Expression>
38+
<Expression xsi:type="Combinator">
39+
<Combinator xsi:type="DoubleProperty">
40+
<Value>0</Value>
41+
</Combinator>
42+
</Expression>
2543
<Expression xsi:type="Combinator">
2644
<Combinator xsi:type="onix1:Headstage64ElectricalStimulatorTrigger">
2745
<onix1:DeviceName>Headstage64/Headstage64ElectricalStimulator</onix1:DeviceName>
28-
<onix1:Enable>true</onix1:Enable>
29-
<onix1:PowerEnable>true</onix1:PowerEnable>
30-
<onix1:TriggerDelay>0</onix1:TriggerDelay>
31-
<onix1:PhaseOneCurrent>100</onix1:PhaseOneCurrent>
32-
<onix1:InterPhaseCurrent>0</onix1:InterPhaseCurrent>
33-
<onix1:PhaseTwoCurrent>-100</onix1:PhaseTwoCurrent>
34-
<onix1:PhaseOneDuration>200</onix1:PhaseOneDuration>
35-
<onix1:InterPhaseInterval>0</onix1:InterPhaseInterval>
36-
<onix1:PhaseTwoDuration>200</onix1:PhaseTwoDuration>
37-
<onix1:InterPulseInterval>400</onix1:InterPulseInterval>
38-
<onix1:InterBurstInterval>0</onix1:InterBurstInterval>
39-
<onix1:BurstPulseCount>5</onix1:BurstPulseCount>
40-
<onix1:TrainBurstCount>1</onix1:TrainBurstCount>
4146
</Combinator>
4247
</Expression>
4348
</Nodes>
@@ -46,6 +51,8 @@
4651
<Edge From="1" To="2" Label="Source1" />
4752
<Edge From="2" To="3" Label="Source1" />
4853
<Edge From="3" To="4" Label="Source1" />
54+
<Edge From="4" To="5" Label="Source1" />
55+
<Edge From="5" To="6" Label="Source1" />
4956
</Edges>
5057
</Workflow>
5158
</WorkflowBuilder>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<WorkflowBuilder Version="2.9.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
5+
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
6+
xmlns="https://bonsai-rx.org/2018/workflow">
7+
<Workflow>
8+
<Nodes>
9+
<Expression xsi:type="Combinator">
10+
<Combinator xsi:type="onix1:DigitalInput">
11+
<onix1:DeviceName>BreakoutBoard/DigitalIO</onix1:DeviceName>
12+
</Combinator>
13+
</Expression>
14+
<Expression xsi:type="MemberSelector">
15+
<Selector>Buttons</Selector>
16+
</Expression>
17+
<Expression xsi:type="HasFlag">
18+
<Operand xsi:type="WorkflowProperty" TypeArguments="onix1:BreakoutButtonState">
19+
<Value>Square</Value>
20+
</Operand>
21+
</Expression>
22+
<Expression xsi:type="Combinator">
23+
<Combinator xsi:type="rx:DistinctUntilChanged" />
24+
</Expression>
25+
<Expression xsi:type="rx:Condition">
26+
<Workflow>
27+
<Nodes>
28+
<Expression xsi:type="WorkflowInput">
29+
<Name>Source1</Name>
30+
</Expression>
31+
<Expression xsi:type="WorkflowOutput" />
32+
</Nodes>
33+
<Edges>
34+
<Edge From="0" To="1" Label="Source1" />
35+
</Edges>
36+
</Workflow>
37+
</Expression>
38+
<Expression xsi:type="Combinator">
39+
<Combinator xsi:type="onix1:Headstage64GpoTrigger">
40+
<onix1:DeviceName>Headstage64/Headstage64PortController</onix1:DeviceName>
41+
</Combinator>
42+
</Expression>
43+
</Nodes>
44+
<Edges>
45+
<Edge From="0" To="1" Label="Source1" />
46+
<Edge From="1" To="2" Label="Source1" />
47+
<Edge From="2" To="3" Label="Source1" />
48+
<Edge From="3" To="4" Label="Source1" />
49+
<Edge From="4" To="5" Label="Source1" />
50+
</Edges>
51+
</Workflow>
52+
</WorkflowBuilder>

0 commit comments

Comments
 (0)