Skip to content

Commit d4def37

Browse files
authored
Merge pull request #427 from AllenNeuralDynamics/fix-non-null-distribution
Ensure distribution is null when re-hydrating site
2 parents 9046840 + 05b6c3e commit d4def37

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

src/Extensions/AddRewardSite.bonsai

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WorkflowBuilder Version="2.8.2"
2+
<WorkflowBuilder Version="2.9.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
55
xmlns:p1="clr-namespace:AindVrForagingDataSchema;assembly=Extensions"
66
xmlns:sys="clr-namespace:System;assembly=mscorlib"
77
xmlns:num="clr-namespace:Bonsai.Numerics;assembly=Bonsai.Numerics"
8+
xmlns:p2="clr-namespace:;assembly=Extensions"
89
xmlns="https://bonsai-rx.org/2018/workflow">
910
<Workflow>
1011
<Nodes>
@@ -180,6 +181,16 @@
180181
<Property Name="OperantLogic" />
181182
</PropertyMappings>
182183
</Expression>
184+
<Expression xsi:type="Combinator">
185+
<Combinator xsi:type="p2:NullDistribution" />
186+
</Expression>
187+
<Expression xsi:type="PropertyMapping">
188+
<PropertyMappings>
189+
<Property Name="Amount" />
190+
<Property Name="Probability" />
191+
<Property Name="Available" />
192+
</PropertyMappings>
193+
</Expression>
183194
<Expression xsi:type="Combinator">
184195
<Combinator xsi:type="p1:RewardSpecification" />
185196
</Expression>
@@ -188,7 +199,7 @@
188199
<Edges>
189200
<Edge From="0" To="1" Label="Source1" />
190201
<Edge From="1" To="2" Label="Source1" />
191-
<Edge From="2" To="16" Label="Source1" />
202+
<Edge From="2" To="18" Label="Source1" />
192203
<Edge From="3" To="4" Label="Source1" />
193204
<Edge From="4" To="5" Label="Source1" />
194205
<Edge From="5" To="6" Label="Source1" />
@@ -201,8 +212,10 @@
201212
<Edge From="12" To="13" Label="Source1" />
202213
<Edge From="13" To="14" Label="Source2" />
203214
<Edge From="14" To="15" Label="Source1" />
204-
<Edge From="15" To="16" Label="Source2" />
215+
<Edge From="15" To="18" Label="Source2" />
205216
<Edge From="16" To="17" Label="Source1" />
217+
<Edge From="17" To="18" Label="Source3" />
218+
<Edge From="18" To="19" Label="Source1" />
206219
</Edges>
207220
</Workflow>
208221
</Expression>

src/Extensions/NullDistribution.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Bonsai;
2+
using System;
3+
using System.ComponentModel;
4+
using System.Reactive.Linq;
5+
6+
[Combinator]
7+
[Description("Returns a sequence containing a null Distribution.")]
8+
[WorkflowElementCategory(ElementCategory.Source)]
9+
public class NullDistribution
10+
{
11+
public IObservable<AindVrForagingDataSchema.Distribution> Process()
12+
{
13+
return Observable.Return<AindVrForagingDataSchema.Distribution>(null);
14+
}
15+
}

0 commit comments

Comments
 (0)