Skip to content

Commit

Permalink
Merge pull request #16 from ispras/issue15
Browse files Browse the repository at this point in the history
#15: fix excessive lead selection
  • Loading branch information
AvetisyanAram authored Nov 11, 2024
2 parents 94febd6 + f9f42db commit 53f4487
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ecglib/data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ def get_name(self, index: int) -> str:
return str(Path(self.get_fpath(index)).stem)

def read_ecg_record(
self, file_path, data_type, leads=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
):
self, file_path, data_type
):
if data_type == "npz":
ecg_record = np.load(file_path)["arr_0"].astype("float64")
frequency = None
elif data_type == "wfdb":
ecg_record, ann = wfdb.rdsamp(file_path, channels=leads)
ecg_record, ann = wfdb.rdsamp(file_path)
ecg_record = ecg_record.T
ecg_record = ecg_record.astype("float64")
frequency = ann['fs']
Expand Down Expand Up @@ -142,7 +142,7 @@ def __getitem__(self, index):
file_path = self.ecg_data.iloc[index]["fpath"]

# data standartization (scaling, resampling, cuts off, normalization and padding/truncation)
ecg_record, _ = self.read_ecg_record(file_path, self.data_type, self.leads)
ecg_record, _ = self.read_ecg_record(file_path, self.data_type)
full_ecg_record_info = EcgRecord(
signal=ecg_record[self.leads, :],
frequency=ecg_frequency,
Expand Down

0 comments on commit 53f4487

Please sign in to comment.