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
6 changes: 3 additions & 3 deletions schema/aind_behavior_dynamic_foraging.json
Original file line number Diff line number Diff line change
Expand Up @@ -3454,9 +3454,9 @@
"title": "Inter Trial Interval Duration",
"type": "number"
},
"is_auto_response_right": {
"is_auto_reward_right": {
"default": null,
"description": "If set, the trial will automatically (and immediately) register a response to the right (True) or left (False).",
"description": "If set, the trial will automatically (and immediately) trigger a reward to the right (True) or left (False). The trial will continue normally after delivery.",
"oneOf": [
{
"type": "boolean"
Expand All @@ -3465,7 +3465,7 @@
"type": "null"
}
],
"title": "Is Auto Response Right"
"title": "Is Auto Reward Right"
},
"lickspout_offset_delta": {
"default": 0.0,
Expand Down
20 changes: 10 additions & 10 deletions src/Extensions/AindBehaviorDynamicForaging.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6091,7 +6091,7 @@ public partial class Trial

private double _interTrialIntervalDuration;

private bool? _isAutoResponseRight;
private bool? _isAutoRewardRight;

private double _lickspoutOffsetDelta;

Expand Down Expand Up @@ -6120,7 +6120,7 @@ protected Trial(Trial other)
_quickRetractSettings = other._quickRetractSettings;
_quiescencePeriodDuration = other._quiescencePeriodDuration;
_interTrialIntervalDuration = other._interTrialIntervalDuration;
_isAutoResponseRight = other._isAutoResponseRight;
_isAutoRewardRight = other._isAutoRewardRight;
_lickspoutOffsetDelta = other._lickspoutOffsetDelta;
_metadata = other._metadata;
}
Expand Down Expand Up @@ -6283,20 +6283,20 @@ public double InterTrialIntervalDuration
}

/// <summary>
/// If set, the trial will automatically (and immediately) register a response to the right (True) or left (False).
/// If set, the trial will automatically (and immediately) trigger a reward to the right (True) or left (False). The trial will continue normally after delivery.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("is_auto_response_right")]
[System.ComponentModel.DescriptionAttribute("If set, the trial will automatically (and immediately) register a response to the" +
" right (True) or left (False).")]
public bool? IsAutoResponseRight
[Newtonsoft.Json.JsonPropertyAttribute("is_auto_reward_right")]
[System.ComponentModel.DescriptionAttribute("If set, the trial will automatically (and immediately) trigger a reward to the ri" +
"ght (True) or left (False). The trial will continue normally after delivery.")]
public bool? IsAutoRewardRight
{
get
{
return _isAutoResponseRight;
return _isAutoRewardRight;
}
set
{
_isAutoResponseRight = value;
_isAutoRewardRight = value;
}
}

