Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Return NAN when downsampling singlechan SDDB dataset #249

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 Aug 20, 2020 · 1 comment · Fixed by #250
Closed

Return NAN when downsampling singlechan SDDB dataset #249

Yosafat1997 opened this issue Aug 20, 2020 · 1 comment · Fixed by #250
Assignees
Labels

Comments

@Yosafat1997
Copy link

Yosafat1997 commented Aug 20, 2020

Dear devs,

I try to downsample one of SDDB signal from 250Hz to 128 Hz due i need to compare it with NSR-DB. Here what I do to downsample it:

import wfdb
from wfdb import processing as proc
#this is from sddb
sig,fields=wfdb.rdsamp(r'C:\Users\Yosafat VS\PycharmProjects\Paper Reproduce\dataset\sddb\30',channels=[0])

ann = wfdb.rdann(r'C:\Users\Yosafat VS\PycharmProjects\Paper Reproduce\dataset\sddb\30',extension='atr')

#this is from nsr_db
nsig,nfields=wfdb.rdsamp(r'C:\Users\Yosafat VS\PycharmProjects\Paper Reproduce\dataset\nsr\16265',channels=[0])
# print(nsig)
nann = wfdb.rdann(r'C:\Users\Yosafat VS\PycharmProjects\Paper Reproduce\dataset\nsr\16265',extension='atr')

print(sig[:,0])
print(lambda sig: [item for sublist in sig for item in sublist])
# print(ann.fs)
# print(nann.fs)
new_sig,new_ann= proc.resample_singlechan(sig[:,0],ann,fields['fs'],nfields['fs'])
print(new_x,new_t)

But when i run it, it return nan for new signal. For record number 30 to 35, it generate nan operation for record number 30 and 34.

@Lucas-Mc Lucas-Mc self-assigned this Aug 20, 2020
@Lucas-Mc Lucas-Mc added the bug label Aug 20, 2020
@Lucas-Mc
Copy link
Contributor

Hey @Yosafat1997, it looks like it was a Scipy issue where it would return all NaNs if there were any NaN values in the input array when attempting to resample. I am pushing a new pull request now to fix this. Thanks for catching this! 👍

Lucas-Mc added a commit that referenced this issue Aug 20, 2020
Fixes error when downsampling single channel if NaN values are present. This was a Scipy issue so extra pre-processing and input validation was done to help safe-guard against this issue re-occuring in the future. Fixes #249.
Lucas-Mc added a commit that referenced this issue Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants