-
Notifications
You must be signed in to change notification settings - Fork 3
Neural decoder example #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
4ef34c9
Added bonsai environment
ncguilbeault dd06f6d
Added decoder python library
ncguilbeault 32491db
Added workflow with extensions
ncguilbeault 034fd52
Added README
ncguilbeault 3d01197
Added clusterless spike decoder model
ncguilbeault 99e1bfe
Changed name to sorted spikes
ncguilbeault 501a622
Added clusterless spikes bonsai workflow
ncguilbeault dcd18b5
Updated data iterator to handle outputting position bins
ncguilbeault 02f8cc0
Changed name of core to decoder
ncguilbeault 8ad156c
Added likelihood module
ncguilbeault 4d5d5e0
Updated model loader to use decoder module
ncguilbeault ebd1f6c
Updated init file
ncguilbeault 6cb45dc
Add bonsai shaders package
ncguilbeault e4d0545
Updated to use shaders render frequency for timing
ncguilbeault 8fce417
Renamed folders more appropriately to NeuralDecoding/PositionDecoding…
ncguilbeault d95ef63
Updated to remove cuda path declaration and copy of decoder class
ncguilbeault 97b7531
Updated to have filename declarations at top
ncguilbeault 0b53a4a
Updated
ncguilbeault 9bc727f
Added README to example
ncguilbeault c022daa
Added requirements.txt file
ncguilbeault 8a775f7
Updated notebook for 50Hz down sampling
ncguilbeault 031c46d
Added cell for plotting
ncguilbeault c8ee1a4
Added online FPS estimate
ncguilbeault b62ad61
Updated to properly use 50 Hz
ncguilbeault 2c9cfda
Remove exensions and use new Bonsai.ML.NeuralDecoding package
ncguilbeault ffd1014
Updated to use Bonsai.ML package
ncguilbeault 5cae1d2
Removed requirements.txt file in favor of installing from git repo
ncguilbeault 7f6b754
Updated notebooks for new package
ncguilbeault 82b92bd
Added new dataset to README
ncguilbeault 1060fee
Updated example README
ncguilbeault 1043f16
Removed python package from inside example folder
ncguilbeault ee9def4
Renamed workflows
ncguilbeault d3bd578
Updated notebooks and removed redundant loading from file
ncguilbeault b0f1ca8
Updated package version correctly
ncguilbeault File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/Bonsai.config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| <?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="Bonsai" version="2.8.5" /> | ||
| <Package id="Bonsai.Core" version="2.8.5" /> | ||
| <Package id="Bonsai.Design" version="2.8.5" /> | ||
| <Package id="Bonsai.Design.Visualizers" version="2.8.0" /> | ||
| <Package id="Bonsai.Editor" version="2.8.5" /> | ||
| <Package id="Bonsai.Gui" version="0.1.0" /> | ||
| <Package id="Bonsai.Gui.ZedGraph" version="0.1.0" /> | ||
| <Package id="Bonsai.ML" version="0.4.0" /> | ||
| <Package id="Bonsai.ML.Design" version="0.4.0" /> | ||
| <Package id="Bonsai.ML.NeuralDecoder" version="0.4.0" /> | ||
| <Package id="Bonsai.ML.NeuralDecoder.Design" version="0.4.0" /> | ||
| <Package id="Bonsai.ML.Python" version="0.4.0" /> | ||
| <Package id="Bonsai.Scripting.Expressions" version="2.8.0" /> | ||
| <Package id="Bonsai.Scripting.Expressions.Design" version="2.8.0" /> | ||
| <Package id="Bonsai.Scripting.Python" version="0.2.1" /> | ||
| <Package id="Bonsai.Shaders" version="0.27.1" /> | ||
| <Package id="Bonsai.System" version="2.8.1" /> | ||
| <Package id="jacobslusser.ScintillaNET" version="3.6.3" /> | ||
| <Package id="Markdig" version="0.18.1" /> | ||
| <Package id="MathNet.Numerics" version="5.0.0" /> | ||
| <Package id="Microsoft.CSharp" version="4.7.0" /> | ||
| <Package id="Microsoft.Web.WebView2" version="1.0.1823.32" /> | ||
| <Package id="OpenCV.Net" version="3.4.2" /> | ||
| <Package id="OpenTK" version="3.1.0" /> | ||
| <Package id="OxyPlot.Core" version="2.1.2" /> | ||
| <Package id="OxyPlot.WindowsForms" version="2.1.2" /> | ||
| <Package id="pythonnet" version="3.0.3" /> | ||
| <Package id="Rx-Core" version="2.2.5" /> | ||
| <Package id="Rx-Interfaces" version="2.2.5" /> | ||
| <Package id="Rx-Linq" version="2.2.5" /> | ||
| <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.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.Reflection.Emit" version="4.3.0" /> | ||
| <Package id="System.Resources.Extensions" version="8.0.0" /> | ||
| <Package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" /> | ||
| <Package id="YamlDotNet" version="13.1.1" /> | ||
| <Package id="ZedGraph" version="5.1.7" /> | ||
| </Packages> | ||
| <AssemblyReferences> | ||
| <AssemblyReference assemblyName="Bonsai" /> | ||
| <AssemblyReference assemblyName="Bonsai.Core" /> | ||
| <AssemblyReference assemblyName="Bonsai.Design" /> | ||
| <AssemblyReference assemblyName="Bonsai.Design.Visualizers" /> | ||
| <AssemblyReference assemblyName="Bonsai.Editor" /> | ||
| <AssemblyReference assemblyName="Bonsai.Gui" /> | ||
| <AssemblyReference assemblyName="Bonsai.Gui.ZedGraph" /> | ||
| <AssemblyReference assemblyName="Bonsai.ML" /> | ||
| <AssemblyReference assemblyName="Bonsai.ML.Design" /> | ||
| <AssemblyReference assemblyName="Bonsai.ML.NeuralDecoder" /> | ||
| <AssemblyReference assemblyName="Bonsai.ML.NeuralDecoder.Design" /> | ||
| <AssemblyReference assemblyName="Bonsai.ML.Python" /> | ||
| <AssemblyReference assemblyName="Bonsai.Scripting.Expressions" /> | ||
| <AssemblyReference assemblyName="Bonsai.Scripting.Expressions.Design" /> | ||
| <AssemblyReference assemblyName="Bonsai.Scripting.Python" /> | ||
| <AssemblyReference assemblyName="Bonsai.Shaders" /> | ||
| <AssemblyReference assemblyName="Bonsai.System" /> | ||
| </AssemblyReferences> | ||
| <AssemblyLocations> | ||
| <AssemblyLocation assemblyName="Bonsai" processorArchitecture="MSIL" location="Packages/Bonsai.2.8.5/lib/net48/Bonsai.exe" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Core" processorArchitecture="MSIL" location="Packages/Bonsai.Core.2.8.5/lib/net462/Bonsai.Core.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Design" processorArchitecture="MSIL" location="Packages/Bonsai.Design.2.8.5/lib/net462/Bonsai.Design.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Design.Visualizers" processorArchitecture="MSIL" location="Packages/Bonsai.Design.Visualizers.2.8.0/lib/net462/Bonsai.Design.Visualizers.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Editor" processorArchitecture="MSIL" location="Packages/Bonsai.Editor.2.8.5/lib/net472/Bonsai.Editor.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Gui" processorArchitecture="MSIL" location="Packages/Bonsai.Gui.0.1.0/lib/net472/Bonsai.Gui.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Gui.ZedGraph" processorArchitecture="MSIL" location="Packages/Bonsai.Gui.ZedGraph.0.1.0/lib/net472/Bonsai.Gui.ZedGraph.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.ML" processorArchitecture="MSIL" location="Packages/Bonsai.ML.0.4.0/lib/net472/Bonsai.ML.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.ML.Design" processorArchitecture="MSIL" location="Packages/Bonsai.ML.Design.0.4.0/lib/net472/Bonsai.ML.Design.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.ML.NeuralDecoder" processorArchitecture="MSIL" location="Packages/Bonsai.ML.NeuralDecoder.0.4.0/lib/net472/Bonsai.ML.NeuralDecoder.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.ML.NeuralDecoder.Design" processorArchitecture="MSIL" location="Packages/Bonsai.ML.NeuralDecoder.Design.0.4.0/lib/net472/Bonsai.ML.NeuralDecoder.Design.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.ML.Python" processorArchitecture="MSIL" location="Packages/Bonsai.ML.Python.0.4.0/lib/net472/Bonsai.ML.Python.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Scripting.Expressions" processorArchitecture="MSIL" location="Packages/Bonsai.Scripting.Expressions.2.8.0/lib/net462/Bonsai.Scripting.Expressions.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Scripting.Expressions.Design" processorArchitecture="MSIL" location="Packages/Bonsai.Scripting.Expressions.Design.2.8.0/lib/net462/Bonsai.Scripting.Expressions.Design.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Scripting.Python" processorArchitecture="MSIL" location="Packages/Bonsai.Scripting.Python.0.2.1/lib/net472/Bonsai.Scripting.Python.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.Shaders" processorArchitecture="MSIL" location="Packages/Bonsai.Shaders.0.27.1/lib/net462/Bonsai.Shaders.dll" /> | ||
| <AssemblyLocation assemblyName="Bonsai.System" processorArchitecture="MSIL" location="Packages/Bonsai.System.2.8.1/lib/net462/Bonsai.System.dll" /> | ||
| <AssemblyLocation assemblyName="Markdig" processorArchitecture="MSIL" location="Packages/Markdig.0.18.1/lib/net40/Markdig.dll" /> | ||
| <AssemblyLocation assemblyName="MathNet.Numerics" processorArchitecture="MSIL" location="Packages/MathNet.Numerics.5.0.0/lib/net48/MathNet.Numerics.dll" /> | ||
| <AssemblyLocation assemblyName="Microsoft.Web.WebView2.Core" processorArchitecture="MSIL" location="Packages/Microsoft.Web.WebView2.1.0.1823.32/lib/net45/Microsoft.Web.WebView2.Core.dll" /> | ||
| <AssemblyLocation assemblyName="Microsoft.Web.WebView2.WinForms" processorArchitecture="MSIL" location="Packages/Microsoft.Web.WebView2.1.0.1823.32/lib/net45/Microsoft.Web.WebView2.WinForms.dll" /> | ||
| <AssemblyLocation assemblyName="Microsoft.Web.WebView2.Wpf" processorArchitecture="MSIL" location="Packages/Microsoft.Web.WebView2.1.0.1823.32/lib/net45/Microsoft.Web.WebView2.Wpf.dll" /> | ||
| <AssemblyLocation assemblyName="OpenCV.Net" processorArchitecture="MSIL" location="Packages/OpenCV.Net.3.4.2/lib/net462/OpenCV.Net.dll" /> | ||
| <AssemblyLocation assemblyName="OpenTK" processorArchitecture="MSIL" location="Packages/OpenTK.3.1.0/lib/net20/OpenTK.dll" /> | ||
| <AssemblyLocation assemblyName="OxyPlot" processorArchitecture="MSIL" location="Packages/OxyPlot.Core.2.1.2/lib/net45/OxyPlot.dll" /> | ||
| <AssemblyLocation assemblyName="OxyPlot.WindowsForms" processorArchitecture="MSIL" location="Packages/OxyPlot.WindowsForms.2.1.2/lib/net45/OxyPlot.WindowsForms.dll" /> | ||
| <AssemblyLocation assemblyName="Python.Runtime" processorArchitecture="MSIL" location="Packages/pythonnet.3.0.3/lib/netstandard2.0/Python.Runtime.dll" /> | ||
| <AssemblyLocation assemblyName="ScintillaNET" processorArchitecture="MSIL" location="Packages/jacobslusser.ScintillaNET.3.6.3/lib/net40/ScintillaNET.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.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" /> | ||
| <AssemblyLocation assemblyName="System.Reactive.Core" processorArchitecture="MSIL" location="Packages/Rx-Core.2.2.5/lib/net45/System.Reactive.Core.dll" /> | ||
| <AssemblyLocation assemblyName="System.Reactive.Interfaces" processorArchitecture="MSIL" location="Packages/Rx-Interfaces.2.2.5/lib/net45/System.Reactive.Interfaces.dll" /> | ||
| <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="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> | ||
| <LibraryFolders> | ||
| <LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-arm64/native" platform="arm64" /> | ||
| <LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-arm64/native_uap" platform="arm64" /> | ||
| <LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x64/native" platform="x64" /> | ||
| <LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x64/native_uap" platform="x64" /> | ||
| <LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x86/native" platform="x86" /> | ||
| <LibraryFolder path="Packages/Microsoft.Web.WebView2.1.0.1823.32/runtimes/win-x86/native_uap" platform="x86" /> | ||
| </LibraryFolders> | ||
| </PackageConfiguration> | ||
8 changes: 8 additions & 0 deletions
8
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/NuGet.config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <packageSources> | ||
| <add key="Gallery" value="Gallery" /> | ||
| <add key="Bonsai Packages" value="https://www.myget.org/F/bonsai/api/v3/index.json" /> | ||
| <add key="Community Packages" value="https://www.myget.org/F/bonsai-community/api/v3/index.json" /> | ||
| </packageSources> | ||
| </configuration> |
21 changes: 21 additions & 0 deletions
21
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/Setup.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Push-Location $PSScriptRoot | ||
| if (!(Test-Path "./Bonsai.exe")) { | ||
| $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 -ErrorAction SilentlyContinue | ||
| Remove-Item -Path "temp.zip" | ||
| Remove-Item -Path "Bonsai32.exe" | ||
| } | ||
| & .\Bonsai.exe --no-editor | ||
| Pop-Location |
41 changes: 41 additions & 0 deletions
41
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/Setup.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #! /bin/bash | ||
|
|
||
| SETUP_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
|
|
||
| DEFAULT_VERSION="latest" | ||
| VERSION="$DEFAULT_VERSION" | ||
|
|
||
| while [[ "$#" -gt 0 ]]; do | ||
| case $1 in | ||
| --version) VERSION="$2"; shift ;; | ||
| *) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| echo "Setting up Bonsai v=$VERSION environment..." | ||
|
|
||
| if [ ! -f "$SETUP_SCRIPT_DIR/Bonsai.exe" ]; then | ||
| CONFIG="$SETUP_SCRIPT_DIR/Bonsai.config" | ||
| if [ -f "$CONFIG" ]; then | ||
| DETECTED=$(xmllint --xpath '//PackageConfiguration/Packages/Package[@id="Bonsai"]/@version' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
| echo "Version detected v=$DETECTED." | ||
| RELEASE="https://github.com/bonsai-rx/bonsai/releases/download/$DETECTED/Bonsai.zip" | ||
| else | ||
| if [ $VERSION = "latest" ]; then | ||
| RELEASE="https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip" | ||
| else | ||
| RELEASE="https://github.com/bonsai-rx/bonsai/releases/download/$VERSION/Bonsai.zip" | ||
| fi | ||
| fi | ||
| echo "Download URL: $RELEASE" | ||
| wget $RELEASE -O "$SETUP_SCRIPT_DIR/temp.zip" | ||
| mv -f "$SETUP_SCRIPT_DIR/NuGet.config" "$SETUP_SCRIPT_DIR/temp.config" | ||
| unzip -d "$SETUP_SCRIPT_DIR" -o "$SETUP_SCRIPT_DIR/temp.zip" | ||
| mv -f "$SETUP_SCRIPT_DIR/temp.config" "$SETUP_SCRIPT_DIR/NuGet.config" | ||
| rm -rf "$SETUP_SCRIPT_DIR/temp.zip" | ||
| rm -rf "$SETUP_SCRIPT_DIR/Bonsai32.exe" | ||
| fi | ||
|
|
||
| source "$SETUP_SCRIPT_DIR/activate" | ||
| source "$SETUP_SCRIPT_DIR/run" --no-editor |
15 changes: 15 additions & 0 deletions
15
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/activate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/bash | ||
| # activate.sh | ||
| if [[ -v BONSAI_EXE_PATH ]]; then | ||
| echo "Error! Cannot have multiple bonsai environments activated at the same time. Please deactivate the current environment before activating the new one." | ||
| return | ||
| fi | ||
| BONSAI_ENV_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
| export BONSAI_ENV_DIR | ||
| export BONSAI_EXE_PATH="$BONSAI_ENV_DIR/Bonsai.exe" | ||
| export ORIGINAL_PS1="$PS1" | ||
| export PS1="($(basename "$BONSAI_ENV_DIR")) $PS1" | ||
| alias bonsai='source "$BONSAI_ENV_DIR"/run' | ||
| alias bonsai-clean='GTK_DATA_PREFIX= source "$BONSAI_ENV_DIR"/run' | ||
| alias deactivate='source "$BONSAI_ENV_DIR"/deactivate' | ||
| echo "Activated bonsai environment in $BONSAI_ENV_DIR" |
8 changes: 8 additions & 0 deletions
8
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/deactivate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
| unset BONSAI_EXE_PATH | ||
| export PS1="$ORIGINAL_PS1" | ||
| unset ORIGINAL_PS1 | ||
| unalias bonsai | ||
| unalias bonsai-clean | ||
| unalias deactivate | ||
| echo "Deactivated bonsai environment." |
58 changes: 58 additions & 0 deletions
58
examples/NeuralDecoding/PositionDecodingFromHippocampus/.bonsai/run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/bin/bash | ||
| # run.sh | ||
|
|
||
| SETUP_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
| CONFIG="$SETUP_SCRIPT_DIR/Bonsai.config" | ||
|
|
||
| cleanup() { | ||
| update_paths_to_windows | ||
| } | ||
|
|
||
| update_paths_to_linux() { | ||
| ASSEMBLYLOCATIONS=$(xmllint --xpath '//PackageConfiguration/AssemblyLocations/AssemblyLocation/@location' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
| for ASSEMBLYLOCATION in $ASSEMBLYLOCATIONS; do | ||
| NEWASSEMBLYLOCATION="${ASSEMBLYLOCATION//\\/\/}" | ||
| xmlstarlet edit --inplace --update "/PackageConfiguration/AssemblyLocations/AssemblyLocation[@location='$ASSEMBLYLOCATION']/@location" --value "$NEWASSEMBLYLOCATION" "$CONFIG" | ||
| done | ||
|
|
||
| LIBRARYFOLDERS=$(xmllint --xpath '//PackageConfiguration/LibraryFolders/LibraryFolder/@path' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
| for LIBRARYFOLDER in $LIBRARYFOLDERS; do | ||
| NEWLIBRARYFOLDER="${LIBRARYFOLDER//\\/\/}" | ||
| xmlstarlet edit --inplace --update "//PackageConfiguration/LibraryFolders/LibraryFolder[@path='$LIBRARYFOLDER']/@path" --value "$NEWLIBRARYFOLDER" "$CONFIG" | ||
| done | ||
| } | ||
|
|
||
| update_paths_to_windows() { | ||
| ASSEMBLYLOCATIONS=$(xmllint --xpath '//PackageConfiguration/AssemblyLocations/AssemblyLocation/@location' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
| for ASSEMBLYLOCATION in $ASSEMBLYLOCATIONS; do | ||
| NEWASSEMBLYLOCATION="${ASSEMBLYLOCATION//\//\\}" | ||
| xmlstarlet edit --inplace --update "/PackageConfiguration/AssemblyLocations/AssemblyLocation[@location='$ASSEMBLYLOCATION']/@location" --value "$NEWASSEMBLYLOCATION" "$CONFIG" | ||
| done | ||
|
|
||
| LIBRARYFOLDERS=$(xmllint --xpath '//PackageConfiguration/LibraryFolders/LibraryFolder/@path' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
| for LIBRARYFOLDER in $LIBRARYFOLDERS; do | ||
| NEWLIBRARYFOLDER="${LIBRARYFOLDER//\//\\}" | ||
| xmlstarlet edit --inplace --update "//PackageConfiguration/LibraryFolders/LibraryFolder[@path='$LIBRARYFOLDER']/@path" --value "$NEWLIBRARYFOLDER" "$CONFIG" | ||
| done | ||
| } | ||
|
|
||
| if [[ -v BONSAI_EXE_PATH ]]; then | ||
| if [ ! -f "$BONSAI_EXE_PATH" ]; then | ||
| bash "$BONSAI_ENV_DIR"/Setup.sh | ||
| bash "$BONSAI_ENV_DIR"/run "$@" | ||
| else | ||
| BONSAI_VERSION=$(xmllint --xpath "//PackageConfiguration/Packages/Package[@id='Bonsai']/@version" "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
| if [[ -z ${BONSAI_VERSION+x} ]] && [ "$BONSAI_VERSION" \< "2.8.4" ]; then | ||
| echo "Updating paths to Linux format..." | ||
| trap cleanup EXIT INT TERM | ||
| update_paths_to_linux | ||
| mono "$BONSAI_EXE_PATH" "$@" | ||
| cleanup | ||
| else | ||
| mono "$BONSAI_EXE_PATH" "$@" | ||
| fi | ||
| fi | ||
| else | ||
| echo "BONSAI_EXE_PATH is not set. Please set the path to the Bonsai executable." | ||
| return | ||
| fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: Ah, I didn't realize this was a stale PR already covered by #19 in this regard.
Please ensure to update this PR to Bonsai 2.9.0 prior to merging, similar to #18 or #19
The easiest way to do this is to put the 2.9.0 Bonsai.exe here and launch it and everything else should be automatic. (Don't do it manually, 2.9.0 has new core dependencies it'll need to add.)
(Worth noting that I did not review any other files, just wanted to make this note.)