Expand Down Expand Up @@ -6357,7 +6357,7 @@ protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder)
stringBuilder.Append("QuickRetractSettings = " + _quickRetractSettings + ", ");
stringBuilder.Append("QuiescencePeriodDuration = " + _quiescencePeriodDuration + ", ");
stringBuilder.Append("InterTrialIntervalDuration = " + _interTrialIntervalDuration + ", ");
stringBuilder.Append("IsAutoResponseRight = " + _isAutoResponseRight + ", ");
stringBuilder.Append("IsAutoRewardRight = " + _isAutoRewardRight + ", ");
stringBuilder.Append("LickspoutOffsetDelta = " + _lickspoutOffsetDelta + ", ");
stringBuilder.Append("Metadata = " + _metadata);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/Extensions/ModifyTrialWithAutoWaterState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public IObservable<Trial> Process(IObservable<Tuple<Trial, AutoWaterState>> sour
if (autoWaterState.IsRight)
{
newTrial.PRewardRight = 1.0f;
newTrial.IsAutoResponseRight = true;
newTrial.IsAutoRewardRight = true;
return newTrial;
}
if (autoWaterState.IsLeft)
{
newTrial.PRewardLeft = 1.0f;
newTrial.IsAutoResponseRight = false;
newTrial.IsAutoRewardRight = false;
return newTrial;
}
throw new InvalidOperationException("AutoWaterState must be either right or left.");
Expand Down
185 changes: 95 additions & 90 deletions src/Extensions/TaskEngine.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -384,50 +384,6 @@
<Name>ResponsePeriod</Name>
<Workflow>
<Nodes>
<Expression xsi:type="SubscribeSubject">
<Name>ThisTrial</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>IsAutoResponseRight</Selector>
</Expression>
<Expression xsi:type="rx:Condition">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>HasValue</Selector>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="InputMapping">
<PropertyMappings>
<Property Name="Value" Selector="Value" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p2:CreateNullableBoolean">
<p2:Value xsi:nil="true" />
</Combinator>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>HarpTimestampSource</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:ObserveOn">
<rx:Scheduler>ThreadPoolScheduler</rx:Scheduler>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>ThisTrial</Name>
</Expression>
Expand Down Expand Up @@ -548,43 +504,60 @@
<Expression xsi:type="MulticastSubject">
<Name>SoftwareEvent</Name>
</Expression>
<Expression xsi:type="Annotation">
<Name>TODO</Name>
<Text><![CDATA[I'm pretty sure we need to do fast retract here?]]></Text>
<Expression xsi:type="SubscribeSubject">
<Name>ThisTrial</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>IsAutoRewardRight</Selector>
</Expression>
<Expression xsi:type="rx:Condition">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>HasValue</Selector>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>GiveRewardRight</Name>
</Expression>
</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="7" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source2" />
<Edge From="7" To="22" Label="Source1" />
<Edge From="8" To="9" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="8" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" Label="Source2" />
<Edge From="8" To="14" Label="Source1" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="9" To="12" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="12" Label="Source1" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="13" To="16" Label="Source1" />
<Edge From="11" To="13" Label="Source1" />
<Edge From="12" To="13" Label="Source2" />
<Edge From="13" To="14" Label="Source2" />
<Edge From="14" To="15" Label="Source1" />
<Edge From="15" To="16" Label="Source2" />
<Edge From="16" To="22" Label="Source2" />
<Edge From="15" To="16" Label="Source1" />
<Edge From="16" To="17" Label="Source1" />
<Edge From="17" To="18" Label="Source1" />
<Edge From="17" To="20" Label="Source1" />
<Edge From="18" To="19" Label="Source1" />
<Edge From="19" To="21" Label="Source1" />
<Edge From="20" To="21" Label="Source2" />
<Edge From="21" To="22" Label="Source3" />
<Edge From="19" To="20" Label="Source1" />
<Edge From="20" To="21" Label="Source1" />
<Edge From="22" To="23" Label="Source1" />
<Edge From="23" To="24" Label="Source1" />
<Edge From="24" To="25" Label="Source1" />
<Edge From="25" To="26" Label="Source1" />
<Edge From="26" To="27" Label="Source1" />
<Edge From="27" To="28" Label="Source1" />
<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 @@ -986,47 +959,74 @@
<rx:DueTime>PT0S</rx:DueTime>
</Combinator>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>IsRewarded</Selector>
<Expression xsi:type="Annotation">
<Name>AutoWater short</Name>
<Text><![CDATA[If AutoWater is enabled we skip the reward check altogether since we dont delivered reward twice.]]></Text>
</Expression>
<Expression xsi:type="BitwiseNot" />
<Expression xsi:type="rx:Condition">
<Expression xsi:type="rx:SelectMany">
<Name>CheckAutoWater</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
<Expression xsi:type="SubscribeSubject">
<Name>ThisTrial</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>IsAutoRewardRight</Selector>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>HasValue</Selector>
</Expression>
<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" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="rx:Condition">
<Name>IsRewarded</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>IsRewarded</Selector>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>false</Value>
</Combinator>
</Expression>
<Expression xsi:type="scr:ExpressionCondition">
<scr:Name>Not IsRewarded</scr:Name>
<scr:Expression>!IsRewarded</scr:Expression>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>false</Value>
</Combinator>
</Expression>
<Expression xsi:type="scr:ExpressionCondition">
<scr:Name>IsRewarded</scr:Name>
<scr:Expression>it.IsRewarded</scr:Expression>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Response.Value.Value</Selector>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>GiveRewardRight</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="BooleanProperty">
<Value>true</Value>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Merge" />
</Expression>
Expand Down Expand Up @@ -1082,26 +1082,31 @@
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" Label="Source2" />
<Edge From="8" To="9" Label="Source1" />
<Edge From="8" To="12" Label="Source1" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="8" To="10" Label="Source1" />
<Edge From="8" To="13" Label="Source1" />
<Edge From="8" To="15" Label="Source1" />
<Edge From="9" To="10" Label="Source2" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="15" Label="Source1" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="11" To="12" Label="Source1" />
<Edge From="12" To="19" Label="Source1" />
<Edge From="13" To="14" Label="Source1" />
<Edge From="14" To="15" Label="Source2" />
<Edge From="14" To="19" Label="Source2" />
<Edge From="15" To="16" Label="Source1" />
<Edge From="16" To="21" Label="Source1" />
<Edge From="16" To="17" Label="Source1" />
<Edge From="17" To="18" Label="Source1" />
<Edge From="18" To="19" Label="Source1" />
<Edge From="18" To="19" Label="Source3" />
<Edge From="19" To="20" Label="Source1" />
<Edge From="20" To="21" Label="Source2" />
<Edge From="21" To="23" Label="Source1" />
<Edge From="22" To="23" Label="Source2" />
<Edge From="20" To="25" Label="Source1" />
<Edge From="21" To="22" Label="Source1" />
<Edge From="22" To="23" Label="Source1" />
<Edge From="23" To="24" Label="Source1" />
<Edge From="24" To="25" Label="Source1" />
<Edge From="26" To="27" 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="27" To="28" Label="Source1" />
<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
2 changes: 1 addition & 1 deletion src/Extensions/TrialOutcomeVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private static void CategorizeTrials(
{
var trial = trialList[i];
float x = i;
bool isAutoResponse = trial.Trial.IsAutoResponseRight.HasValue;
bool isAutoResponse = trial.Trial.IsAutoRewardRight.HasValue;

if (!trial.IsRightChoice.HasValue)
{
Expand Down
Loading