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

correctly track anonymization date of empty room recordings when written simultaneously with data #1270

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

drammock
Copy link
Member

@drammock drammock commented Jul 11, 2024

closes #1269

PR Description

Merge checklist

Maintainer, please confirm the following before merging.
If applicable:

  • All comments are resolved
  • This is not your own PR
  • All CIs are happy
  • PR title starts with [MRG]
  • whats_new.rst is updated
  • New contributors have been added to CITATION.cff
  • PR description includes phrase "closes <#issue-number>"

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks, Dan. CI failures are unrelated.

@sappelhoff sappelhoff requested a review from hoechenberger July 12, 2024 08:43
@sappelhoff sappelhoff added this to the 0.16 milestone Jul 12, 2024
Comment on lines +3154 to +3163
erm = dict()
else:
bids_path.update(task="task", suffix="eeg", datatype="eeg")
# make sure anonymization works when also writing empty room file
erm = dict(empty_room=raw.copy())
daysback_min, daysback_max = get_anonymization_daysback(raw)
anonymize = dict(daysback=daysback_min + 1)
orig_bids_path = bids_path.copy()
bids_path = write_raw_bids(
raw, bids_path, overwrite=True, anonymize=anonymize, verbose=False
raw, bids_path, overwrite=True, anonymize=anonymize, verbose=False, **erm
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be simplified to

if subject == "emptyroom":
    ...
    er_raw=None
else:
    ...
    er_raw = raw.copy()
...
write_raw_bids(..., empty_room=er_raw)

or so

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, that's a slight improvement I guess

Copy link
Member

Choose a reason for hiding this comment

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

I think we can merge this as is though, I think the difference in code here is miniscule. Thanks for the PR and the reviews.

Copy link
Member

Choose a reason for hiding this comment

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

i don't know, why would you create a dict if you don't need it? just to later unpack the only element it contains 🧐

Copy link
Member Author

Choose a reason for hiding this comment

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

@sappelhoff sappelhoff merged commit 4c3e753 into mne-tools:main Jul 12, 2024
19 of 20 checks passed
@drammock drammock deleted the fix-anon-erm branch July 12, 2024 16:33
@drammock drammock mentioned this pull request Jul 12, 2024
7 tasks
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.

write_raw_bids cannot find emptyroom when anonymize=True
4 participants