Skip to content
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

BUG: Fix bug with reading his_id from snirf #12526

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Conversation

larsoner
Copy link
Member

@larsoner larsoner commented Apr 2, 2024

Companion to mne-tools/mne-nirs#546. But the short version is that SNIRF stores a SubjectID which maps nicely onto our info["subject_info"]["his_id"] but we weren't setting it.

@larsoner
Copy link
Member Author

larsoner commented Apr 2, 2024

@drammock should be good to go!

Comment on lines 287 to +289
names = np.array(dat.get("nirs/metaDataTags/SubjectID"))
subject_info["first_name"] = _correct_shape(names)[0].decode("UTF-8")
names = _correct_shape(names)[0].decode("UTF-8")
subject_info["his_id"] = names
Copy link
Member

Choose a reason for hiding this comment

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

[nitpick] varname shouldn't be names if the content is an anonymous ID. Or is SubjectID sometimes containing actual names?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sometimes it contains just the concat of first middle last. The naming and stuff is meant to mirror the NIRX convention / use I think:

subject_info["his_id"] = "_".join(names)

Comment on lines +300 to +302
else:
# MNE < 1.7 used to not write the firstName tag, so pull it from names
subject_info["first_name"] = names.split("_")[0]
Copy link
Member

Choose a reason for hiding this comment

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

this strikes me as odd but if you're doing it I trust that it makes sense?

@drammock drammock merged commit 675f38a into mne-tools:main Apr 2, 2024
30 checks passed
@drammock drammock deleted the snirf2 branch April 2, 2024 19:20
larsoner added a commit to larsoner/mne-python that referenced this pull request Apr 15, 2024
* upstream/main: (50 commits)
  ENH: Improve OPM auditory dataset and example (mne-tools#12539)
  MAINT: Bump to latest pydata-sphinx-theme (mne-tools#12228)
  MRG: Simplify manual installation instructions a little by dropping explicit mention of (lib)mamba (mne-tools#12362)
  fix PSD weights handling when bad annotations present (mne-tools#12538)
  Fix phase loading (mne-tools#12537)
  align FFT windows to good data spans in psd_array_welch (mne-tools#12536)
  explicitly disallow multitaper in presence of bad annotations (mne-tools#12535)
  MAINT: Clean up PyVista contexts (mne-tools#12533)
  MAINT: Complete API change of ordered (mne-tools#12534)
  MAINT: Reinstall statsmodels and improve logging (mne-tools#12532)
  MAINT: Remove scipy.signal.morlet2 (mne-tools#12531)
  Update README badge links (mne-tools#12529)
  BUG: Fix bug with reading his_id from snirf (mne-tools#12526)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#12524)
  Fix file format check in _check_eeglab_fname function (mne-tools#12523)
  MAINT: Reenable picard in pre testing (mne-tools#12525)
  MAINT: Bump to large resource class (mne-tools#12522)
  MAINT: Restore 2 jobs on Windows (mne-tools#12520)
  Add exclude_after_unique option to mne.io.read_raw_edf/read_raw_edf to search for exclude channels after making channel names unique (mne-tools#12518)
  Improve consistency of sensor types in code and documentation (mne-tools#12509)
  ...
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