IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34489


Ignore:
Timestamp:
Sep 28, 2012, 4:56:30 PM (14 years ago)
Author:
watersc1
Message:

Removed excess debug information, and pulled header information so that I don't need to hard code anything anymore.

Location:
branches/czw_branch/20120906/pswarp/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/pswarp/src/pswarp.c

    r34411 r34489  
    4747    }
    4848    if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) {
    49       fprintf(stderr,"Here!\n");
    5049      if (!pswarpDefineBackground(config)) {
    5150        goto DIE;
     
    7473    }
    7574    if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) {
    76       fprintf(stderr,"There!\n");
    7775      if (!pswarpLoopBackground(config, stats)) {
    7876        fprintf(stderr,"Dying!\n");
  • branches/czw_branch/20120906/pswarp/src/pswarp.h

    r34471 r34489  
    6262    psImage *region;
    6363
     64    /** values which are needed to control the background model warping. */
     65    bool background_warping;
     66    double offset_x;
     67    double offset_y;
     68 
    6469    /** input values for this tile */
    6570    int gridX;
  • branches/czw_branch/20120906/pswarp/src/pswarpLoop.c

    r34487 r34489  
    605605        }
    606606
     607        // Pull information from the header of the background files so we can use it to set values.
     608        pmHDU *hdu = pmFPAviewThisHDU(view,input->fpa);
     609        psMetadata *header = hdu->header;
     610       
     611        int IMAXIS1 = psMetadataLookupS32(NULL,header,"IMNAXIS1");
     612        int IMAXIS2 = psMetadataLookupS32(NULL,header,"IMNAXIS2");
     613        int NAXIS1 = psMetadataLookupS32(NULL,header,"NAXIS1");
     614        int NAXIS2 = psMetadataLookupS32(NULL,header,"NAXIS2");
     615        char *CCDSUM = psMetadataLookupStr(NULL,header,"CCDSUM");
     616        int CCDSUM1 = atoi(strtok(CCDSUM," "));
     617        int CCDSUM2 = atoi(strtok(NULL," "));
     618       
     619        psMetadataAddF32(config->arguments,PS_LIST_TAIL,"BKG_WARP_XOFFSET", PS_META_REPLACE,
     620                         "xoffset for background model data", (NAXIS1 * CCDSUM1 - IMAXIS1) / (2.0 * CCDSUM1));
     621        psMetadataAddF32(config->arguments,PS_LIST_TAIL,"BKG_WARP_YOFFSET", PS_META_REPLACE,
     622                         "yoffset for background model data", (NAXIS2 * CCDSUM2 - IMAXIS2) / (2.0 * CCDSUM2));
     623        psTrace("pswarp",5,"%d %d %d %d %d %d %g %g %d %d",
     624                psMetadataLookupS32(NULL,header,"IMNAXIS1"),
     625                psMetadataLookupS32(NULL,header,"IMNAXIS2"),
     626                psMetadataLookupS32(NULL,header,"NAXIS1"),
     627                psMetadataLookupS32(NULL,header,"NAXIS2"),
     628                CCDSUM1,CCDSUM2,
     629                psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_XOFFSET"),
     630                psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_YOFFSET"),
     631                psMetadataLookupS32(NULL,config->arguments,"BKG.XGRID"),
     632                psMetadataLookupS32(NULL,config->arguments,"BKG.YGRID"));
     633       
     634       
    607635        // read WCS data from the corresponding header
    608         pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa);
     636        hdu = pmFPAviewThisHDU (view, astrom->fpa);
    609637
    610638        pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header);
    611639
    612         double cd1f = 1.0 * 400;
    613         double cd2f = 1.0 * 400;
     640        double cd1f = (1.0 * CCDSUM1);// * (1.0 * psMetadataLookupS32(NULL,config->arguments,"BKG.XGRID"));
     641        double cd2f = (1.0 * CCDSUM2);// * (1.0 * psMetadataLookupS32(NULL,config->arguments,"BKG.YGRID"));
    614642
    615643        WCS->cdelt1 *= cd1f;
     
    681709               
    682710                psMetadataAddS32(config->arguments,PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "", 8);
    683                 fprintf(stderr,"Transforming Readout!\n");
    684711
    685712                psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", true);
    686713                pswarpTransformReadout(output, readout, config);
    687714                psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", false);
     715
    688716                if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    689717                    psError(psErrorCodeLast(), false, "Unable to write files.");
     
    701729        }
    702730    }
    703     fprintf(stderr,"End readout transformations!\n");
    704731    if (!output->data_exists) {
    705732        psWarning("No overlap between input and skycell.");
  • branches/czw_branch/20120906/pswarp/src/pswarpTransformReadout.c

    r34487 r34489  
    132132            args->goodPixels = 0;
    133133
     134            if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND_WARPING")) {
     135              args->background_warping = true;
     136              args->offset_x = psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_XOFFSET");
     137              args->offset_y = psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_YOFFSET");
     138            }
     139
     140           
    134141            // allocate a job
    135142            psThreadJob *job = psThreadJobAlloc ("PSWARP_TRANSFORM_TILE");
     
    184191                jacobian += args->jacobian * args->goodPixels;
    185192            }
     193
     194           
    186195        }
    187196        psFree(job);
  • branches/czw_branch/20120906/pswarp/src/pswarpTransformTile.c

    r34471 r34489  
    4646    args->jacobian = NAN;
    4747
     48    args->background_warping = false;
     49    args->offset_x = 0.0;
     50    args->offset_y = 0.0;
     51   
    4852    return args;
    4953}
     
    96100
    97101            // This needs to use a more reliable method to do this offset and limiting
    98             if (args->interp->mode == 8) {
    99               double xOffset = 177.0 / 400.0; // (modelsize * modelbinning - xsize) / 2.0
    100               double yOffset = 166.0 / 400.0; // (modelsize * modelbinning - ysize) / 2.0
    101               xIn += xOffset;
    102               yIn += yOffset;
     102            //      if (args->interp->mode == 8) {
     103            if (args->background_warping) {
     104              //              double xOffset = 177.0 / 400.0; // (modelsize * modelbinning - xsize) / 2.0
     105              //              double yOffset = 166.0 / 400.0; // (modelsize * modelbinning - ysize) / 2.0
     106              xIn += args->offset_x;
     107              yIn += args->offset_y;
    103108
    104               if ((xIn > inNumCols - xOffset)||
    105                   (yIn > inNumRows - yOffset)||
    106                   (xIn < xOffset)||
    107                   (yIn < yOffset)) {
     109              if ((xIn > inNumCols - args->offset_x)||
     110                  (yIn > inNumRows - args->offset_y)||
     111                  (xIn < args->offset_x)||
     112                  (yIn < args->offset_y)) {
    108113                continue;
    109114              }
    110             }           
     115            }
    111116           
    112117            if (xIn < 0 || xIn >= inNumCols || yIn < 0 || yIn >= inNumRows) {
Note: See TracChangeset for help on using the changeset viewer.