fix: session string parsing doesn't work with ephys sessions#126
fix: session string parsing doesn't work with ephys sessions#126galenlynch wants to merge 1 commit intomainfrom
Conversation
ephys sessions have names like ecephys_<subject>_<date>_<time>, and the current session parsing logic depends on the exact number and placement of underscores.
|
Would it be simpler to just use if nwb.session_id.startswith("behavior") or nwb.session_id.startswith("FIP") or nwb.session_id.startswith("ecephys"):
splits = nwb.session_id.split("_")
subject_id = splits[1]
session_date = splits[2]
else:
splits = nwb.session_id.split("_")
subject_id = splits[0]
session_date = splits[1]The Note here that the only reason we are parsing session names at all is because metadata is not added to the NWB files |
|
What about another modality besides ecephys, behavior, or FIP? I personally don't find regexs that complicated, and I think they're often the "right" tool for this job of string parsing - they are expressive enough to represent what you actually mean. In this case the function is finding the first substring ( That being said I just want it to work with ecephys sessions, so if you don't want to use a regex I'm fine using string splitting on underscores for now. |
|
metadata 2.0 removes the modality prefix anyways, so this issue will go away eventually. I think for readability, splitting by "_" is way easier to understand than a regex. |
Ephys sessions have names like
ecephys_<subject>_<date>_<time>, and the current session parsing logic depends on the exact number and placement of underscores, causing these functions to not work for ephys nwbs.