OverLordGoldDragon / ssqueezepy

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

Error in make_scales #79

Closed nyirobalazs closed 1 year ago

nyirobalazs commented 1 year ago

When I run the make_scales function I got an error: 'UnboundLocalError: local variable 'i' referenced before assignment'

the error occurs in find_downsampling_scale(wavelet, scales):

File /usr/local/lib/python3.9/dist-packages/ssqueezepy/utils/cwt_utils.py:580, in find_downsampling_scale(wavelet, scales, span, tol, method, nonzero_th, nonzero_tol, N, viz, viz_last) 575 print(("Failing scale: (idx, scale) = ({}, {:.2f})\n" 576 "out of max: (idx, scale) = ({}, {:.2f})" 577 ).format(i, float(scales[i]), len(scales) - 1, float(scales[-1]))) 578 _viz(psihs, psihs_peaks, joint_peak, psihs_nonzeros, i) --> 580 return i if (i < n_groups - 1) else None

Thus bug occurs when the signal len: 30,000 | low cut: 150 | high_cut: 250 | scaletype: log_piecewise | wavelet: morelet.

OverLordGoldDragon commented 1 year ago

Thanks for the report. A reproducible example would help address this sooner.