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

MRG: Write events.json with "sample", "value", and "trial_type" entries #1132

Merged
merged 3 commits into from
Apr 25, 2023

Conversation

hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Apr 22, 2023

Fixes #1130

Also adding trial_type here because it's also considered an optional column that should come with an accompanying entry in events.json

Not adding Levels for trial_type here, though – this would need discussion

@hoechenberger hoechenberger marked this pull request as ready for review April 22, 2023 22:15
Comment on lines +314 to +326
fname = Path(fname)
if fname.exists():
orig_data = json.loads(
fname.read_text(encoding='utf-8'),
object_pairs_hook=OrderedDict
)
new_data = {**orig_data, **new_data}

_write_json(fname, new_data, overwrite)
Copy link
Member Author

Choose a reason for hiding this comment

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

Code duplication from below. But I felt it wasn't worth creating a new helper function for this. thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

looks fine to me

@hoechenberger hoechenberger changed the title Write events.json with "sample" and "value" entries MRG: Write events.json with "sample" and "value" entries Apr 23, 2023
@hoechenberger hoechenberger force-pushed the hoechenberger/issue1130 branch 2 times, most recently from 1f6e157 to e4a0c82 Compare April 23, 2023 10:29
@hoechenberger hoechenberger changed the title MRG: Write events.json with "sample" and "value" entries MRG: Write events.json with "sample", "value", and "trial_type" entries Apr 23, 2023
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.

thanks for this PR!

"""
new_data = {
'sample': {
'Description': 'The event onset time in number of sampling points.'
Copy link
Member

Choose a reason for hiding this comment

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

needs clarification whether 0based or 1based indexing is used

Copy link
Member Author

@hoechenberger hoechenberger Apr 23, 2023

Choose a reason for hiding this comment

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

I don't know which one we use, and I don't know how it interacts with raw.first_samp

Could you help?

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 either, but let's merge this and make a new issue to improve on this later. raw.first_samp is always confusing :)

@sappelhoff sappelhoff enabled auto-merge (squash) April 25, 2023 11:58
@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #1132 (d65c685) into main (82867d4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1132   +/-   ##
=======================================
  Coverage   95.27%   95.28%           
=======================================
  Files          40       40           
  Lines        8682     8694   +12     
=======================================
+ Hits         8272     8284   +12     
  Misses        410      410           
Impacted Files Coverage Δ
mne_bids/path.py 97.70% <100.00%> (ø)
mne_bids/tests/test_write.py 90.33% <100.00%> (+0.02%) ⬆️
mne_bids/write.py 97.30% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@sappelhoff sappelhoff merged commit f599e76 into mne-tools:main Apr 25, 2023
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.

BIDS sample and value columns will be considered "arbitrary" columns soon
2 participants