AllenNeuralDynamics / dynamic-foraging-task

Bonsai/Harp workflow for Dynamic Foraging with Python GUI for visualization and control
MIT License
5 stars 4 forks source link

Sound intensity calibration function #475

Closed hagikent closed 1 month ago

hagikent commented 2 months ago

Describe changes:

Attenuation function is added to GoCueChecker.bonsai in src\soundcard_setup

image

If you navigate to AttenuationPayload,

image

you will be able to attenuate sound intensity for both L/R channels separately. (larger attenuation value= smaller sound)

This snippet should be used for both checking if sound upload properly worked and sound intensity calibration (e.g. GoCue~60dB)

What issues or discussions does this update address?

With this, precise calibration of sound intensity per rig can be possible.

Also, automatically solving this: https://github.com/AllenNeuralDynamics/aind-behavior-blog/issues/396

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

No. Only when calibrating sound intensity.

Describe any manual update steps for task computers

No. (main foraging.bonsai will be updated accordingly to integrate attenuation and then externalize the values in local setting files)

Was this update tested in 446/447?

Tested in 428-9-A

alexpiet commented 2 months ago

@hagikent After we determine the appropriate attenuation, how/where do we save that value?

hagikent commented 2 months ago

@alexpiet https://teams.microsoft.com/l/message/19:3f4fca20f4d34720a0ae8b90a6a75b22@thread.v2/1716915637194?context=%7B%22contextType%22%3A%22chat%22%7D

I was thinking of "...and storing the attenuation value in Setting.json or Box.csv?" and Xinxin seems to be agreeing. Or could be a different calibration file like the solenoid calibration file.

XX-Yin commented 2 months ago

calibration

@alexpiet https://teams.microsoft.com/l/message/19:3f4fca20f4d34720a0ae8b90a6a75b22@thread.v2/1716915637194?context=%7B%22contextType%22%3A%22chat%22%7D

I was thinking of "...and storing the attenuation value in Setting.json or Box.csv?" and Xinxin seems to be agreeing. Or could be a different calibration file like the solenoid calibration file.

I think these values can go to the box csv file

hagikent commented 2 months ago

I don't have any preference. The most intuitive, easiest to maintain location would be the best. Anyway, this PR is agnostic to how to actually store calibrated values.

alexpiet commented 2 months ago

@hagikent Can you go ahead an implement the system for saving the calibration values?

hagikent commented 2 months ago

@alexpiet As we only need a value corresponding to 60dB with a fixed frequency, I was just thinking of manually adding it to Box.cvs after calibration. Are you expecting something more?

alexpiet commented 2 months ago

Yes, that seems great. And just figuring out how to get bonsai to read that value

hagikent commented 2 months ago

Attenuation node can externalize the value (see below).

Screen Shot 2024-05-29 at 13 29 43

So, just sending value directly from CLI. Or adding csvreader to make Bonsai read it.

Screen Shot 2024-05-29 at 13 38 32

I don't know which one goes smoothly with other "parameter externalization" you two already implemented, though.

alexpiet commented 2 months ago

Add it to Settings_box#.csv

hagikent commented 1 month ago

Merged into #481