﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
1147	psphot fails to build PSF model for SDSS data in PSF.TREND.MODE == MAP (without giving useful diagnostic messages)	jester@…	eugene	"Created an attachment (id=123)
Complete dump of SDSSmosaic configuration

Apologies for rolling 2 PRs into one - may need to split them up into one about the error, and one about lack of diagnostics.

The generic error (which may be a config file error on my part, but I can't tell):

psphot fails to fit a PSF when processing SDSS data with the following settings, which are the default in recipes/psphot.config (at least as of 2008-10-07, which psconfig version I refer to as cvs-20081007)

PSF.TREND.MODE                      STR   MAP
PSF.TREND.NX                        S32   1
PSF.TREND.NY                        S32   1

It works with the old default (in 2.6.1):

PSF.TREND.MODE                      STR POLY_ORD         
PSF.TREND.NX                        S32   0 
PSF.TREND.NY                        S32   0

I am attaching a dump of the config system for the SDSSmosaic camera (camera, format, user, system, site, recipes; let me know if you want the config files separately), and the image file is at alala:~jester/fpC-001056-i6-0193.fits.gz (and attached too if bugzilla lets me later). Maybe there's a reason for MAP failing in the config status?

About 2/3 frames succeeded when I had MAP on and NX, NY = 3; and it seems slightly worse with 5.

Maybe this isn't actually critical if MAP works for other cameras, or maybe there's a simple explanation. But for now, I'm a bit startled.

----

The meta-error is the lack of noticeable diagnostic information in psphot later than (but not equal to) version 2.6.1. In that version, psphot says in MAP mode:

 pmPSFFitShapeParams (pmPSFtry.c:583) : failed to find image map for shape params
 pmPSFtryModel (pmPSFtry.c:156) : failed to construct a psf model from collection of sources
Failed to fit any models when choosing PSF

I'm wondering what the ""failed to find image map"" is trying to tell me...It then complains about missing metadata, creates some plots and exits with messages about leaks:

psMetadataItemSupplement (psMetadata.c:634) : Could not find 'APMIFIT' in metadata.
 psMetadataItemSupplement (psMetadata.c:634) : Could not find 'DAPMIFIT' in metadata.
 psMetadataItemSupplement (psMetadata.c:634) : Could not find 'NAPMIFIT' in metadata.
 psMetadataItemSupplement (psMetadata.c:634) : Could not find 'SKYBIAS' in metadata.
 psMetadataItemSupplement (psMetadata.c:634) : Could not find 'SKYSAT' in metadata.
 psMetadataItemSupplement (psMetadata.c:634) : Could not find 'APLOSS' in metadata.
2008-10-10 12:39:35Z|aida77              |I|psphot
    creating moments plot
2008-10-10 12:39:36Z|aida77              |I|psphot
    saving plot to test.CHIP6.mnt.png
2008-10-10 12:39:36Z|aida77              |I|psphot
    creating psf model plot
2008-10-10 12:39:37Z|aida77              |I|psphot
    saving plot to test.CHIP6.psf.png
2008-10-10 12:39:37Z|aida77              |I|psphot
    creating ap mag - psf mag plot
2008-10-10 12:39:37Z|aida77              |I|psphot
    saving plot to test.CHIP6.dap.png
2008-10-10 12:39:38Z|aida77              |I|psphot
    complete psphot run: 8.940686 sec
found 10 leaks at psphot
# func at (file:line)  ID: X  Ref: X
pmPSFFitShapeParams at (pmPSFtry.c:527)  ID: 609519  Ref: 1
vectorAlloc at (psVector.c:77)  ID: 609520  Ref: 1
pmPSFFitShapeParams at (pmPSFtry.c:528)  ID: 609521  Ref: 1
vectorAlloc at (psVector.c:77)  ID: 609522  Ref: 1
pmPSFFitShapeParams at (pmPSFtry.c:529)  ID: 609523  Ref: 1
vectorAlloc at (psVector.c:77)  ID: 609524  Ref: 1
pmPSFFitShapeParams at (pmPSFtry.c:530)  ID: 609525  Ref: 1
vectorAlloc at (psVector.c:77)  ID: 609526  Ref: 1
pmPSFFitShapeParams at (pmPSFtry.c:554)  ID: 609527  Ref: 1
vectorAlloc at (psVector.c:77)  ID: 609528  Ref: 1
pipe has died!

By contrast, in cvs-20081007, psphot only says:

 failure to construct a psf model

buried somewhere in its output, and the leaks seem to have gone away.

When psphot is run by ppImage via pantasks with the MAP setting in psphot.config, ppImage then fails without any real error message:

    creating psf model plot
2008-10-10 12:16:15Z|aida77              |I|psphot
    saving plot to /IPP/data/SDSS/stripe82/coadd/test//run_ipp/1056-0194.3/1056-0194.3.ch.2.CHIP6.psf.png
2008-10-10 12:16:15Z|aida77              |I|psphot
    creating ap mag - psf mag plot
2008-10-10 12:16:15Z|aida77              |I|psphot
    saving plot to /IPP/data/SDSS/stripe82/coadd/test//run_ipp/1056-0194.3/1056-0194.3.ch.2.CHIP6.dap.png
pipe has died!
Unable to perform ppImage: 4 at /IPP/ipp-2.6.1.lin64/bin/chip_imfile.pl line 234
        main::my_die('Unable to perform ppImage: 4', 3, 2, 'CHIP6', 4) called at /IPP/ipp-2.6.1.lin64/bin/chip_imfile.pl line 148

I finally found the error by comparing the config files I have for 2.6.1 and cvs-20081007 and realizing that the default for PSF.TREND.MODE in recipes/psphot.config has changed between those two versions; hence I wasn't really turning the MAP mode off when I thought I was by commenting it out in SDSSmosaic/psphot.config.

I'm not sure whether or not ppImage should be continuing without a PSF model (and e.g. only with aperture magnitudes), but lack of PSF model seems to be close to a catastrophic failure given that so many later processing steps rely on PSF magnitudes PSF convolutions."	defect	closed	high		psphot	2.6	critical	worksforme		
