MIT-LCP / wfdb-python

Native Python WFDB package
MIT License
747 stars 302 forks source link

Waveform limit locator #134

Open krivenkoz opened 6 years ago

krivenkoz commented 6 years ago

Is there any way to detect P and/or T peaks and/or their bounds in new version? Something like ECGPUWAVE functionality. Now I have to call subprocess with binary ECGPUWAVE version and it's inconvenient way for me. Thanks a lot.

cx1111 commented 6 years ago

Not currently. Planning to add in the next few months. Contributions welcome.

RichardBJ commented 2 years ago

Whoops, posted comment from wrong account! I am going to have a crack at converting ECGPUWAVE into a Python form... version I have from Physionet is Fortran so since I've only ever done a little (Fortran) programming... and that was 30 years ago, don't hold your breath. I am always re-inventing the wheel so if anyone has already done this or even made a big start please let me know!? I am already aware that apart from regular errors, I am likely to have errors with the switch to zero indexing, but perhaps I should put a git of this little project up entirely separately from this project... I don't want to contaminate your beautiful code!!

cx1111 commented 2 years ago

Hey Richard, we're always grateful for contributions. Feel free to make pull requests to this project if you'd like, and we'd be happy to review.

krivenkoz commented 2 years ago

Hi guys! I wasted a lot of time for searching Python-version of waveform locators. The only version I've found is in Neurokit2 package. But. I've compared it with binary version of ECGPUWAVE and IMHO ECGPUWAVE is slightly better in terms of MSE (mean squired error) and, of course, much faster. Moreover, it's good idea to implement robust Lipponen-Tarvainen algorithm of R-peaks correction (PMID: 31314618, DOI: 10.1080/03091902.2019.1640306).

RichardBJ commented 2 years ago

Thanks, Neurokit2 actually looks great, I will check it out, meanwhile I am merely attempting a line-by-line translation of Fortran to Python. If I ever get it to work it will be very slow compared to any complied version. Just scratching an itch here, I doubt it will be of practical use, but time will tell.

RichardBJ commented 2 years ago

Update: Having translated over 1000 lines of code, including an interesting coding bug that you have to clone for the program to work... I have given up! I got to the point where one of the subroutines has too many GOTOs that drop you back into the middle of nested ifs that I realised I would have to reproduce the functionality, not just "translate". AND The Neurokit2 ecg_delineate() you pointed me to works pretty well. The line-by-line translation of Fortran to Python would have been rather slow anyway. So I will move ahead using that suite now alongside WFDB. I am now converting my raw data from CED format to wfdb records and drawing from a mixture of wfdb, neurokit2 and the full range of Python packages available. Thanks so much for your help with this!