Closed mahmoodabed closed 5 years ago
1 c02r Traceback (most recent call last): File "script.py", line 20, in record = wfdb.rdsamp(recordname_new) # rdsamp() returns the signal as a numpy array File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1394, in rdsamp warn_empty=warn_empty) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1154, in rdrecord record = rdheader(record_name, pb_dir=pb_dir, rd_segments=False) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 991, in rdheader dir_name, pb_dir) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/_header.py", line 705, in _read_header_lines with open(os.path.join(dir_name, file_name), 'r') as fp: FileNotFoundError: [Errno 2] No such file or directory: '/home/mahmood/apnea-ecg/02r.hea'
Hi. It looks like you got a problem with your file path there. Did you check the path?
1 c02r Traceback (most recent call last): File "script.py", line 20, in record = wfdb.rdsamp(recordname_new) # rdsamp() returns the signal as a numpy array File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1394, in rdsamp warn_empty=warn_empty) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1154, in rdrecord record = rdheader(record_name, pb_dir=pb_dir, rd_segments=False) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 991, in rdheader dir_name, pb_dir) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/_header.py", line 705, in _read_header_lines with open(os.path.join(dir_name, file_name), 'r') as fp: FileNotFoundError: [Errno 2] No such file or directory: '/home/mahmood/apnea-ecg/02r.hea'
Hi. It looks like you got a problem with your file path there. Did you check the path?
Thank you for your kind reply. Yes sir the script.py is in the same place with apnea-ecg files. I think the issue comes from this line: recordname_new=recordname[-7:-4] #Extracting just the filename part (will differ from database to database) what does [-7:-4] mean?
1 c02r Traceback (most recent call last): File "script.py", line 20, in record = wfdb.rdsamp(recordname_new) # rdsamp() returns the signal as a numpy array File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1394, in rdsamp warn_empty=warn_empty) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1154, in rdrecord record = rdheader(record_name, pb_dir=pb_dir, rd_segments=False) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 991, in rdheader dir_name, pb_dir) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/_header.py", line 705, in _read_header_lines with open(os.path.join(dir_name, file_name), 'r') as fp: FileNotFoundError: [Errno 2] No such file or directory: '/home/mahmood/apnea-ecg/02r.hea'
Hi. It looks like you got a problem with your file path there. Did you check the path?
Thank you for your kind reply. Yes sir the script.py is in the same place with apnea-ecg files. I think the issue comes from this line: recordname_new=recordname[-7:-4] #Extracting just the filename part (will differ from database to database) what does [-7:-4] mean?
[-7:-4] refers to the part of the filename. -1 is the last letter of the filename. Likewise, -4 is the 4th last letter. Here, I am skipping the last 4 letters as they are ".dat". [-7:-4] includes only letters from index -7 to -4.
[-7:-4] refers to the part of the filename. -1 is the last letter of the filename. Likewise, -4 is the 4th last letter. Here, I am skipping the last 4 letters as they are ".dat". [-7:-4] includes only letters from index -7 to -4.
Thank you again sir. So why then the error is indicating to .hea while it is supposed to deal with just .dat ecg signals. what is your advice to do in this case?
[-7:-4] refers to the part of the filename. -1 is the last letter of the filename. Likewise, -4 is the 4th last letter. Here, I am skipping the last 4 letters as they are ".dat". [-7:-4] includes only letters from index -7 to -4.
Thank you again sir. So why then the error is indicating to .hea while it is supposed to deal with just .dat ecg signals. what is your advice to do in this case?
Hi. Sorry for the late reply. I am not sure this code works with .hea files. But you can try and replace ".dat" with ".hea" and see if it works. Do let me know what happens doing that. Meanwhile, I will check for alternatives for you that can work for .hea files.
[-7:-4] refers to the part of the filename. -1 is the last letter of the filename. Likewise, -4 is the 4th last letter. Here, I am skipping the last 4 letters as they are ".dat". [-7:-4] includes only letters from index -7 to -4.
Thank you again sir. So why then the error is indicating to .hea while it is supposed to deal with just .dat ecg signals. what is your advice to do in this case?
Hi. Sorry for the late reply. I am not sure this code works with .hea files. But you can try and replace ".dat" with ".hea" and see if it works. Do let me know what happens doing that. Meanwhile, I will check for alternatives for you that can work for .hea files.
Hello sir. I have fixed the issue and now I have the csv files of the data please can you tell how to use them in classification process using svm or any other deep learning techniques.
[-7:-4] refers to the part of the filename. -1 is the last letter of the filename. Likewise, -4 is the 4th last letter. Here, I am skipping the last 4 letters as they are ".dat". [-7:-4] includes only letters from index -7 to -4.
Thank you again sir. So why then the error is indicating to .hea while it is supposed to deal with just .dat ecg signals. what is your advice to do in this case?
Hi. Sorry for the late reply. I am not sure this code works with .hea files. But you can try and replace ".dat" with ".hea" and see if it works. Do let me know what happens doing that. Meanwhile, I will check for alternatives for you that can work for .hea files.
Hello sir. I have fixed the issue and now I have the csv files of the data please can you tell how to use them in classification process using svm or any other deep learning techniques.
For classification, it really depends on what your data actually is. You can use peak detection algorithms and then use peak-to-peak variation or Heart Rate Variability analysis techniques.
1 c02r Traceback (most recent call last): File "script.py", line 20, in
record = wfdb.rdsamp(recordname_new) # rdsamp() returns the signal as a numpy array
File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1394, in rdsamp warn_empty=warn_empty) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 1154, in rdrecord record = rdheader(record_name, pb_dir=pb_dir, rd_segments=False) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/record.py", line 991, in rdheader dir_name, pb_dir) File "/home/mahmood/.local/lib/python3.6/site-packages/wfdb/io/_header.py", line 705, in _read_header_lines with open(os.path.join(dir_name, file_name), 'r') as fp: FileNotFoundError: [Errno 2] No such file or directory: '/home/mahmood/apnea-ecg/02r.hea'