Git Product home page Git Product logo

Comments (3)

Div12345 avatar Div12345 commented on July 16, 2024

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.

Div12345 avatar Div12345 commented on July 16, 2024

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.

wzxiaobai avatar wzxiaobai commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.