Changeset 34489
- Timestamp:
- Sep 28, 2012, 4:56:30 PM (14 years ago)
- Location:
- branches/czw_branch/20120906/pswarp/src
- Files:
-
- 5 edited
-
pswarp.c (modified) (2 diffs)
-
pswarp.h (modified) (1 diff)
-
pswarpLoop.c (modified) (3 diffs)
-
pswarpTransformReadout.c (modified) (2 diffs)
-
pswarpTransformTile.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20120906/pswarp/src/pswarp.c
r34411 r34489 47 47 } 48 48 if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) { 49 fprintf(stderr,"Here!\n");50 49 if (!pswarpDefineBackground(config)) { 51 50 goto DIE; … … 74 73 } 75 74 if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) { 76 fprintf(stderr,"There!\n");77 75 if (!pswarpLoopBackground(config, stats)) { 78 76 fprintf(stderr,"Dying!\n"); -
branches/czw_branch/20120906/pswarp/src/pswarp.h
r34471 r34489 62 62 psImage *region; 63 63 64 /** values which are needed to control the background model warping. */ 65 bool background_warping; 66 double offset_x; 67 double offset_y; 68 64 69 /** input values for this tile */ 65 70 int gridX; -
branches/czw_branch/20120906/pswarp/src/pswarpLoop.c
r34487 r34489 605 605 } 606 606 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 607 635 // read WCS data from the corresponding header 608 pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa);636 hdu = pmFPAviewThisHDU (view, astrom->fpa); 609 637 610 638 pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header); 611 639 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")); 614 642 615 643 WCS->cdelt1 *= cd1f; … … 681 709 682 710 psMetadataAddS32(config->arguments,PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "", 8); 683 fprintf(stderr,"Transforming Readout!\n");684 711 685 712 psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", true); 686 713 pswarpTransformReadout(output, readout, config); 687 714 psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", false); 715 688 716 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 689 717 psError(psErrorCodeLast(), false, "Unable to write files."); … … 701 729 } 702 730 } 703 fprintf(stderr,"End readout transformations!\n");704 731 if (!output->data_exists) { 705 732 psWarning("No overlap between input and skycell."); -
branches/czw_branch/20120906/pswarp/src/pswarpTransformReadout.c
r34487 r34489 132 132 args->goodPixels = 0; 133 133 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 134 141 // allocate a job 135 142 psThreadJob *job = psThreadJobAlloc ("PSWARP_TRANSFORM_TILE"); … … 184 191 jacobian += args->jacobian * args->goodPixels; 185 192 } 193 194 186 195 } 187 196 psFree(job); -
branches/czw_branch/20120906/pswarp/src/pswarpTransformTile.c
r34471 r34489 46 46 args->jacobian = NAN; 47 47 48 args->background_warping = false; 49 args->offset_x = 0.0; 50 args->offset_y = 0.0; 51 48 52 return args; 49 53 } … … 96 100 97 101 // 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; 103 108 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)) { 108 113 continue; 109 114 } 110 } 115 } 111 116 112 117 if (xIn < 0 || xIn >= inNumCols || yIn < 0 || yIn >= inNumRows) {
Note:
See TracChangeset
for help on using the changeset viewer.
