Skip to content

AssertionError raised without information when resamplesinglechan #281

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

Closed
Yosafat1997 opened this issue Mar 4, 2021 · 0 comments
Closed
Labels

Comments

@Yosafat1997
Copy link

Yosafat1997 commented Mar 4, 2021

I using wfdb in Google Colab. I try to resample sddb signal which provided in here: https://physionet.org/content/sddb/1.0.0/ (previous fs 250, target fs 128)

      sig,fields=wfdb.rdsamp(r'path'+rec_name,channels=[0])
      annot = wfdb.rdann(r'path'+rec_name,extension='ari')
      print(fields['fs'])
      new_sig, _ = wfdb.processing.resample_singlechan(x=sig[:, 0], ann = annot, fs=fields['fs'], fs_target=128)

When i try to resample 38.dat, it gives me error:

AssertionError                            Traceback (most recent call last)
<ipython-input-21-8c086e978c26> in <module>()
      7       annot = wfdb.rdann(r'path'+rec_name,extension='ari')
      8       print(fields['fs'])
----> 9       new_sig, _ = wfdb.processing.resample_singlechan(x=sig[:, 0], ann = annot, fs=fields['fs'], fs_target=128)
     10       resampled_x_fill=RemoveBaseline(new_sig,128)
     11       # sig_flat=(sig.flatten())

1 frames
/usr/local/lib/python3.7/dist-packages/wfdb/processing/basic.py in resample_singlechan(x, ann, fs, fs_target)
    128     resampled_x, resampled_t = resample_sig(x, fs, fs_target)
    129 
--> 130     new_sample = resample_ann(resampled_t, ann.sample)
    131     assert ann.sample.shape == new_sample.shape
    132 

/usr/local/lib/python3.7/dist-packages/wfdb/processing/basic.py in resample_ann(resampled_t, ann_sample)
     61         for j in range(tmp[i]):
     62             res.append(i)
---> 63     assert len(res) == len(ann_sample)
     64 
     65     return np.asarray(res, dtype='int64')

which only happen with this data and the assertion error didn't give more information what is the specific issue (line or code) which trigger this error.

@Lucas-Mc Lucas-Mc added the bug label Mar 30, 2021
Lucas-Mc added a commit that referenced this issue Apr 23, 2021
Refactors signal and annotation resampling #281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants