phoebe-project / phoebe2

PHOEBE - Eclipsing Binary Star Modeling Software
http://phoebe-project.org
GNU General Public License v3.0
80 stars 30 forks source link

compute_ck2004_ldcoeffs causes an error in SciPy #305

Closed dpandel closed 5 years ago

dpandel commented 6 years ago

When I try to create a custom passband following the instructions at http://phoebe-project.org/docs/2.0/tutorials/passbands/, the step for calculating the LD coefficients with compute_ck2004_ldcoeffs() fails with the error message below. I am using Phoebe 2.0.11 and the latest version of SciPy (1.1.0).

In [8]: pb.content
Out[8]: ['blackbody', 'ck2004', 'ck2004_all']

In [9]: pb.compute_ck2004_ldcoeffs()
/home/software/phoebe/local/lib/python2.7/site-packages/scipy/optimize/minpack.py:794: OptimizeWarning: Covariance of the parameters could not be estimated
  category=OptimizeWarning)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-a026aed5b31a> in <module>()
----> 1 pb.compute_ck2004_ldcoeffs()

/home/software/phoebe/local/lib/python2.7/site-packages/phoebe/atmospheres/passbands.pyc in compute_ck2004_ldcoeffs(self, plot_diagnostics)
    590                     cEsqrt, pcov = cfit(self._ldlaw_sqrt,   mus[fEmask], IsE[fEmask], p0=[0.5, 0.5])
    591                     cEquad, pcov = cfit(self._ldlaw_quad,   mus[fEmask], IsE[fEmask], p0=[0.5, 0.5])
--> 592                     cEnlin, pcov = cfit(self._ldlaw_nonlin, mus[fEmask], IsE[fEmask], p0=[0.5, 0.5, 0.5, 0.5])
    593                     self._ck2004_ld_energy_grid[Tindex, lindex, mindex] = np.hstack((cElin, cElog, cEsqrt, cEquad, cEnlin))
    594 

/home/software/phoebe/local/lib/python2.7/site-packages/scipy/optimize/minpack.pyc in curve_fit(f, xdata, ydata, p0, sigma, absolute_sigma, check_finite, bounds, method, jac, **kwargs)
    749         # Remove full_output from kwargs, otherwise we're passing it in twice.
    750         return_full = kwargs.pop('full_output', False)
--> 751         res = leastsq(func, p0, Dfun=jac, full_output=1, **kwargs)
    752         popt, pcov, infodict, errmsg, ier = res
    753         cost = np.sum(infodict['fvec'] ** 2)

/home/software/phoebe/local/lib/python2.7/site-packages/scipy/optimize/minpack.pyc in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
    384     m = shape[0]
    385     if n > m:
--> 386         raise TypeError('Improper input: N=%s must not exceed M=%s' % (n, m))
    387     if epsfcn is None:
    388         epsfcn = finfo(dtype).eps

TypeError: Improper input: N=4 must not exceed M=2
dpandel commented 5 years ago

The issue was caused by using the atmospheric tables in ck2004.tar instead of ck2004i.tgz.