IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 25, 2007, 1:53:33 PM (19 years ago)
Author:
eugene
Message:

adding test for field coverage of psf candidates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotChoosePSF.c

    r15017 r15023  
    6262
    6363    pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), options->poissonErrorsPhotLMM);
    64 
    65     // check that the identified psf stars sufficiently cover the region; if not, extend the
    66     // limits somewhat
    67     // psphotCheckStarDistribution (sources, options);
    6864
    6965    psArray *stars = psArrayAllocEmpty (sources->n);
     
    8177        }
    8278    }
     79    // check that the identified psf stars sufficiently cover the region; if not, extend the
     80    // limits somewhat
     81    psphotCheckStarDistribution (stars, sources, options);
     82
    8383    psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
    84 
    85     if (stars->n == 0) {
    86         psLogMsg ("psphot.choosePSF", PS_LOG_WARN, "Failed to find any PSF candidates");
    87         psFree (stars);
    88         return NULL;
    89     }
    9084
    9185    // get the list pointers for the PSF_MODEL entries
     
    10094        if (item->type != PS_DATA_METADATA_MULTI) psAbort("missing PSF_MODEL selection");
    10195        modelNames = psListToArray (item->data.list);
     96    }
     97
     98    // generate a psf model using the first selection
     99    if (stars->n == 0) {
     100        // XXX optionally give up here
     101        psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF");
     102        psErrorStackPrint (stderr, "Using guess PSF model");
     103        psErrorClear ();
     104       
     105        // unset the PSFSTAR flags (none are used):
     106        for (int i = 0; i < sources->n; i++) {
     107            pmSource *source = sources->data[i];
     108            source->mode &= ~PM_SOURCE_MODE_PSFSTAR;
     109        }
     110
     111        // XXX set sxx, etc from FWHM in recipe
     112        pmPSF *psf = pmPSFBuildSimple (modelNames->data[0], 1.0, 1.0, 0.0, 1.0);
     113        psf->fieldNx = readout->image->numCols;
     114        psf->fieldNy = readout->image->numRows;
     115        psFree (modelNames);
     116
     117        bool status = true;
     118        status &= psphotMakeFluxScale (readout->image, recipe, psf);
     119        status &= psphotPSFstats (readout, recipe, psf);
     120        if (!status) {
     121            psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF");
     122            psFree (psf);
     123            return NULL;
     124        }
     125
     126        // XXX set DSX_MEAN, etc?
     127        return psf;
    102128    }
    103129
Note: See TracChangeset for help on using the changeset viewer.