Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.1.1 #18

Merged
merged 8 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ExamplesWorkflows/UclaMiniCam.bonsai
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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:p1="clr-namespace:OpenEphys.Bonsai.Miniscope;assembly=OpenEphys.Bonsai.Miniscope"
xmlns:p1="clr-namespace:OpenEphys.Miniscope;assembly=OpenEphys.Miniscope"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
Expand All @@ -10,8 +10,8 @@
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:UclaMiniCam">
<p1:Index>2</p1:Index>
<p1:LedBrightness>10</p1:LedBrightness>
<p1:Index>0</p1:Index>
<p1:LedBrightness>0</p1:LedBrightness>
<p1:SensorGain>Low</p1:SensorGain>
<p1:FramesPerSecond>Fps50</p1:FramesPerSecond>
</Combinator>
Expand Down
8 changes: 4 additions & 4 deletions ExamplesWorkflows/UclaMiniCamTriggered.bonsai
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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:p1="clr-namespace:OpenEphys.Bonsai.Miniscope;assembly=OpenEphys.Bonsai.Miniscope"
xmlns:p1="clr-namespace:OpenEphys.Miniscope;assembly=OpenEphys.Miniscope"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
Expand All @@ -10,8 +10,8 @@
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:UclaMiniCam">
<p1:Index>2</p1:Index>
<p1:LedBrightness>10</p1:LedBrightness>
<p1:Index>0</p1:Index>
<p1:LedBrightness>0</p1:LedBrightness>
<p1:SensorGain>Low</p1:SensorGain>
<p1:FramesPerSecond>Fps50</p1:FramesPerSecond>
</Combinator>
Expand Down
2 changes: 1 addition & 1 deletion ExamplesWorkflows/UclaMiniscopeV4.bonsai
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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:p1="clr-namespace:OpenEphys.Miniscope;assembly=OpenEphys.Miniscope"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
Expand Down
147 changes: 14 additions & 133 deletions ExamplesWorkflows/UclaMiniscopeV4Commutated.bonsai
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?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:p1="clr-namespace:OpenEphys.Bonsai.Miniscope;assembly=OpenEphys.Bonsai.Miniscope"
xmlns:p1="clr-namespace:OpenEphys.Miniscope;assembly=OpenEphys.Miniscope"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
xmlns:ipy="clr-namespace:Bonsai.Scripting.IronPython;assembly=Bonsai.Scripting.IronPython"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:UclaMiniscopeV4">
<p1:Index>1</p1:Index>
<p1:Index>0</p1:Index>
<p1:LedBrightness>0</p1:LedBrightness>
<p1:Focus>0</p1:Focus>
<p1:SensorGain>Medium</p1:SensorGain>
<p1:FramesPerSecond>Fps15</p1:FramesPerSecond>
<p1:SensorGain>Low</p1:SensorGain>
<p1:FramesPerSecond>Fps30</p1:FramesPerSecond>
<p1:LedRespectsTrigger>false</p1:LedRespectsTrigger>
</Combinator>
</Expression>
Expand Down Expand Up @@ -56,130 +54,14 @@
<Expression xsi:type="MemberSelector">
<Selector>Quaternion</Selector>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="PortName" DisplayName="Commutator Port" />
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>Commutator</Name>
<Description>Drives ONIX Commutator from BNO055 Quaterion data. Pressing down/up keys will manually turn the commutator, overrding the BNO055 heading input.
</Description>
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="wie:KeyDown">
<wie:Filter>Up</wie:Filter>
<wie:SuppressRepetitions>false</wie:SuppressRepetitions>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="StringProperty">
<Value>"{turn : 0.1}"</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="wie:KeyDown">
<wie:Filter>Down</wie:Filter>
<wie:SuppressRepetitions>false</wie:SuppressRepetitions>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="StringProperty">
<Value>"{turn : -0.1}"</Value>
</Combinator>
</Expression>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="ipy:PythonTransform">
<ipy:Name>Heading</ipy:Name>
<ipy:Script>from math import atan2
@returns(float)
def process(value):

