Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ecg.py #39

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

trueZihaoXu
Copy link

Added Pan_Tompkins_Plus_Plus, an improved Pan-Tompkins algorithm

Added Pan_Tompkins_Plus_Plus, an improved Pan-Tompkins algorithm
Added automatic beat correction algorithm
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved
biosppy/signals/ecg.py Outdated Show resolved Hide resolved


pks = []
locs = peakutils.indexes(y=ecg_m, thres=0, min_dist=round(0.231*fs)) #Find all the peaks apart from previous peak 231ms, peak indices
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm if this the PeakUtils package, so it can be added to the optional requirements for Biosppy :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also don't forget to import the library at the beginning of the file!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the peakutils is this one: https://peakutils.readthedocs.io/en/latest/. Sorry for the missing import

biosppy/signals/ecg.py Outdated Show resolved Hide resolved
th: float
Threshold.
'''
df = pd.DataFrame({"signal": np.abs(x)})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Biosppy currently does not support data frames. Would it be possible to change this function to use only numpy?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe convert dataframe to numpy array using pandas.DataFrame.to_numpy?

Copy link
Collaborator

@sofia3ms sofia3ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Zihao, and thank you for your contribution! I suggested some changes that need to be addressed before testing the code with the rest of Biosppy. They are mainly related with imports and consistency with the rest of the library. Let me know if you agree with them!

trueZihaoXu and others added 9 commits May 18, 2024 12:23
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
trueZihaoXu and others added 7 commits May 18, 2024 12:25
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Co-authored-by: Sofia Monteiro <81264130+sofia3ms@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants