IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13225


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

Location:
trunk/psphot/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/Makefile.am

    r13086 r13225  
    5050        psphotSummaryPlots.c     \
    5151        psphotMergeSources.c     \
     52        psphotLoadPSF.c  \
    5253        psphotReadoutCleanup.c   \
    5354        psphotSourcePlots.c      \
  • trunk/psphot/src/psphot.h

    r13086 r13225  
    9898bool            psphotMergeSources (psArray *oldSources, psArray *newSources);
    9999bool            psphotLoadExtSources (pmConfig *config, pmFPAview *view, psArray *sources);
     100pmPSF          *psphotLoadPSF (pmConfig *config, pmFPAview *view, psMetadata *recipe);
    100101bool            psphotSetHeaderNstars (psMetadata *recipe, psArray *sources);
    101102bool            psphotAddNoise (pmReadout *readout, psArray *sources, psMetadata *recipe, bool add);
  • 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
  • trunk/psphot/src/psphotDefineFiles.c

    r13216 r13225  
    8787    }
    8888
     89    if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) {
     90        pmFPAfileDefineFromArgs (&status, config, "PSPHOT.INPUT.CMF", "SRC");
     91        if (!status) {
     92            psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.INPUT.CMF");
     93            return status;
     94        }
     95    }
     96
     97    if (psMetadataLookupPtr(NULL, config->arguments, "PSF")) {
     98        pmFPAfileDefineFromArgs (&status, config, "PSPHOT.PSF.LOAD", "PSF");
     99        if (!status) {
     100            psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC");
     101            return status;
     102        }
     103    }
     104
    89105    // XXX add in example PSF image thumbnails
    90106    // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE");
     
    98114    // before it is added back into the code.
    99115# if (0)   
    100     if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) {
    101         pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "SRC");
    102         if (!status) {
    103             psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC");
    104             return status;
    105         }
    106     }
    107116    // optionally load the PSF Model and/or fixed stars
    108117    // XXX add this back in later
  • trunk/psphot/src/psphotMergeSources.c

    r12792 r13225  
    1616
    1717    // find the currently selected readout
    18     pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.SRC");
     18    pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CMF");
    1919    if (!readout) {
    2020        psLogMsg ("psphot", 3, "no external sources supplied");
  • trunk/psphot/src/psphotReadout.c

    r13133 r13225  
    104104    }
    105105
    106     // use bright stellar objects to measure PSF
    107     pmPSF *psf = psphotChoosePSF (readout, sources, recipe);
    108     if (psf == NULL) {
    109         psLogMsg ("psphot", 3, "failure to construct a psf model");
    110         return psphotReadoutCleanup (config, readout, recipe, psf, sources);
     106    // load the psf model, if suppled
     107    pmPSF *psf = psphotLoadPSF (config, view, recipe);
     108    if (!psf) {
     109        // use bright stellar objects to measure PSF
     110        psf = psphotChoosePSF (readout, sources, recipe);
     111        if (psf == NULL) {
     112            psLogMsg ("psphot", 3, "failure to construct a psf model");
     113            return psphotReadoutCleanup (config, readout, recipe, psf, sources);
     114        }
    111115    }
    112116    if (!strcasecmp (breakPt, "PSFMODEL")) {
Note: See TracChangeset for help on using the changeset viewer.