Fitting in astropy.modeling much slower in 4.2 than 3.2.3
See original GitHub issueDescription
The speed of the fitting in astropy.modeling was seen to be significantly slower after astropy 4.0 was released. This was commented by multiple developers of the pahfit package. This package is a spectral decomposition tool that fits many lines and continuum components to NIR/MIR spectra of interstellar matter emission.
Expected behavior
Similar run times in both version of astropy
Actual behavior
10x slower when run with astropy 4.2 compared to astropy 3.2.3
astropy4.2
(base) [kgordon@grimy pahfit]$ time scripts/run_pahfit --savefig=png pahfit/data/M101_Nucleus_irs.ipac pahfit/packs/scipack_ExGal_SpitzerIRSSLLL.ipac WARNING: The fit may be unsuccessful; check fit_info[‘message’] for more information. [astropy.modeling.fitting] Number of calls to function has reached maxfev = 200.
real 0m32.365s user 0m33.346s sys 0m1.471s
astropy3.2.3
(astropy323) [kgordon@grimy pahfit]$ time scripts/run_pahfit --savefig=png pahfit/data/M101_Nucleus_irs.ipac pahfit/packs/scipack_ExGal_SpitzerIRSSLLL.ipac WARNING: The fit may be unsuccessful; check fit_info[‘message’] for more information. [astropy.modeling.fitting] Number of calls to function has reached maxfev = 200.
real 0m3.176s user 0m4.046s sys 0m1.211s
notes Used two slightly different versions of python (3.7 for astropy 3.2.3 and 3.8 for astropy 4.2) to get the conda environments to be independent. Clearly not a conda expert yet. Regardless, testing this with different versions of python give very similar answers.
Steps to Reproduce
- Use the testastropy branch of karllark/pahfit to run the command given above. This branch works in the two version of astropy tested above
astropy 4.2 result
astropy 3.2.3 result
System Details
astropy 4.2 conda environment
import platform; print(platform.platform()) Linux-5.10.8-100.fc32.x86_64-x86_64-with-glibc2.10 import sys; print(“Python”, sys.version) Python 3.8.5 (default, Sep 4 2020, 07:30:14) [GCC 7.3.0] import numpy; print(“Numpy”, numpy.version) Numpy 1.20.1 import astropy; print(“astropy”, astropy.version) astropy 4.2 import scipy; print(“Scipy”, scipy.version) Scipy 1.6.0 import matplotlib; print(“Matplotlib”, matplotlib.version) Matplotlib 3.3.4
astropy 3.2.3 conda environment
import platform; print(platform.platform()) Linux-5.10.8-100.fc32.x86_64-x86_64-with-fedora-32-Thirty_Two import sys; print(“Python”, sys.version) Python 3.7.9 (default, Aug 31 2020, 12:42:55) [GCC 7.3.0] import numpy; print(“Numpy”, numpy.version) Numpy 1.20.1 import astropy; print(“astropy”, astropy.version) astropy 3.2.3 import scipy; print(“Scipy”, scipy.version) Scipy 1.6.0 import matplotlib; print(“Matplotlib”, matplotlib.version) Matplotlib 3.3.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
Not yet. I will have to look at their source code to get a better idea of what is going on.
Very different results from profiling. Using snakeviz to view the profiling output.
astropy 4.2
astropy 3.2.3