-
Notifications
You must be signed in to change notification settings - Fork 318
Read FLAC signal files #372
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d418a9a
wfdb.io._coreio: new module.
0932a35
pyproject.toml: add dependency on soundfile.
9c677b5
.github/workflows: Install soundfile and libsndfile.
b83fad5
_digi_bounds: use a dictionary instead of "if" statements.
184f4fb
_digi_nan: use a dictionary instead of "if" statements.
e681f7b
_rd_dat_signals: add support for FLAC formats (508, 516, 524).
9d3491c
_rd_dat_signals, _rd_dat_file: fix documentation.
0ff4f84
Add a test case for all WFDB FLAC signal formats.
6cdf038
Add a test case for reading FLAC files over HTTP.
9b5df00
Add an example of ICU waveform data in FLAC format.
d49a5c3
README.md: add note about installing libsndfile.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| flacformats 3 200 499 | ||
| flacformats.d0 508 200/mV 8 0 -127 -484 0 sig 0, fmt 508 | ||
| flacformats.d1 516 200/mV 16 0 -32766 -750 0 sig 1, fmt 516 | ||
| flacformats.d2 524 200/mV 24 0 -8388605 8721 0 sig 2, fmt 524 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| mixedsignals 6 62.4725/999.56 14400 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you haven't added a test case for these signals? |
||
| mixedsignals_e.dat 516x4 200/mV 14 8192 0 24460 0 II | ||
| mixedsignals_e.dat 516x4 200/mV 14 8192 0 19772 0 III | ||
| mixedsignals_e.dat 516x4 200/mV 14 8192 0 22261 0 V | ||
| mixedsignals_p.dat 516x2 16(800)/mmHg 12 2048 0 49347 0 ABP | ||
| mixedsignals_p.dat 516x2 4096(0)/NU 12 2048 0 36026 0 Pleth | ||
| mixedsignals_r.dat 516 4093(2)/Ohm 12 2048 0 35395 0 Resp | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| from wfdb.io import _url | ||
|
|
||
|
|
||
| def _open_file( | ||
| pn_dir, | ||
| file_name, | ||
| mode="r", | ||
| *, | ||
| buffering=-1, | ||
| encoding=None, | ||
| errors=None, | ||
| newline=None, | ||
| check_access=False, | ||
| ): | ||
| """ | ||
| Open a data file as a random-access file object. | ||
|
|
||
| See the documentation of `open` and `wfdb.io._url.openurl` for details | ||
| about the `mode`, `buffering`, `encoding`, `errors`, and `newline` | ||
| parameters. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| pn_dir : str or None | ||
| The PhysioNet database directory where the file is stored, or None | ||
| if file_name is a local path. | ||
| file_name : str | ||
| The name of the file, either as a local filesystem path (if | ||
| `pn_dir` is None) or a URL path (if `pn_dir` is a string.) | ||
| mode : str, optional | ||
| The standard I/O mode for the file ("r" by default). If `pn_dir` | ||
| is not None, this must be "r", "rt", or "rb". | ||
| buffering : int, optional | ||
| Buffering policy. | ||
| encoding : str, optional | ||
| Name of character encoding used in text mode. | ||
| errors : str, optional | ||
| Error handling strategy used in text mode. | ||
| newline : str, optional | ||
| Newline translation mode used in text mode. | ||
| check_access : bool, optional | ||
| If true, raise an exception immediately if the file does not | ||
| exist or is not accessible. | ||
|
|
||
| """ | ||
| if pn_dir is None: | ||
| return open( | ||
| file_name, | ||
| mode, | ||
| buffering=buffering, | ||
| encoding=encoding, | ||
| errors=errors, | ||
| newline=newline, | ||
| ) | ||
| else: | ||
| url = posixpath.join(config.db_index_url, pn_dir, file_name) | ||
| return _url.openurl( | ||
| url, | ||
| mode, | ||
| buffering=buffering, | ||
| encoding=encoding, | ||
| errors=errors, | ||
| newline=newline, | ||
| check_access=check_access, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.