IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12611


Ignore:
Timestamp:
Mar 27, 2007, 2:58:39 PM (19 years ago)
Author:
eugene
Message:

dropped deprecated code, put trace around test outputs

File:
1 edited

Legend:

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

    r12600 r12611  
    11# include "psphot.h"
    2 // # define TESTSAVE
     2static int npass = 0;
    33
    44// generate the median in NxN boxes, clipping heavily
     
    277277    }
    278278
    279 # ifdef TESTSAVE
    280     psphotSaveImage (NULL, image, "image.fits");
    281     psphotSaveImage (NULL, background->image, "back.fits");
    282     psphotSaveImage (NULL, mask, "mask.fits");
    283     psphotSaveImage (NULL, model->image, "backmdl.fits");
    284 # endif
     279    if (psTraceGetLevel("psphot") > 5) {
     280        char name[256];
     281        sprintf (name, "image.%02d.fits", npass);
     282        psphotSaveImage (NULL, image, name);
     283        sprintf (name, "back.%02d.fits", npass);
     284        psphotSaveImage (NULL, background->image, name);
     285        sprintf (name, "mask.%02d.fits", npass);
     286        psphotSaveImage (NULL, mask, name);
     287        sprintf (name, "backmdl.%02d.fits", npass);
     288        psphotSaveImage (NULL, model->image, name);
     289    }
    285290
    286291    // subtract the background model (save in backSub, if requested)
     
    294299    }
    295300
    296 # ifdef TESTSAVE
    297     psphotSaveImage (NULL, image, "backsub.fits");
    298     exit (1);
    299 # endif
     301    if (psTraceGetLevel("psphot") > 5) {
     302        char name[256];
     303        sprintf (name, "backsub.%02d.fits", npass);
     304        psphotSaveImage (NULL, image, name);
     305    }
     306    npass ++;
    300307
    301308    psLogMsg ("psphot", PS_LOG_INFO, "subtracted background model: %f sec\n", psTimerMark ("psphot"));
     
    308315    return true;
    309316}
    310 
    311 
    312 # if (0)
    313 
    314     // dimensions of input & output image
    315     int Nx = image->numCols;
    316     int Ny = image->numRows;
    317 
    318     // scaling factor
    319     int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
    320     int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
    321 
    322     // overhang : we will balance this evenly
    323     int xExtra = (Nx % DX) / 2;
    324     int yExtra = (Ny % DY) / 2;
    325     int xOffset = (xExtra > 0) ? DX - xExtra : 0;
    326     int yOffset = (yExtra > 0) ? DY - yExtra : 0;
    327     xOffset -= image->col0;
    328     yOffset -= image->row0;
    329 
    330     // dimensions of binned image
    331     int nx, ny;
    332     if (Nx % DX == 0) {
    333         nx = Nx / DX;
    334     } else {
    335         nx = (xExtra) ? (Nx / DX) + 2 : (Nx / DX) + 1;
    336     }
    337     if (Ny % DY == 0) {
    338         ny = Ny / DY;
    339     } else {
    340         ny = (yExtra) ? (Ny / DY) + 2 : (Ny / DY) + 1;
    341     }
    342 
    343     // we have 4 possibilities: (INTERNAL or I/O file) and (exists or not)
    344     // select model pixels (from output background model file, or create internal file)
    345     file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKMDL");
    346     if (file == NULL) {
    347         // we are not using PSPHOT.BACKMDL as an I/O file: define an internal version
    348         model = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKMDL", nx, ny, PS_TYPE_F32);
    349     } else {
    350         if (file->mode == PM_FPA_MODE_INTERNAL) {
    351             // we are not using PSPHOT.BACKMDL as an I/O file: already defined above
    352             model = file->readout;
    353         } else {
    354             // we are using PSPHOT.BACKMDL as an I/O file: select readout or create
    355             model = pmFPAviewThisReadout (view, file->fpa);
    356             if (model == NULL) {
    357                 // readout does not yet exist: create from input
    358                 // XXX we have an inconsistency in this calculation here and in pmFPACopy
    359                 pmFPAfileCopyStructureView (file->fpa, inFPA, DX, DY, view);
    360                 model = pmFPAviewThisReadout (view, file->fpa);
    361                 if ((nx != model->image->numCols) || (ny != model->image->numRows)) {
    362                     psError (PSPHOT_ERR_PROG, true, "inconsistent sizes for model dimensions");
    363                     return false;
    364                 }
    365             }
    366         }
    367     }
    368     psF32 **modelData = model->image->data.F32;
    369 
    370 
    371 
    372             // sx, sy are in parent coords
    373             int sx = ix*DX - xOffset;
    374             int sy = iy*DY - yOffset;
    375             region = psRegionSet (sx, sx + 2*DX, sy, sy + 2*DY);
    376 
    377 # endif
Note: See TracChangeset for help on using the changeset viewer.