Skip to content

Commit

Permalink
Merge pull request #289 from AllenNeuralDynamics/dev
Browse files Browse the repository at this point in the history
v0.5.0 release
  • Loading branch information
bruno-f-cruz authored Jan 27, 2025
2 parents d261e6b + 94a0c1f commit 4db648f
Show file tree
Hide file tree
Showing 55 changed files with 14,718 additions and 7,636 deletions.
69 changes: 15 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,24 @@
name: CI
name: ci/cd

on:
workflow_dispatch:
pull_request:
branches:
- main
- feat*
- dev*
- release*
push:
branches:
- main

jobs:
linters:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install -e .[linters] --no-cache-dir
- name: Run ruff format
run: ruff format .
- name: Run ruff check
run: ruff check .
- name: Run codespell
run : codespell .

tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: 7.x
- name: Restore dotnet tools
run: dotnet tool restore
- name: Setup Bonsai
working-directory: bonsai
run: .\Setup.ps1

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11'
python-linting:
uses: AllenNeuralDynamics/Aind.Behavior.GitHubActions/.github/workflows/python-linting.yml@main
with:
runs-on: ubuntu-latest

- name: Install dependencies
run: |
python -m pip install -e . --no-cache-dir
- name: Run tests
run: python -m unittest
- name: Regenerate schemas
run: python .\scripts\regenerate.py
- name: Check for uncommitted changes
run: |
git config --global core.safecrlf false
git diff --exit-code || (echo "Untracked changes found" && exit 1)
aind-behavior-framework-testing:
uses: AllenNeuralDynamics/Aind.Behavior.GitHubActions/.github/workflows/test-aind-behavior-framework.yml@main
with:
python-version-path: .python-version
run-coverage: false
run-schema: true
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Sphinx documentation to Pages
on:
workflow_dispatch:
push:
branches: [main]
branches: main

jobs:
pages:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/tag_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Tag and Publish

on:
workflow_dispatch: {}

jobs:
tag-and-publish:
uses : AllenNeuralDynamics/Aind.Behavior.GitHubActions/.github/workflows/python-package-tag-and-publish.yml@main
with:
publish: false
3 changes: 3 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3.11
3.12
3.13
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# aind-vr-foraging

![CI](https://github.com/AllenNeuralDynamics/Aind.Behavior.VrForaging/actions/workflows/ci.yml/badge.svg)

Check warning on line 3 in README.md

View workflow job for this annotation

GitHub Actions / pages

'myst' cross-reference target not found: 'LICENSE'
[![PyPI - Version](https://img.shields.io/pypi/v/aind-behavior-vr-foraging)](https://pypi.org/project/aind-behavior-vr-foraging/)
[![License](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
[![ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)

A repository for the VR Foraging task.

---
Expand Down
44 changes: 26 additions & 18 deletions bonsai/Bonsai.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<Package id="AForge" version="2.2.5" />
<Package id="AForge.Video" version="2.2.5" />
<Package id="AForge.Video.DirectShow" version="2.2.5" />
<Package id="AllenNeuralDynamics.AindBehaviorServices" version="0.7.14" />
<Package id="AllenNeuralDynamics.AindManipulator" version="0.1.4" />
<Package id="AllenNeuralDynamics.Core" version="0.2.3" />
<Package id="AllenNeuralDynamics.Core.Design" version="0.2.0" />
<Package id="AllenNeuralDynamics.HarpUtils" version="0.1.6" />
<Package id="AllenNeuralDynamics.LicketySplit" version="0.1.0" />
<Package id="AllenNeuralDynamics.SniffDetector" version="0.1.0-preview06032024" />
<Package id="AllenNeuralDynamics.Treadmill" version="0.1.0" />
<Package id="AllenNeuralDynamics.AindBehaviorServices" version="0.8.0" />
<Package id="AllenNeuralDynamics.AindManipulator" version="0.1.6" />
<Package id="AllenNeuralDynamics.Core" version="0.3.0" />
<Package id="AllenNeuralDynamics.Core.Design" version="0.2.3" />
<Package id="AllenNeuralDynamics.EnvironmentSensor" version="0.2.0" />
<Package id="AllenNeuralDynamics.HarpUtils" version="0.2.0" />
<Package id="AllenNeuralDynamics.LicketySplit" version="0.2.0" />
<Package id="AllenNeuralDynamics.SniffDetector" version="0.2.0" />
<Package id="AllenNeuralDynamics.Treadmill" version="0.2.0" />
<Package id="AllenNeuralDynamics.VersionControl" version="0.1.1" />
<Package id="AllenNeuralDynamics.WhiteRabbit" version="0.2.0" />
<Package id="AssimpNet" version="4.1.0" />
<Package id="Bonsai" version="2.8.5" />
<Package id="Bonsai.Audio" version="2.8.0" />
Expand Down Expand Up @@ -66,11 +68,12 @@
<Package id="Rx-PlatformServices" version="2.2.5" />
<Package id="SvgNet" version="3.3.3" />
<Package id="System.Buffers" version="4.5.1" />
<Package id="System.Collections.Immutable" version="8.0.0" />
<Package id="System.Linq.Dynamic" version="1.0.7" />
<Package id="System.Memory" version="4.5.5" />
<Package id="System.Numerics.Vectors" version="4.5.0" />
<Package id="System.Resources.Extensions" version="8.0.0" />
<Package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" />
<Package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" />
<Package id="YamlDotNet" version="13.1.1" />
<Package id="ZedGraph" version="5.1.7" />
</Packages>
Expand All @@ -79,11 +82,13 @@
<AssemblyReference assemblyName="AllenNeuralDynamics.AindManipulator" />
<AssemblyReference assemblyName="AllenNeuralDynamics.Core" />
<AssemblyReference assemblyName="AllenNeuralDynamics.Core.Design" />
<AssemblyReference assemblyName="AllenNeuralDynamics.EnvironmentSensor" />
<AssemblyReference assemblyName="AllenNeuralDynamics.HarpUtils" />
<AssemblyReference assemblyName="AllenNeuralDynamics.LicketySplit" />
<AssemblyReference assemblyName="AllenNeuralDynamics.SniffDetector" />
<AssemblyReference assemblyName="AllenNeuralDynamics.Treadmill" />
<AssemblyReference assemblyName="AllenNeuralDynamics.VersionControl" />
<AssemblyReference assemblyName="AllenNeuralDynamics.WhiteRabbit" />
<AssemblyReference assemblyName="Bonsai" />
<AssemblyReference assemblyName="Bonsai.Audio" />
<AssemblyReference assemblyName="Bonsai.Core" />
Expand Down Expand Up @@ -123,15 +128,17 @@
<AssemblyLocation assemblyName="AForge" processorArchitecture="MSIL" location="Packages/AForge.2.2.5/lib/AForge.dll" />
<AssemblyLocation assemblyName="AForge.Video" processorArchitecture="MSIL" location="Packages/AForge.Video.2.2.5/lib/AForge.Video.dll" />
<AssemblyLocation assemblyName="AForge.Video.DirectShow" processorArchitecture="MSIL" location="Packages/AForge.Video.DirectShow.2.2.5/lib/AForge.Video.DirectShow.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.AindBehaviorServices" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.AindBehaviorServices.0.7.14/lib/net472/AllenNeuralDynamics.AindBehaviorServices.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.AindManipulator" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.AindManipulator.0.1.4/lib/net48/AllenNeuralDynamics.AindManipulator.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.Core" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Core.0.2.3/lib/net472/AllenNeuralDynamics.Core.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.Core.Design" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Core.Design.0.2.0/lib/net472/AllenNeuralDynamics.Core.Design.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.HarpUtils" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.HarpUtils.0.1.6/lib/net472/AllenNeuralDynamics.HarpUtils.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.LicketySplit" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.LicketySplit.0.1.0/lib/net462/AllenNeuralDynamics.LicketySplit.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.SniffDetector" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.SniffDetector.0.1.0-preview06032024/lib/net462/AllenNeuralDynamics.SniffDetector.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.Treadmill" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Treadmill.0.1.0/lib/net462/AllenNeuralDynamics.Treadmill.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.AindBehaviorServices" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.AindBehaviorServices.0.8.0/lib/net472/AllenNeuralDynamics.AindBehaviorServices.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.AindManipulator" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.AindManipulator.0.1.6/lib/net48/AllenNeuralDynamics.AindManipulator.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.Core" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Core.0.3.0/lib/net472/AllenNeuralDynamics.Core.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.Core.Design" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Core.Design.0.2.3/lib/net472/AllenNeuralDynamics.Core.Design.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.EnvironmentSensor" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.EnvironmentSensor.0.2.0/lib/net462/AllenNeuralDynamics.EnvironmentSensor.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.HarpUtils" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.HarpUtils.0.2.0/lib/net472/AllenNeuralDynamics.HarpUtils.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.LicketySplit" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.LicketySplit.0.2.0/lib/net462/AllenNeuralDynamics.LicketySplit.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.SniffDetector" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.SniffDetector.0.2.0/lib/net462/AllenNeuralDynamics.SniffDetector.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.Treadmill" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Treadmill.0.2.0/lib/net462/AllenNeuralDynamics.Treadmill.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.VersionControl" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.VersionControl.0.1.1/lib/net472/AllenNeuralDynamics.VersionControl.dll" />
<AssemblyLocation assemblyName="AllenNeuralDynamics.WhiteRabbit" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.WhiteRabbit.0.2.0/lib/net462/AllenNeuralDynamics.WhiteRabbit.dll" />
<AssemblyLocation assemblyName="AssimpNet" processorArchitecture="MSIL" location="Packages/AssimpNet.4.1.0/lib/net40/AssimpNet.dll" />
<AssemblyLocation assemblyName="Bonsai" processorArchitecture="MSIL" location="Packages/Bonsai.2.8.5/lib/net48/Bonsai.exe" />
<AssemblyLocation assemblyName="Bonsai.Audio" processorArchitecture="MSIL" location="Packages/Bonsai.Audio.2.8.0/lib/net462/Bonsai.Audio.dll" />
Expand Down Expand Up @@ -182,6 +189,7 @@
<AssemblyLocation assemblyName="SpinnakerNET_v140" processorArchitecture="Amd64" location="Packages/Bonsai.Spinnaker.0.7.1/build/net462/bin/x64/SpinnakerNET_v140.dll" />
<AssemblyLocation assemblyName="SVG" processorArchitecture="MSIL" location="Packages/SvgNet.3.3.3/lib/net462/SVG.dll" />
<AssemblyLocation assemblyName="System.Buffers" processorArchitecture="MSIL" location="Packages/System.Buffers.4.5.1/lib/net461/System.Buffers.dll" />
<AssemblyLocation assemblyName="System.Collections.Immutable" processorArchitecture="MSIL" location="Packages/System.Collections.Immutable.8.0.0/lib/net462/System.Collections.Immutable.dll" />
<AssemblyLocation assemblyName="System.Linq.Dynamic" processorArchitecture="MSIL" location="Packages/System.Linq.Dynamic.1.0.7/lib/net40/System.Linq.Dynamic.dll" />
<AssemblyLocation assemblyName="System.Memory" processorArchitecture="MSIL" location="Packages/System.Memory.4.5.5/lib/net461/System.Memory.dll" />
<AssemblyLocation assemblyName="System.Numerics.Vectors" processorArchitecture="MSIL" location="Packages/System.Numerics.Vectors.4.5.0/lib/net46/System.Numerics.Vectors.dll" />
Expand All @@ -190,7 +198,7 @@
<AssemblyLocation assemblyName="System.Reactive.Linq" processorArchitecture="MSIL" location="Packages/Rx-Linq.2.2.5/lib/net45/System.Reactive.Linq.dll" />
<AssemblyLocation assemblyName="System.Reactive.PlatformServices" processorArchitecture="MSIL" location="Packages/Rx-PlatformServices.2.2.5/lib/net45/System.Reactive.PlatformServices.dll" />
<AssemblyLocation assemblyName="System.Resources.Extensions" processorArchitecture="MSIL" location="Packages/System.Resources.Extensions.8.0.0/lib/net462/System.Resources.Extensions.dll" />
<AssemblyLocation assemblyName="System.Runtime.CompilerServices.Unsafe" processorArchitecture="MSIL" location="Packages/System.Runtime.CompilerServices.Unsafe.4.5.3/lib/net461/System.Runtime.CompilerServices.Unsafe.dll" />
<AssemblyLocation assemblyName="System.Runtime.CompilerServices.Unsafe" processorArchitecture="MSIL" location="Packages/System.Runtime.CompilerServices.Unsafe.6.0.0/lib/net461/System.Runtime.CompilerServices.Unsafe.dll" />
<AssemblyLocation assemblyName="YamlDotNet" processorArchitecture="MSIL" location="Packages/YamlDotNet.13.1.1/lib/net47/YamlDotNet.dll" />
<AssemblyLocation assemblyName="ZedGraph" processorArchitecture="MSIL" location="Packages/ZedGraph.5.1.7/lib/net35-Client/ZedGraph.dll" />
</AssemblyLocations>
Expand Down
20 changes: 16 additions & 4 deletions bonsai/setup.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
Push-Location $PSScriptRoot
if (!(Test-Path "./Bonsai.exe")) {
Invoke-WebRequest "https://github.com/bonsai-rx/bonsai/releases/download/2.8.5/Bonsai.zip" -OutFile "temp.zip"
Move-Item -Path "NuGet.config" "temp.config"
$release = "https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip"
$configPath = "./Bonsai.config"
if (Test-Path $configPath) {
[xml]$config = Get-Content $configPath
$bootstrapper = $config.PackageConfiguration.Packages.Package.where{$_.id -eq 'Bonsai'}
if ($bootstrapper) {
$version = $bootstrapper.version
$release = "https://github.com/bonsai-rx/bonsai/releases/download/$version/Bonsai.zip"
}
}
Invoke-WebRequest $release -OutFile "temp.zip"
Move-Item -Path "NuGet.config" "temp.config" -ErrorAction SilentlyContinue
Expand-Archive "temp.zip" -DestinationPath "." -Force
Move-Item -Path "temp.config" "NuGet.config" -Force
Move-Item -Path "temp.config" "NuGet.config" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "temp.zip"
Remove-Item -Path "Bonsai32.exe"
}
& .\Bonsai.exe --no-editor
& .\Bonsai.exe --no-editor
Pop-Location
29 changes: 18 additions & 11 deletions examples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
OlfactometerChannelConfig,
OlfactometerChannelType,
)
from aind_behavior_services.calibration.treadmill import (
Treadmill,
TreadmillCalibration,
TreadmillCalibrationInput,
TreadmillCalibrationOutput,
)
from aind_behavior_services.calibration.water_valve import (
Measurement,
WaterValveCalibration,
Expand All @@ -36,10 +42,7 @@
HarpLickometer,
HarpOlfactometer,
HarpSniffDetector,
HarpTreadmill,
RigCalibration,
Screen,
Treadmill,
)
from aind_behavior_vr_foraging.task_logic import (
AindVrForagingTaskLogic,
Expand Down Expand Up @@ -126,7 +129,7 @@ def mock_rig() -> AindVrForagingRig:
]
)
water_valve_calibration = WaterValveCalibration(
input=water_valve_input, output=water_valve_input.calibrate_output(), calibration_date=datetime.datetime.now()
input=water_valve_input, output=water_valve_input.calibrate_output(), date=datetime.datetime.now()
)
water_valve_calibration.output = WaterValveCalibrationOutput(slope=1, offset=0) # For testing purposes

Expand All @@ -152,16 +155,17 @@ def mock_rig() -> AindVrForagingRig:
harp_clock_generator=HarpClockGenerator(port_name="COM6"),
harp_analog_input=None,
harp_sniff_detector=HarpSniffDetector(port_name="COM7"),
harp_treadmill=HarpTreadmill(
harp_treadmill=Treadmill(
port_name="COM8",
calibration=Treadmill(
wheel_diameter=15,
pulses_per_revolution=28800,
break_lookup_calibration=[[0, 0], [1, 65535]],
calibration=TreadmillCalibration(
input=TreadmillCalibrationInput(),
output=TreadmillCalibrationOutput(
wheel_diameter=15, pulses_per_revolution=28800, brake_lookup_calibration=[[0, 0], [1, 65535]]
),
),
),
manipulator=AindManipulatorDevice(port_name="COM9", calibration=manipulator_calibration),
screen=Screen(display_index=1),
screen=rig.Screen(display_index=1),
calibration=RigCalibration(water_valve=water_valve_calibration),
)

Expand Down Expand Up @@ -302,7 +306,10 @@ def PostPatch_VirtualSiteGeneratorHelper(contrast: float = 1, friction: float =
task_parameters=AindVrForagingTaskParameters(
rng_seed=None,
updaters=updaters,
environment_statistics=environment_statistics,
environment=vr_task_logic.BlockStructure(
blocks=[vr_task_logic.Block(environment_statistics=environment_statistics, end_conditions=[])],
sampling_mode="Random",
),
task_mode_settings=vr_task_logic.ForagingSettings(),
operation_control=operation_control,
)
Expand Down
31 changes: 23 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,35 @@ build-backend = "setuptools.build_meta"

[project]
name = "aind-behavior-vr-foraging"
description = "A library that defines AIND data schema for the Aind Behavior VR Foraing experiment."
description = "A library that defines AIND data schema for the Aind Behavior VR Foraging experiment."
authors = [ {name = "Bruno Cruz", email = "[email protected]"}]
license = {text = "MIT"}
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3"
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
]
readme = "README.md"
dynamic = ["version"]

dependencies = [
"aind_behavior_services@git+https://github.com/AllenNeuralDynamics/[email protected]",
"aind_behavior_services>=0.9, <0.10",
]

[project.urls]
Documentation = "https://allenneuraldynamics.github.io/Aind.Behavior.VrForaging/"
Repository = "https://github.com/AllenNeuralDynamics/Aind.Behavior.VrForaging/"
Issues = "https://github.com/AllenNeuralDynamics/Aind.Behavior.VrForaging/issues"
Changelog = "https://github.com/AllenNeuralDynamics/Aind.Behavior.VrForaging/releases"

[project.optional-dependencies]

linters = [
'ruff',
'codespell'
launcher = ["aind_behavior_experiment_launcher[aind-services]<0.4"]

dev = ["aind_behavior_vr_foraging[launcher]",
"ruff",
"codespell"
]

docs = [
Expand All @@ -33,12 +44,16 @@ docs = [
'sphinx-jsonschema'
]

[project.scripts]
clabe = "aind_behavior_vr_foraging.launcher:main"
regenerate = "aind_behavior_vr_foraging.regenerate:main"

[tool.setuptools.packages.find]
where = ["src/DataSchemas"]

[tool.setuptools.dynamic]
version = {attr = "aind_behavior_vr_foraging.__version__"}
readme = {file = ["README.md"]}
readme = {file = "README.md", content-type = "text/markdown"}

[tool.ruff]
line-length = 120
Expand All @@ -51,5 +66,5 @@ mccabe = { max-complexity = 14 }
pydocstyle = { convention = 'google' }

[tool.codespell]
skip = '.git,*.pdf,*.svg,./bonsai,*.bonsai,./docs/_build'
skip = '.git,*.pdf,*.svg,./bonsai,*.bonsai,./docs/_build,uv.lock'
ignore-words-list = 'nd'
Loading

0 comments on commit 4db648f

Please sign in to comment.