<div dir="ltr">Hi Seméli,<div>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.</div>
<div><br></div><div>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():</div><div><a href="https://github.com/sncosmo/sncosmo/issues/15">https://github.com/sncosmo/sncosmo/issues/15</a><br>
</div><div><br></div><div>Thanks for trying sncosmo. Feel free to contact me directly with any other questions or problems!</div><div>- Kyle</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 11, 2013 at 1:13 AM, Seméli Papadogiannakis <span dir="ltr"><<a href="mailto:semelipap@gmail.com" target="_blank">semelipap@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi, <br></div>I have been trying to use the function:<br>
<p style="margin:0px;text-indent:0px">sncosmo.fit_lc() from the sncosmo package</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">to fit SNe lightcurves without much success. <br></p>
<p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">
</p><p style="margin:0px;text-indent:0px">model = sncosmo.get_model('hsiao', version='2.0')</p>
<p style="margin:0px;text-indent:0px">model.set(mabs=-19, z=0.0e5, c=0.1, s=1.2)</p><p style="margin:0px;text-indent:0px">
</p><p style="margin:0px;text-indent:0px">data_fitting = {'time': time_normalised, 'flux': mag_lc,</p>
<p style="margin:0px;text-indent:0px"> 'fluxerr': emag_lc, 'band': 'sdssr',</p>
<p style="margin:0px;text-indent:0px"> 'zp': 0, 'magsys': 'ab'}</p>
<p style="margin:0px;text-indent:0px"><br></p>
<p style="margin:0px;text-indent:0px">res = sncosmo.fit_lc(data_fitting, model, ['c', 's'])</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">
The error I get is not helpful: <br></p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">ERROR: ValueError: Error code returned by bispev: 10 [scipy.interpolate.fitpack2]<br>Traceback (most recent call last):<br>
File "/home/astrobarn/R-band SN/New_R_band/template_maker.py", line 108, in <module><br> res = sncosmo.fit_lc(data_fitting, model, ['c', 's'])<br> File "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/fitting.py", line 298, in fit_lc<br>
d, l = m.migrad(ncall=max_ncall)<br> File "_libiminuit.pyx", line 331, in iminuit._libiminuit.Minuit.migrad (iminuit/_libiminuit.cpp:4840)<br> File "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/fitting.py", line 278, in chi2<br>
return chi2_array_like(parvals)<br> File "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/fitting.py", line 257, in chi2_array_like<br> zp=data['zp'], zpsys=data['zpsys'])<br>
File "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/models.py", line 486, in bandflux<br>
flux = self._model_flux(phase[idx], d)<br> File "/home/astrobarn/.local/lib/python2.7/site-packages/sncosmo/models.py", line 721, in _model_flux<br> return dust_trans * self._flux(phase, disp)<br> File "/home/astrobarn/anaconda/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py", line 552, in __call__<br>
raise ValueError("Error code returned by bispev: %s" % ier)<br>ValueError: Error code returned by bispev: 10</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">Could you please help me understand what I am doing wrong. <br>
</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">Cheers, <br></p><p style="margin:0px;text-indent:0px">Seméli<br></p><p style="margin:0px;text-indent:0px">
</p></div>
<br>_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
<br></blockquote></div><br></div>