[AstroPy] sncosmo.fit_lc() error
Kyle Barbary
kylebarbary at gmail.com
Fri Oct 11 09:09:09 EDT 2013
Hi Seméli,
I'm the main developer of sncosmo. Without knowing what your data look
like, the cause of this error might be that your data are not ordered in
time. There have been several bugfixes on the master branch on github since
the v0.2 release. One of the things that has been fixed is that data are
now automatically ordered in time internally by fit_lc() to avoid this
problem. For now you can try ordering your data in time, or install the
development version from github master.
I opened an issue to fix the error message in cases where model.flux() or
model.bandflux() are called directly, rather than through fit_lc():
https://github.com/sncosmo/sncosmo/issues/15
Thanks for trying sncosmo. Feel free to contact me directly with any other
questions or problems!
- Kyle
On Fri, Oct 11, 2013 at 1:13 AM, Seméli Papadogiannakis <semelipap at gmail.com
> wrote:
> Hi,
> I have been trying to use the function:
>
>
> sncosmo.fit_lc() from the sncosmo package
>
>
> to fit SNe lightcurves without much success.
>
>
> model = sncosmo.get_model('hsiao', version='2.0')
>
> model.set(mabs=-19, z=0.0e5, c=0.1, s=1.2)
>
> data_fitting = {'time': time_normalised, 'flux': mag_lc,
>
> 'fluxerr': emag_lc, 'band': 'sdssr',
>
> 'zp': 0, 'magsys': 'ab'}
>
>
> res = sncosmo.fit_lc(data_fitting, model, ['c', 's'])
>
>
>
> The error I get is not helpful:
>
>
> ERROR: ValueError: Error code returned by bispev: 10
> [scipy.interpolate.fitpack2]
> Traceback (most recent call last):
> File "/home/astrobarn/R-band SN/New_R_band/template_maker.py", line 108,
> in <module>
> res = sncosmo.fit_lc(data_fitting, model, ['c', 's'])
> File
> "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/fitting.py",
> line 298, in fit_lc
> d, l = m.migrad(ncall=max_ncall)
> File "_libiminuit.pyx", line 331, in iminuit._libiminuit.Minuit.migrad
> (iminuit/_libiminuit.cpp:4840)
> File
> "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/fitting.py",
> line 278, in chi2
> return chi2_array_like(parvals)
> File
> "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/fitting.py",
> line 257, in chi2_array_like
> zp=data['zp'], zpsys=data['zpsys'])
> File
> "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/models.py",
> line 486, in bandflux
> flux = self._model_flux(phase[idx], d)
> File
> "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/models.py",
> line 721, in _model_flux
> return dust_trans * self._flux(phase, disp)
> File
> "/home/astrobarn/anaconda/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py",
> line 552, in __call__
> raise ValueError("Error code returned by bispev: %s" % ier)
> ValueError: Error code returned by bispev: 10
>
>
> Could you please help me understand what I am doing wrong.
>
>
> Cheers,
>
> Seméli
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131011/c46e85a5/attachment.html>
More information about the AstroPy
mailing list