siny_cosp = 2 * (value.W * value.Z + value.x * value.y);
cosy_cosp = 1 - 2 * (value.y * value.y + value.z * value.z);

return atan2(siny_cosp, cosy_cosp)</ipy:Script>
</Expression>
<Expression xsi:type="io:CsvWriter">
<io:FileName>heading_.csv</io:FileName>
<io:Append>false</io:Append>
<io:Overwrite>false</io:Overwrite>
<io:Suffix>Timestamp</io:Suffix>
<io:IncludeHeader>false</io:IncludeHeader>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Timer">
<rx:DueTime>PT0S</rx:DueTime>
<rx:Period>PT0.1S</rx:Period>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Sample" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Skip">
<rx:Count>1</rx:Count>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Zip" />
</Expression>
<Expression xsi:type="ipy:PythonTransform">
<ipy:Script>from math import pi

@returns(str)
def process(value):


last = value.Item2

curr = value.Item1
a1 = curr + 2 * pi
a2 = curr - 2 * pi
pos = [curr, a1, a2]

delta = [abs(x - last) for x in pos]

p = pos[delta.index(min(delta))]

turn = (p - last) / (2 * pi)

return "{turn : %s}" % turn</ipy:Script>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Merge" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="PortName" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="io:SerialStringWrite">
<io:PortName>COM3</io:PortName>
<io:NewLine>\r\n</io:NewLine>
</Combinator>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="12" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="12" Label="Source2" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="8" Label="Source1" />
<Edge From="7" To="8" Label="Source2" />
<Edge From="8" To="9" Label="Source1" />
<Edge From="8" To="10" Label="Source1" />
<Edge From="9" To="10" Label="Source2" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="12" Label="Source3" />
<Edge From="12" To="14" Label="Source1" />
<Edge From="13" To="14" Label="Source2" />
<Edge From="14" To="15" Label="Source1" />
</Edges>
</Workflow>
<Expression xsi:type="IncludeWorkflow" Path="OpenEphys.Commutator:AutoCommutator.bonsai">
<RotationAxis>
<X>0</X>
<Y>0</Y>
<Z>1</Z>
</RotationAxis>
<LedEnable>true</LedEnable>
<PortName>COM3</PortName>
</Expression>
</Nodes>
<Edges>
Expand All @@ -189,8 +71,7 @@ def process(value):
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="6" To="8" Label="Source1" />
<Edge From="7" To="8" Label="Source2" />
<Edge From="6" To="7" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
10 changes: 5 additions & 5 deletions ExamplesWorkflows/UclaMiniscopeV4Triggered.bonsai
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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:p1="clr-namespace:OpenEphys.Bonsai.Miniscope;assembly=OpenEphys.Bonsai.Miniscope"
xmlns:p1="clr-namespace:OpenEphys.Miniscope;assembly=OpenEphys.Miniscope"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
Expand All @@ -10,11 +10,11 @@
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:UclaMiniscopeV4">
<p1:Index>1</p1:Index>
<p1:Index>0</p1:Index>
<p1:LedBrightness>0</p1:LedBrightness>
<p1:Focus>0</p1:Focus>
<p1:SensorGain>Medium</p1:SensorGain>
<p1:FramesPerSecond>Fps15</p1:FramesPerSecond>
<p1:SensorGain>Low</p1:SensorGain>
<p1:FramesPerSecond>Fps30</p1:FramesPerSecond>
<p1:LedRespectsTrigger>false</p1:LedRespectsTrigger>
</Combinator>
</Expression>
Expand Down
16 changes: 16 additions & 0 deletions OpenEphys.Miniscope.Design/OpenEphys.Miniscope.Design.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ItemGroup>
<PackageReference Include="Bonsai.Design" Version="2.8.5" />
<PackageReference Include="Bonsai.Design.Visualizers" Version="2.8.0" />
<PackageReference Include="OpenCV.Net" Version="3.4.2" />
<PackageReference Include="ZedGraph" Version="5.1.7" />
</ItemGroup>

Expand All @@ -26,4 +27,19 @@
<Folder Include="Resources\" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
63 changes: 63 additions & 0 deletions OpenEphys.Miniscope.Design/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading