IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 10, 2010, 6:28:51 PM (16 years ago)
Author:
watersc1
Message:

Skycell Summary and stack Association stuff should be finished. I'll merge and do final tests on monday.

Location:
branches/czw_branch/20100519
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100519

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

    r28013 r28304  
    1414    // by the multiple threads, not the total time used by all threads.
    1515    psTimerStart ("psphotReadout");
    16 
     16    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    1717    pmModelClassSetLimits(PM_MODEL_LIMITS_LAX);
    1818
     
    2626    char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT");
    2727    psAssert (breakPt, "configuration error: set BREAK_POINT");
    28 
     28    printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    2929    // set the photcode for this image
    3030    if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
     
    3232        return false;
    3333    }
    34 
     34        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    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 
     42        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    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()));
    4748    if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
    4849        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     
    5152        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5253    }
    53 
     54        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    5455    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are determined and saved on
    5556    // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT
     
    5859        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5960    }
    60 
     61        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    6162    // find the detections (by peak and/or footprint) in the image.
    6263    if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1
     
    6566        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6667    }
    67 
     68        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    6869    // construct sources and measure basic stats (saved on detections->newSources)
    6970    if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1
     
    7475        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7576    }
    76 
     77        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    7778    // find blended neighbors of very saturated stars (detections->newSources)
    7879    if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {
     
    8081        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8182    }
    82 
     83        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    8384    // mark blended peaks PS_SOURCE_BLEND (detections->newSources)
    8485    if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {
     
    8687        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8788    }
    88 
     89        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    8990    // classify sources based on moments, brightness.  if a PSF model has been loaded, the PSF
    9091    // clump defined for it is used not measured (detections->newSources)
     
    9394        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9495    }
     96            printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    9597    // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources)
    9698    if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1
     
    101103        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    102104    }
    103 
     105        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    104106    // use bright stellar objects to measure PSF if we were supplied a PSF for any input file,
    105107    // this step is skipped
     
    115117    // XXX fix this in the new multi-input context
    116118    // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1
    117 
     119        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    118120    // construct an initial model for each object, set the radius to fitRadius, set circular
    119121    // fit mask (detections->newSources)
    120122    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1
    121 
     123        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    122124    // merge the newly selected sources into the existing list
    123125    // NOTE: merge OLD and NEW
    124126    psphotMergeSources (config, view, "PSPHOT.INPUT");
    125 
     127        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    126128    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
    127129    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)
    128 
     130        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    129131    // identify CRs and extended sources (only unmeasured sources are measured)
    130132    psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)
     
    132134        goto finish;
    133135    }
    134 
     136        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    135137    // non-linear PSF and EXT fit to brighter sources
    136138    // replace model flux, adjust mask as needed, fit, subtract the models (full stamp)
    137139    psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    138 
     140        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    139141    // replace all sources
    140142    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    141 
     143        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    142144    // linear fit to include all sources (subtract again)
    143145    // NOTE : apply to ALL sources (extended + psf)
    144146    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)
    145 
     147        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    146148    // if we only do one pass, skip to extended source analysis
    147149    if (!strcasecmp (breakPt, "PASS1")) goto pass1finish;
    148 
     150        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    149151    // NOTE: possibly re-measure background model here with objects subtracted / or masked
    150152
    151153    // add noise for subtracted objects
    152154    psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    153 
     155        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    154156    // find fainter sources
    155157    // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections
    156158    psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)
    157 
     159        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    158160    // remove noise for subtracted objects (ie, return to normal noise level)
    159161    // NOTE: this needs to operate only on the OLD sources
    160162    psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    161 
     163        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    162164    // define new sources based on only the new peaks
    163165    // NOTE: new sources are saved on detections->newSources
    164166    psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)
    165 
     167        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    166168    // set source type
    167169    // NOTE: apply only to detections->newSources
     
    170172        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    171173    }
    172 
     174        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    173175    // create full input models, set the radius to fitRadius, set circular fit mask
    174176    // NOTE: apply only to detections->newSources
    175177    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)
    176 
     178        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    177179    // replace all sources so fit below applies to all at once
    178180    // NOTE: apply only to OLD sources (which have been subtracted)
    179181    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2
    180 
     182        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    181183    // merge the newly selected sources into the existing list
    182184    // NOTE: merge OLD and NEW
    183185    // XXX check on free of sources...
    184186    psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)
    185 
     187        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    186188    // NOTE: apply to ALL sources
    187189    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)
    188 
     190        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    189191pass1finish:
    190192
     
    192194    // NOTE: applies only to NEW (unmeasured) sources
    193195    psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)
    194 
     196        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    195197    psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    196198    psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    197 
     199        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    198200finish:
    199201
    200202    // plot positive sources
    201203    // psphotSourcePlots (readout, sources, recipe);
    202 
     204        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    203205    // measure aperture photometry corrections
    204206    if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
     
    206208        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    207209    }
    208 
     210        printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));
    209211    // calculate source magnitudes
    210     psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    211 
     212    if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
     213      psErrorStackPrint(stderr, "Unable to do magnitudes.");
     214        psErrorClear();
     215    }     
    212216    if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1
    213217        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
     
    219223
    220224    // replace background in residual image
    221     psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1
    222 
     225    if (!psphotSkyReplace (config, view, "PSPHOT.INPUT")) { // pass 1
     226      psErrorStackPrint(stderr, "Unable to replace sky");
     227      psErrorClear();
     228
     229/*       psLogMsg("psphot", 3, "failed on psphotSkyReplace"); */
     230/*       return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */
     231    }
    223232    // drop the references to the image pixels held by each source
    224     psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1
    225 
     233    if (!psphotSourceFreePixels (config, view, "PSPHOT.INPUT")) { // pass 1
     234      psErrorStackPrint(stderr, "Unable to free source pixels");
     235      psErrorClear();
     236
     237/*       psLogMsg ("psphot", 3, "failed on psphotSourceFreePixels"); */
     238/*       return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */
     239    }
    226240    // create the exported-metadata and free local data
    227241    return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
  • branches/czw_branch/20100519/psphot/src/psphotStackOptions.c

    r28013 r28304  
    4040    options->psfs        = psArrayAlloc(num);
    4141    options->sourceLists = psArrayAlloc(num); // Individual lists of sources for matching
    42     options->kernels     = psArrayAlloc(num); 
    43     options->regions     = psArrayAlloc(num); 
     42    options->kernels     = psArrayAlloc(num);
     43    options->regions     = psArrayAlloc(num);
    4444
    4545    options->inputMask   = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
     
    7777    switch (options->convolveSource) {
    7878      case PSPHOT_CNV_SRC_AUTO:
    79         fileSrc = fileCnv ? fileCnv : fileRaw;
    80         break;
     79        fileSrc = fileCnv ? fileCnv : fileRaw;
     80        break;
    8181
    8282      case PSPHOT_CNV_SRC_RAW:
    83         fileSrc = fileRaw;
    84         break;
     83        fileSrc = fileRaw;
     84        break;
    8585
    8686      case PSPHOT_CNV_SRC_CNV:
    87         fileSrc = fileCnv;
    88         break;
     87        fileSrc = fileCnv;
     88        break;
    8989
    9090      default:
    91         psAbort("impossible case");
     91        psAbort("impossible case");
    9292    }
    9393    if (!fileSrc) {
    94         psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %llx, raw : %llx)", (long long) fileCnv, (long long) fileRaw);
     94        psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %p, raw : %p)", fileCnv, fileRaw);
    9595    }
    96    
     96
    9797    return fileSrc;
    9898}
  • branches/czw_branch/20100519/psphot/src/psphotVisual.c

    r27819 r28304  
    1515# include <kapa.h>
    1616
     17# define DEBUG 0
     18
    1719bool pmVisualLimitsFromVectors (Graphdata *graphdata, psVector *xVec, psVector *yVec);
    1820
     
    197199    pmReadout *backgnd;
    198200
    199     if (!pmVisualIsVisual()) return true;
     201    if (!DEBUG && !pmVisualIsVisual()) return true;
    200202
    201203    int kapa = psphotKapaChannel (1);
     
    220222bool psphotVisualShowSignificance (psImage *image, float min, float max) {
    221223
    222     if (!pmVisualIsVisual()) return true;
     224    if (!DEBUG && !pmVisualIsVisual()) return true;
    223225
    224226    int kapa = psphotKapaChannel (1);
     
    236238    KiiOverlay *overlay;
    237239
    238     if (!pmVisualIsVisual()) return true;
     240    if (!DEBUG && !pmVisualIsVisual()) return true;
    239241
    240242    int kapa = psphotKapaChannel (1);
     
    275277    KiiOverlay *overlay;
    276278
    277     if (!pmVisualIsVisual()) return true;
     279    if (!DEBUG && !pmVisualIsVisual()) return true;
    278280
    279281    int kapa = psphotKapaChannel (1);
     
    385387    psEllipseAxes axes;
    386388
    387     if (!pmVisualIsVisual()) return true;
     389    if (!DEBUG && !pmVisualIsVisual()) return true;
    388390
    389391    int kapa = psphotKapaChannel (1);
     
    437439    KapaSection section;
    438440
    439     if (!pmVisualIsVisual()) return true;
     441    if (!DEBUG && !pmVisualIsVisual()) return true;
    440442
    441443    int myKapa = psphotKapaChannel (2);
     
    753755bool psphotVisualShowRoughClass (psArray *sources) {
    754756
    755     if (!pmVisualIsVisual()) return true;
     757    if (!DEBUG && !pmVisualIsVisual()) return true;
    756758
    757759    int myKapa = psphotKapaChannel (1);
     
    774776bool psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf) {
    775777
    776     if (!pmVisualIsVisual()) return true;
     778    if (!DEBUG && !pmVisualIsVisual()) return true;
    777779
    778780    int myKapa = psphotKapaChannel (3);
     
    840842    bool status;
    841843
    842     if (!pmVisualIsVisual()) return true;
     844    if (!DEBUG && !pmVisualIsVisual()) return true;
    843845
    844846    int myKapa = psphotKapaChannel (3);
     
    992994    bool status;
    993995
    994     if (!pmVisualIsVisual()) return true;
     996    if (!DEBUG && !pmVisualIsVisual()) return true;
    995997
    996998    int myKapa = psphotKapaChannel (3);
     
    13561358    KapaSection section;  // put the positive profile in one and the residuals in another?
    13571359
    1358     if (!pmVisualIsVisual()) return true;
     1360    if (!DEBUG && !pmVisualIsVisual()) return true;
    13591361
    13601362    int myKapa = psphotKapaChannel (2);
     
    14271429    return true;
    14281430
    1429     if (!pmVisualIsVisual()) return true;
     1431    if (!DEBUG && !pmVisualIsVisual()) return true;
    14301432
    14311433    int myKapa = psphotKapaChannel (1);
     
    15681570bool psphotVisualShowSourceSize (pmReadout *readout, psArray *sources) {
    15691571
    1570     if (!pmVisualIsVisual()) return true;
     1572    if (!DEBUG && !pmVisualIsVisual()) return true;
    15711573
    15721574    int myKapa = psphotKapaChannel (1);
     
    15951597    KapaSection section;
    15961598
    1597     if (!pmVisualIsVisual()) return true;
     1599    if (!DEBUG && !pmVisualIsVisual()) return true;
    15981600
    15991601    int myKapa = psphotKapaChannel (2);
     
    21062108bool psphotVisualShowResidualImage (pmReadout *readout) {
    21072109
    2108     if (!pmVisualIsVisual()) return true;
     2110    if (!DEBUG && !pmVisualIsVisual()) return true;
    21092111
    21102112    int myKapa = psphotKapaChannel (1);
     
    21222124    float lineX[2], lineY[2];
    21232125
    2124     if (!pmVisualIsVisual()) return true;
     2126    if (!DEBUG && !pmVisualIsVisual()) return true;
    21252127
    21262128    int myKapa = psphotKapaChannel (2);
     
    22402242    Graphdata graphdata;
    22412243
    2242     if (!pmVisualIsVisual()) return true;
     2244    if (!DEBUG && !pmVisualIsVisual()) return true;
    22432245
    22442246    int myKapa = psphotKapaChannel (2);
     
    23242326    KiiOverlay *overlay;
    23252327
    2326     if (!pmVisualIsVisual()) return true;
     2328    if (!DEBUG && !pmVisualIsVisual()) return true;
    23272329
    23282330    int kapa = psphotKapaChannel (1);
Note: See TracChangeset for help on using the changeset viewer.