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

FIX+ENH: Fix indexing in events and add measurement date option to writer #29

Merged
merged 8 commits into from Jul 23, 2019

Conversation

sappelhoff
Copy link
Member

@sappelhoff sappelhoff commented Jul 21, 2019

This PR does two things

1

This PR exposes a meas_date argument to the writer function and a test suite. The default is None and maintains the current behavior.

2

This PR fixes #27

I am adding 1 to each sample index, to account for BrainVision's 1-based indexing (whereas we expect an array that is 0-based indexed). Note, I changed the docstring for events. It now mentions that we expect a zero-based indexed array of events.

Currently the reasoning that BrainVision uses 1-based indexing is based on inspecting files, and realizing that the "New Segment" marker is always the first one, and always at sample 1 ... not at 0

@sappelhoff sappelhoff added the enhancement New feature or request label Jul 21, 2019
@codecov
Copy link

codecov bot commented Jul 21, 2019

Codecov Report

Merging #29 into master will increase coverage by 0.47%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
+ Coverage   94.89%   95.37%   +0.47%     
==========================================
  Files           3        3              
  Lines         196      216      +20     
==========================================
+ Hits          186      206      +20     
  Misses         10       10
Impacted Files Coverage Δ
pybv/io.py 92.85% <100%> (+0.54%) ⬆️
pybv/tests/test_bv_writer.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae5ab65...d0467c2. Read the comment docs.

@sappelhoff sappelhoff changed the title Add measurement date option to writer FIX+ENH: Fix indexing in events and add measurement date option to writer Jul 21, 2019
@sappelhoff sappelhoff added the fix fixes a bug label Jul 21, 2019
@sappelhoff sappelhoff added this to the 0.3 milestone Jul 21, 2019
meas_date : str | None
The measurement date of the data specified as a string in the format:
"YYYYMMDDhhmmssuuuuuu". "u" stands for microseconds. If None, defaults
to '00000000000000000000'.
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not allow for ISO 8601 formatting which is a bit more human-readable?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, I am now allowing datetime.datetime objects, I think this should cater to all needs :-)

See: d0467c2

Copy link
Collaborator

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

one small comment but in general this looks good to me, thanks for tackling this bug

@sappelhoff
Copy link
Member Author

Thanks for the review @choldgraf All tests pass, I am merging this now and preparing a new release :-)

@sappelhoff sappelhoff merged commit 8899fe5 into bids-standard:master Jul 23, 2019
@sappelhoff sappelhoff deleted the fixind branch July 23, 2019 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

potential indexing issue
2 participants