Skip to content

Refactor header helper functions #393

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

Merged
merged 4 commits into from
Jun 16, 2022
Merged

Refactor header helper functions #393

merged 4 commits into from
Jun 16, 2022

Conversation

cx1111
Copy link
Member

@cx1111 cx1111 commented Jun 15, 2022

Two main changes:

  1. Remove the duplicate logic for parsing comment and non-comment lines from header text in download.py and _header.py
  2. Fix the above logic to no longer try to find comment strings at the end of record/signal/segment lines. See: Add header spec document wfdb/wfdb-spec#9 (comment)

Copy link
Member

@tompollard tompollard left a comment

Choose a reason for hiding this comment

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

Looks good! So we are intentionally dropping support for inline comments? e.g. for the following data:

drive02.dat 16 1.0001/bpm 16 0 75 -19070 0 HR
drive02.dat 16 100 16 0 0 -9226 0 marker # INLINE COMMENT
drive02.dat 16x2 500 16 0 5804 -14191 0 RESP
# COMMENT ON OWN LINE

...previously we returned:

 'comments': ['INLINE COMMENT', 'COMMENT ON OWN LINE'],

...but now we return:

 'comments': ['COMMENT ON OWN LINE'],

It would be good to know how often inline comments appear in existing datasets (if at all), but fine with me if @bemoody is happy (which I assume he is based on wfdb/wfdb-spec#9 (comment)).

@cx1111
Copy link
Member Author

cx1111 commented Jun 16, 2022

...but now we return:

 'comments': ['COMMENT ON OWN LINE'],

It would be good to know how often inline comments appear in existing datasets (if at all), but fine with me if @bemoody is happy (which I assume he is based on wfdb/wfdb-spec#9 (comment)).

Yes. The previous behavior can be considered a bug. Hopefully no header files are written with that mistaken format. I don't think this package supported writing those inline comments.

@cx1111 cx1111 merged commit 14248d1 into main Jun 16, 2022
@cx1111 cx1111 deleted the cx/refactor-header branch June 16, 2022 01:29
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