ccd-utexas / tsphot

Time series photometry using astropy.
MIT License
1 stars 4 forks source link

fails for bad conditions #56

Closed ccd-admin closed 10 years ago

ccd-admin commented 10 years ago

see data in 2014-07-01, J1600

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
C:\Anaconda\envs\np1.7.1\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc)
    195             else:
    196                 filename = fname
--> 197             exec compile(scripttext, filename, 'exec') in glob, loc
    198     else:
    199         def execfile(fname, *where):

C:\Users\admin\Documents\GitHub\tsphot\do_spe_online.py in <module>()
    104     if not os.path.isfile(args.fcoords):
    105         raise IOError(("File does not exist: {fname}").format(fname=args.fcoords))
--> 106     main(args)

C:\Users\admin\Documents\GitHub\tsphot\do_spe_online.py in main(args)
     33             try:
     34                 spe_process.main(args)
---> 35                 lc_online2.main(args)
     36             # IndexError or ValueError can be raised by lc_online2 due to namespace conflicts with spe_process.
     37             # TODO: Resolve namespace issues by sharing state info within modules using classes.

C:\Users\admin\Documents\GitHub\tsphot\lc_online2.pyc in main(args)
    372     # Choose comparison or target star based on lower level of scatter.
    373     if comp_ysig <= sigmin:
--> 374         fwhm_vec = fwhm_fit2(aplist,comps[:,:,ncmin])   # FWHM of composite comparison star
    375     else:
    376         fwhm_vec = fwhm_fit2(aplist,targs)   # FWHM of target star

C:\Users\admin\Documents\GitHub\tsphot\lc_online2.pyc in fwhm_fit2(aplist, targs)
     28         w = 3.
     29         pinitial = np.array([ s0, s1, w ])
---> 30         popt, pcov = sco.curve_fit(psf, aplist_shifted, dapvec2, p0=pinitial)
     31         w = popt[2]
     32         fwhm = 2. * np.sqrt(2.*np.log(2.)) * w

C:\Anaconda\envs\np1.7.1\lib\site-packages\scipy\optimize\minpack.pyc in curve_fit(f, xdata, ydata, p0, sigma, **kw)
    536     if ier not in [1, 2, 3, 4]:
    537         msg = "Optimal parameters not found: " + errmsg
--> 538         raise RuntimeError(msg)
    539 
    540     if (len(ydata) > len(p0)) and pcov is not None:

RuntimeError: Optimal parameters not found: Number of calls to function has reached maxfev = 800.
ccd-admin commented 10 years ago

(experimenting with assignee function)

ccd-admin commented 10 years ago

also fails for donut-like bad focus

stharrold commented 10 years ago

fixed with try/except RuntimeError hack.