Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
- Electrical/Optical Stimulator
- Add ScalarBuffer to BreakoutAnalogOutput
- Display workflows in templates
  • Loading branch information
bparks13 committed Jul 31, 2024
1 parent 1731c6d commit a46f0c0
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 30 deletions.
2 changes: 1 addition & 1 deletion articles/devices/electricalstimulator.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ workflow_file: ~/workflows/devices/ElectricalStimulator.bonsai

## Send Trigger

In the workflow, pressing the middle button on the mouse will send a trigger, delivering the stimulation waveform that is configured. The `MouseButtonDown` node can be found in the `Bonsai.Windows.Input` package.
While the workflow is running, pressing the middle button on the mouse will send a trigger delivering the stimulation waveform that is configured. The `MouseButtonDown` node can be found in the `Bonsai.Windows.Input` package.
16 changes: 16 additions & 0 deletions articles/devices/opticalstimulator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
uid: device-opticalstimulator
title: Headstage64OpticalStimulator
isGuide: true
isDevice: true
device: OpticalStimulator
headstage: Headstage64
workflow: true
workflow_file: ~/workflows/devices/OpticalStimulator.bonsai
---

<br>

## Send Trigger

While the workflow is running, pressing the middle button on the mouse will send a trigger delivering the stimulation waveform that is configured. The `MouseButtonDown` node can be found in the `Bonsai.Windows.Input` package.
1 change: 1 addition & 0 deletions articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- href: devices/breakoutanalogio.md
- href: devices/breakoutdigitalio.md
- href: devices/electricalstimulator.md
- href: devices/opticalstimulator.md
- href: devices/heartbeat.md
- href: devices/memorymonitor.md
- href: devices/neuropixelsv1e.md
Expand Down
9 changes: 9 additions & 0 deletions template/ManagedReference.extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,23 @@ function defineOperatorType(model){
for (let i = 0; i < inheritanceLength; i++){
if (model.inheritance[i].uid.includes('Bonsai.Source')){
operatorType.source = true;
operatorType.showWorkflow = true;
}
else if (model.inheritance[i].uid.includes('Bonsai.Sink')){
operatorType.sink = true;
operatorType.showWorkflow = true;
}
else if (model.inheritance[i].uid.includes('Bonsai.Combinator')){
operatorType.combinator = true;
operatorType.showWorkflow = true;
}
else if (model.inheritance[i].uid.includes('HubDeviceFactory')){
operatorType.hub = true;
operatorType.showWorkflow = true;
}
else if (model.inheritance[i].uid.includes('DeviceFactory')){
operatorType.device = true;
operatorType.showWorkflow = true;
}
}
}
Expand Down Expand Up @@ -359,6 +364,10 @@ exports.preTransform = function (model) {
model.oe.operatorType = 'combinator';
}

if (operatorType.hasOwnProperty('showWorkflow')) {
model.showWorkflow = operatorType.showWorkflow;
}

