Skip to content

Commit 101f3c7

Browse files
authored
Merge pull request #429 from AllenNeuralDynamics/feat-add-software-event-patch-state-at-reward
Add software event with the state of the patch used to sample a reward
2 parents c5811be + c081192 commit 101f3c7

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

src/Extensions/InstantiateSite.bonsai

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
xmlns:p1="clr-namespace:AindVrForagingDataSchema;assembly=Extensions"
88
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
99
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
10-
xmlns:p2="clr-namespace:Bonsai.Numerics.Distributions;assembly=Bonsai.Numerics"
10+
xmlns:p2="clr-namespace:AllenNeuralDynamics.Core;assembly=AllenNeuralDynamics.Core"
11+
xmlns:p3="clr-namespace:Bonsai.Numerics.Distributions;assembly=Bonsai.Numerics"
1112
xmlns:bv="clr-namespace:BonVision;assembly=BonVision"
1213
xmlns="https://bonsai-rx.org/2018/workflow">
1314
<Workflow>
@@ -849,20 +850,31 @@ it.Item2 as EntryPosition)</scr:Expression>
849850
<Expression xsi:type="SubscribeSubject">
850851
<Name>patchState</Name>
851852
</Expression>
853+
<Expression xsi:type="Combinator">
854+
<Combinator xsi:type="p2:CreateSoftwareEvent">
855+
<p2:EventName>PatchStateAtReward</p2:EventName>
856+
</Combinator>
857+
</Expression>
858+
<Expression xsi:type="MulticastSubject">
859+
<Name>SoftwareEvent</Name>
860+
</Expression>
861+
<Expression xsi:type="SubscribeSubject">
862+
<Name>patchState</Name>
863+
</Expression>
852864
<Expression xsi:type="MemberSelector">
853865
<Selector>Probability</Selector>
854866
</Expression>
855867
<Expression xsi:type="SubscribeSubject">
856868
<Name>RngSeed</Name>
857869
</Expression>
858870
<Expression xsi:type="Combinator">
859-
<Combinator xsi:type="p2:CreateContinuousUniform">
860-
<p2:Lower>0</p2:Lower>
861-
<p2:Upper>1</p2:Upper>
871+
<Combinator xsi:type="p3:CreateContinuousUniform">
872+
<p3:Lower>0</p3:Lower>
873+
<p3:Upper>1</p3:Upper>
862874
</Combinator>
863875
</Expression>
864876
<Expression xsi:type="Combinator">
865-
<Combinator xsi:type="p2:Sample" />
877+
<Combinator xsi:type="p3:Sample" />
866878
</Expression>
867879
<Expression xsi:type="Combinator">
868880
<Combinator xsi:type="rx:Zip" />
@@ -972,31 +984,33 @@ it.Item2 as EntryPosition)</scr:Expression>
972984
<Edge From="3" To="4" Label="Source2" />
973985
<Edge From="4" To="5" Label="Source1" />
974986
<Edge From="6" To="7" Label="Source1" />
975-
<Edge From="7" To="11" Label="Source1" />
976-
<Edge From="8" To="9" Label="Source1" />
987+
<Edge From="7" To="8" Label="Source1" />
977988
<Edge From="9" To="10" Label="Source1" />
978-
<Edge From="10" To="11" Label="Source2" />
989+
<Edge From="10" To="14" Label="Source1" />
979990
<Edge From="11" To="12" Label="Source1" />
980-
<Edge From="11" To="13" Label="Source1" />
981-
<Edge From="12" To="13" Label="Source2" />
982-
<Edge From="13" To="14" Label="Source1" />
983-
<Edge From="14" To="17" Label="Source1" />
984-
<Edge From="15" To="16" Label="Source1" />
985-
<Edge From="16" To="17" Label="Source2" />
986-
<Edge From="17" To="18" Label="Source1" />
987-
<Edge From="17" To="26" Label="Source1" />
991+
<Edge From="12" To="13" Label="Source1" />
992+
<Edge From="13" To="14" Label="Source2" />
993+
<Edge From="14" To="15" Label="Source1" />
994+
<Edge From="14" To="16" Label="Source1" />
995+
<Edge From="15" To="16" Label="Source2" />
996+
<Edge From="16" To="17" Label="Source1" />
997+
<Edge From="17" To="20" Label="Source1" />
988998
<Edge From="18" To="19" Label="Source1" />
989-
<Edge From="19" To="22" Label="Source1" />
999+
<Edge From="19" To="20" Label="Source2" />
9901000
<Edge From="20" To="21" Label="Source1" />
991-
<Edge From="21" To="22" Label="Source2" />
992-
<Edge From="22" To="23" Label="Source1" />
1001+
<Edge From="20" To="29" Label="Source1" />
1002+
<Edge From="21" To="22" Label="Source1" />
1003+
<Edge From="22" To="25" Label="Source1" />
9931004
<Edge From="23" To="24" Label="Source1" />
994-
<Edge From="24" To="25" Label="Source1" />
995-
<Edge From="25" To="28" Label="Source1" />
1005+
<Edge From="24" To="25" Label="Source2" />
1006+
<Edge From="25" To="26" Label="Source1" />
9961007
<Edge From="26" To="27" Label="Source1" />
997-
<Edge From="27" To="28" Label="Source2" />
998-
<Edge From="28" To="29" Label="Source1" />
1008+
<Edge From="27" To="28" Label="Source1" />
1009+
<Edge From="28" To="31" Label="Source1" />
9991010
<Edge From="29" To="30" Label="Source1" />
1011+
<Edge From="30" To="31" Label="Source2" />
1012+
<Edge From="31" To="32" Label="Source1" />
1013+
<Edge From="32" To="33" Label="Source1" />
10001014
</Edges>
10011015
</Workflow>
10021016
</Expression>

src/aind_behavior_vr_foraging/data_contract/v0_6_0.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ def dataset(
337337
root_path / "behavior/SoftwareEvents/SpoutParkingPositions.json"
338338
),
339339
),
340+
SoftwareEvents(
341+
name="PatchStateAtReward",
342+
description="An event emitted whenever the reward is about to be given and the patch state is sampled.",
343+
reader_params=SoftwareEvents.make_params(
344+
root_path / "behavior/SoftwareEvents/PatchStateAtReward.json"
345+
),
346+
),
340347
],
341348
),
342349
DataStreamCollection(

0 commit comments

Comments
 (0)