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

Cannot import LombScargle in extract_features.py #42

Open
FrancisThibaultNRC opened this issue Mar 6, 2024 · 9 comments
Open

Cannot import LombScargle in extract_features.py #42

FrancisThibaultNRC opened this issue Mar 6, 2024 · 9 comments

Comments

@FrancisThibaultNRC
Copy link

Once trying to import the module in the script extract_features.py:
from astropy.stats import LombScargle

Get a message: module LombScargle not found.

So I found a workaround as the following:

try:
from astropy.timeseries import LombScargle
except ImportError:
from astropy.stats import LombScargle

Any possibility to implement this?

Thanks.

Francis

@FrancisThibaultNRC
Copy link
Author

using hrv-analysis 1.0.4

@pattersonltApp
Copy link

I also had this issue, downgrading astropy to 5.3.4 caused it to import without the workaround.

@FrancisThibaultNRC
Copy link
Author

I also had this issue, downgrading astropy to 5.3.4 caused it to import without the workaround.

Thanks for your quick reply. Will do!

@pattersonltApp
Copy link

I also had this issue, downgrading astropy to 5.3.4 caused it to import without the workaround.

Thanks for your quick reply. Will do!

No problem. Just a heads up, I'm not sure this library has been maintained for several years. The TINN feature isn't even implemented and I had to write it myself when trying to use the library. The interpolate NaN function doesn't handle leading NaN values. I calculated several features using the library and it also didn't really match with what I would expect the values to be based on the literature about HRV features and also didn't match my test set calculated from professional grade software. I'm looking into other solutions now, I found another Python library called pyHRV but it also hasn't been maintained in over 2 years and the tracked issues suggest their calculations for some values may be incorrect as well. Currently trying to figure out how to move forward.

@Aminsinichi
Copy link

@pattersonltApp Any success in finding a good alternative which is maintained?

@LucaCerina
Copy link

For everyone interested, I have a pull request #40 that checks for the relevant version of AstroPy without needing to downgrade it. The maintenance status of the library seems unclear at the moment.

@Mario-0
Copy link

Mario-0 commented Jun 17, 2024

Downgrading to 5.3.4 via pip install --upgrade astropy==5.3.4 doesn't work for me. I checked current astropy version via pip list; it is 5.3.4 but I'm still getting this error: cannot import name 'LombScargle' from 'astropy.stats' (C:\Users\BootMR\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\astropy\stats\__init__.py)

Any other ideas?

I don't know the maintenance status of HRVAnalysis.

@tecamenz
Copy link

I also had this issue, downgrading astropy to 5.3.4 caused it to import without the workaround.

Thanks for your quick reply. Will do!

No problem. Just a heads up, I'm not sure this library has been maintained for several years. The TINN feature isn't even implemented and I had to write it myself when trying to use the library. The interpolate NaN function doesn't handle leading NaN values. I calculated several features using the library and it also didn't really match with what I would expect the values to be based on the literature about HRV features and also didn't match my test set calculated from professional grade software. I'm looking into other solutions now, I found another Python library called pyHRV but it also hasn't been maintained in over 2 years and the tracked issues suggest their calculations for some values may be incorrect as well. Currently trying to figure out how to move forward.

Hey @pattersonltApp did you find a good alternative HRV package?

@pattersonltApp
Copy link

I also had this issue, downgrading astropy to 5.3.4 caused it to import without the workaround.

Thanks for your quick reply. Will do!

No problem. Just a heads up, I'm not sure this library has been maintained for several years. The TINN feature isn't even implemented and I had to write it myself when trying to use the library. The interpolate NaN function doesn't handle leading NaN values. I calculated several features using the library and it also didn't really match with what I would expect the values to be based on the literature about HRV features and also didn't match my test set calculated from professional grade software. I'm looking into other solutions now, I found another Python library called pyHRV but it also hasn't been maintained in over 2 years and the tracked issues suggest their calculations for some values may be incorrect as well. Currently trying to figure out how to move forward.

Hey @pattersonltApp did you find a good alternative HRV package?

@Aminsinichi @tecamenz

Hey all! The best solution I have been able to find is:
NeuroKit2
https://github.com/neuropsychology/NeuroKit

If anyone else locates a better package please let me know (:

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

No branches or pull requests

6 participants