Skip to content

Commit

Permalink
fix download instruction from LUDB database
Browse files Browse the repository at this point in the history
  • Loading branch information
DominiqueMakowski committed Jun 20, 2024
1 parent ec4d63e commit 7df75ad
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions data/ludb/download_ludb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
The database consists of 200 10-second 12-lead ECG signal records representing different morphologies of the ECG signal. The ECGs were collected from healthy volunteers and patients, which had various cardiovascular diseases. The boundaries of P, T waves and QRS complexes were manually annotated by cardiologists for all 200 records.
Steps:
1. In the command line, run 'pip install gsutil'
2. Then, 'gsutil -m cp -r gs://ludb-1.0.0.physionet.org D:/YOURPATH/NeuroKit/data/ludb'
This will download all the files in a folder named 'ludb-1.0.0.physionet.org' at the
destination you entered.
1. Download zipped data base from https://physionet.org/content/ludb/1.0.1/
2. Unzip the folder so that you have a `lobachevsky-university-electrocardiography-database-1.0.1/` folder'
3. Run this script.
"""
import pandas as pd
Expand All @@ -16,31 +14,33 @@
import os


files = os.listdir("./ludb-1.0.0.physionet.org/")

dfs_ecg = []
dfs_rpeaks = []


for participant in range(200):
filename = str(participant + 1)

data, info = wfdb.rdsamp("./ludb-1.0.0.physionet.org/" + filename)
data, info = wfdb.rdsamp(
"./lobachevsky-university-electrocardiography-database-1.0.1/data/" + filename
)

# Get signal
data = pd.DataFrame(data, columns=info["sig_name"])
data = data[["i"]].rename(columns={"i": "ECG"})
data["Participant"] = "LUDB_%.2i" %(participant + 1)
data["Participant"] = "LUDB_%.2i" % (participant + 1)
data["Sample"] = range(len(data))
data["Sampling_Rate"] = info['fs']
data["Sampling_Rate"] = info["fs"]
data["Database"] = "LUDB"

# Get annotations
anno = wfdb.rdann("./ludb-1.0.0.physionet.org/" + filename, 'atr_i')
anno = wfdb.rdann(
"./lobachevsky-university-electrocardiography-database-1.0.1/data/" + filename, "i"
)
anno = anno.sample[np.where(np.array(anno.symbol) == "N")[0]]
anno = pd.DataFrame({"Rpeaks": anno})
anno["Participant"] = "LUDB_%.2i" %(participant + 1)
anno["Sampling_Rate"] = info['fs']
anno["Participant"] = "LUDB_%.2i" % (participant + 1)
anno["Sampling_Rate"] = info["fs"]
anno["Database"] = "LUDB"

# Store with the rest
Expand Down

0 comments on commit 7df75ad

Please sign in to comment.