Comments (3)
Hi,
I think I've encountered a similar issue.
This is the error I get -
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[5], line 33
30 print(f"Sampling Frequency: {fs}")
32 # Write the record
---> 33 wrsamp(record_name=base_name, fs=fs, units=units, sig_name=sig_name, p_signal=p_signal, write_dir=record_dir)
35 # Handling annotations if available
36 if 'markers' in loaded_data:
File [~\.conda\envs\wfdb_test\Lib\site-packages\wfdb\io\record.py:2968](http://localhost:8888/lab/tree/wfdb_files/~/.conda/envs/wfdb_test/Lib/site-packages/wfdb/io/record.py#line=2967), in wrsamp(record_name, fs, units, sig_name, p_signal, d_signal, fmt, adc_gain, baseline, comments, base_time, base_date, base_datetime, write_dir)
2966 record.set_defaults()
2967 # Write the record files - header and associated dat
-> 2968 record.wrsamp(write_dir=write_dir)
File [~\.conda\envs\wfdb_test\Lib\site-packages\wfdb\io\record.py:939](http://localhost:8888/lab/tree/wfdb_files/~/.conda/envs/wfdb_test/Lib/site-packages/wfdb/io/record.py#line=938), in Record.wrsamp(self, expanded, write_dir)
935 self.wrheader(write_dir=write_dir, expanded=expanded)
936 if self.n_sig > 0:
937 # Perform signal validity and cohesion checks, and write the
938 # associated dat files.
--> 939 self.wr_dats(expanded=expanded, write_dir=write_dir)
File [~\.conda\envs\wfdb_test\Lib\site-packages\wfdb\io\_signal.py:158](http://localhost:8888/lab/tree/wfdb_files/~/.conda/envs/wfdb_test/Lib/site-packages/wfdb/io/_signal.py#line=157), in SignalMixin.wr_dats(self, expanded, write_dir)
152 self.check_field("d_signal")
154 # Check the cohesion of the d_signal field against the other
155 # fields used to write the header. (Note that for historical
156 # reasons, this doesn't actually check any of the optional
157 # header fields.)
--> 158 self.check_sig_cohesion([], expanded)
160 # Write each of the specified dat files
161 self.wr_dat_files(expanded=expanded, write_dir=write_dir)
File [~\.conda\envs\wfdb_test\Lib\site-packages\wfdb\io\_signal.py:264](http://localhost:8888/lab/tree/wfdb_files/~/.conda/envs/wfdb_test/Lib/site-packages/wfdb/io/_signal.py#line=263), in SignalMixin.check_sig_cohesion(self, write_fields, expanded)
262 chmax = max(self.d_signal[:, ch])
263 if (chmin < dmin) or (chmax > dmax):
--> 264 raise IndexError(
265 "Channel "
266 + str(ch)
267 + " contain values outside allowed range ["
268 + str(dmin)
269 + ", "
270 + str(dmax)
271 + "] for fmt "
272 + str(fmt)
273 )
275 # Ensure that the checksums and initial value fields match the digital signal (if the fields are present)
276 if self.n_sig > 0:
IndexError: Channel 0 contain values outside allowed range [-2147483648, 2147483647] for fmt 32
I checked the min and max values of my p_signal and they seem to be well within the range -
max = array([-7.44786116e+01, 9.99969482e+00, 9.99969482e+00, 9.99969482e+00,
9.99969482e+00, 9.99969482e+00, 1.86553955e+00, 1.44958496e-01,
3.41796875e-02, 2.77832031e+00])
I would very much appreciate some guidance if something should be corrected. Is this something to do with the dtype of my array - if so I also did try type casting to float32 and it still didn't make a difference.
Thanks,
Divyesh
from wfdb-python.
Hey @tompollard ,
I'm trying to get a dataset to be submitted to physionet and I'm trying to get into wfdb format. I would greatly appreciate your help with this issue or if you need any more information.
Thanks,
Divyesh
from wfdb-python.
Hey @tompollard , I'm trying to get a dataset to be submitted to physionet and I'm trying to get into wfdb format. I would greatly appreciate your help with this issue or if you need any more information.
Thanks, Divyesh
using fmt=['16'], wfdb.wrsamp(signame,
fs=fs,
sig_name=channel_itos,
p_signal=data,
units=['mV']*len(channel_itos),
fmt = ['16']*len(channel_itos),
write_dir=sigfolder)
from wfdb-python.
Related Issues (20)
- error when running processing.ann2rr HOT 1
- One malformed signal in mimic3 matched?
- wrann ValueError HOT 1
- Memory Exception When Merging Large Volumes of Waveform Data Files Using wrdb.wrsamp() HOT 2
- mimic3wdb-matched RECORDS file hast too many entries HOT 1
- Accessing a file in a subfolder on PhysioNet using pn_dir HOT 2
- Advanced Scientific Data Format
- Unable to write WFDB with subtyp = -1 HOT 1
- Correct sampto behaviour using rdsamp and rdann? HOT 2
- HTML documentation does not distinguish between parameters and return values
- wfd.processing.qrs.xqrs_detect() does not pass the learn parameter to xqrs.detect()
- Third loop in wfdb.processing.peaks.find_local_peaks will not be executed and can be removed
- I try to use Rdsamp but it says the file cannot be found. I am using Jupyter notebook HOT 4
- AttributeError: module 'wfdb.io' has no attribute 'convert'
- ann2rr returns ghost beats
- Record.adc: RuntimeWarning: invalid value encountered in cast HOT 2
- FLAC Writing is not supported. HOT 2
- rdsamp and wrsamp not isopmorphic HOT 1
- Handle all-NaN channels in calc_adc_params HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wfdb-python.