Skip to content

Commit

Permalink
Ensure null RewardSpecification is handled
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-f-cruz committed Jul 3, 2024
1 parent 89b8b11 commit 415f104
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/Extensions/InstantiateSite.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,10 @@ it.Item2 as EntryPosition)</scr:Expression>
<Expression xsi:type="MemberSelector">
<Selector>TreadmillSpecification</Selector>
</Expression>
<Expression xsi:type="IncludeWorkflow" Path="AllenNeuralDynamics.Core:FilterNotNull.bonsai" />
<Expression xsi:type="MemberSelector">
<Selector>Friction</Selector>
</Expression>
<Expression xsi:type="IncludeWorkflow" Path="AllenNeuralDynamics.Core:FilterNotNull.bonsai" />
<Expression xsi:type="SubscribeSubject">
<Name>RngSeed</Name>
</Expression>
Expand All @@ -1112,7 +1112,9 @@ it.Item2 as EntryPosition)</scr:Expression>
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:SampleDistribution" />
<Combinator xsi:type="p1:SampleDistribution">
<p1:RandomSource />
</Combinator>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>TreadmillFriction</Name>
Expand Down
186 changes: 183 additions & 3 deletions src/vr-foraging.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -5212,8 +5212,16 @@ Value as IsStopped)</scr:Expression>
<Expression xsi:type="SubscribeSubject">
<Name>ThisPatch</Name>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>ActivePatch</Name>
<Expression xsi:type="scr:ExpressionTransform">
<scr:Expression>it != null</scr:Expression>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Take">
<rx:Count>1</rx:Count>
</Combinator>
</Expression>
<Expression xsi:type="rx:AsyncSubject">
<Name>HasRewardSpec</Name>
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>DetermineDepletionRule</Name>
Expand Down Expand Up @@ -5523,6 +5531,70 @@ Value as IsStopped)</scr:Expression>
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>HasRewardSpec</Name>
</Expression>
<Expression xsi:type="rx:Condition">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:SubscribeWhen" />
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>DefaultTo0</Name>
<Workflow>
<Nodes>
<Expression xsi:type="SubscribeSubject">
<Name>HasRewardSpec</Name>
</Expression>
<Expression xsi:type="BitwiseNot" />
<Expression xsi:type="rx:Condition">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="FloatProperty">
<Value>0</Value>
</Combinator>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>DepletionVariable</Name>
</Expression>
<Expression xsi:type="Unit" />
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Concat" />
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>DetermineRewardSpecs</Name>
<Workflow>
Expand Down Expand Up @@ -5622,6 +5694,84 @@ Value as IsStopped)</scr:Expression>
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>HasRewardSpec</Name>
</Expression>
<Expression xsi:type="rx:Condition">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:SubscribeWhen" />
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>DefaultTo0</Name>
<Workflow>
<Nodes>
<Expression xsi:type="SubscribeSubject">
<Name>HasRewardSpec</Name>
</Expression>
<Expression xsi:type="BitwiseNot" />
<Expression xsi:type="rx:Condition">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="FloatProperty">
<Value>0</Value>
</Combinator>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>PatchRewardAvailable</Name>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>PatchRewardAmount</Name>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>PatchRewardProbability</Name>
</Expression>
<Expression xsi:type="Unit" />
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Concat" />
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>ThisPatch</Name>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>ActivePatch</Name>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>DepletionVariable</Name>
</Expression>
Expand All @@ -5645,8 +5795,21 @@ Value as IsStopped)</scr:Expression>
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="16" To="17" Label="Source1" />
<Edge From="13" To="14" Label="Source1" />
<Edge From="14" To="15" Label="Source1" />
<Edge From="16" To="19" Label="Source1" />
<Edge From="17" To="18" Label="Source1" />
<Edge From="18" To="19" Label="Source2" />
<Edge From="19" To="21" Label="Source1" />
<Edge From="20" To="21" Label="Source2" />
<Edge From="22" To="25" Label="Source1" />
<Edge From="23" To="24" Label="Source1" />
<Edge From="24" To="25" Label="Source2" />
<Edge From="25" To="27" Label="Source1" />
<Edge From="26" To="27" Label="Source2" />
<Edge From="28" To="29" Label="Source1" />
<Edge From="30" To="31" Label="Source1" />
<Edge From="31" To="32" Label="Source1" />
</Edges>
</Workflow>
</Expression>
Expand Down Expand Up @@ -6084,6 +6247,22 @@ Value as IsStopped)</scr:Expression>
<Expression xsi:type="MulticastSubject">
<Name>HarpOlfactometerCommands</Name>
</Expression>
<Expression xsi:type="PropertySource" TypeArguments="p10:CreateDO1SyncPayload,p10:DO1SyncConfig">
<MemberName>DO1Sync</MemberName>
<Value>None</Value>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p14:CreateOdorMix">
<p14:channel3AsCarrier>false</p14:channel3AsCarrier>
<p14:PercentageChannel0>0</p14:PercentageChannel0>
<p14:PercentageChannel1>0</p14:PercentageChannel1>
<p14:PercentageChannel2>0</p14:PercentageChannel2>
<p14:PercentageChannel3>0</p14:PercentageChannel3>
<p14:Channel3AsCarrier>false</p14:Channel3AsCarrier>
<p14:TargetOdorFlow>100</p14:TargetOdorFlow>
<p14:TotalFlow>1000</p14:TotalFlow>
</Combinator>
</Expression>
</Nodes>
<Edges>
<Edge From="1" To="2" Label="Source1" />
Expand All @@ -6104,6 +6283,7 @@ Value as IsStopped)</scr:Expression>
<Edge From="16" To="18" Label="Source1" />
<Edge From="17" To="18" Label="Source2" />
<Edge From="18" To="19" Label="Source1" />
<Edge From="20" To="21" Label="Source1" />
</Edges>
</Workflow>
</Expression>
Expand Down

0 comments on commit 415f104

Please sign in to comment.