OverLordGoldDragon / ssqueezepy

Synchrosqueezing, wavelet transforms, and time-frequency analysis in Python
MIT License
618 stars 96 forks source link

Kernel Crash on Ridge Extraction #37

Closed bhclowers closed 3 years ago

bhclowers commented 3 years ago

I am able to get the examples shown in the front page to work fine, however, all attempts towards ridge extraction fail on my system. The frustrating part is that I don't even get a traceback, only total kernel failure. I've tried through the command line and through a jupyter notebook (I realize they are linking to the same kernel). Any ideas on how I might rectify this situation?

I've attempted to run the examples on the readme for ridge extraciton and observed the same result when running the core example. On the latter I can't proceed past line 63 (https://raw.githubusercontent.com/OverLordGoldDragon/ssqueezepy/master/examples/extracting_ridges.py).

Synchrosqueezing is an intriguing concept and am interested to try it out on our data.

System Profile: OSX 10.13.6 (High Sierra) Python 3.8 (Anaconda, Fresh Install)

Install/Dependency Trace: Downloading ssqueezepy-0.6.1-py3-none-any.whl (121 kB) |████████████████████████████████| 121 kB 1.2 MB/s Requirement already satisfied: numba in /opt/anaconda3/lib/python3.8/site-packages (from ssqueezepy) (0.53.1) Requirement already satisfied: scipy in /opt/anaconda3/lib/python3.8/site-packages (from ssqueezepy) (1.6.2) Requirement already satisfied: matplotlib in /opt/anaconda3/lib/python3.8/site-packages (from ssqueezepy) (3.3.4) Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.8/site-packages (from ssqueezepy) (1.20.1) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib->ssqueezepy) (2.4.7) Requirement already satisfied: pillow>=6.2.0 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib->ssqueezepy) (8.2.0) Requirement already satisfied: kiwisolver>=1.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib->ssqueezepy) (1.3.1) Requirement already satisfied: cycler>=0.10 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib->ssqueezepy) (0.10.0) Requirement already satisfied: python-dateutil>=2.1 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib->ssqueezepy) (2.8.1) Requirement already satisfied: six in /opt/anaconda3/lib/python3.8/site-packages (from cycler>=0.10->matplotlib->ssqueezepy) (1.15.0) Requirement already satisfied: llvmlite<0.37,>=0.36.0rc1 in /opt/anaconda3/lib/python3.8/site-packages (from numba->ssqueezepy) (0.36.0) Requirement already satisfied: setuptools in /opt/anaconda3/lib/python3.8/site-packages (from numba->ssqueezepy) (52.0.0.post20210125) Installing collected packages: ssqueezepy Successfully installed ssqueezepy-0.6.1

bhclowers commented 3 years ago

Quick update. I installed the package on a separate Windows 10 machine running Python 3.7. From there I was able run the example file without issue (https://raw.githubusercontent.com/OverLordGoldDragon/ssqueezepy/master/examples/extracting_ridges.py). However, the examples on the README.md for the ridge extraction still throw an error with respect to an incorrect tuple size. This should get me going though.

OverLordGoldDragon commented 3 years ago

Thanks for the report.

Assuming you ran without os.environ['SSQ_GPU'] = '1', this is a numba issue. A culprit to my mind is loose type handling in ssqueezepy, which is taken care of fine on my system, but maybe not everywhere; an idea is to explicitly cast values via int and float where applicable, see if it helps.

Worth trying os.environ['SSQ_PARALLEL'] = '0', but this'll be much slower. If anything other than ridge extraction fails, can try os.environ['SSQ_GPU'] = '1' to run via CuPy rather than numba.

On README, code was written in an earlier version and I've not gotten around to update it, but comparing with extracting_ridges.py it shouldn't be hard to fix (a PR is welcome).

bhclowers commented 3 years ago

In case this helps someone else, here are the examples extracted into an ipynb.

Cheers. Synchrosqueeze Ridge Extraction ipynb.zip