Skip to content

Commit

Permalink
Merge pull request #139 from SainsburyWellcomeCentre/gl-dev
Browse files Browse the repository at this point in the history
Refactor embedded operators to use latest workflow modules
  • Loading branch information
glopesdev authored Aug 18, 2023
2 parents ef7e3af + bcd446d commit 29a51cf
Show file tree
Hide file tree
Showing 32 changed files with 352 additions and 383 deletions.
34 changes: 17 additions & 17 deletions src/Aeon.Acquisition/ActivityTracking.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.6.2"
<WorkflowBuilder Version="2.8.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision"
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
Expand All @@ -15,12 +15,6 @@
<Expression xsi:type="MemberSelector">
<Selector>Value.Image</Selector>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="ThresholdValue" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="TrackingEvents" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Regions" />
</Expression>
Expand All @@ -35,6 +29,9 @@
</cv:FillValue>
</Combinator>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="ThresholdValue" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="cv:BackgroundSubtraction">
<cv:BackgroundFrames>1</cv:BackgroundFrames>
Expand All @@ -59,25 +56,28 @@
<Expression xsi:type="Combinator">
<Combinator xsi:type="aeon:CreateTimestamped" />
</Expression>
<Expression xsi:type="PublishSubject">
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="TrackingEvents" />
</Expression>
<Expression xsi:type="rx:PublishSubject">
<Name>ActivityEvents</Name>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="0" To="9" Label="Source1" />
<Edge From="1" To="5" Label="Source1" />
<Edge From="2" To="6" Label="Source2" />
<Edge From="3" To="12" Label="Source2" />
<Edge From="0" To="8" Label="Source1" />
<Edge From="1" To="3" Label="Source1" />
<Edge From="2" To="3" Label="Source2" />
<Edge From="3" To="5" Label="Source1" />
<Edge From="4" To="5" Label="Source2" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" 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="Source1" />
<Edge From="7" To="9" Label="Source1" />
<Edge From="8" To="9" Label="Source2" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="12" Label="Source1" />
<Edge From="11" To="12" Label="Source2" />
<Edge From="12" To="13" Label="Source1" />
</Edges>
</Workflow>
Expand Down
4 changes: 3 additions & 1 deletion src/Aeon.Acquisition/Aeon.Acquisition.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageTags>Bonsai Rx Project Aeon Acquisition</PackageTags>
<TargetFramework>net472</TargetFramework>
<VersionPrefix>0.4.0</VersionPrefix>
<VersionSuffix>build230818</VersionSuffix>
<VersionSuffix>build230821</VersionSuffix>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,6 +18,7 @@
<PackageReference Include="Bonsai.Core" Version="2.8.1" />
<PackageReference Include="Bonsai.Audio" Version="2.8.0" />
<PackageReference Include="Bonsai.Harp" Version="3.5.0" />
<PackageReference Include="Harp.CameraControllerGen2" Version="0.1.0" />
<PackageReference Include="Harp.OutputExpander" Version="0.2.0-build230803" />
<PackageReference Include="Bonsai.Osc" Version="2.7.0" />
<PackageReference Include="Bonsai.Pylon" Version="0.3.0" />
Expand All @@ -27,6 +28,7 @@
<PackageReference Include="Bonsai.System" Version="2.8.0" />
<PackageReference Include="Bonsai.Scripting.Expressions" Version="2.8.0" />
<PackageReference Include="Bonsai.ZeroMQ" Version="0.2.0" />
<PackageReference Include="Harp.Synchronizer" Version="0.1.0" />
<PackageReference Include="LibGit2Sharp" Version="0.25.4" />
<PackageReference Include="Bonsai.Vision" Version="2.8.0" />
<PackageReference Include="MathNet.Numerics" Version="4.5.1" />
Expand Down
7 changes: 3 additions & 4 deletions src/Aeon.Acquisition/AeonAudio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ namespace Aeon.Acquisition
[Description("Configures and initializes a software timestamped audio capture.")]
public class AeonAudio : AudioCapture
{
IEnumerable<Timestamped<Mat>> TimestampBuffers(IEnumerable<Mat> buffers, HarpMessage message)
IEnumerable<Timestamped<Mat>> TimestampBuffers(IEnumerable<Mat> buffers, double timestamp)
{
var timestamp = message.GetTimestamp();
foreach (var buffer in buffers)
{
yield return Timestamped.Create(buffer, timestamp);
}
}

public IObservable<Timestamped<Mat>> Generate(IObservable<HarpMessage> source)
public IObservable<Timestamped<Mat>> Generate<TPayload>(IObservable<Timestamped<TPayload>> source)
{
var data = Generate();
return source.Publish(triggers =>
data.Buffer(triggers)
.Zip(triggers, (list, trigger) => TimestampBuffers(list, trigger))
.Zip(triggers, (list, trigger) => TimestampBuffers(list, trigger.Seconds))
.SelectMany(x => x));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Aeon.Acquisition/AudioSource.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.7.0"
<WorkflowBuilder Version="2.8.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aeon="clr-namespace:Aeon.Acquisition;assembly=Aeon.Acquisition"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
Expand Down
Loading

0 comments on commit 29a51cf

Please sign in to comment.