Skip to content

Commit

Permalink
Merge pull request #417 from SainsburyWellcomeCentre/social-dev
Browse files Browse the repository at this point in the history
Add social foraging environment definition schema
  • Loading branch information
glopesdev authored Dec 11, 2023
2 parents 1d688dd + 5d77e1f commit 4aff59d
Show file tree
Hide file tree
Showing 15 changed files with 1,221 additions and 668 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,6 @@ It is recommended to keep every project within its own subfolder, and name the s

If you use this software, please cite it as below:

Sainsbury Wellcome Centre Foraging Behaviour Working Group. (2023). Aeon: An open-source platform to study the neural basis of ethological behaviours over naturalistic timescales, https://doi.org/10.5281/zenodo.8413142
Sainsbury Wellcome Centre Foraging Behaviour Working Group. (2023). Aeon: An open-source platform to study the neural basis of ethological behaviours over naturalistic timescales, https://doi.org/10.5281/zenodo.8411157

[![DOI](https://zenodo.org/badge/485512362.svg)](https://zenodo.org/badge/latestdoi/485512362)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8411157.svg)](https://zenodo.org/doi/10.5281/zenodo.8411157)
8 changes: 4 additions & 4 deletions bonsai/Bonsai.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Packages>
<Package id="Aeon.Acquisition" version="0.5.0-build231201" />
<Package id="Aeon.Acquisition" version="0.5.0-build231203" />
<Package id="Aeon.Database" version="0.1.0-build231020" />
<Package id="Aeon.Environment" version="0.1.0-build231015" />
<Package id="Aeon.Foraging" version="0.1.0-build231201" />
Expand Down Expand Up @@ -34,7 +34,7 @@
<Package id="Harp.Behavior" version="0.1.0" />
<Package id="Harp.CameraControllerGen2" version="0.1.0" />
<Package id="Harp.ClockSynchronizer" version="0.1.0" />
<Package id="Harp.OutputExpander" version="0.2.0-build231203" />
<Package id="Harp.OutputExpander" version="0.2.0-build231204" />
<Package id="Harp.RfidReader" version="0.1.0" />
<Package id="Harp.TimestampGeneratorGen3" version="0.1.0" />
<Package id="jacobslusser.ScintillaNET" version="3.6.3" />
Expand Down Expand Up @@ -109,7 +109,7 @@
<AssemblyReference assemblyName="Harp.TimestampGeneratorGen3" />
</AssemblyReferences>
<AssemblyLocations>
<AssemblyLocation assemblyName="Aeon.Acquisition" processorArchitecture="MSIL" location="Packages\Aeon.Acquisition.0.5.0-build231201\lib\net472\Aeon.Acquisition.dll" />
<AssemblyLocation assemblyName="Aeon.Acquisition" processorArchitecture="MSIL" location="Packages\Aeon.Acquisition.0.5.0-build231203\lib\net472\Aeon.Acquisition.dll" />
<AssemblyLocation assemblyName="Aeon.Database" processorArchitecture="MSIL" location="Packages\Aeon.Database.0.1.0-build231020\lib\net472\Aeon.Database.dll" />
<AssemblyLocation assemblyName="Aeon.Environment" processorArchitecture="MSIL" location="Packages\Aeon.Environment.0.1.0-build231015\lib\net472\Aeon.Environment.dll" />
<AssemblyLocation assemblyName="Aeon.Foraging" processorArchitecture="MSIL" location="Packages\Aeon.Foraging.0.1.0-build231201\lib\net472\Aeon.Foraging.dll" />
Expand Down Expand Up @@ -146,7 +146,7 @@
<AssemblyLocation assemblyName="Harp.Behavior" processorArchitecture="MSIL" location="Packages\Harp.Behavior.0.1.0\lib\net462\Harp.Behavior.dll" />
<AssemblyLocation assemblyName="Harp.CameraControllerGen2" processorArchitecture="MSIL" location="Packages\Harp.CameraControllerGen2.0.1.0\lib\net462\Harp.CameraControllerGen2.dll" />
<AssemblyLocation assemblyName="Harp.ClockSynchronizer" processorArchitecture="MSIL" location="Packages\Harp.ClockSynchronizer.0.1.0\lib\net462\Harp.ClockSynchronizer.dll" />
<AssemblyLocation assemblyName="Harp.OutputExpander" processorArchitecture="MSIL" location="Packages\Harp.OutputExpander.0.2.0-build231203\lib\net462\Harp.OutputExpander.dll" />
<AssemblyLocation assemblyName="Harp.OutputExpander" processorArchitecture="MSIL" location="Packages\Harp.OutputExpander.0.2.0-build231204\lib\net462\Harp.OutputExpander.dll" />
<AssemblyLocation assemblyName="Harp.RfidReader" processorArchitecture="MSIL" location="Packages\Harp.RfidReader.0.1.0\lib\net462\Harp.RfidReader.dll" />
<AssemblyLocation assemblyName="Harp.TimestampGeneratorGen3" processorArchitecture="MSIL" location="Packages\Harp.TimestampGeneratorGen3.0.1.0\lib\net462\Harp.TimestampGeneratorGen3.dll" />
<AssemblyLocation assemblyName="IronPython" processorArchitecture="MSIL" location="Packages\IronPython.2.7.5\lib\Net45\IronPython.dll" />
Expand Down
13 changes: 13 additions & 0 deletions workflows/social/Extensions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bonsai.Core" Version="2.8.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="YamlDotNet" Version="13.1.1" />
</ItemGroup>

</Project>
68 changes: 38 additions & 30 deletions workflows/social/Extensions/ControlPanel.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
xmlns:viz="clr-namespace:Bonsai.Design.Visualizers;assembly=Bonsai.Design.Visualizers"
xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions"
xmlns:aeon="clr-namespace:Aeon.Acquisition;assembly=Aeon.Acquisition"
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
xmlns:aeon-frg="clr-namespace:Aeon.Foraging;assembly=Aeon.Foraging"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
Expand Down Expand Up @@ -639,11 +639,17 @@ Item3 as Rate)</scr:Expression>
<Expression xsi:type="SubscribeSubject">
<Name>BlockState</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Item3</Selector>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>Heartbeats</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="aeon:GetDateTime" />
<Expression xsi:type="harp:Parse">
<harp:Register xsi:type="harp:ParseMessagePayload">
<harp:PayloadType>Timestamp</harp:PayloadType>
<harp:IsArray>false</harp:IsArray>
</harp:Register>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:CombineLatest" />
Expand All @@ -652,9 +658,9 @@ Item3 as Rate)</scr:Expression>
<scr:Expression>new(
Item1.Item1 as BlockPelletCount,
Item1.Item2 as BlockThreshold,
(Item1.Item3 == DateTime(0)
(Item2 == 0
? TimeSpan.Zero
: Item1.Item3 - Item2)
: TimeSpan.FromSeconds(Item2 - Item3))
.TotalMinutes as BlockDueTime)</scr:Expression>
</Expression>
<Expression xsi:type="Combinator">
Expand Down Expand Up @@ -894,57 +900,59 @@ P3 (rate: {8}, d0: {7}, thr: {6:0.##})</Format>
<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="35" Label="Source1" />
<Edge From="3" To="36" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="35" Label="Source2" />
<Edge From="7" To="36" Label="Source2" />
<Edge From="8" To="9" Label="Source1" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="35" Label="Source3" />
<Edge From="11" To="36" Label="Source3" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="13" To="14" Label="Source1" />
<Edge From="14" To="15" Label="Source1" />
<Edge From="15" To="35" Label="Source4" />
<Edge From="15" To="36" Label="Source4" />
<Edge From="16" To="17" Label="Source1" />
<Edge From="17" To="18" Label="Source1" />
<Edge From="18" To="19" Label="Source1" />
<Edge From="19" To="35" Label="Source5" />
<Edge From="19" To="36" Label="Source5" />
<Edge From="20" To="21" Label="Source1" />
<Edge From="21" To="31" Label="Source1" />
<Edge From="21" To="32" Label="Source1" />
<Edge From="22" To="23" Label="Source1" />
<Edge From="23" To="31" Label="Source2" />
<Edge From="23" To="32" Label="Source2" />
<Edge From="24" To="25" Label="Source1" />
<Edge From="25" To="31" Label="Source3" />
<Edge From="26" To="29" Label="Source1" />
<Edge From="27" To="28" Label="Source1" />
<Edge From="28" To="29" Label="Source2" />
<Edge From="29" To="30" Label="Source1" />
<Edge From="30" To="31" Label="Source4" />
<Edge From="31" To="32" Label="Source1" />
<Edge From="25" To="32" Label="Source3" />
<Edge From="26" To="27" Label="Source1" />
<Edge From="26" To="30" Label="Source1" />
<Edge From="27" To="30" Label="Source2" />
<Edge From="28" To="29" Label="Source1" />
<Edge From="29" To="30" Label="Source3" />
<Edge From="30" To="31" Label="Source1" />
<Edge From="31" To="32" Label="Source4" />
<Edge From="32" To="33" Label="Source1" />
<Edge From="33" To="34" Label="Source1" />
<Edge From="34" To="35" Label="Source6" />
<Edge From="35" To="36" Label="Source1" />
<Edge From="37" To="38" Label="Source1" />
<Edge From="34" To="35" Label="Source1" />
<Edge From="35" To="36" Label="Source6" />
<Edge From="36" To="37" Label="Source1" />
<Edge From="38" To="39" Label="Source1" />
<Edge From="38" To="41" Label="Source1" />
<Edge From="39" To="40" Label="Source1" />
<Edge From="41" To="42" Label="Source1" />
<Edge From="39" To="42" Label="Source1" />
<Edge From="40" To="41" Label="Source1" />
<Edge From="42" To="43" Label="Source1" />
<Edge From="44" To="45" Label="Source1" />
<Edge From="43" To="44" Label="Source1" />
<Edge From="45" To="46" Label="Source1" />
<Edge From="45" To="48" Label="Source1" />
<Edge From="46" To="47" Label="Source1" />
<Edge From="48" To="49" Label="Source1" />
<Edge From="46" To="49" Label="Source1" />
<Edge From="47" To="48" Label="Source1" />
<Edge From="49" To="50" Label="Source1" />
<Edge From="51" To="52" Label="Source1" />
<Edge From="50" To="51" Label="Source1" />
<Edge From="52" To="53" Label="Source1" />
<Edge From="52" To="55" Label="Source1" />
<Edge From="53" To="54" Label="Source1" />
<Edge From="55" To="56" Label="Source1" />
<Edge From="53" To="56" Label="Source1" />
<Edge From="54" To="55" Label="Source1" />
<Edge From="56" To="57" Label="Source1" />
<Edge From="57" To="58" Label="Source1" />
</Edges>
</Workflow>
</Expression>
Expand Down
2 changes: 1 addition & 1 deletion workflows/social/Extensions/Declarations.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<Expression xsi:type="aeon:StateRecoverySubject" TypeArguments="sys:ValueTuple(sys:Double,sys:Double,sys:Double)">
<aeon:Name>PatchState3</aeon:Name>
</Expression>
<Expression xsi:type="aeon:StateRecoverySubject" TypeArguments="sys:ValueTuple(sys:Int32,sys:Int32,sys:DateTime)">
<Expression xsi:type="aeon:StateRecoverySubject" TypeArguments="sys:ValueTuple(sys:Int32,sys:Int32,sys:Double)">
<aeon:Name>BlockState</aeon:Name>
</Expression>
<Expression xsi:type="rx:PublishSubject" TypeArguments="harp:Timestamped(sys:Double)">
Expand Down
103 changes: 103 additions & 0 deletions workflows/social/Extensions/Environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://github.com/SainsburyWellcomeCentre/aeon_experiments/tree/social",
"description": "Represents patch configuration parameters used in foraging experiments.",
"title": "Environment",
"type": "object",
"properties": {
"distributions": {
"type": "object",
"description": "Specifies a pre-defined set of named probability distributions.",
"additionalProperties": { "$ref": "#/definitions/exponentialDistribution" }
},
"blocks": {
"type": "array",
"description": "Specifies the sequence of blocks in a foraging experiment.",
"items": { "$ref": "#/definitions/blockState" }
}
},
"definitions": {
"exponentialDistribution": {
"type": "object",
"description": "Specifies the parameters of an exponential distribution.",
"properties": {
"rate": {
"type": "number",
"description": "Specifies the rate parameter of the distribution."
},
"offset": {
"type": "number",
"description": "Specifies the minimum value sampled from the exponential distribution."
}
},
"required": [ "rate", "offset" ]
},
"uniformDistribution": {
"type": "object",
"description": "Specifies the parameters of a uniform distribution.",
"properties": {
"mean": {
"type": "number",
"description": "Specifies the mean value sampled from the uniform distribution."
},
"offset": {
"type": "number",
"description": "Specifies the minimum value sampled from the uniform distribution."
}
},
"required": [ "mean", "offset" ]
},
"patchState": {
"type": "object",
"description": "Specifies the configuration parameters for a single patch.",
"properties": {
"distribution": {
"oneOf": [
{ "$ref": "#/definitions/exponentialDistribution" },
{ "$ref": "#/definitions/uniformDistribution" }
]
},
"distributionRef": {
"type": "string",
"description": "Specifies the name of a predefined distribution."
}
},
"oneOf": [
{ "required": [ "distribution" ] },
{ "required": [ "distributionRef" ] }
]
},
"blockState": {
"type": "object",
"description": "Specifies the configuration parameters for a single block.",
"properties": {
"weight": {
"type": "number",
"description": "Specifies the probability mass for the block. Normalization is not required."
},
"minDueTime": {
"type": "number",
"description": "Specifies the minimum block duration, in minutes."
},
"maxDueTime": {
"type": "number",
"description": "Specifies the maximum block duration, in minutes."
},
"minPelletCount": {
"type": "integer",
"description": "Specifies the minimum number of pellets before block transition."
},
"maxPelletCount": {
"type": "integer",
"description": "Specifies the maximum number of pellets before block transition."
},
"patches": {
"type": "object",
"description": "Specifies the configuration of each foraging patch in the block.",
"additionalProperties": { "$ref": "#/definitions/patchState" }
}
},
"required": [ "weight", "patches" ]
}
}
}
Loading

0 comments on commit 4aff59d

Please sign in to comment.