IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 3, 2007, 4:51:40 PM (19 years ago)
Author:
eugene
Message:

load PSF from external file, load sources file external file, move default values to master recipe

File:
1 edited

Legend:

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

    r13079 r13225  
    1212    psTimerStart ("psphot");
    1313
    14     // check if a PSF model is supplied by the user
    15     psf = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.PSF");
    16     if (psf != NULL) {
    17         if (!psphotPSFstats (readout, recipe, psf)) psAbort("cannot measure PSF shape terms");
    18         return psf;
    19     }
    20 
    2114    // examine PSF sources in S/N order (brightest first)
    2215    sources = psArraySort (sources, pmSourceSortBySN);
     
    2417    // array to store candidate PSF stars
    2518    int NSTARS = psMetadataLookupS32 (&status, recipe, "PSF_MAX_NSTARS");
    26     if (!status) {
    27         NSTARS = PS_MIN (sources->n, 200);
    28         psWarning("PSF_MAX_NSTARS is not set in the recipe --- defaulting to %d\n", NSTARS);
    29     }
     19    PS_ASSERT (status, NULL);
    3020
    3121    float PSF_MIN_DS = psMetadataLookupF32 (&status, recipe, "PSF_MIN_DS");
    32     if (!status) {
    33         PSF_MIN_DS = 0.01;
    34         psWarning("PSF_MIN_DS is not set --- defaulting to %f\n", PSF_MIN_DS);
    35     }
     22    PS_ASSERT (status, NULL);
    3623
    3724    // supply the measured sky variance for optional constant errors (non-poissonian)
    3825    float SKY_SIG = psMetadataLookupF32 (&status, recipe, "SKY_SIG");
    39     if (!status) {
    40         SKY_SIG = 1.0;
    41         psWarning("SKY_SIG is not set --- defaulting to %f\n", SKY_SIG);
    42     }
     26    PS_ASSERT (status, NULL);
     27
    4328    // use poissonian errors or local-sky errors
    4429    bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, "POISSON_ERRORS");
    45     if (!status) {
    46         POISSON_ERRORS = true;
    47         psWarning("POISSON_ERRORS is not set in the recipe --- defaulting to true.\n");
    48     }
    49     pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), POISSON_ERRORS);
     30    PS_ASSERT (status, NULL);
    5031
    5132    // use poissonian errors or local-sky errors
    5233    bool PSF_PARAM_WEIGHTS = psMetadataLookupBool (&status, recipe, "PSF_PARAM_WEIGHTS");
    53     if (!status) {
    54         PSF_PARAM_WEIGHTS = false;
    55         psWarning("PSF_PARAM_WEIGHTS is not set in the recipe --- defaulting to false.\n");
    56     }
     34    PS_ASSERT (status, NULL);
    5735
    5836    // how to model the PSF variations across the field
    59     // XXX make a default value?  or not?
    6037    psMetadata *md = psMetadataLookupMetadata (&status, recipe, "PSF.TREND.MASK");
    61     psPolynomial2D *psfTrendMask;
    62     if (!status || !md) {
    63         psWarning("PSF.TREND.MASK is not set in the recipe --- defaulting to use zeroth order.\n");
    64         psfTrendMask = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 0, 0);
    65     } else {
    66         psfTrendMask = psPolynomial2DfromMetadata (md);
    67         if (!psfTrendMask) {
    68             psError(PSPHOT_ERR_PSF, true, "Unable to construct polynomial from PSF.TREND.MASK in the recipe");
    69             return NULL;
    70         }
     38    PS_ASSERT (status, NULL);
     39
     40    // get the fixed PSF fit radius
     41    // XXX check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS
     42    float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
     43    PS_ASSERT (status, NULL);
     44
     45    pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), POISSON_ERRORS);
     46
     47    psPolynomial2D *psfTrendMask = psPolynomial2DfromMetadata (md);
     48    if (!psfTrendMask) {
     49        psError(PSPHOT_ERR_PSF, true, "Unable to construct polynomial from PSF.TREND.MASK in the recipe");
     50        return NULL;
    7151    }
    7252
     
    9070        psError(PSPHOT_ERR_PSF, true, "Failed to find any PSF candidates");
    9171        return NULL;
    92     }
    93 
    94     // get the fixed PSF fit radius
    95     // XXX EAM : check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS
    96     float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
    97     if (!status) {
    98         RADIUS = 20.0;
    99         psWarning("PSF_FIT_RADIUS is not set in the recipe --- defaulting to %g\n", RADIUS);
    10072    }
    10173
Note: See TracChangeset for help on using the changeset viewer.