IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 19, 2010, 2:08:46 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/czw_branch/20100427/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100427/psphot

  • branches/czw_branch/20100427/psphot/src/psphotReadout.c

    r27657 r28029  
    2828
    2929    // set the photcode for this image
    30     if (!psphotAddPhotcode (config, view)) {
     30    if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
    3131        psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    3232        return false;
     
    3434
    3535    // Generate the mask and weight images, including the user-defined analysis region of interest
    36     if (!psphotSetMaskAndVariance (config, view)) {
    37         return psphotReadoutCleanup(config, view);
     36    if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) {
     37        return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
    3838    }
    3939    if (!strcasecmp (breakPt, "NOTHING")) {
    40         return psphotReadoutCleanup(config, view);
     40        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4141    }
    4242
    4343    // generate a background model (median, smoothed image)
    44     if (!psphotModelBackground (config, view)) {
    45         return psphotReadoutCleanup (config, view);
    46     }
    47     if (!psphotSubtractBackground (config, view)) {
    48         return psphotReadoutCleanup (config, view);
     44    if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {
     45        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     46    }
     47    if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
     48        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4949    }
    5050    if (!strcasecmp (breakPt, "BACKMDL")) {
    51         return psphotReadoutCleanup (config, view);
     51        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5252    }
    5353
    5454    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are determined and saved on
    5555    // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT
    56     if (!psphotLoadPSF (config, view)) {
     56    if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ?
    5757        psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model");
    58         return psphotReadoutCleanup (config, view);
     58        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5959    }
    6060
    6161    // find the detections (by peak and/or footprint) in the image.
    62     if (!psphotFindDetections (config, view, true)) { // pass 1
     62    if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1
    6363        // this only happens if we had an error in psphotFindDetections
    6464        psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis");
    65         return psphotReadoutCleanup (config, view);
     65        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6666    }
    6767
    6868    // construct sources and measure basic stats (saved on detections->newSources)
    69     if (!psphotSourceStats (config, view, true)) { // pass 1
     69    if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1
    7070        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    71         return psphotReadoutCleanup (config, view);
     71        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7272    }
    7373    if (!strcasecmp (breakPt, "PEAKS")) {
    74         return psphotReadoutCleanup(config, view);
     74        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7575    }
    7676
    7777    // find blended neighbors of very saturated stars (detections->newSources)
    78     if (!psphotDeblendSatstars (config, view)) {
     78    if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {
    7979        psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis");
    80         return psphotReadoutCleanup (config, view);
     80        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8181    }
    8282
    8383    // mark blended peaks PS_SOURCE_BLEND (detections->newSources)
    84     if (!psphotBasicDeblend (config, view)) {
     84    if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {
    8585        psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis");
    86         return psphotReadoutCleanup (config, view);
     86        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8787    }
    8888
    8989    // classify sources based on moments, brightness.  if a PSF model has been loaded, the PSF
    9090    // clump defined for it is used not measured (detections->newSources)
    91     if (!psphotRoughClass (config, view)) { // pass 1
     91    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 1
    9292        psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications");
    93         return psphotReadoutCleanup (config, view);
     93        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9494    }
    9595    // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources)
    96     if (!psphotImageQuality (config, view)) { // pass 1
     96    if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1
    9797        psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality");
    98         return psphotReadoutCleanup(config, view);
     98        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9999    }
    100100    if (!strcasecmp (breakPt, "MOMENTS")) {
    101         return psphotReadoutCleanup(config, view);
     101        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    102102    }
    103103
    104104    // use bright stellar objects to measure PSF if we were supplied a PSF for any input file,
    105105    // this step is skipped
    106     if (!psphotChoosePSF (config, view)) { // pass 1
     106    if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { // pass 1
    107107        psLogMsg ("psphot", 3, "failure to construct a psf model");
    108         return psphotReadoutCleanup (config, view);
     108        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    109109    }
    110110    if (!strcasecmp (breakPt, "PSFMODEL")) {
    111         return psphotReadoutCleanup (config, view);
     111        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    112112    }
    113113
    114114    // include externally-supplied sources
    115115    // XXX fix this in the new multi-input context
    116     // psphotLoadExtSources (config, view); // pass 1
     116    // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1
    117117
    118118    // construct an initial model for each object, set the radius to fitRadius, set circular
    119119    // fit mask (detections->newSources)
    120     psphotGuessModels (config, view); // pass 1
     120    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1
    121121
    122122    // merge the newly selected sources into the existing list
    123123    // NOTE: merge OLD and NEW
    124     psphotMergeSources (config, view);
     124    psphotMergeSources (config, view, "PSPHOT.INPUT");
    125125
    126126    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
    127     psphotFitSourcesLinear (config, view, false); // pass 1 (detections->allSources)
     127    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)
    128128
    129129    // identify CRs and extended sources (only unmeasured sources are measured)
    130     psphotSourceSize (config, view, true); // pass 1 (detections->allSources)
     130    psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)
    131131    if (!strcasecmp (breakPt, "ENSEMBLE")) {
    132132        goto finish;
     
    135135    // non-linear PSF and EXT fit to brighter sources
    136136    // replace model flux, adjust mask as needed, fit, subtract the models (full stamp)
    137     psphotBlendFit (config, view); // pass 1 (detections->allSources)
     137    psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    138138
    139139    // replace all sources
    140     psphotReplaceAllSources (config, view); // pass 1 (detections->allSources)
     140    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    141141
    142142    // linear fit to include all sources (subtract again)
    143143    // NOTE : apply to ALL sources (extended + psf)
    144     psphotFitSourcesLinear (config, view, true); // pass 2 (detections->allSources)
     144    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)
    145145
    146146    // if we only do one pass, skip to extended source analysis
     
    150150
    151151    // add noise for subtracted objects
    152     psphotAddNoise (config, view); // pass 1 (detections->allSources)
     152    psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    153153
    154154    // find fainter sources
    155155    // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections
    156     psphotFindDetections (config, view, false); // pass 2 (detections->peaks, detections->footprints)
     156    psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)
    157157
    158158    // remove noise for subtracted objects (ie, return to normal noise level)
    159159    // NOTE: this needs to operate only on the OLD sources
    160     psphotSubNoise (config, view); // pass 1 (detections->allSources)
     160    psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    161161
    162162    // define new sources based on only the new peaks
    163163    // NOTE: new sources are saved on detections->newSources
    164     psphotSourceStats (config, view, false); // pass 2 (detections->newSources)
     164    psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)
    165165
    166166    // set source type
    167167    // NOTE: apply only to detections->newSources
    168     if (!psphotRoughClass (config, view)) { // pass 2 (detections->newSources)
     168    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 2 (detections->newSources)
    169169        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    170         return psphotReadoutCleanup (config, view);
     170        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    171171    }
    172172
    173173    // create full input models, set the radius to fitRadius, set circular fit mask
    174174    // NOTE: apply only to detections->newSources
    175     psphotGuessModels (config, view); // pass 2 (detections->newSources)
     175    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)
    176176
    177177    // replace all sources so fit below applies to all at once
    178178    // NOTE: apply only to OLD sources (which have been subtracted)
    179     psphotReplaceAllSources (config, view); // pass 2
     179    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2
    180180
    181181    // merge the newly selected sources into the existing list
    182182    // NOTE: merge OLD and NEW
    183183    // XXX check on free of sources...
    184     psphotMergeSources (config, view); // (detections->newSources + detections->allSources -> detections->allSources)
     184    psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)
    185185
    186186    // NOTE: apply to ALL sources
    187     psphotFitSourcesLinear (config, view, true); // pass 3 (detections->allSources)
     187    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)
    188188
    189189pass1finish:
     
    191191    // measure source size for the remaining sources
    192192    // NOTE: applies only to NEW (unmeasured) sources
    193     psphotSourceSize (config, view, false); // pass 2 (detections->allSources)
    194 
    195     psphotExtendedSourceAnalysis (config, view); // pass 1 (detections->allSources)
    196     psphotExtendedSourceFits (config, view); // pass 1 (detections->allSources)
     193    psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)
     194
     195    psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
     196    psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    197197
    198198finish:
     
    202202
    203203    // measure aperture photometry corrections
    204     if (!psphotApResid (config, view)) { // pass 1 (detections->allSources)
     204    if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
    205205        psLogMsg ("psphot", 3, "failed on psphotApResid");
    206         return psphotReadoutCleanup (config, view);
     206        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    207207    }
    208208
    209209    // calculate source magnitudes
    210     psphotMagnitudes(config, view); // pass 1 (detections->allSources)
    211 
    212     if (!psphotEfficiency(config, view)) { // pass 1
     210    psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
     211
     212    if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1
    213213        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
    214214        psErrorClear();
     
    219219
    220220    // replace background in residual image
    221     psphotSkyReplace (config, view); // pass 1
     221    psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1
    222222
    223223    // drop the references to the image pixels held by each source
    224     psphotSourceFreePixels (config, view); // pass 1
     224    psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1
    225225
    226226    // create the exported-metadata and free local data
    227     return psphotReadoutCleanup(config, view);
     227    return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
    228228}
Note: See TracChangeset for help on using the changeset viewer.