baghban: check Bonsai workflows for silent data-loss bugs before running them (Python, works on Mac/Linux) #2672
aslansd
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I've built a small Python tool, baghban (gardener in Persian and Azerbaijani), that reads
.bonsaifiles and reports faults that lose data without an error. It runs anywhere Python does, macOS and Linux included, with no Windows, .NET or Bonsai installation needed. It only reads the XML; it never runs the workflow.What it catches
The bugs that cost the most in a rig are the ones that don't crash: the session runs, and the problem shows up weeks later in analysis. For example:
CsvWriterinside a per-trialSelectManywithOverwrite=TrueandSuffix=None, which leaves only the last trial in the file;SubscribeSubjectnaming a subject that doesn't exist (with a "did you mean" hint);It also:
How I checked it
Every finding follows behaviour I traced in the Bonsai source, and I checked baghban three ways:
Bonsai.Core.TestsandBonsai.Editor.Testsabout which ones fail to build.These are the real problems it found. Each was checked against the repository's history before I reported it, and the links point to the files at the commits I checked:
AindManipulator.bonsai, which was removed from the package in January. Reported: Docs examples include AindManipulator.bonsai, which was removed from the package AllenNeuralDynamics/Bonsai.AllenNeuralDynamics#141Extensions\range.bonsaithat isn't next to it. Reported: screen_sweep_harp_photodiode.bonsai includes Extensions\range.bonsai, which doesn't exist next to it int-brain-lab/iblrig#930responses.csvon every run. Reported: GNGTemplate.bonsai: responses.csv is overwritten on every run neurogears/vestibular-vr#137Reading the results by hand matters. baghban also flags five BonVision tutorial workflows in the docs for a missing include, but the tutorial has the reader create that file, so those findings are correct but intentional. The survey records them that way, along with every other finding: survey/SURVEY.md.
Limitations
Two requests
python confirm/confirm.pyfrom the repository. That would confirm the findings where rigs actually run; file locking differs between operating systems, which matters most for duplicate outputs. Setup and expected output are in confirm/README.md.Code, docs and the full survey: https://github.com/aslansd/baghban
Thanks to the Bonsai team for a codebase clear enough to build this on.
All reactions