qtdb
Classes
QtdbDataset
QT dataset
Source code in heartkit/datasets/qtdb.py
Attributes
patient_ids
property
Functions
get_train_patient_ids
get_test_patient_ids
patient_data
Get patient data
Parameters:
-
(patient_idint) –Patient ID
Returns:
-
None–Generator[PatientData, None, None]: Patient data
Source code in heartkit/datasets/qtdb.py
signal_generator
signal_generator(
patient_generator: PatientGenerator, frame_size: int, samples_per_patient: int = 1, target_rate: int | None = None
) -> Generator[npt.NDArray, None, None]
Generate random frames.
Parameters:
-
(patient_generatorPatientGenerator) –Generator that yields patient data.
-
(frame_sizeint) –Frame size
-
(samples_per_patientint, default:1) –Samples per patient. Defaults to 1.
-
(target_rateint | None, default:None) –Target rate. Defaults to None.
Returns:
-
None–Generator[npt.NDArray, None, None]: Generator of input data of shape (frame_size, 1)
Source code in heartkit/datasets/qtdb.py
get_patient_data_segments
Get patient's entire data and segments
Parameters:
-
(patient_idint) –Patient ID (1-based)
Returns:
Source code in heartkit/datasets/qtdb.py
download
Download QT dataset
Parameters:
-
(num_workersint | None, default:None) –parallel workers. Defaults to None.
-
(forcebool, default:False) –Force redownload. Defaults to False.
Source code in heartkit/datasets/qtdb.py
download_raw_dataset
Downloads full dataset zipfile and converts into individial patient HDF5 files.
Parameters:
-
(forcebool, default:False) –Whether to force re-download if destination exists. Defaults to False.
-
(num_workersint, default:None) –parallel workers. Defaults to os.cpu_count().
Source code in heartkit/datasets/qtdb.py
convert_pt_wfdb_to_hdf5
convert_pt_wfdb_to_hdf5(
patient: int, src_path: PathLike, dst_path: PathLike, force: bool = False
) -> tuple[npt.NDArray, npt.NDArray, npt.NDArray]
Convert QTDB patient data from WFDB to more consumable HDF5 format.
Parameters:
-
(patientint) –Patient id (1-based)
-
(src_pathPathLike) –Source path to WFDB folder
-
(dst_pathPathLike) –Destination path to store HDF5 file
Returns:
-
tuple[NDArray, NDArray, NDArray]–tuple[npt.NDArray, npt.NDArray, npt.NDArray]: data, segments, and fiducials
Source code in heartkit/datasets/qtdb.py
convert_dataset_zip_to_hdf5
convert_dataset_zip_to_hdf5(
zip_path: PathLike, patient_ids: NDArray | None = None, force: bool = False, num_workers: int | None = None
)
Convert dataset into individial patient HDF5 files.
Parameters:
-
(zip_pathPathLike) –Zip path
-
(patient_idsNDArray | None, default:None) –List of patient IDs to extract. Defaults to all.
-
(forcebool, default:False) –Whether to force re-download if destination exists. Defaults to False.
-
(num_workersint, default:None) –parallel workers. Defaults to os.cpu_count().