-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion errors in tractor.optimize #73
Comments
That assertion error is thrown when a point source is being rendered. It first renders a unit-flux image of the PSF, and then scales it by the number of counts. That assertion is thrown when the unit-flux image has non-finite values. It's an assertion because it indicates that something is very wrong with the PSF model. Could you please print out the PSF model where that error occurs? "print self.psf" in pdb. What kind of PSF model are you using? |
Hi Dustin, Thanks so much for getting back to me, I really appreciate the help! I tried the following to get you the output of self.psf:
but got a "self is not defined" error. But I don't have much experience The psf models used are generated following the examples in the Tractor ks_band_image = Image(data=subim, invvar=np.ones_like(subim) / where kspsig=[1.60,3.09,10.0], kspsigwt=[0.59,0.27,0.135], and ksskynoise The Gaussian sigma and weight parameters above were determined by I've attached Ks-band cutout fits files with radii of 4" (success) and 5" If you have any ideas at all please let me know! Thank you again!!!!
|
Hi, Are you freezing the PSF model, or are you fitting that as well? If you're trying to fit that, it could be that the PSF model is going wild. Otherwise, I don't see how an NGaussianPSF can yield non-finite values. cheers, |
AHA! I guess the psf wasn't frozen. Including a freezeAllRecursive call I previously misunderstood that tractor.freezeParam('images') was all that Assuming I understand correctly now and the following isn't nonsense, you Thanks for your help! ~Kristina
|
tractor.freezeParams('images') You can use the cheers, On Thu, Dec 3, 2015 at 5:31 PM, Kristina Nyland [email protected]
|
Ok, got it. A varying psf was not the issue, I guess the varying position Including cat.freezeAllRecursive() and then cat.thawPathsTo('brightness') Thanks again!
|
I would check with tractor.printThawedParams() that it is doing what you |
Hi Dustin,
I've discovered that for complex fields, the minimization routine in tractor.optimize can "blow up" (i.e., the fit begins to diverge). This produces an assertion error at line 48 of pointsources.py. This is understandable, and can be "fixed" for a given source of interest by adjusting the size of the fitting region. However, my end goal is to do photometry on a survey with a large number of sources, and it would be impractical to individually define fitting region sizes using trial and error. Since this seems like a fairly standard application of the Tractor software, do you have any advice on how I might be able to catch an instance like that where the fit doesn't converge during a tractor.optimize step, and force it to continue? I have a few ideas of how to work around it, but it seems like others must have run across this as well. Ideally, it would be useful for tractor.optimize to provide a warning and produce masked arrays of NaNs (or something clever like that) for other tractor classes/functions to manipulate.
I've attached some figures showing the multiwavelength data for one source that I'm working with to demonstrate the problem. The first figure has 12 optical/IR cutouts with radii of 5". Tractor.optimize fails (line 48 of pointsources.py) on the very first cutout, the Ks-band image on the top left (again, not surprising as there are multiple bright point sources present). The 2nd figure is identical to the first, but the cutout radius shown (and used during optimization) is 4". An example of model and chi arrays successfully generated using 4" cutout radii is shown in the 3rd figure (yes, I'm aware it has other issues; I am only concerned with getting the code to run consistently at this point).
Thanks!!! :)
~Kristina
P.S. - Exact error identified in ipython's debug mode:
/Users/knyland/tractor/tractor/pointsource.pyc in getModelPatch(self, img, minsb, modelMask)
46
47 if upatch.patch is not None:
---> 48 assert(np.all(np.isfinite(upatch.patch)))
49
50 p = upatch * counts
AssertionError:
Field_74_optimize_failure.pdf
Field_74_optimize_success.pdf
The text was updated successfully, but these errors were encountered: