Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

UnboundLocalError: local variable 'twopeaks' referenced before assignment #28

Closed
vykintasmak opened this issue Jun 23, 2017 · 6 comments

Comments

@vykintasmak
Copy link

Hi,
I get this for like 1% files from my DB, not entirely sure how to fix it myself:

File "/usr/local/lib/python2.7/dist-packages/biosppy/signals/ecg.py", line 1157, in hamilton_segmenter
posdiv = abs(twopeaks[0][0] - twopeaks[1][0])
UnboundLocalError: local variable 'twopeaks' referenced before assignment

@capcarr
Copy link
Contributor

capcarr commented Jun 23, 2017

Hi @vykintasmak
Could you please send, if possible, one of the files where the error happens?

@vykintasmak
Copy link
Author

@capcarr
Copy link
Contributor

capcarr commented Jun 23, 2017

@vykintasmak
Thanks, I'll check it out.

@capcarr
Copy link
Contributor

capcarr commented Jul 10, 2017

@vykintasmak
I was not able to reproduce the error you reported.
Could you please check the version of biosppy that you're using, making sure to run the most recent version.

@vykintasmak
Copy link
Author

@capcarr
I resolved it but not sure if that should be a valid solution:
If i filter the signal before hamilton_segmenter - then it works fine. If i use hamilton_segmenter on raw signal - I get this error.

As I see, using ecg.ecg(samples) filters the signal before using segmenter, but the segmenter itself cannot be used separately without filtering.

Again, not sure if it's a problem, very sorry if I'm wasting your time

@capcarr
Copy link
Contributor

capcarr commented Jul 10, 2017

Indeed, I was able to reproduce the error without filtering.
I think I'm able to fix the problem, I'll push the changes in a moment.
If the problem persists, feel free to reopen the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants