wrsamp: IndexError: Channel 0 contains values outside the allowed range [-32768, 32767] for fmt 16
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 853
- Forks
- 322
- PR merge metrics
- No merged PRs in 30d
Description
We're encountering an issue when trying to write data to WFDB files using the wrsamp function. Specifically, we’re seeing an error that prevents us from writing the files correctly. When attempting to call wrsamp to save our data, we receive the following error message:
IndexError: Channel 0 contains values outside the allowed range [-32768, 32767] for fmt 16.
To investigate the issue further, we modified the WFDB source code to provide additional debugging information. The csv file we’re attempting to convert to wfdb has values ranging between:
Minimum: -90.113269
Maximum: 622.269327
But this is being scaled to -32767 and 32772 after calling wrsamp, so the max value allowed in fmt 16 is being exceeded.
We are using package versions:
Please see a screenshot below depicting the error we get using:
wfdb==4.1.2
pandas==2.2.3
numpy==2.1.2
We have a minimal reproducible sample that we sent to Ben Moody and Tom Pollard.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the wrsamp call with the reported input range and inspect how values are scaled for fmt 16 before the range check. The payload does not name source files or tests; done means the described data can be written without producing values outside the allowed fmt 16 range, with regression coverage for the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100