Skip to content

More fib plus pav updates #293

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

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from
Open

Conversation

dougollerenshaw
Copy link
Contributor

@dougollerenshaw dougollerenshaw commented May 5, 2025

Summary of updates:

  • Add behavior cameras to src/aind_metadata_mapper/pavlovian_behavior/example_create_session.py
  • Improves the docstring in src/aind_metadata_mapper/pavlovian_behavior/example_create_session.py with an example CLI command.
  • Add a special case to src/aind_metadata_mapper/utils/merge_sessions.py to deal with conflicting reward units. If one session file has reward_consumed_total = null, ignore the associated units.
  • Added many missing fields in the stimulus_epochs field in src/aind_metadata_mapper/pavlovian_behavior/example_create_session.py
  • Vastly simplified scripts/example_create_fiber_and_pav_sessions.py to use the default params specified in src/aind_metadata_mapper/pavlovian_behavior/example_create_session.py and src/aind_metadata_mapper/fib/example_create_session.py
  • Added ability to pass through the following parameters from the command line:
    • active_mouse_platform
    • anaesthesia
    • animal_weight_post
    • animal_weight_prior
    • mouse_platform_name

Testing the Session Mapper

To test the session mapper with real data:

First, check out this branch and update your environment:

git checkout origin/more_fib_plus_pav_updates
pip install -e .  # This will install/update dependencies including s3fs

Then download a session's data. Running the command below in your terminal will download data from one real session from S3 to the data folder in the root of this repo (creating the folder if it doesn't already exist):

python scripts/download_fiber_behavior_data.py s3://aind-private-data-prod-o5171v/behavior_694360_2024-01-10_13-43-17

Note that this requires you having AWS credentials saved locally. See the docstring for details.

This will create a directory structure at data/behavior_694360_2024-01-10_13-43-17/ containing the session's CSV files, which are the input to the session metadata mappers.

Then generate the session metadata by running the following at the command line:

python scripts/example_create_fiber_and_pav_sessions.py \
    --data-dir data/behavior_694360_2024-01-10_13-43-17 \
    --experimenter "Jane Doe" \
    --subject-id "694360" \
    --rig-id "rig_123" \
    --iacuc "1234" \

The output session JSON will be written to data/behavior_694360_2024-01-10_13-43-17/session.json.

@dougollerenshaw dougollerenshaw requested a review from hagikent May 5, 2025 17:05
@dougollerenshaw
Copy link
Contributor Author

Note: this is related to this issue.

Copy link
Collaborator

@hagikent hagikent left a comment

Choose a reason for hiding this comment

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

All changes confirmed. Major modality specific functions tested. Bash argparse example usage tested.
Once Saskia et al. give a green light to the (tentative) design of stimulus_epoch, goo to be merged! (or merge now and later patch-fix)

hagikent and others added 12 commits May 6, 2025 18:46
The original code was mainly designed to be used for CLI/argparse via command-line. I foresee a need to use it as a standalone python function. So, this refactoring introduced the create_unified_session_metadata() while keeping the main() function at the bottom so it can be used for both usecases.
restoring help args for CLI
…dates_patch_kh

suggestion for the example code to make it a python function
@dougollerenshaw dougollerenshaw requested a review from saskiad May 7, 2025 19:53
@dougollerenshaw
Copy link
Contributor Author

Comment from Saskia: remove active_mouse_platform and anesthesia as passable params. They are not relevant here.

@dougollerenshaw
Copy link
Contributor Author

@hagikent, I reviewed the session.json that is produced by this code with @saskiad yesterday afternoon. She had a few questions/suggestions. Here's a subset of those that I could use some help from you in answering:

  • Are there any data acquisition boards you can specify that are used for behavior videos, behavior, or fiber? All of these are currently empty lists. They should correspond to daq names that are listed in the rig, which are:
    • "harp behavior board"
    • "harp sound card"
    • "harp clock synchronization board"
    • "harp sound amplifier"
    • "USB DAQ"
  • The data_stream that I have named 'behavior' should actually be 'behavior-videos'. I'll make that change. But do you have any info you can share about the software that controlled the behavior videos? Ideally a github permalink to the actual version used.
  • Do you have info on the software controlling the fiber acquisition? Again, ideally a github permalink to the actual version used
  • And same for the behavior control. Need a link to the software used to control stim delivery
  • Do the stimulus_names of the four stimuli in the stimulus_parameters (CS1, CS2, CS3, CS4) match the actual names used in code? If so, we should leave them as is. If not, Saskia was suggesting that the white noise stimulus should have a more descriptive name.

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.

2 participants