From a92e79ea4655a0828f5e44debe01f148e371dfb3 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Tue, 9 Jun 2026 18:57:17 -0700 Subject: [PATCH 01/13] adds SetRewardAmount subject" --- src/Extensions/OperationControl.bonsai | 71 +- src/Extensions/ValveUi.bonsai | 12 + src/main.bonsai | 1069 +++++++++++++++++++++++- 3 files changed, 1109 insertions(+), 43 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index 7931b7d4..1e050ef0 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -343,10 +343,16 @@ GiveRewardRight + + SetRewardAmount + SetRewardAmount + + Source1 + TaskLogicParameters @@ -427,28 +433,28 @@ - - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + + @@ -607,27 +613,28 @@ - - - - + + + - - + + + - - - - + + + + - - + + - - + + + diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index e4cc8a0a..e55a3e5b 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -344,6 +344,9 @@ + + SetRewardAmount + @@ -387,6 +390,7 @@ + @@ -777,6 +781,9 @@ 1 + + SetRewardAmount + @@ -808,6 +815,7 @@ + @@ -938,6 +946,9 @@ 1 + + SetRewardAmount + @@ -969,6 +980,7 @@ + diff --git a/src/main.bonsai b/src/main.bonsai index a5e1dbe9..82ef917f 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -8,6 +8,11 @@ xmlns:p3="clr-namespace:System.Reactive;assembly=System.Reactive.Core" xmlns:p4="clr-namespace:AllenNeuralDynamics.AindBehaviorServices.DataTypes;assembly=AllenNeuralDynamics.AindBehaviorServices" xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions" + xmlns:p5="clr-namespace:AllenNeuralDynamics.Core;assembly=AllenNeuralDynamics.Core" + xmlns:gui="clr-namespace:Bonsai.Gui;assembly=Bonsai.Gui" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:p6="clr-namespace:AllenNeuralDynamics.Core.Design;assembly=AllenNeuralDynamics.Core.Design" + xmlns:ui="clr-namespace:Bonsai.Design;assembly=Bonsai.Design" xmlns="https://bonsai-rx.org/2018/workflow"> @@ -112,6 +117,19 @@ IsWaveformUploadDone + + + false + + + + + 1 + + + + SetRewardAmount + @@ -233,21 +251,23 @@ - - + + - - + - + - + - - - - + + + + + + + @@ -392,7 +412,1034 @@ - + + Visualizers + + + + + 0 + + + + + + + TrialPlots + + + + GlobalTrialOutcome + + + 16 + + + + SoftwareEvent + + + IsRightLickEvent + + + + + + Source1 + + + Value + + + + + + + + + + + + LickRight + + + + IsRightLickEvent + + + + + + Source1 + + + Value + + + + + + + + + + + + + + LickLeft + + + + GiveRewardRight + + + + + + Source1 + + + + + + + + + + + WaterRight + + + + GiveRewardRight + + + + + + + Source1 + + + + + + + + + + + WaterLeft + + + + + + + 16 + 20 + + + QuiscentPeriod + Gold + 0.3 + + + ResponsePeriod + SandyBrown + 0.3 + + + RewardConsumptionPeriod + RosyBrown + 0.3 + + + ItiPeriod + Green + 0.3 + + + + + LickLeft + Red + 0.9 + 6 + Down + + + LickRight + Blue + 0.1 + 6 + Up + + + IsRightTriggerQuickRetract + DarkCyan + 0.5 + 6 + Plus + + + DeliverSecondaryReinforcer + Sienna + 0.5 + 6 + Plus + + + WaterRight + Blue + 0.2 + 6 + Circle + + + WaterLeft + Red + 0.8 + 6 + Circle + + + + 5 + + + + true + true + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ManualOverrides + + + + OffsetControl + + + + + 0.05 + + + + + 1 + + + + BumpSize + + + ManipulatorBiasTracker + + + {0:F2} + + + + + + + + true + true + Microsoft Sans Serif, 20.25pt + 0.00 + + + + Left + true + true + Microsoft Sans Serif, 15.75pt + โ—€๏ธ + + + BumpLeft + + + + Source1 + + + BumpSize + + + + + + Item2 + + + + -1 + + + + ManualSpoutDelta + + + + + + + + + + + + + + + + Right + true + true + Microsoft Sans Serif, 15.75pt + โ–ถ + + + BumpRight + + + + Source1 + + + BumpSize + + + + + + Item2 + + + ManualSpoutDelta + + + + + + + + + + + + + + + true + true + 2 + 1 + + + + + + + ExperimentState + + + + + + + + false + true + Microsoft Sans Serif, 22.125pt + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Spout offset + true + true + Microsoft Sans Serif, 15.75pt + Spout offset + + + + GiveWaterUI + + + + Left + true + true + ๐Ÿ’งโ—€ + + + TriggerLeft + + + + Source1 + + + + false + + + + GiveManualWaterRight + + + + + + + + + + + + + Right + true + true + ๐Ÿ’งโ–ถ + + + TriggerRight + + + + Source1 + + + + true + + + + GiveManualWaterRight + + + + + + + + + + + + + ManualWater + true + true + 2 + 1 + + + Percent + 0.5 + + + Percent + 0.5 + + + + + + + + GiveManualWaterRight + + + GiveManualWaterRight + + + GiveRewardRight + + + + + + + + + + + + + + + + + + ๐Ÿ’ง + true + true + Microsoft Sans Serif, 8.25pt + + + + + ForceAutoWater + + + + GlobalAutoWaterState + + + !it.IsLeft + + + + + + + + SetLeft + true + true + ๐ŸŽฃโ—€ + + + UpdateGlobalState + + + + Source1 + + + GlobalAutoWaterState + + + + + + Item2 + + + + + + it.SetLeft() + + + GlobalAutoWaterState + + + + + + + + + + + + + + + + + GlobalAutoWaterState + + + !it.IsRight + + + + + + + + SetRight + true + true + ๐ŸŽฃโ–ถ + + + UpdateGlobalState + + + + Source1 + + + GlobalAutoWaterState + + + + + + Item2 + + + + + + it.SetRight() + + + GlobalAutoWaterState + + + + + + + + + + + + + + + + + GlobalAutoWaterState + + + it.HasValue + + + + + + + + Reset + false + true + โŽ + + + UpdateGlobalState + + + + Source1 + + + GlobalAutoWaterState + + + + + + Item2 + + + + + + it.Reset() + + + GlobalAutoWaterState + + + + + + + + + + + + + + + + + ForceAutoWater + true + true + 3 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ๐ŸŽฃ + true + true + Microsoft Sans Serif, 8.25pt + + + + + true + true + Microsoft Sans Serif, 15.75pt + + + + Manual Control + true + true + Microsoft Sans Serif, 36pt + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + LauncherControl + + + + + + + + ExperimentState + + + + + + + + + Start + true + true + Start Experiment + + + StartExperimentToggleButton + + + + End + true + true + End Experiment + + + EndExperimentButton + + + + LauncherControl + true + true + Microsoft Sans Serif, 26pt + 2 + 4 + + + + + + + + + + + StartExperimentToggleButton + + + + 1 + + + + + StartExperimentShortcut + + + EndExperimentButton + + + + 1 + + + + + EndExperiment + + + StartExperiment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + true + true + 1 + 2 + + + + + + + + true + true + 3 + 1 + + + + + + + + + TriggeredCamerasStream + + + + + + + + + + + true + true + 2 + 1 + + + + + + + true + true + 1 + 2 + + + Percent + 0.75 + + + Percent + 0.25 + + + + + + + + GlobalTrial + + + 2 + 16 + + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DynamicForaging + true + + + Maximized + + + + + + + + From 6747b8567ac36c2bac02d56746b1314165ef06eb Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Tue, 9 Jun 2026 18:58:45 -0700 Subject: [PATCH 02/13] regroups visualizers --- src/main.bonsai | 1034 +---------------------------------------------- 1 file changed, 1 insertion(+), 1033 deletions(-) diff --git a/src/main.bonsai b/src/main.bonsai index 82ef917f..866dd917 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -8,11 +8,6 @@ xmlns:p3="clr-namespace:System.Reactive;assembly=System.Reactive.Core" xmlns:p4="clr-namespace:AllenNeuralDynamics.AindBehaviorServices.DataTypes;assembly=AllenNeuralDynamics.AindBehaviorServices" xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions" - xmlns:p5="clr-namespace:AllenNeuralDynamics.Core;assembly=AllenNeuralDynamics.Core" - xmlns:gui="clr-namespace:Bonsai.Gui;assembly=Bonsai.Gui" - xmlns:sys="clr-namespace:System;assembly=mscorlib" - xmlns:p6="clr-namespace:AllenNeuralDynamics.Core.Design;assembly=AllenNeuralDynamics.Core.Design" - xmlns:ui="clr-namespace:Bonsai.Design;assembly=Bonsai.Design" xmlns="https://bonsai-rx.org/2018/workflow"> @@ -412,1034 +407,7 @@ - - Visualizers - - - - - 0 - - - - - - - TrialPlots - - - - GlobalTrialOutcome - - - 16 - - - - SoftwareEvent - - - IsRightLickEvent - - - - - - Source1 - - - Value - - - - - - - - - - - - LickRight - - - - IsRightLickEvent - - - - - - Source1 - - - Value - - - - - - - - - - - - - - LickLeft - - - - GiveRewardRight - - - - - - Source1 - - - - - - - - - - - WaterRight - - - - GiveRewardRight - - - - - - - Source1 - - - - - - - - - - - WaterLeft - - - - - - - 16 - 20 - - - QuiscentPeriod - Gold - 0.3 - - - ResponsePeriod - SandyBrown - 0.3 - - - RewardConsumptionPeriod - RosyBrown - 0.3 - - - ItiPeriod - Green - 0.3 - - - - - LickLeft - Red - 0.9 - 6 - Down - - - LickRight - Blue - 0.1 - 6 - Up - - - IsRightTriggerQuickRetract - DarkCyan - 0.5 - 6 - Plus - - - DeliverSecondaryReinforcer - Sienna - 0.5 - 6 - Plus - - - WaterRight - Blue - 0.2 - 6 - Circle - - - WaterLeft - Red - 0.8 - 6 - Circle - - - - 5 - - - - true - true - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ManualOverrides - - - - OffsetControl - - - - - 0.05 - - - - - 1 - - - - BumpSize - - - ManipulatorBiasTracker - - - {0:F2} - - - - - - - - true - true - Microsoft Sans Serif, 20.25pt - 0.00 - - - - Left - true - true - Microsoft Sans Serif, 15.75pt - โ—€๏ธ - - - BumpLeft - - - - Source1 - - - BumpSize - - - - - - Item2 - - - - -1 - - - - ManualSpoutDelta - - - - - - - - - - - - - - - - Right - true - true - Microsoft Sans Serif, 15.75pt - โ–ถ - - - BumpRight - - - - Source1 - - - BumpSize - - - - - - Item2 - - - ManualSpoutDelta - - - - - - - - - - - - - - - true - true - 2 - 1 - - - - - - - ExperimentState - - - - - - - - false - true - Microsoft Sans Serif, 22.125pt - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Spout offset - true - true - Microsoft Sans Serif, 15.75pt - Spout offset - - - - GiveWaterUI - - - - Left - true - true - ๐Ÿ’งโ—€ - - - TriggerLeft - - - - Source1 - - - - false - - - - GiveManualWaterRight - - - - - - - - - - - - - Right - true - true - ๐Ÿ’งโ–ถ - - - TriggerRight - - - - Source1 - - - - true - - - - GiveManualWaterRight - - - - - - - - - - - - - ManualWater - true - true - 2 - 1 - - - Percent - 0.5 - - - Percent - 0.5 - - - - - - - - GiveManualWaterRight - - - GiveManualWaterRight - - - GiveRewardRight - - - - - - - - - - - - - - - - - - ๐Ÿ’ง - true - true - Microsoft Sans Serif, 8.25pt - - - - - ForceAutoWater - - - - GlobalAutoWaterState - - - !it.IsLeft - - - - - - - - SetLeft - true - true - ๐ŸŽฃโ—€ - - - UpdateGlobalState - - - - Source1 - - - GlobalAutoWaterState - - - - - - Item2 - - - - - - it.SetLeft() - - - GlobalAutoWaterState - - - - - - - - - - - - - - - - - GlobalAutoWaterState - - - !it.IsRight - - - - - - - - SetRight - true - true - ๐ŸŽฃโ–ถ - - - UpdateGlobalState - - - - Source1 - - - GlobalAutoWaterState - - - - - - Item2 - - - - - - it.SetRight() - - - GlobalAutoWaterState - - - - - - - - - - - - - - - - - GlobalAutoWaterState - - - it.HasValue - - - - - - - - Reset - false - true - โŽ - - - UpdateGlobalState - - - - Source1 - - - GlobalAutoWaterState - - - - - - Item2 - - - - - - it.Reset() - - - GlobalAutoWaterState - - - - - - - - - - - - - - - - - ForceAutoWater - true - true - 3 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ๐ŸŽฃ - true - true - Microsoft Sans Serif, 8.25pt - - - - - true - true - Microsoft Sans Serif, 15.75pt - - - - Manual Control - true - true - Microsoft Sans Serif, 36pt - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - LauncherControl - - - - - - - - ExperimentState - - - - - - - - - Start - true - true - Start Experiment - - - StartExperimentToggleButton - - - - End - true - true - End Experiment - - - EndExperimentButton - - - - LauncherControl - true - true - Microsoft Sans Serif, 26pt - 2 - 4 - - - - - - - - - - - StartExperimentToggleButton - - - - 1 - - - - - StartExperimentShortcut - - - EndExperimentButton - - - - 1 - - - - - EndExperiment - - - StartExperiment - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - - - - - true - true - 1 - 2 - - - - - - - - true - true - 3 - 1 - - - - - - - - - TriggeredCamerasStream - - - - - - - - - - - true - true - 2 - 1 - - - - - - - true - true - 1 - 2 - - - Percent - 0.75 - - - Percent - 0.25 - - - - - - - - GlobalTrial - - - 2 - 16 - - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DynamicForaging - true - - - Maximized - - - - - - - - + From 07306f3acb02762775154b058034fbaae699484d Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Wed, 10 Jun 2026 03:45:00 -0700 Subject: [PATCH 03/13] sets set reward time to unit --- src/Extensions/OperationControl.bonsai | 93 +++++++++++++++----------- src/Extensions/ValveUi.bonsai | 6 ++ src/main.bonsai | 6 +- 3 files changed, 62 insertions(+), 43 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index 1e050ef0..462f8523 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -343,15 +343,12 @@ GiveRewardRight - - SetRewardAmount - SetRewardAmount - - Source1 + + SetRewardAmount TaskLogicParameters @@ -359,6 +356,12 @@ RewardSize.LeftValueVolume + + + + + Item2 + RigSchema @@ -366,7 +369,7 @@ Calibration.WaterValveLeft - + RewardToTime @@ -392,12 +395,21 @@ SetIsRightValveMs + + SetRewardAmount + TaskLogicParameters RewardSize.RightValueVolume + + + + + Item2 + RigSchema @@ -405,7 +417,7 @@ Calibration.WaterValveRight - + RewardToTime @@ -422,7 +434,7 @@ - true + false @@ -433,28 +445,34 @@ + - + - + - - - - - + + + + + + - - - - - - + + + + + - - + + + + + + + @@ -613,28 +631,27 @@ - - - + + + + - - - + + - - - + + + + - - - + + - - - + + diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index e55a3e5b..a09a3fcd 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -344,6 +344,7 @@ + SetRewardAmount @@ -391,6 +392,7 @@ + @@ -781,6 +783,7 @@ 1 + SetRewardAmount @@ -816,6 +819,7 @@ + @@ -946,6 +950,7 @@ 1 + SetRewardAmount @@ -981,6 +986,7 @@ + diff --git a/src/main.bonsai b/src/main.bonsai index 866dd917..4b751d09 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -112,11 +112,7 @@ IsWaveformUploadDone - - - false - - + 1 From e1f8538693c3a5978528e3e89eeda3917bb4b004 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Wed, 10 Jun 2026 04:10:36 -0700 Subject: [PATCH 04/13] replaces zip with WithLatestFrom --- src/Extensions/OperationControl.bonsai | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index 462f8523..e359f8dd 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -357,7 +357,7 @@ RewardSize.LeftValueVolume - + Item2 @@ -369,7 +369,7 @@ Calibration.WaterValveLeft - + RewardToTime @@ -405,7 +405,7 @@ RewardSize.RightValueVolume - + Item2 @@ -417,7 +417,7 @@ Calibration.WaterValveRight - + RewardToTime From dcf60cdd86ac92f6f2264e39b355191882be91e2 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Wed, 10 Jun 2026 04:14:45 -0700 Subject: [PATCH 05/13] fixes copy paste error --- src/Extensions/OperationControl.bonsai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index e359f8dd..2017f64a 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -434,7 +434,7 @@ - false + true From f16300c9c8578723042f3c3a47f7e40a9f5bfcb2 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Wed, 10 Jun 2026 04:47:00 -0700 Subject: [PATCH 06/13] sets right and left reward amount independently --- src/Extensions/OperationControl.bonsai | 76 ++++++++++++++++++-------- src/Extensions/ValveUi.bonsai | 48 ++++++++++------ src/main.bonsai | 63 ++++++++++++++------- 3 files changed, 128 insertions(+), 59 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index 2017f64a..cf3db7bf 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -348,7 +348,21 @@ - SetRewardAmount + SetRightRewardAmount + + + + + + + Source1 + + + + + + + TaskLogicParameters @@ -396,7 +410,20 @@ SetIsRightValveMs - SetRewardAmount + SetRightRewardAmount + + + + + + Source1 + + + + + + + TaskLogicParameters @@ -445,34 +472,37 @@ - + - + - + - + - - - - - + + + + - - - - - - - - - + + + + + + + + + + - - - + + + + + + diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index a09a3fcd..5ab01bc6 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -344,9 +344,16 @@ - - SetRewardAmount + SetRightRewardAmount + + + + true + + + + SetRightRewardAmount @@ -392,7 +399,8 @@ - + + @@ -783,10 +791,6 @@ 1 - - - SetRewardAmount - @@ -818,14 +822,20 @@ - - + + + false + + + + SetRightRewardAmount + IsFlushingValveRight @@ -950,10 +960,6 @@ 1 - - - SetRewardAmount - @@ -985,14 +991,20 @@ - - + + + true + + + + SetRightRewardAmount + @@ -1046,8 +1058,12 @@ + - + + + + diff --git a/src/main.bonsai b/src/main.bonsai index 4b751d09..b3d0aefd 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -7,6 +7,7 @@ xmlns:p2="clr-namespace:;assembly=Extensions" xmlns:p3="clr-namespace:System.Reactive;assembly=System.Reactive.Core" xmlns:p4="clr-namespace:AllenNeuralDynamics.AindBehaviorServices.DataTypes;assembly=AllenNeuralDynamics.AindBehaviorServices" + xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions" xmlns="https://bonsai-rx.org/2018/workflow"> @@ -112,15 +113,6 @@ IsWaveformUploadDone - - - - 1 - - - - SetRewardAmount - @@ -159,6 +151,9 @@ GlobalTrial + + SetRightRewardAmount + GlobalTrialMetrics @@ -213,6 +208,32 @@ ExperimentState + + SetRightRewardAmount + + + + 1 + + + + + true + + + + SetRightRewardAmount + + + + 1 + + + + + false + + -5 @@ -242,23 +263,25 @@ - - - + + + - - + + - - + + - - - + + - + + + + From 842b5283dfd60aec6116941155c4dd5e812a102d Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Wed, 10 Jun 2026 05:15:13 -0700 Subject: [PATCH 07/13] resets calibration independently --- src/Extensions/ValveUi.bonsai | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index 5ab01bc6..818f430c 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -344,8 +344,10 @@ - - SetRightRewardAmount + + + + @@ -392,14 +394,15 @@ + - + From 8c700185be87228ea79d6f076bc5d663243328eb Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Mon, 15 Jun 2026 09:11:13 -0700 Subject: [PATCH 08/13] makes SetRightRewardAmount a bool,float --- src/Extensions/OperationControl.bonsai | 62 +++++------ src/Extensions/ValveUi.bonsai | 143 +++++++++++++++++++++---- src/main.bonsai | 40 ++++++- 3 files changed, 181 insertions(+), 64 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index cf3db7bf..753331dd 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -350,29 +350,26 @@ SetRightRewardAmount - + IsLeft Source1 + + Item1 + + + + - - TaskLogicParameters - - - RewardSize.LeftValueVolume - - - - Item2 @@ -413,27 +410,23 @@ SetRightRewardAmount + IsRight Source1 + + Item1 + + - - TaskLogicParameters - - - RewardSize.RightValueVolume - - - - Item2 @@ -478,31 +471,24 @@ - - - + + + + - - + - - - - - + + + + + - + + - - - - - - - - diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index 818f430c..7fa1cdfc 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -264,7 +264,7 @@ - SetIsRightValveMs + SetRightRewardAmount isRightValve @@ -354,8 +354,45 @@ true - - SetRightRewardAmount + + ResetRewardVolume + + + + Source1 + + + TaskLogicParameters + + + RewardSize + + + + + + ValveVolume + it.Item1 ? it.Item2.RightValueVolume : it.Item2.LeftValueVolume + + + + + + SetRightRewardAmount + + + + + + + + + + + + + + @@ -716,7 +753,7 @@ - SetIsRightValveMs + SetRightRewardAmount @@ -831,13 +868,45 @@ - - - false - - - - SetRightRewardAmount + + ResetLeftRewardVolume + + + + Source1 + + + + false + + + + TaskLogicParameters + + + RewardSize + + + LeftValueVolume + + + + + + SetRightRewardAmount + + + + + + + + + + + + + IsFlushingValveRight @@ -885,7 +954,7 @@ - SetIsRightValveMs + SetRightRewardAmount @@ -1000,13 +1069,45 @@ - - - true - - - - SetRightRewardAmount + + ResetRightRewardVolume + + + + Source1 + + + + true + + + + TaskLogicParameters + + + RewardSize + + + RightValueVolume + + + + + + SetRightRewardAmount + + + + + + + + + + + + + @@ -1062,11 +1163,9 @@ - + - - diff --git a/src/main.bonsai b/src/main.bonsai index b3d0aefd..d710ed95 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -151,7 +151,7 @@ GlobalTrial - + SetRightRewardAmount @@ -221,6 +221,18 @@ true + + TaskLogicParameters + + + RewardSize + + + RightValueVolume + + + + SetRightRewardAmount @@ -234,6 +246,18 @@ false + + TaskLogicParameters + + + RewardSize + + + LeftValueVolume + + + + -5 @@ -276,12 +300,20 @@ + - - + + - + + + + + + + + From c6b60853b166aae0c65380fb87bf67995a0d4153 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Mon, 29 Jun 2026 11:49:32 -0700 Subject: [PATCH 09/13] set flush volume to 50ul --- src/Extensions/ValveUi.bonsai | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index 7fa1cdfc..d5895d6f 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -746,7 +746,7 @@ - 500 + 50 @@ -947,7 +947,7 @@ - 500 + 50 From 374f094e303b02f75181fb617c7cd631b323b263 Mon Sep 17 00:00:00 2001 From: bruno-f-cruz <7049351+bruno-f-cruz@users.noreply.github.com> Date: Mon, 29 Jun 2026 12:37:24 -0700 Subject: [PATCH 10/13] Cleanup valve timing logic --- src/Extensions/OperationControl.bonsai | 225 +++++++++++-------------- 1 file changed, 101 insertions(+), 124 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index 753331dd..3267ef06 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -463,6 +463,91 @@ SetIsRightValveMs + + SetIsRightValveMs + + + gt0 + + + + Source1 + + + Item2 + + + + 0 + + + + + + + + + + + + + IsRight + + + + Source1 + + + Item1 + + + + + + + + + + + Item2 + + + Write + + + + IsLeft + + + + Source1 + + + Item1 + + + + + + + + + + + + + Item2 + + + Write + + + + + + + HarpBehaviorCommands + @@ -489,15 +574,19 @@ + + + + + + + + + + - - HarpBehaviorEvents - - - - GiveRewardRight @@ -546,128 +635,16 @@ HarpBehaviorCommands - - SetIsRightValveMs - - - - - - Source1 - - - Item1 - - - - - - - - - - - Item2 - - - gt0 - - - - Source1 - - - - 0 - - - - - - - - - - - - Write - - - - - - - Source1 - - - Item1 - - - - - - - - - - - - - Item2 - - - gt0 - - - - Source1 - - - - 0 - - - - - - - - - - - - Write - - - - - - - HarpBehaviorCommands - - - - - + + + + - - + + - - - - - - - - - - - - - From be5340b33de3977b9f29f4a681d94152fd05e397 Mon Sep 17 00:00:00 2001 From: bruno-f-cruz <7049351+bruno-f-cruz@users.noreply.github.com> Date: Mon, 29 Jun 2026 12:37:55 -0700 Subject: [PATCH 11/13] Consistency in naming convention --- src/Extensions/OperationControl.bonsai | 4 ++-- src/Extensions/ValveUi.bonsai | 12 ++++++------ src/main.bonsai | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Extensions/OperationControl.bonsai b/src/Extensions/OperationControl.bonsai index 3267ef06..b05e227b 100644 --- a/src/Extensions/OperationControl.bonsai +++ b/src/Extensions/OperationControl.bonsai @@ -348,7 +348,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount IsLeft @@ -407,7 +407,7 @@ SetIsRightValveMs - SetRightRewardAmount + SetIsRightRewardAmount IsRight diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index d5895d6f..47008d47 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -264,7 +264,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount isRightValve @@ -378,7 +378,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount @@ -753,7 +753,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount @@ -893,7 +893,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount @@ -954,7 +954,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount @@ -1094,7 +1094,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount diff --git a/src/main.bonsai b/src/main.bonsai index d710ed95..579c4274 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -152,7 +152,7 @@ GlobalTrial - SetRightRewardAmount + SetIsRightRewardAmount GlobalTrialMetrics @@ -209,7 +209,7 @@ ExperimentState - SetRightRewardAmount + SetIsRightRewardAmount @@ -234,7 +234,7 @@ - SetRightRewardAmount + SetIsRightRewardAmount From fadb1a07478804a47faa81934ea95ff662d8aa24 Mon Sep 17 00:00:00 2001 From: svc_aind_behavior Date: Mon, 29 Jun 2026 16:10:54 -0700 Subject: [PATCH 12/13] fixes valve wait time --- src/Extensions/ValveUi.bonsai | 195 +++++++++++++++++++++------------- 1 file changed, 123 insertions(+), 72 deletions(-) diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index d5895d6f..f66bcba2 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -5,6 +5,7 @@ xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions" xmlns:gui="clr-namespace:Bonsai.Gui;assembly=Bonsai.Gui" xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:p1="clr-namespace:AllenNeuralDynamics.Core;assembly=AllenNeuralDynamics.Core" xmlns="https://bonsai-rx.org/2018/workflow"> @@ -714,6 +715,19 @@ Flush + + + 50 + + + + + 1 + + + + DefaultVolume + Source1 @@ -744,10 +758,8 @@ false - - - 50 - + + DefaultVolume @@ -766,15 +778,8 @@ GiveRewardRight - - - PT0.5S - - - - - 5000 - + + DefaultVolume RigSchema @@ -798,9 +803,25 @@ 1000 + + + + + + + + + + + PT0.0061046S + + + + DefaultVolume + DivideByEachOpen - Math.Ceiling(it / 500) + Math.Ceiling(5000 / it) @@ -809,7 +830,7 @@ - 300 + 100 @@ -836,32 +857,37 @@ - - - - - - - - + + + + + + + - - - - + + + + - - - - - + + + + + - - - + + + - + + + + + + + @@ -915,6 +941,19 @@ Flush + + + 50 + + + + + 1 + + + + DefaultVolume + Source1 @@ -945,10 +984,8 @@ true - - - 50 - + + DefaultVolume @@ -967,15 +1004,8 @@ GiveRewardRight - - - PT0.5S - - - - - 5000 - + + DefaultVolume RigSchema @@ -999,9 +1029,25 @@ 1000 + + + + + + + + + + + PT0.5S + + + + DefaultVolume + DivideByEachOpen - Math.Ceiling(it / 500) + Math.Ceiling(5000 / it) @@ -1010,7 +1056,7 @@ - 300 + 137 @@ -1037,32 +1083,37 @@ - - - - - - - - + + + + + + + - - - - + + + + - - - - - + + + + + - - - + + + - + + + + + + + From 6430a6b58ede41176c46a33a3dc35d7d182ba0bc Mon Sep 17 00:00:00 2001 From: svc_aind_behavior Date: Tue, 30 Jun 2026 08:24:55 -0700 Subject: [PATCH 13/13] remove millisecond conversion --- src/Extensions/ValveUi.bonsai | 76 +++++++++++++---------------------- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/src/Extensions/ValveUi.bonsai b/src/Extensions/ValveUi.bonsai index ac75171f..f2541c94 100644 --- a/src/Extensions/ValveUi.bonsai +++ b/src/Extensions/ValveUi.bonsai @@ -794,15 +794,6 @@ RewardToTime ((Item1 * 0.001) - Item2.Offset) / Item2.Slope - - ToMilliseconds - - - - - 1000 - - @@ -813,7 +804,7 @@ - PT0.0061046S + PT0.607S @@ -859,7 +850,7 @@ - + @@ -868,26 +859,24 @@ - + - - - - - - - + + + + + + + - + - + - - - + @@ -1020,15 +1009,6 @@ RewardToTime ((Item1 * 0.001) - Item2.Offset) / Item2.Slope - - ToMilliseconds - - - - - 1000 - - @@ -1039,7 +1019,7 @@ - PT0.5S + PT0.678S @@ -1056,7 +1036,7 @@ - 137 + 100 @@ -1085,7 +1065,7 @@ - + @@ -1094,26 +1074,24 @@ - + - - - - - - - + + + + + + + - + - + - - - +