Closed Myles-JB closed 5 years ago
Hi, @Myles-JB !
Please provide the code that caused the error including the code you used to create and process sample
object you've mentioned.
This error might appear in case you create an EcgBatch
object and do not use load
action to load the signals into it, but it's hard to tell without the code.
Hi @dpodvyaznikov, Thanks for getting back! Below is the code that I have been using including imports etc.
import matplotlib.pyplot as plt
import pandas as pd
import wfdb as wf
import cardio
import cardio.batchflow as bf
from cardio import EcgDataset
from cardio import EcgBatch
import sys
pathToDataSet = "physionet.org/physiobank/database/afdb/*.hea"
pathToRefCSV = "physionet.org/physiobank/database/afdb/REFERENCE.csv"
dataset = EcgDataset(path=pathToDataSet, no_ext=True, sort=True)
batch = dataset.next_batch(batch_size=6, unique_labels=['A', 'N', 'O'])
sample = batch.load(fmt='wf', components=['signal', 'meta'])
sample = sample.load(src = pathToRefCSV, fmt='csv', components='target' )
sample.show_ecg('A00001')
Great, thank you!
The problem is that you use fmt='wf'
instead of fmt='wfdb'
in load function. 'wfdb'
is the proper value here to use for the wfdb
files.
An error about the format should've been raised when you passed wrong value, I'll look into the reasons why it did not.
Amazing! Thanks for your help!
Fixed in #23 Closing this issue.
I got this error whilst following the tutorial when trying to display the ecg signal using:
sample.show_ecg('A00001')
File "<ipython-input-42-3742dca0684b>", line 1, in <module> sample.show_ecg('A00001')
File "/anaconda3/lib/python3.6/site-packages/cardio/core/ecg_batch.py", line 391, in show_ecg self._check_2d(signal)
File "/anaconda3/lib/python3.6/site-packages/cardio/core/ecg_batch.py", line 218, in _check_2d if signal.ndim != 2:
AttributeError: 'NoneType' object has no attribute 'ndim'
Quite new to python so not sure if its something to do with me cloning the repo etc?
Any help would be much appreciated!