isadoranun / FATS

MIT License
75 stars 40 forks source link

Structure Function not end #6

Open leliel12 opened 7 years ago

leliel12 commented 7 years ago

I found a big bug on the master code of FATS. with some light curves the StructureFunction_index_21 never ends. I attached a test case with the examples of a lightcurve from a VVV that make the feature fail. And also a screenshoot of my process monitor when i run the script

I suspect the error is a bad use of the numpy.trim_zero function. This functions only remove the leading and trailing zeros but with this light curve are some zeros in between

Test Case: https://gist.github.com/leliel12/a3ee1c0de5a7f2cf72100c99c220f05c

image

leliel12 commented 7 years ago

My environment

$ pip freeze
cycler==0.10.0
git+https://github.com/isadoranun/FATS.git
functools32==3.2.3.post2
matplotlib==2.0.2
numpy==1.13.1
pandas==0.20.3
patsy==0.4.1
pkg-resources==0.0.0
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2017.2
scipy==0.19.1
six==1.10.0
statsmodels==0.8.0
subprocess32==3.2.7
leliel12 commented 7 years ago

the output of run the test script

$ python test_StructureFunction_index_21.py
/test_FATS/local/lib/python2.7/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
  from pandas.core import datetools
/test_FATS/local/lib/python2.7/site-packages/FATS/FeatureFunctionLib.py:1404: RuntimeWarning: divide by zero encountered in log10
  sf1_log = np.log10(np.trim_zeros(sf1))
/test_FATS/local/lib/python2.7/site-packages/FATS/FeatureFunctionLib.py:1405: RuntimeWarning: divide by zero encountered in log10
  sf2_log = np.log10(np.trim_zeros(sf2))
/test_FATS/local/lib/python2.7/site-packages/FATS/FeatureFunctionLib.py:1406: RuntimeWarning: divide by zero encountered in log10
  sf3_log = np.log10(np.trim_zeros(sf3))
/test_FATS/local/lib/python2.7/site-packages/numpy/lib/polynomial.py:584: RuntimeWarning: invalid value encountered in true_divide
  lhs /= scale