properties = defineProperties(model);
if (properties.length > 0){
model.oe.hasProperties = true;
Expand Down
32 changes: 9 additions & 23 deletions workflows/devices/ElectricalStimulator.bonsai
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.1"
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:onix="clr-namespace:OpenEphys.Onix;assembly=OpenEphys.Onix"
xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
Expand All @@ -20,7 +19,6 @@
<onix:DeviceName>Headstage64/Rhd2164</onix:DeviceName>
<onix:DeviceAddress>256</onix:DeviceAddress>
<onix:Enable>true</onix:Enable>
<onix:AmplifierDataFormat>Unsigned</onix:AmplifierDataFormat>
<onix:DspCutoff>Dsp146mHz</onix:DspCutoff>
<onix:AnalogLowCutoff>Low100mHz</onix:AnalogLowCutoff>
<onix:AnalogHighCutoff>High10000Hz</onix:AnalogHighCutoff>
Expand All @@ -39,6 +37,10 @@
<onix:DeviceName>Headstage64/Headstage64ElectricalStimulator</onix:DeviceName>
<onix:DeviceAddress>259</onix:DeviceAddress>
</onix:ElectricalStimulator>
<onix:OpticalStimulator>
<onix:DeviceName>Headstage64/Headstage64OpticalStimulator</onix:DeviceName>
<onix:DeviceAddress>260</onix:DeviceAddress>
</onix:OpticalStimulator>
<onix:Port>PortA</onix:Port>
<onix:PortVoltage xsi:nil="true" />
</Combinator>
Expand All @@ -59,46 +61,30 @@
<Value>true</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>false</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Delay">
<rx:DueTime>PT0.5S</rx:DueTime>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Merge" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:Headstage64ElectricalStimulatorTrigger">
<onix:DeviceName>Headstage64/Headstage64ElectricalStimulator</onix:DeviceName>
<onix:Enable>true</onix:Enable>
<onix:PowerEnable>false</onix:PowerEnable>
<onix:TriggerDelay>0</onix:TriggerDelay>
<onix:PhaseOneCurrent>0</onix:PhaseOneCurrent>
<onix:InterPhaseCurrent>0</onix:InterPhaseCurrent>
<onix:PhaseTwoCurrent>0</onix:PhaseTwoCurrent>
<onix:TrainDelay>0</onix:TrainDelay>
<onix:PhaseOneDuration>0</onix:PhaseOneDuration>
<onix:InterPhaseInterval>0</onix:InterPhaseInterval>
<onix:PhaseTwoDuration>0</onix:PhaseTwoDuration>
<onix:InterPulseInterval>0</onix:InterPulseInterval>
<onix:InterBurstInterval>0</onix:InterBurstInterval>
<onix:BurstPulseCount>0</onix:BurstPulseCount>
<onix:TrainBurstCount>0</onix:TrainBurstCount>
<onix:PowerEnable>false</onix:PowerEnable>
</Combinator>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="3" To="5" Label="Source1" />
<Edge From="4" To="7" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source2" />
<Edge From="7" To="8" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
87 changes: 87 additions & 0 deletions workflows/devices/OpticalStimulator.bonsai
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:onix="clr-namespace:OpenEphys.Onix;assembly=OpenEphys.Onix"
xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:CreateContext">
<onix:Driver>riffa</onix:Driver>
<onix:Index>0</onix:Index>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:ConfigureHeadstage64">
<onix:Name>Headstage64</onix:Name>
<onix:Rhd2164>
<onix:DeviceName>Headstage64/Rhd2164</onix:DeviceName>
<onix:DeviceAddress>256</onix:DeviceAddress>
<onix:Enable>true</onix:Enable>
<onix:DspCutoff>Dsp146mHz</onix:DspCutoff>
<onix:AnalogLowCutoff>Low100mHz</onix:AnalogLowCutoff>
<onix:AnalogHighCutoff>High10000Hz</onix:AnalogHighCutoff>
</onix:Rhd2164>
<onix:Bno055>
<onix:DeviceName>Headstage64/Bno055</onix:DeviceName>
<onix:DeviceAddress>257</onix:DeviceAddress>
<onix:Enable>true</onix:Enable>
</onix:Bno055>
<onix:TS4231>
<onix:DeviceName>Headstage64/TS4231</onix:DeviceName>
<onix:DeviceAddress>258</onix:DeviceAddress>
<onix:Enable>false</onix:Enable>
</onix:TS4231>
<onix:ElectricalStimulator>
<onix:DeviceName>Headstage64/Headstage64ElectricalStimulator</onix:DeviceName>
<onix:DeviceAddress>259</onix:DeviceAddress>
</onix:ElectricalStimulator>
<onix:OpticalStimulator>
<onix:DeviceName>Headstage64/Headstage64OpticalStimulator</onix:DeviceName>
<onix:DeviceAddress>260</onix:DeviceAddress>
</onix:OpticalStimulator>
<onix:Port>PortA</onix:Port>
<onix:PortVoltage xsi:nil="true" />
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:StartAcquisition">
<onix:ReadSize>2048</onix:ReadSize>
<onix:WriteSize>2048</onix:WriteSize>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="wie:MouseButtonDown">
<wie:Filter>Middle</wie:Filter>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>true</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:Headstage64OpticalStimulatorTrigger">
<onix:DeviceName>Headstage64/Headstage64OpticalStimulator</onix:DeviceName>
<onix:Enable>true</onix:Enable>
<onix:Delay>0</onix:Delay>
<onix:MaxCurrent>100</onix:MaxCurrent>
<onix:ChannelOneCurrent>100</onix:ChannelOneCurrent>
<onix:ChannelTwoCurrent>0</onix:ChannelTwoCurrent>
<onix:PulseDuration>5</onix:PulseDuration>
<onix:PulsesPerSecond>50</onix:PulsesPerSecond>
<onix:PulsesPerBurst>20</onix:PulsesPerBurst>
<onix:InterBurstInterval>0</onix:InterBurstInterval>
<onix:BurstsPerTrain>1</onix:BurstsPerTrain>
</Combinator>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
23 changes: 21 additions & 2 deletions workflows/operators/BreakoutAnalogOutput.bonsai
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
xmlns:onix="clr-namespace:OpenEphys.Onix;assembly=OpenEphys.Onix"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:ScalarBuffer">
<dsp:Size>
<dsp:Width>12</dsp:Width>
<dsp:Height>1</dsp:Height>
</dsp:Size>
<dsp:Depth>F32</dsp:Depth>
<dsp:Channels>1</dsp:Channels>
<dsp:Value>
<dsp:Val0>1</dsp:Val0>
<dsp:Val1>0</dsp:Val1>
<dsp:Val2>0</dsp:Val2>
<dsp:Val3>0</dsp:Val3>
</dsp:Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:BreakoutAnalogOutput">
<onix:DataType>S16</onix:DataType>
<onix:DataType>Volts</onix:DataType>
</Combinator>
</Expression>
</Nodes>
<Edges />
<Edges>
<Edge From="0" To="1" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
18 changes: 16 additions & 2 deletions workflows/operators/Headstage64ElectricalStimulatorTrigger.bonsai
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.1"
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
xmlns:onix="clr-namespace:OpenEphys.Onix;assembly=OpenEphys.Onix"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="wie:MouseButtonDown">
<wie:Filter>Middle</wie:Filter>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>true</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:Headstage64ElectricalStimulatorTrigger">
<onix:DeviceName>Headstage64/Headstage64ElectricalStimulator</onix:DeviceName>
Expand All @@ -24,6 +35,9 @@
</Combinator>
</Expression>
</Nodes>
<Edges />
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
18 changes: 16 additions & 2 deletions workflows/operators/Headstage64OpticalStimulatorTrigger.bonsai
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.1"
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
xmlns:onix="clr-namespace:OpenEphys.Onix;assembly=OpenEphys.Onix"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="wie:MouseButtonDown">
<wie:Filter>Middle</wie:Filter>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>true</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="onix:Headstage64OpticalStimulatorTrigger">
<onix:DeviceName>Headstage64/Headstage64OpticalStimulator</onix:DeviceName>
Expand All @@ -21,6 +32,9 @@
</Combinator>
</Expression>
</Nodes>
<Edges />
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>

0 comments on commit a46f0c0

Please sign in to comment.