GithubHelp home page GithubHelp logo

Python3 about construe HOT 18 CLOSED

citiususc avatar citiususc commented on July 20, 2024
Python3

from construe.

Comments (18)

tomas-teijeiro avatar tomas-teijeiro commented on July 20, 2024

Unfortunately, we do not have the resources to maintain both Python 2 and Python 3 implementations, but in the near future we plan to migrate all the codebase to Python 3.

from construe.

lkjell avatar lkjell commented on July 20, 2024

I will port the code to python3 with 2to3 and fix some import problems. In addition pep8 formatting too.

from construe.

krivenkoz avatar krivenkoz commented on July 20, 2024

Hi guys! So what about Python3 support? Is it exist now?

from construe.

lkjell avatar lkjell commented on July 20, 2024

I should have a branch that support python3 at my repository.

from construe.

krivenkoz avatar krivenkoz commented on July 20, 2024

I didn't find. Could you provide a link to it?

from construe.

lkjell avatar lkjell commented on July 20, 2024

https://github.com/lkjell/construe/tree/python3

from construe.

krivenkoz avatar krivenkoz commented on July 20, 2024

Great, thanks

from construe.

krivenkoz avatar krivenkoz commented on July 20, 2024

When I ran run_example.sh I've got next error:
ModuleNotFoundError: No module named 'construe.utils.signal_processing.dtw.dtw
I've read about this issue in Know issues but I can't resolve it by now. My OS is Linux Debian 9. I could not install mlpy package due to 'Failed building wheel for mlpy' error. Any suggestions?

from construe.

lkjell avatar lkjell commented on July 20, 2024

Have you read the readme file in that folder?

from construe.

lkjell avatar lkjell commented on July 20, 2024

https://github.com/lkjell/construe/blob/652396a3378277cb473e858af1b2f7cb2be9cab1/construe/utils/signal_processing/dtw/readme

from construe.

krivenkoz avatar krivenkoz commented on July 20, 2024

My bad, thank you. It works for me now after replacing some methods in plotter.py to modern one(nodes_iter() to nodes(), set_axis_bgcolor() to set_facecolor()). What about the Windows 10 x64? Do I have a chance to launch Construe? At the moment I have errors with dtw,pygraphviz and some else.

from construe.

hsiaocy avatar hsiaocy commented on July 20, 2024

Hi @lkjell, thanks for your job on Python3 version!
I want to help and use the MIT-LCP's wfdb-python repository as a pure python environment, and decrease the dependency problems.
While I ran the construe_ecg.py in your repository, the error pop up with a "Not Implemented Error".
Could you please help me to fix this issue?

The error context happens from this function "process_record_rhythm()" in construe_ecg.py module and so on:
`File "/Users/AppleUser/PycharmProjects/construe-python3/construe_ecg.py", line 256, in
Rec.exclude_twaves, Rec.verbose)

File "/Users/AppleUser/PycharmProjects/construe-python3/record_processing.py", line 498, in process_record_rhythm
cntr.step(filt)

File "/Users/AppleUser/PycharmProjects/construe-python3/construe/inference/searching.py", line 182, in step
self._update_closed(newclosed)

File "/Users/AppleUser/PycharmProjects/construe-python3/construe/inference/searching.py", line 132, in _update_closed
self.closed.append(tmplst.pop(0))

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sortedcontainers/sortedlist.py", line 1279, in append
raise NotImplementedError('use sl.add(value) instead')
NotImplementedError: use sl.add(value) instead`

Please ask if any question. Thanks!

from construe.

lkjell avatar lkjell commented on July 20, 2024

You could try to monkey patch th code and use the method add instead of append for self.closed. Not sure why that happen. Could be later version of sortedcontainer breaks the api.

from construe.

hsiaocy avatar hsiaocy commented on July 20, 2024

Sorry, I didn't notice the replacement message 'use sl.add(value) instead'. It works with following:
self.closed.append(tmplst.pop(0))
change to --> self.closed.add(tmplst.pop(0))

from construe.

karimkhanp avatar karimkhanp commented on July 20, 2024

@lkjell Thanks for python3 version of construe.

I installed all dependencies in my Mac machine python3 venv.

Now when I try to run

./run_example.sh fig4

It gives me an error with python2 code lines -

Running: python -i fragment_processing.py -r examples/fig4
Traceback (most recent call last):
  File "fragment_processing.py", line 12, in <module>
    import construe.utils.plotting.plotter as plotter
  File "/Users/construe/construe/construe/utils/plotting/plotter.py", line 11, in <module>
    import construe.knowledge.observables as o
  File "/Users/construe/construe/construe/knowledge/observables/__init__.py", line 7, in <module>
    from .CardiacCycles import *
  File "/Users/construe/construe/construe/knowledge/observables/CardiacCycles.py", line 11, in <module>
    from construe.model import Observable, singleton_observable
  File "/Users/construe/construe/construe/model/__init__.py", line 5, in <module>
    from .abstraction_pattern import AbstractionPattern
  File "/Users/construe/construe/construe/model/abstraction_pattern.py", line 13, in <module>
    from .constraint_network import ConstraintNetwork, InconsistencyError, verify
  File "/Users/construe/construe/construe/model/constraint_network.py", line 429
    print 'v0:' + str(v0) + ' v1:' + str(v1) +\
              ^
SyntaxError: invalid syntax

I converted to python3 print syntax and run it. So it gave another error

Traceback (most recent call last): File "fragment_processing.py", line 12, in <module> import construe.utils.plotting.plotter as plotter File "/Users/construe/construe/construe/utils/plotting/plotter.py", line 12, in <module> import construe.knowledge.abstraction_patterns as ap File "/Users/construe/construe/construe/knowledge/abstraction_patterns/__init__.py", line 6, in <module> from .rhythm import (RHYTHMSTART_PATTERN, SINUS_PATTERN, TACHYCARDIA_PATTERN, File "/Users/construe/construe/construe/knowledge/abstraction_patterns/rhythm/__init__.py", line 11, in <module> from .patterns import * File "/Users/construe/construe/construe/knowledge/abstraction_patterns/rhythm/patterns.py", line 13, in <module> from construe.knowledge.constants import (PW_DURATION, ST_INTERVAL, File "/Users/construe/construe/construe/knowledge/constants.py", line 12, in <module> import construe.acquisition.signal_buffer as SIG File "/Users/construe/construe/construe/acquisition/signal_buffer.py", line 11, in <module> import segmentation.wavelets.wavelet_filter as wf ModuleNotFoundError: No module named 'segmentation'

from construe.

lkjell avatar lkjell commented on July 20, 2024

@karimkhanp perhaps you are not on the python3 branch.

from construe.

lkjell avatar lkjell commented on July 20, 2024

@karimkhanp It is hard to tell. But you might try python 3.5 and use packages which was released at Dec 10, 2017. I suspect that some dependency packages changed their API. Beside the classifier for detecting P wave is quite old. Last time I talked to @tomas-teijeiro he did not have the training data.

from construe.

tomas-teijeiro avatar tomas-teijeiro commented on July 20, 2024

Dear all,

We just released a new version of Construe, with all code translated to Python 3. The interpretation algorithms have also been refactored to reduce the computing requirements, so we suggest you to move to the new version. @karimkhanp our last tests were made with python 3.6 and everything worked as expected, but I will try with python 3.7 and see if there are some regression issues. Thanks @lkjell for your help!

from construe.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.