Aura-healthcare / hrv-analysis

Package for Heart Rate Variability analysis in Python
GNU General Public License v3.0
375 stars 93 forks source link

Cannot import LombScargle in extract_features.py #42

Open FrancisThibaultNRC opened 6 months ago

FrancisThibaultNRC commented 6 months ago

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 commented 6 months ago

using hrv-analysis 1.0.4

pattersonltApp commented 6 months ago

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

FrancisThibaultNRC commented 6 months ago

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 commented 6 months ago

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 commented 5 months ago

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

LucaCerina commented 4 months ago

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 commented 3 months ago

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 commented 2 months ago

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 commented 2 months ago

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 (: