Skip to content

Add sniff detector to the dynamic foraging bonsai workflow#1602

Merged
micahwoodard merged 6 commits intodevelopfrom
feat-add-sniff-detector
Oct 29, 2025
Merged

Add sniff detector to the dynamic foraging bonsai workflow#1602
micahwoodard merged 6 commits intodevelopfrom
feat-add-sniff-detector

Conversation

@bruno-f-cruz
Copy link
Member

Pull Request instructions:

  • If the experimenters must do anything new, provide detailed step by step instructions on the wiki
    Users may need to connect the thermistor to the sniff detector board

  • If computer maintainers need to manually update anything, provide detailed step by step instructions
    Maintainers will have to update the settings csv file to add a new setting with the key: "SniffDetector". The value of this key should be a string with the ComPort for the device. If the key is not present, the device will not be instantiated and no logging should occur.

Describe changes:

What issues or discussions does this update address?

#1601

Describe the expected change in behavior from the perspective of the experimenter

None anticipated

Describe any manual update steps for task computers

In computers that will record this device, you will need to add said device to the rig and corresponding settings to the CSV file

Was this update tested in 446/447?

Not yet

Does this update impact downstream processing by adding new saved files, or changing their format? If so, have you documented changes?

It adds new saved files to the following path:

root/../../behavior/SniffDetector.harp

all logging is accoring to spec in https://allenneuraldynamics.github.io/aind-file-standards/file_formats/harp/ version 0.2.0

Add harp utils package for easy logging
Update aind core package
@alexpiet alexpiet removed their request for review September 12, 2025 16:33
@micahwoodard
Copy link
Collaborator

@bruno-f-cruz @jasonyslee is this pr on hold until a sniff detector is installed in a box in 446/7?

@micahwoodard
Copy link
Collaborator

micahwoodard commented Sep 17, 2025

@jasonyslee I don't think anything needs to be added to this pr? Seems like it already checks if the SniffDetector key is in the csv file and if it's found initializes the device. Have you tested on 2B with the added key to confirm this works?

@jasonyslee
Copy link
Contributor

@bruno-f-cruz @micahwoodard Sniff detector is now on box 1B. Issue: Upon clicking "Start," the behavior GUI freezes and eventually Windows popup error "Python is not responding." This is only occurring on this branch, not main/testing.

@micahwoodard
Copy link
Collaborator

@jasonyslee do you have any log files?

@bruno-f-cruz
Copy link
Member Author

You may want to implement the same fix as the one xinxin suggested for the camera loggers. This PR will have the same issue.

@jasonyslee
Copy link
Contributor

@micahwoodard Here are console outputs, not especially informative...
ErrorLog_Box1B_sniff_detector.txt

@bruno-f-cruz Xinxin's fix in #1593 ? So we should reconfigure bonsai RestartLoggers to propagate RootPath?

@jasonyslee
Copy link
Contributor

@bruno-f-cruz I implemented Xinxin's fix for #1593 and got a bit further: Task now starts and video/sniffing is recorded. However, I get this ConnectionAbortedError from the GUI when attempting to start Camera Preview. RAs will not run mice if they cannot be monitored live. Could this have to do with deleting foraging.bonsai.layout ?
250925_DF_1B_camera_preview_ConnectionAbortedError

@bruno-f-cruz
Copy link
Member Author

No clue where this is coming from. It merely states the OSC connection dropped. If someone ends up concluding what the issue is, lmk and I can try help solving it from the Bonsai side if needed

@XX-Yin
Copy link
Collaborator

XX-Yin commented Sep 27, 2025

@jasonyslee It's working normally on my side. I can't repeat this issue, but I tested without a sniff sensor on the ephys rig 3.

@micahwoodard
Copy link
Collaborator

@jasonyslee is this ready to merge? I just tested on 1B and seems to be working with sniff detector

@jasonyslee
Copy link
Contributor

@micahwoodard The last thing I need to resolve is how to visualize streams while recording (video, sniff). They don't automatically appear because I had to delete foraging.bonsai.layout for workflow to run. Maybe I'm just using bonsai wrong but manually opening visualizers through the workflow just generates empty windows. I will try to test with Xinxin this week.

Added sniff detector visualization window and recreated Lick/CamRecord/CamPreview windows.
@jasonyslee
Copy link
Contributor

@micahwoodard Update: Task now runs with foraging.bonsai.layout. I pushed changes that automatically pull up visualizer windows like the main branch (but with sniff detector values added). Now we should be good to merge.

@bruno-f-cruz
Copy link
Member Author

In order to get rid of the clunkiness of keeping local layout files, consider merging #1625. Once that is done you will be able to launch the visualizers from the workflow without having to specify anything in layout files

Copy link
Contributor

@jasonyslee jasonyslee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch works as intended; sniff detector signals recorded successfully during behavior

@micahwoodard
Copy link
Collaborator

@jasonyslee could you resolve merge conflicts so we can merge?

@micahwoodard
Copy link
Collaborator

@jasonyslee yay thank you! I'll merge for testing next week

@micahwoodard micahwoodard merged commit a05f4ed into develop Oct 29, 2025
@micahwoodard micahwoodard deleted the feat-add-sniff-detector branch October 29, 2025 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants