Metadata-Version: 2.1
Name: HeartSounds
Version: 0.0.2
Summary: A package for automatically annotating heart sounds locations based on ECG traces.
Author: Jack Peck
Project-URL: Homepage, https://github.com/jackpeck/heartsounds
Project-URL: Bug Tracker, https://github.com/jackpeck/heartsounds/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

**HeartSounds** is a package for automatically annotating heart sounds locations based on ECG traces.

![Audio with S1 and S2 periods](docs/img/audio-labelled.png)

![ECG with peaks](docs/img/ecg-labelled.png)

# Quick example

```python
from src.find_ecg_peaks import find_ecg_peaks
from src.annotations import get_heart_sound_timings_by_intervals, save_annotations_to_file
import wfdb

# Download example data
signal, fields = wfdb.rdsamp('ECGPCG0007', pn_dir='ephnogram/WFDB', channels=[0])
ecg = signal[:, 0]
ecg_sample_rate = fields['fs']

# Find ECG R and T peaks
ecg_peaks = find_ecg_peaks(ecg, ecg_sample_rate)

# Find heart sound timings
annotations = get_heart_sound_timings_by_intervals(ecg_peaks)

# Save annotations to file
save_annotations_to_file('./', 'annotations', annotations)
```

# Examples

- [Heart sounds annotations](example-produce-heart-sound-annotations.ipynb)
- [Using local ECG files](example-local-file.ipynb)
- [Using multiple ECG files](example-multiple-files.ipynb)
- [Visualizations using ECG and PCG](example-visualizations.ipynb)
- [Visualizations using local ECG and PCG files](example-visualizations-local-file.ipynb)
