Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 14 additions & 61 deletions src/Extensions/PositionControl.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
xmlns:gl="clr-namespace:Bonsai.Shaders;assembly=Bonsai.Shaders"
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
Expand Down Expand Up @@ -151,47 +150,10 @@
<Name>CurrentPosition</Name>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>EncoderSample</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Value</Selector>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>InstantVelocity</Selector>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>TaskLogicParameters</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>OperationControl</Selector>
<Name>FilteredCurrentVelocity</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>PositionControl.FrequencyFilterCutoff</Selector>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Cutoff1" />
</PropertyMappings>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>TreadmillSamplingRate</Name>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="SampleRate" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:FrequencyFilter">
<dsp:SampleRate>250</dsp:SampleRate>
<dsp:Cutoff1>5</dsp:Cutoff1>
<dsp:Cutoff2>0</dsp:Cutoff2>
<dsp:KernelLength>60</dsp:KernelLength>
<dsp:FilterType>LowPass</dsp:FilterType>
</Combinator>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>FilteredCurrentVelocity</Name>
<Selector>Item1</Selector>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>StopVelocityThreshold</Name>
Expand All @@ -210,7 +172,7 @@
<Combinator xsi:type="rx:DistinctUntilChanged" />
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Seconds</Selector>
<Selector>Item2</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
Expand Down Expand Up @@ -294,31 +256,22 @@
<Edge From="25" To="26" Label="Source1" />
<Edge From="26" To="27" Label="Source1" />
<Edge From="28" To="29" Label="Source1" />
<Edge From="28" To="43" Label="Source1" />
<Edge From="29" To="30" Label="Source1" />
<Edge From="30" To="37" Label="Source1" />
<Edge From="31" To="32" Label="Source1" />
<Edge From="28" To="34" Label="Source1" />
<Edge From="29" To="32" Label="Source1" />
<Edge From="30" To="31" Label="Source1" />
<Edge From="31" To="32" Label="Source2" />
<Edge From="32" To="33" Label="Source1" />
<Edge From="33" To="34" Label="Source1" />
<Edge From="34" To="37" Label="Source2" />
<Edge From="33" To="35" Label="Source1" />
<Edge From="34" To="35" Label="Source2" />
<Edge From="35" To="36" Label="Source1" />
<Edge From="36" To="37" Label="Source3" />
<Edge From="36" To="37" Label="Source1" />
<Edge From="37" To="38" Label="Source1" />
<Edge From="38" To="41" Label="Source1" />
<Edge From="39" To="40" Label="Source1" />
<Edge From="40" To="41" Label="Source2" />
<Edge From="40" To="43" Label="Source1" />
<Edge From="41" To="42" Label="Source1" />
<Edge From="42" To="44" Label="Source1" />
<Edge From="43" To="44" Label="Source2" />
<Edge From="44" To="45" Label="Source1" />
<Edge From="45" To="46" Label="Source1" />
<Edge From="46" To="47" Label="Source1" />
<Edge From="48" To="49" Label="Source1" />
<Edge From="49" To="52" Label="Source1" />
<Edge From="50" To="51" Label="Source1" />
<Edge From="51" To="52" Label="Source2" />
<Edge From="52" To="54" Label="Source1" />
<Edge From="53" To="54" Label="Source2" />
<Edge From="42" To="43" Label="Source2" />
<Edge From="43" To="45" Label="Source1" />
<Edge From="44" To="45" Label="Source2" />
</Edges>
</Workflow>
</WorkflowBuilder>
24 changes: 20 additions & 4 deletions src/Extensions/Visualizers.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,26 @@ Item2.Item2 as SecondsSinceChoice)</scr:Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="gl:SampleOnRenderFrame" />
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>TaskLogicParameters</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>OperationControl</Selector>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>PositionControl.VelocityThreshold</Selector>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>StopVelocityThreshold</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Merge" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:CombineLatest" />
</Expression>
<Expression xsi:type="zg:RollingGraphBuilder">
<zg:ValueSelector>Item1,Item2</zg:ValueSelector>
<zg:ValueSelector>Item1.Item1,Item2</zg:ValueSelector>
<zg:SymbolType>None</zg:SymbolType>
<zg:LineWidth>2</zg:LineWidth>
<zg:CurveSettings />
Expand All @@ -443,10 +455,14 @@ Item2.Item2 as SecondsSinceChoice)</scr:Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="3" Label="Source1" />
<Edge From="2" To="3" Label="Source2" />
<Edge From="1" To="7" 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="4" To="6" Label="Source1" />
<Edge From="5" To="6" Label="Source2" />
<Edge From="6" To="7" Label="Source2" />
<Edge From="7" To="8" Label="Source1" />
<Edge From="8" To="9" Label="Source1" />
</Edges>
</Workflow>
</Expression>
Expand Down
6 changes: 6 additions & 0 deletions src/aind_behavior_vr_foraging/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def experiment(launcher: Launcher) -> None:
ads_rig.write_standard_file(launcher.session_directory)

# Watchdog
is_transfer = picker.ui_helper.prompt_yes_no_question("Would you like to transfer data?")
if not is_transfer:
logger.info("Data transfer skipped by user.")
launcher.copy_logs()
return

launcher.copy_logs()
watchdog_settings = WatchdogSettings()
watchdog_settings.destination = Path(watchdog_settings.destination) / launcher.session.subject
Expand Down
64 changes: 63 additions & 1 deletion src/main.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ Item3 as Right)</scr:Expression>
<Expression xsi:type="rx:BehaviorSubject" TypeArguments="sys:Double">
<rx:Name>StopVelocityThreshold</rx:Name>
</Expression>
<Expression xsi:type="rx:BehaviorSubject" TypeArguments="sys:Double">
<Expression xsi:type="rx:BehaviorSubject" TypeArguments="sys:Tuple(sys:Double,sys:Double)">
<rx:Name>FilteredCurrentVelocity</rx:Name>
</Expression>
</Nodes>
Expand Down Expand Up @@ -4376,6 +4376,55 @@ Item1 as Displacement,
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Switch" />
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>EncoderSample</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Value</Selector>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>InstantVelocity</Selector>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>TaskLogicParameters</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>OperationControl</Selector>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>PositionControl.FrequencyFilterCutoff</Selector>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Cutoff1" />
</PropertyMappings>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>TreadmillSamplingRate</Name>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="SampleRate" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:FrequencyFilter">
<dsp:SampleRate>250</dsp:SampleRate>
<dsp:Cutoff1>5</dsp:Cutoff1>
<dsp:Cutoff2>0</dsp:Cutoff2>
<dsp:KernelLength>60</dsp:KernelLength>
<dsp:FilterType>LowPass</dsp:FilterType>
</Combinator>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Seconds</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>FilteredCurrentVelocity</Name>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
Expand Down Expand Up @@ -4410,6 +4459,19 @@ Item1 as Displacement,
<Edge From="30" To="31" Label="Source1" />
<Edge From="31" To="32" Label="Source1" />
<Edge From="32" To="33" Label="Source1" />
<Edge From="34" To="35" Label="Source1" />
<Edge From="34" To="44" Label="Source1" />
<Edge From="35" To="36" Label="Source1" />
<Edge From="36" To="43" Label="Source1" />
<Edge From="37" To="38" Label="Source1" />
<Edge From="38" To="39" Label="Source1" />
<Edge From="39" To="40" Label="Source1" />
<Edge From="40" To="43" Label="Source2" />
<Edge From="41" To="42" Label="Source1" />
<Edge From="42" To="43" Label="Source3" />
<Edge From="43" To="45" Label="Source1" />
<Edge From="44" To="45" Label="Source2" />
<Edge From="45" To="46" Label="Source1" />
</Edges>
</Workflow>
</Expression>
Expand Down