Coder Social home page Coder Social logo

Comments (5)

LegrandNico avatar LegrandNico commented on May 21, 2024

Thank you for reporting this, I suspect this might be due to artefacts close to each other, can you share the data you are using so I can reproduce the error?

from systole.

MeisterP avatar MeisterP commented on May 21, 2024

My code is failing because the output of the correct_rr() function changed.

import pandas as pd
from systole.correction import correct_rr

df = pd.read_csv('data.csv')
correct = correct_rr(df['R-R'])

with version 0.2.2:

print(correct)
{'clean_rr': array([565., 560., 560., ..., 507., 512., 509.]), 'ectopic': 66, 'short': 40, 'long': 11, 'extra': 17, 'missed': 0}

print(correct['clean_rr'])
[565. 560. 560. ... 507. 512. 509.]

with version 0.2.3:

print(correct)
(array([565., 560., 560., ..., 507., 512., 509.]), (0, 17, 21, 30, 10))

print(correct['clean_rr'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: tuple indices must be integers or slices, not str

from systole.

LegrandNico avatar LegrandNico commented on May 21, 2024

It looks like the function is working correctly but the way it returns the results have changed:
https://embodied-computation-group.github.io/systole/generated/correction/systole.correction.correct_rr.html#systole.correction.correct_rr

It is now returning a tuple like:

clean_rr, (nMissed, nExtra, nEctopic, nShort, Long) = correct_rr(df['R-R'])

If you use the code above it should work. Sorry for this refactoring, the function has been completely rewritten in this release.

from systole.

MeisterP avatar MeisterP commented on May 21, 2024

There's no need to be sorry. Thanks for your work and support. Much appreciated. 👍

Not sure whether I'm misreading the docs... but I can't get arguments to work.

correct = correct_rr(df['R-R'], extra_correction=False)
Cleaning the RR interval time series.
... correcting 21 ectopic interval(s).
... correcting 30 short interval(s).
... correcting 12 long interval(s).
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/systole/correction.py", line 363, in correct_rr
    return _correct_rr(
  File "/usr/lib/python3.10/site-packages/systole/correction.py", line 263, in _correct_rr
    return clean_rr, (nMissed, nExtra, nEctopic, nShort, nLong)
UnboundLocalError: local variable 'nExtra' referenced before assignment
correct = correct_rr(df['R-R'], n_iterations=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: correct_rr() got an unexpected keyword argument 'n_iterations'

from systole.

LegrandNico avatar LegrandNico commented on May 21, 2024

I see the error comes from the absence of extra correction that is not correctly accounted for in the code, I will fix that as soon as possible. Thank you for pointing that out.

For the second example, the n_iteration argument has been removed in the new API to better fit with the original paper, so the function will not allow running multiple iterations of the algorithm.

from systole.

Related Issues (20)

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.