IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28398


Ignore:
Timestamp:
Jun 17, 2010, 2:21:24 PM (16 years ago)
Author:
Paul Price
Message:

Remove debugging printf

File:
1 edited

Legend:

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

    r28375 r28398  
    1414    // by the multiple threads, not the total time used by all threads.
    1515    psTimerStart ("psphotReadout");
    16     printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     16
    1717    pmModelClassSetLimits(PM_MODEL_LIMITS_LAX);
    1818
     
    2626    char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT");
    2727    psAssert (breakPt, "configuration error: set BREAK_POINT");
    28     printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     28
    2929    // set the photcode for this image
    3030    if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
     
    3232        return false;
    3333    }
    34         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     34
    3535    // Generate the mask and weight images, including the user-defined analysis region of interest
    3636    if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) {
     
    4040        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4141    }
    42         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     42
    4343    // generate a background model (median, smoothed image)
    4444    if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {
    4545        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4646    }
    47             printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     47
    4848    if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
    4949        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     
    5252        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5353    }
    54         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     54
    5555    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are determined and saved on
    5656    // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT
     
    5959        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6060    }
    61         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     61
    6262    // find the detections (by peak and/or footprint) in the image.
    6363    if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1
     
    6666        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6767    }
    68         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     68
    6969    // construct sources and measure basic stats (saved on detections->newSources)
    7070    if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1
     
    7575        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7676    }
    77         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     77
    7878    // find blended neighbors of very saturated stars (detections->newSources)
    7979    if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {
     
    8181        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8282    }
    83         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     83
    8484    // mark blended peaks PS_SOURCE_BLEND (detections->newSources)
    8585    if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {
     
    8787        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8888    }
    89         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     89
    9090    // classify sources based on moments, brightness.  if a PSF model has been loaded, the PSF
    9191    // clump defined for it is used not measured (detections->newSources)
     
    9494        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9595    }
    96             printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     96
    9797    // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources)
    9898    if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1
     
    103103        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    104104    }
    105         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     105
    106106    // use bright stellar objects to measure PSF if we were supplied a PSF for any input file,
    107107    // this step is skipped
     
    117117    // XXX fix this in the new multi-input context
    118118    // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1
    119         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     119
    120120    // construct an initial model for each object, set the radius to fitRadius, set circular
    121121    // fit mask (detections->newSources)
    122122    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1
    123         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     123
    124124    // merge the newly selected sources into the existing list
    125125    // NOTE: merge OLD and NEW
    126126    psphotMergeSources (config, view, "PSPHOT.INPUT");
    127         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     127
    128128    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
    129129    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)
    130         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     130
    131131    // identify CRs and extended sources (only unmeasured sources are measured)
    132132    psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)
     
    134134        goto finish;
    135135    }
    136         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     136
    137137    // non-linear PSF and EXT fit to brighter sources
    138138    // replace model flux, adjust mask as needed, fit, subtract the models (full stamp)
    139139    psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    140         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     140
    141141    // replace all sources
    142142    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    143         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     143
    144144    // linear fit to include all sources (subtract again)
    145145    // NOTE : apply to ALL sources (extended + psf)
    146146    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)
    147         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     147
    148148    // if we only do one pass, skip to extended source analysis
    149149    if (!strcasecmp (breakPt, "PASS1")) goto pass1finish;
    150         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     150
    151151    // NOTE: possibly re-measure background model here with objects subtracted / or masked
    152152
    153153    // add noise for subtracted objects
    154154    psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    155         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     155
    156156    // find fainter sources
    157157    // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections
    158158    psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)
    159         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     159
    160160    // remove noise for subtracted objects (ie, return to normal noise level)
    161161    // NOTE: this needs to operate only on the OLD sources
    162162    psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    163         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     163
    164164    // define new sources based on only the new peaks
    165165    // NOTE: new sources are saved on detections->newSources
    166166    psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)
    167         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     167
    168168    // set source type
    169169    // NOTE: apply only to detections->newSources
     
    172172        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    173173    }
    174         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     174
    175175    // create full input models, set the radius to fitRadius, set circular fit mask
    176176    // NOTE: apply only to detections->newSources
    177177    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)
    178         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     178
    179179    // replace all sources so fit below applies to all at once
    180180    // NOTE: apply only to OLD sources (which have been subtracted)
    181181    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2
    182         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     182
    183183    // merge the newly selected sources into the existing list
    184184    // NOTE: merge OLD and NEW
    185185    // XXX check on free of sources...
    186186    psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)
    187         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     187
    188188    // NOTE: apply to ALL sources
    189189    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)
    190         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     190
    191191pass1finish:
    192192
     
    194194    // NOTE: applies only to NEW (unmeasured) sources
    195195    psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)
    196         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     196
    197197    psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    198198    psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    199         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     199
    200200finish:
    201201
    202202    // plot positive sources
    203203    // psphotSourcePlots (readout, sources, recipe);
    204         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     204
    205205    // measure aperture photometry corrections
    206206    if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
     
    208208        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    209209    }
    210         printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
     210
    211211    // calculate source magnitudes
    212212    if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
    213213      psErrorStackPrint(stderr, "Unable to do magnitudes.");
    214214        psErrorClear();
    215     }     
     215    }
    216216    if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1
    217217        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
Note: See TracChangeset for help on using the changeset viewer.