IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 6, 2011, 1:32:31 PM (15 years ago)
Author:
eugene
Message:
  • clarified the output to show the stages and their timing more clearly
  • psphotStackReadout now uses the same functions as psphotReadout (deprecated FitLinearStack, ExtendedAnalysisByObject, RadialAnalysisByObject, etc)
  • psphotStack now does 2nd (5 sigma) detection pass and radial photometry of the un-matched image (as well as the matched images)
  • for speed, fitting uses a smaller subset of pixels than subtraction: the model is extended when the subtraction is performed to avoid a discontinuity
  • extended source analysis (petrosians) is threaded
  • iterative kron radius / magnitude analysis with down-weighted neighbors replaces the masked neighbor kron analysis. the result of this analysis is used by fitting guesses and is the value written to the PSF and XFIT tables.
  • the target matched PSFs are determined in advance and the 0 element of this array is always the unmatched image (with target PSF of NAN)
  • dQ, the difference between the upper and lower quartile, is measured (but not yet used to adjust the sky level. sky should be FITTED_MEAN - 2.5*dQ
  • fake sources inserted for the efficiency analysis are removed at the end of the analysis
  • radial apertures is now threaded
  • edge case petrosian mags are now handled without aborts (may still have a problem with the measured error of the petrosian radius)
  • new sersic model guess based on the psf size, the moments, and the kron flux. the psf - kron mag is used to guess the index, then the index is used to convert measured moments into model guess parameters. this uses empirical relationships between the quantities generated from fake images.
  • define the fit region and window region based on the 1st radial moments
  • use the kron S/N to determine if analysis is performed for extended sources, not the psf S/N
  • remove the old 'basic deblend' which did not really do any deblending and is superceeded by the deblending in KronIterate and the footprint analysis
Location:
trunk/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src

    • Property svn:ignore
      •  

        old new  
        2222psphotMakePSF
        2323psphotStack
         24psphotModelTest
  • trunk/psphot/src/psphotStackPSF.c

    r31154 r32348  
    11# include "psphotInternal.h"
    22
    3 pmPSF *psphotStackPSF(const pmConfig *config, int numCols, int numRows, const psArray *psfs, const psVector *inputMask)
    4 {
     3// determine the 1st target PSF (either AUTO or defined by PSPHOT.STACK.TARGET.PSF.FWHM)
     4bool psphotStackPSF(const pmConfig *config, psphotStackOptions *options)  {
     5
    56    bool mdok = false;
    6     pmPSF *psf = NULL;
     7
     8    int numCols = options->numCols;
     9    int numRows = options->numRows;
     10    psArray *psfs = options->psfs;
     11    psVector *inputMask = options->inputMask;
    712
    813    // Get the recipe values
     
    1722       
    1823    char *psfModel = psMetadataLookupStr(NULL, recipe, "PSF.MODEL"); // Model for PSF
     24
     25    options->targetSeeing = psVectorAllocEmpty(4, PS_TYPE_F32);
    1926
    2027    if (autoPSF) {
     
    3845
    3946        // Solve for the target PSF
    40         psf = pmPSFEnvelope(numCols, numRows, psfs, psfInstances, psfRadius, psfModel, psfOrder, psfOrder, maskVal);
    41         if (!psf) {
     47        options->psf = pmPSFEnvelope(numCols, numRows, psfs, psfInstances, psfRadius, psfModel, psfOrder, psfOrder, maskVal);
     48        if (!options->psf) {
    4249            psError(PSPHOT_ERR_PSF, false, "Unable to determine output PSF.");
    43             return NULL;
     50            return false;
    4451        }
    4552
    46     } else {
    47 
    48         // externally-defined PSF
    49         // XXX need to test for compatibility of target with inputs
    50 
    51         float targetFWHM = psMetadataLookupF32 (&mdok, psphotRecipe, "PSPHOT.STACK.TARGET.PSF.FWHM");
    52         if (!mdok) {
    53             psVector *fwhmValues = psMetadataLookupVector(&mdok, psphotRecipe, "PSPHOT.STACK.TARGET.PSF.FWHM"); // Magnitude offsets
    54             psAssert (mdok, "missing psphot recipe value PSPHOT.STACK.TARGET.PSF.FWHM");
    55             targetFWHM = fwhmValues->data.F32[0];
    56         }
    57 
    58         // measured scale factors (fwhm = Sxx * 2.35 * scaleFactor / sqrt(2.0))
    59         // GAUSS  : 1.000
    60         // PGAUSS : 1.006
    61         // QGAUSS : 1.151
    62         // RGAUSS : 0.883
    63         // PS1_V1 : 1.134
    64        
    65         float scaleFactor = NAN;
    66         if (!strcmp(psfModel, "PS_MODEL_GAUSS")) {
    67             scaleFactor = 1.000;
    68         }
    69         if (!strcmp(psfModel, "PS_MODEL_PGAUSS")) {
    70             scaleFactor = 1.0006;
    71         }
    72         if (!strcmp(psfModel, "PS_MODEL_QGAUSS")) {
    73             scaleFactor = 1.151;
    74         }
    75         if (!strcmp(psfModel, "PS_MODEL_RGAUSS")) {
    76             scaleFactor = 0.883;
    77         }
    78         if (!strcmp(psfModel, "PS_MODEL_PS1_V1")) {
    79             scaleFactor = 1.134;
    80         }
    81         psAssert (isfinite(scaleFactor), "invalid model for PSF");
    82 
    83         float Sxx = sqrt(2.0)*targetFWHM / 2.35 / scaleFactor;
    84 
    85         // XXX probably should make the model type (and par 7) optional from recipe
    86         // psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0);
    87         psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 0.2);
    88         if (!psf) {
    89             psError(PSPHOT_ERR_PSF, false, "Unable to build dummy PSF.");
    90             return NULL;
    91         }
     53        psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "PSF.TARGET", PS_DATA_UNKNOWN, "Target PSF for stack", options->psf);
     54        float targetSeeing = pmPSFtoFWHM(options->psf, 0.5 * options->numCols, 0.5 * options->numRows); // FWHM for target
     55        psVectorAppend(options->targetSeeing, targetSeeing);
     56        psLogMsg("psphotStack", PS_LOG_INFO, "Target seeing FWHM (auto-scaled): %f\n", targetSeeing);
     57        return true;
    9258    }
    9359
    94     return psf;
     60    // externally-defined PSF
     61    // XXX need to test for compatibility of target with inputs
     62
     63    // is a single target FWHM specified, or a set of values?  set up the vector options->targetSeeing and the local 1st value
     64    float targetSeeing = psMetadataLookupF32 (&mdok, psphotRecipe, "PSPHOT.STACK.TARGET.PSF.FWHM");
     65    if (!mdok) {
     66        psVector *fwhmValues = psMetadataLookupVector(&mdok, psphotRecipe, "PSPHOT.STACK.TARGET.PSF.FWHM"); // Magnitude offsets
     67        psAssert (mdok, "missing psphot recipe value PSPHOT.STACK.TARGET.PSF.FWHM");
     68        for (int i = 0; i < fwhmValues->n; i++) {
     69            psVectorAppend(options->targetSeeing, fwhmValues->data.F32[i]);
     70        }           
     71        targetSeeing = fwhmValues->data.F32[0];
     72    } else {
     73        psVectorAppend(options->targetSeeing, targetSeeing);
     74    }
     75
     76    // measured scale factors (fwhm = Sxx * 2.35 * scaleFactor / sqrt(2.0))
     77    // GAUSS  : 1.000
     78    // PGAUSS : 1.006
     79    // QGAUSS : 1.151
     80    // RGAUSS : 0.883
     81    // PS1_V1 : 1.134
     82       
     83    float scaleFactor = NAN;
     84    if (!strcmp(psfModel, "PS_MODEL_GAUSS")) {
     85        scaleFactor = 1.000;
     86    }
     87    if (!strcmp(psfModel, "PS_MODEL_PGAUSS")) {
     88        scaleFactor = 1.0006;
     89    }
     90    if (!strcmp(psfModel, "PS_MODEL_QGAUSS")) {
     91        scaleFactor = 1.151;
     92    }
     93    if (!strcmp(psfModel, "PS_MODEL_RGAUSS")) {
     94        scaleFactor = 0.883;
     95    }
     96    if (!strcmp(psfModel, "PS_MODEL_PS1_V1")) {
     97        scaleFactor = 1.134;
     98    }
     99    psAssert (isfinite(scaleFactor), "invalid model for PSF");
     100
     101    float Sxx = sqrt(2.0)*targetSeeing / 2.35 / scaleFactor;
     102
     103    // XXX probably should make the model type (and par 7) optional from recipe
     104    // psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0);
     105    options->psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 0.2);
     106    if (!options->psf) {
     107        psError(PSPHOT_ERR_PSF, false, "Unable to build dummy PSF.");
     108        return false;
     109    }
     110
     111    psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "PSF.TARGET", PS_DATA_UNKNOWN, "Target PSF for stack", options->psf);
     112    psLogMsg("psphotStack", PS_LOG_INFO, "Target seeing FWHM (1 of %ld): %f\n", options->targetSeeing->n, targetSeeing);
     113    return true;
    95114}
Note: See TracChangeset for help on using the changeset viewer.