Skip to content

BUG: Fix bug with reading his_id from snirf#12526

Merged
drammock merged 3 commits intomne-tools:mainfrom
larsoner:snirf2
Apr 2, 2024
Merged

BUG: Fix bug with reading his_id from snirf#12526
drammock merged 3 commits intomne-tools:mainfrom
larsoner:snirf2

Conversation

@larsoner
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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