-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from AllenNeuralDynamics/feature-add-device-m…
…etadata Add operator to log device metadata
- Loading branch information
Showing
21 changed files
with
366 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule harp.device.cuttlefish
updated
4 files
Submodule harp.device.environment-sensor
updated
4 files
Submodule harp.device.lickety-split
updated
4 files
Submodule harp.device.sniff-detector
updated
4 files
Submodule harp.device.treadmill
updated
from efe3f0 to b148f4
Submodule harp.device.white-rabbit
updated
4 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<WorkflowBuilder Version="2.8.5" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:p1="clr-namespace:AllenNeuralDynamics.LicketySplit;assembly=AllenNeuralDynamics.LicketySplit" | ||
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp" | ||
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core" | ||
xmlns="https://bonsai-rx.org/2018/workflow"> | ||
<Workflow> | ||
<Nodes> | ||
<Expression xsi:type="IncludeWorkflow" Path="AllenNeuralDynamics.Core:GenerateRootLoggingPath.bonsai"> | ||
<RootFolder xsi:nil="true" /> | ||
<Subject xsi:nil="true" /> | ||
<DateTimeOffset>0001-01-01T00:00:00.0000000+00:00</DateTimeOffset> | ||
<SubjectName>LoggingRootPath</SubjectName> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="p1:Device"> | ||
<harp:OperationMode>Active</harp:OperationMode> | ||
<harp:OperationLed>On</harp:OperationLed> | ||
<harp:DumpRegisters>true</harp:DumpRegisters> | ||
<harp:VisualIndicators>On</harp:VisualIndicators> | ||
<harp:Heartbeat>Disabled</harp:Heartbeat> | ||
<harp:IgnoreErrors>false</harp:IgnoreErrors> | ||
<harp:PortName>COMx</harp:PortName> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="rx:PublishSubject"> | ||
<Name>LicketySplitEvents</Name> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>LicketySplitEvents</Name> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="p1:GetMetadata" /> | ||
</Expression> | ||
<Expression xsi:type="PropertyMapping"> | ||
<PropertyMappings> | ||
<Property Name="DeviceMetadata" /> | ||
</PropertyMappings> | ||
</Expression> | ||
<Expression xsi:type="IncludeWorkflow" Path="AllenNeuralDynamics.Core:LogHarpDeviceWithMetadata.bonsai"> | ||
<DeviceMetadata /> | ||
<Modality>Behavior</Modality> | ||
<DeviceName>Lickometer</DeviceName> | ||
</Expression> | ||
</Nodes> | ||
<Edges> | ||
<Edge From="1" To="2" Label="Source1" /> | ||
<Edge From="3" To="6" Label="Source1" /> | ||
<Edge From="4" To="5" Label="Source1" /> | ||
<Edge From="5" To="6" Label="Source2" /> | ||
</Edges> | ||
</Workflow> | ||
</WorkflowBuilder> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
185 changes: 185 additions & 0 deletions
185
src/AllenNeuralDynamics.Core/LogHarpDeviceWithMetadata.bonsai
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<WorkflowBuilder Version="2.8.5" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp" | ||
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core" | ||
xmlns:p1="clr-namespace:AllenNeuralDynamics.Core;assembly=AllenNeuralDynamics.Core" | ||
xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions" | ||
xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System" | ||
xmlns="https://bonsai-rx.org/2018/workflow"> | ||
<Workflow> | ||
<Nodes> | ||
<Expression xsi:type="WorkflowInput" TypeArguments="harp:HarpMessage"> | ||
<Name>Source1</Name> | ||
</Expression> | ||
<Expression xsi:type="ExternalizedMapping"> | ||
<Property Name="DeviceMetadata" /> | ||
<Property Name="Modality" /> | ||
<Property Name="DeviceName" /> | ||
</Expression> | ||
<Expression xsi:type="rx:Defer"> | ||
<Name>LogHarpDeviceWithMetadata</Name> | ||
<Workflow> | ||
<Nodes> | ||
<Expression xsi:type="WorkflowInput" TypeArguments="harp:HarpMessage"> | ||
<Name>Source1</Name> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="harp:GroupByRegister" /> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>PathConstructor</Name> | ||
</Expression> | ||
<Expression xsi:type="Format"> | ||
<Format>{0}/{1}.harp/{2}.bin</Format> | ||
<Selector>Item1,Item2.DeviceName,Item2.HarpDeviceName</Selector> | ||
</Expression> | ||
<Expression xsi:type="PropertyMapping"> | ||
<PropertyMappings> | ||
<Property Name="FileName" /> | ||
</PropertyMappings> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="harp:MessageWriter"> | ||
<harp:FileName>//_20240705T174448\behavior/.harp/.bin</harp:FileName> | ||
<harp:Suffix>None</harp:Suffix> | ||
<harp:Buffered>true</harp:Buffered> | ||
<harp:Overwrite>false</harp:Overwrite> | ||
<harp:FilterType>Include</harp:FilterType> | ||
<harp:MessageType xsi:nil="true" /> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="WorkflowOutput" /> | ||
<Expression xsi:type="ExternalizedMapping"> | ||
<Property Name="Value" DisplayName="DeviceMetadata" /> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="StringProperty"> | ||
<Value /> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="rx:Take"> | ||
<rx:Count>1</rx:Count> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="rx:AsyncSubject"> | ||
<Name>DeviceMetadata</Name> | ||
</Expression> | ||
<Expression xsi:type="ExternalizedMapping"> | ||
<Property Name="Name" DisplayName="SubjectName" /> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>LoggingRootPath</Name> | ||
</Expression> | ||
<Expression xsi:type="ExternalizedMapping"> | ||
<Property Name="Modality" /> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="p1:AppendModalitySuffix"> | ||
<p1:Modality>Behavior</p1:Modality> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="ExternalizedMapping"> | ||
<Property Name="Value" DisplayName="DeviceName" /> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="StringProperty"> | ||
<Value /> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>DeviceMetadata</Name> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="rx:Take"> | ||
<rx:Count>1</rx:Count> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="Parse"> | ||
<Pattern>device: %swhoAmI</Pattern> | ||
</Expression> | ||
<Expression xsi:type="scr:ExpressionTransform"> | ||
<scr:Name>Trim</scr:Name> | ||
<scr:Expression>it.Trim()</scr:Expression> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="rx:Zip" /> | ||
</Expression> | ||
<Expression xsi:type="scr:ExpressionTransform"> | ||
<scr:Name>Rename</scr:Name> | ||
<scr:Expression>new(Item1 as DeviceName, Item2 as HarpDeviceName)</scr:Expression> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="rx:Zip" /> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="rx:Take"> | ||
<rx:Count>1</rx:Count> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="rx:AsyncSubject"> | ||
<Name>PathConstructor</Name> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>DeviceMetadata</Name> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>PathConstructor</Name> | ||
</Expression> | ||
<Expression xsi:type="Format"> | ||
<Format>{0}/{1}.harp/device.yml</Format> | ||
<Selector>Item1,Item2.DeviceName</Selector> | ||
</Expression> | ||
<Expression xsi:type="PropertyMapping"> | ||
<PropertyMappings> | ||
<Property Name="Path" /> | ||
</PropertyMappings> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="io:WriteAllText"> | ||
<io:Overwrite>false</io:Overwrite> | ||
<io:Append>false</io:Append> | ||
</Combinator> | ||
</Expression> | ||
</Nodes> | ||
<Edges> | ||
<Edge From="0" To="1" Label="Source1" /> | ||
<Edge From="1" To="5" Label="Source1" /> | ||
<Edge From="2" To="3" Label="Source1" /> | ||
<Edge From="3" To="4" Label="Source1" /> | ||
<Edge From="4" To="5" Label="Source2" /> | ||
<Edge From="5" To="6" Label="Source1" /> | ||
<Edge From="7" To="8" Label="Source1" /> | ||
<Edge From="8" To="9" Label="Source1" /> | ||
<Edge From="9" To="10" Label="Source1" /> | ||
<Edge From="11" To="12" Label="Source1" /> | ||
<Edge From="12" To="14" Label="Source1" /> | ||
<Edge From="13" To="14" Label="Source2" /> | ||
<Edge From="14" To="23" Label="Source1" /> | ||
<Edge From="15" To="16" Label="Source1" /> | ||
<Edge From="16" To="21" Label="Source1" /> | ||
<Edge From="17" To="18" Label="Source1" /> | ||
<Edge From="18" To="19" Label="Source1" /> | ||
<Edge From="19" To="20" Label="Source1" /> | ||
<Edge From="20" To="21" Label="Source2" /> | ||
<Edge From="21" To="22" Label="Source1" /> | ||
<Edge From="22" To="23" Label="Source2" /> | ||
<Edge From="23" To="24" Label="Source1" /> | ||
<Edge From="24" To="25" Label="Source1" /> | ||
<Edge From="26" To="30" Label="Source1" /> | ||
<Edge From="27" To="28" Label="Source1" /> | ||
<Edge From="28" To="29" Label="Source1" /> | ||
<Edge From="29" To="30" Label="Source2" /> | ||
</Edges> | ||
</Workflow> | ||
</Expression> | ||
<Expression xsi:type="WorkflowOutput" /> | ||
</Nodes> | ||
<Edges> | ||
<Edge From="0" To="2" Label="Source1" /> | ||
<Edge From="1" To="2" Label="Source2" /> | ||
<Edge From="2" To="3" Label="Source1" /> | ||
</Edges> | ||
</Workflow> | ||
</WorkflowBuilder> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.