Skip to content

Commit 9046840

Browse files
authored
Merge pull request #434 from AllenNeuralDynamics/fix-distribution-sampling
Implement `clamp` for truncation of distribution sampling
2 parents 05a9453 + 025f8f0 commit 9046840

File tree

5 files changed

+1280
-900
lines changed

5 files changed

+1280
-900
lines changed

src/DataSchemas/aind_behavior_vr_foraging.json

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"AindBehaviorSessionModel": {
44
"properties": {
55
"aind_behavior_services_pkg_version": {
6-
"default": "0.12.2",
6+
"default": "0.12.3",
77
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
88
"title": "aind_behavior_services package version",
99
"type": "string"
1010
},
1111
"version": {
12-
"const": "0.12.2",
13-
"default": "0.12.2",
12+
"const": "0.12.3",
13+
"default": "0.12.3",
1414
"title": "Version",
1515
"type": "string"
1616
},
@@ -353,7 +353,7 @@
353353
"AindVrForagingRig": {
354354
"properties": {
355355
"aind_behavior_services_pkg_version": {
356-
"default": "0.12.2",
356+
"default": "0.12.3",
357357
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
358358
"title": "aind_behavior_services package version",
359359
"type": "string"
@@ -611,7 +611,7 @@
611611
"title": "Rng Seed"
612612
},
613613
"aind_behavior_services_pkg_version": {
614-
"default": "0.12.2",
614+
"default": "0.12.3",
615615
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
616616
"title": "aind_behavior_services package version",
617617
"type": "string"
@@ -917,16 +917,6 @@
917917
"type": "object"
918918
},
919919
"BlockEndCondition": {
920-
"discriminator": {
921-
"mapping": {
922-
"Choice": "#/$defs/BlockEndConditionChoice",
923-
"Distance": "#/$defs/BlockEndConditionDistance",
924-
"Duration": "#/$defs/BlockEndConditionDuration",
925-
"PatchCount": "#/$defs/BlockEndConditionPatchCount",
926-
"Reward": "#/$defs/BlockEndConditionReward"
927-
},
928-
"propertyName": "condition_type"
929-
},
930920
"oneOf": [
931921
{
932922
"$ref": "#/$defs/BlockEndConditionDuration"
@@ -3376,16 +3366,6 @@
33763366
"type": "object"
33773367
},
33783368
"PatchTerminator": {
3379-
"discriminator": {
3380-
"mapping": {
3381-
"OnChoice": "#/$defs/PatchTerminatorOnChoice",
3382-
"OnDistance": "#/$defs/PatchTerminatorOnDistance",
3383-
"OnRejection": "#/$defs/PatchTerminatorOnRejection",
3384-
"OnReward": "#/$defs/PatchTerminatorOnReward",
3385-
"OnTime": "#/$defs/PatchTerminatorOnTime"
3386-
},
3387-
"propertyName": "terminator_type"
3388-
},
33893369
"oneOf": [
33903370
{
33913371
"$ref": "#/$defs/PatchTerminatorOnRejection"
@@ -3945,15 +3925,6 @@
39453925
"type": "object"
39463926
},
39473927
"RewardFunction": {
3948-
"discriminator": {
3949-
"mapping": {
3950-
"OnThisPatchEntryRewardFunction": "#/$defs/OnThisPatchEntryRewardFunction",
3951-
"OutsideRewardFunction": "#/$defs/OutsideRewardFunction",
3952-
"PatchRewardFunction": "#/$defs/PatchRewardFunction",
3953-
"PersistentRewardFunction": "#/$defs/PersistentRewardFunction"
3954-
},
3955-
"propertyName": "function_type"
3956-
},
39573928
"oneOf": [
39583929
{
39593930
"$ref": "#/$defs/PatchRewardFunction"
@@ -4997,8 +4968,18 @@
49974968
"type": "object"
49984969
},
49994970
"TruncationParameters": {
5000-
"description": "Parameters for truncating a distribution to a specified range. Truncation should\nbe applied after sampling and scaling.\n\nUsed to constrain sampled values within minimum and maximum bounds.",
4971+
"description": "Parameters for truncating a distribution to a specified range. Truncation should\nbe applied after sampling and scaling.\n\nThe truncation_mode determines how out-of-bounds values are handled:\n- \"exclude\": Resample until a value within [min, max] is obtained.\nIf after a certain number of attempts no valid value is found, it\nwill use the average of sampled values and pick the closest bound.\n- \"clamp\": Clamp values to the nearest bound within [min, max].\nUsed to constrain sampled values within minimum and maximum bounds.",
50014972
"properties": {
4973+
"truncation_mode": {
4974+
"default": "exclude",
4975+
"description": "Mode of truncation to apply",
4976+
"enum": [
4977+
"exclude",
4978+
"clamp"
4979+
],
4980+
"title": "Truncation Mode",
4981+
"type": "string"
4982+
},
50024983
"min": {
50034984
"default": 0,
50044985
"description": "Minimum value of the sampled distribution",
@@ -5097,13 +5078,6 @@
50975078
"type": "string"
50985079
},
50995080
"VideoWriter": {
5100-
"discriminator": {
5101-
"mapping": {
5102-
"FFMPEG": "#/$defs/VideoWriterFfmpeg",
5103-
"OPENCV": "#/$defs/VideoWriterOpenCv"
5104-
},
5105-
"propertyName": "video_writer_type"
5106-
},
51075081
"oneOf": [
51085082
{
51095083
"$ref": "#/$defs/VideoWriterFfmpeg"

src/Extensions.csproj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net48</TargetFramework>
3+
<!-- <OutputType>Exe</OutputType> -->
4+
<!--<TargetFramework>net8.0-windows</TargetFramework>-->
5+
<TargetFramework>net480</TargetFramework>
46
<UseWindowsForms>true</UseWindowsForms>
5-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
68
</PropertyGroup>
79
<ItemGroup>
810
<PackageReference Include="Bonsai.Core" Version="2.9.0" />
9-
<PackageReference Include="AllenNeuralDynamics.Core.Design" Version="0.3.0" />
11+
<PackageReference Include="AllenNeuralDynamics.Core.Design" Version="0.3.0" />
1012
<PackageReference Include="OpenCV.Net" Version="3.4.2" />
1113
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
12-
<PackageReference Include="Bonsai.Harp" Version="3.5.0" />
14+
<PackageReference Include="Bonsai.Harp" Version="3.5.2" />
1315
<PackageReference Include="MathNet.Numerics" Version="4.15.0" />
1416
<PackageReference Include="Harp.Olfactometer" Version="0.1.0-build231127" />
1517
<PackageReference Include="AllenNeuralDynamics.AindManipulator" Version="0.1.6" />
16-
<PackageReference Include="Hexa.NET.ImGui" Version="2.2.8.4" />
17-
<PackageReference Include="Hexa.NET.ImPlot" Version="2.2.8.4" />
18+
<PackageReference Include="Hexa.NET.ImGui" Version="2.2.9" />
19+
<PackageReference Include="Hexa.NET.ImPlot" Version="2.2.9" />
1820
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" />
1921
<PackageReference Include="Bonsai.Dsp.Design" Version="2.9.0" />
20-
<PackageReference Include="Hexa.NET.ImGui.Backends" Version="1.0.17" />
22+
<PackageReference Include="Hexa.NET.ImGui.Backends" Version="1.0.17.4" />
2123
<PackageReference Include="AllenNeuralDynamics.AindBehaviorServices" Version="0.12.0" />
2224
</ItemGroup>
2325
</Project>

0 commit comments

Comments
 (0)