Changeset 34442
- Timestamp:
- Sep 14, 2012, 6:10:32 PM (14 years ago)
- Location:
- branches/czw_branch/20120906
- Files:
-
- 11 edited
-
ippconfig/recipes/nightly_science.config (modified) (4 diffs)
-
psLib/src/imageops/psImageInterpolate.c (modified) (6 diffs)
-
psLib/src/imageops/psImageInterpolate.h (modified) (1 diff)
-
psModules/src/detrend/pmDark.c (modified) (3 diffs)
-
psModules/src/objects/Makefile.am (modified) (1 diff)
-
psModules/src/objects/pmFootprintCullPeaks.c (modified) (1 diff)
-
pswarp/src/pswarpArguments.c (modified) (1 diff)
-
pswarp/src/pswarpLoop.c (modified) (8 diffs)
-
pswarp/src/pswarpTransformReadout.c (modified) (1 diff)
-
pswarp/src/pswarpTransformSources.c (modified) (1 diff)
-
pswarp/src/pswarpTransformTile.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20120906/ippconfig/recipes/nightly_science.config
r34065 r34442 223 223 DIFFABLE BOOL TRUE 224 224 REDUCTION STR SWEETSPOT 225 ADDITIONAL_STACK_LABEL STR ecliptic.rp 225 226 # REDUCTION STR SSTF_4SIG 226 227 # WARP S16 60 … … 234 235 DIFFABLE BOOL TRUE 235 236 REDUCTION STR SWEETSPOT 237 ADDITIONAL_STACK_LABEL STR ecliptic.rp 236 238 # REDUCTION STR SSTF_4SIG 237 239 END … … 244 246 DIFFABLE BOOL TRUE 245 247 REDUCTION STR SWEETSPOT 248 ADDITIONAL_STACK_LABEL STR ecliptic.rp 246 249 # REDUCTION STR SSTF_4SIG 247 250 END … … 254 257 DIFFABLE BOOL TRUE 255 258 REDUCTION STR SWEETSPOT 259 ADDITIONAL_STACK_LABEL STR ecliptic.rp 256 260 # REDUCTION STR SSTF_4SIG 257 261 END -
branches/czw_branch/20120906/psLib/src/imageops/psImageInterpolate.c
r34414 r34442 189 189 switch (mode) { 190 190 case PS_INTERPOLATE_FLAT: 191 case PS_INTERPOLATE_BILINEAR_SIMPLE: 191 192 // Nothing to pre-compute 192 193 break; … … 287 288 # endif 288 289 case PS_INTERPOLATE_BIQUADRATIC: 290 case PS_INTERPOLATE_BILINEAR_SIMPLE: 289 291 // 2D kernel, would cost too much memory to pre-calculate 290 292 break; 293 291 294 default: 292 295 psAbort("Unsupported interpolation mode: %x", mode); … … 937 940 938 941 942 psImageInterpolateStatus interpolateJustWork(double *imageValue, double *varianceValue, 943 psImageMaskType *maskValue, float x, float y, 944 const psImageInterpolation *interp) { 945 float u1,u2; 946 int xl,xh; 947 int yl,yh; 948 const psImage *image = interp->image; // Image to interpolate 949 // const psImage *mask = interp->mask; // Mask to interpolate 950 const psImage *variance = interp->variance; // Variance to interpolate 951 952 xl = floor(x); 953 if (xl < 0) { xl = 0; } 954 if (xl >= image->numCols) {xl = image->numCols - 1; } 955 xh = xl + 1; 956 if (xh >= image->numCols) {xh = image->numCols - 1; } 957 yl = floor(y); 958 if (yl < 0) { yl = 0; } 959 if (yl >= image->numRows) {yl = image->numRows - 1; } 960 yh = yl + 1; 961 if (yh >= image->numRows) {yh = image->numRows - 1; } 962 if (varianceValue && variance) { 963 u1 = (xh - x) * variance->data.F32[yl][xl] + (x - xl) * variance->data.F32[yl][xh]; 964 u2 = (xh - x) * variance->data.F32[yh][xl] + (x - xl) * variance->data.F32[yh][xh]; 965 966 *varianceValue = (yh - y) * u1 + (y - yl) * u2; 967 } 968 #if 0 969 if (maskValue && mask) { 970 u1 = (xh - x) * mask->data.F32[yl][xl] + (x - xl) * mask->data.F32[yl][xh]; 971 u2 = (xh - x) * mask->data.F32[yh][xl] + (x - xl) * mask->data.F32[yh][xh]; 972 973 maskValue = (yh - y) * u1 + (y - yl) * u2; 974 } 975 #endif 976 if (imageValue && image) { 977 if (image->data.F32[yl][xl] == image->data.F32[yl][xh]) { 978 u1 = image->data.F32[yl][xh]; 979 } 980 else { 981 u1 = (xh - x) * image->data.F32[yl][xl] + (x - xl) * image->data.F32[yl][xh]; 982 } 983 if (image->data.F32[yh][xl] == image->data.F32[yh][xh]) { 984 u2 = image->data.F32[yh][xh]; 985 } 986 else { 987 u2 = (xh - x) * image->data.F32[yh][xl] + (x - xl) * image->data.F32[yh][xh]; 988 } 989 if (u1 == u2) { 990 *imageValue = u1; 991 } 992 else { 993 *imageValue = (yh - y) * u1 + (y - yl) * u2; 994 } 995 if ((floor(x) >= image->numCols)|| 996 (floor(y) >= image->numRows)) { 997 *imageValue = NAN; 998 } 999 } 1000 if (*imageValue == 0.0) { 1001 fprintf(stderr,"IJK: Zero!: %g %g [%d %d %d %d] %g %g (%g %g %g %g)\n", 1002 x,y,xl,xh,yl,yh,u1,u2, 1003 image->data.F32[yl][xl],image->data.F32[yl][xh],image->data.F32[yh][xl],image->data.F32[yh][xh] 1004 ); 1005 } 1006 return PS_INTERPOLATE_STATUS_GOOD; 1007 } 1008 939 1009 940 1010 psImageInterpolateStatus psImageInterpolate(double *imageValue, double *varianceValue, … … 969 1039 case PS_INTERPOLATE_BIQUADRATIC: 970 1040 return interpolateKernel(imageValue, varianceValue, maskValue, x, y, interp); 1041 case PS_INTERPOLATE_BILINEAR_SIMPLE: 1042 return interpolateJustWork(imageValue, varianceValue, maskValue, x, y, interp); 971 1043 case PS_INTERPOLATE_BILINEAR: 972 1044 # if (!IS_BILIN_SEPARABLE) 973 return interpolateKernel(imageValue, varianceValue, maskValue, x, y, interp);1045 return interpolateKernel(imageValue, varianceValue, maskValue, x, y, interp); 974 1046 # endif 975 1047 case PS_INTERPOLATE_GAUSS: … … 1019 1091 switch (mode) { 1020 1092 case PS_INTERPOLATE_FLAT: 1093 case PS_INTERPOLATE_BILINEAR_SIMPLE: 1021 1094 // No smearing by design 1022 1095 return 1.0; … … 1083 1156 if (!strcasecmp(name, "FLAT")) return PS_INTERPOLATE_FLAT; 1084 1157 if (!strcasecmp(name, "BILINEAR")) return PS_INTERPOLATE_BILINEAR; 1158 if (!strcasecmp(name, "SIMPLEBILINEAR")) return PS_INTERPOLATE_BILINEAR_SIMPLE; 1085 1159 if (!strcasecmp(name, "BIQUADRATIC")) return PS_INTERPOLATE_BIQUADRATIC; 1086 1160 if (!strcasecmp(name, "GAUSS")) return PS_INTERPOLATE_GAUSS; -
branches/czw_branch/20120906/psLib/src/imageops/psImageInterpolate.h
r21281 r34442 33 33 PS_INTERPOLATE_LANCZOS3, ///< Sinc interpolation with 6x6 pixel kernel 34 34 PS_INTERPOLATE_LANCZOS4, ///< Sinc interpolation with 8x8 pixel kernel 35 PS_INTERPOLATE_BILINEAR_SIMPLE, ///< Simple manual bilinear interpolation 35 36 } psImageInterpolateMode; 36 37 -
branches/czw_branch/20120906/psModules/src/detrend/pmDark.c
r33089 r34442 353 353 354 354 // retrieve the required parameter vectors 355 psArray * values = psMetadataLookupPtr(&mdok, output->analysis, "DARK.VALUES");356 psAssert( values, "values not supplied");355 psArray *in_values = psMetadataLookupPtr(&mdok, output->analysis, "DARK.VALUES"); 356 psAssert(in_values, "values not supplied"); 357 357 psVector *roMask = psMetadataLookupPtr(&mdok, output->analysis, "DARK.RO.MASK"); 358 358 psAssert(roMask, "roMask not supplied"); 359 psVector *orders = psMetadataLookupPtr(&mdok, output->analysis, "DARK.ORDERS"); 360 psAssert(orders, "orders not supplied"); 361 362 psPolynomialMD *poly = psPolynomialMDAlloc(orders); // Polynomial for fitting 359 psVector *max_orders = psMetadataLookupPtr(&mdok, output->analysis, "DARK.ORDERS"); 360 psAssert(max_orders, "orders not supplied"); 361 362 psArray *values_set = psArrayAlloc(max_orders->n); 363 psArray *poly_set = psArrayAlloc(max_orders->n); 364 psVector *logL = psVectorAlloc(max_orders->n,PS_TYPE_F64); 365 366 for (int i = 0; i < max_orders->n; i++) { 367 psVector *orders = psVectorAlloc(i+1,PS_TYPE_U8); 368 for (int j = 0; j < orders->n; j++) { 369 orders->data.U8[j] = max_orders->data.U8[j]; 370 } 371 poly_set->data[i] = psPolynomialMDAlloc(orders); // Polynomial for fitting 372 373 psArray *values = psArrayAlloc(in_values->n); 374 375 for (int j = 0; j < values->n; j++) { 376 psVector *these_values = psVectorAlloc(i+1,PS_TYPE_F32); 377 psVector *input_values = in_values->data[j]; 378 379 for (int k = 0; k < orders->n; k++) { 380 these_values->data.F32[k] = input_values->data.F32[k]; 381 } 382 values->data[j] = these_values; 383 } 384 values_set->data[i] = values; 385 } 363 386 364 387 // retrieve the norm vector, if supplied … … 383 406 } 384 407 385 pmDarkVisualInit(values );408 pmDarkVisualInit(values_set->data[max_orders->n - 1]); 386 409 387 410 pmReadout *outReadout = output->readouts->data[0]; … … 423 446 } 424 447 425 if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, 0xff, values, iter, rej)) { 448 int k_best = 0; 449 for (int k = 0; k < max_orders->n; k++) { 450 psPolynomialMD *poly = poly_set->data[k]; 451 psArray *values = values_set->data[k]; 452 453 if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, 0xff, values, iter, rej)) { 426 454 psErrorClear(); // Nothing we can do about it 427 455 psVectorInit(poly->coeff, NAN); 428 } 429 430 pmDarkVisualPixelFit(pixels, mask); 431 pmDarkVisualPixelModel(poly, values); 432 433 for (int k = 0; k < poly->coeff->n; k++) { 456 } 457 458 pmDarkVisualPixelFit(pixels, mask); 459 pmDarkVisualPixelModel(poly, values); 460 461 // Insert math here to choose optimum model. 462 logL->data.F64[k] = 0.0; 463 psPolynomialMD *polySig = poly_set->data[0]; 464 for (int m = 0; m < poly->deviations->n; m++) { 465 logL->data.F64[k] += pow(poly->deviations->data.F32[m] / polySig->stdevFit,2); 466 /* if ((xOut == 20) && (yOut == 256)) { */ 467 /* psTrace("psModules.detrend",3,"pmDarkCombine DEV: %d %d: input %d models: Norders: %d logL: %g value: %g\n", */ 468 /* xOut,yOut,m,k,logL->data.F64[k],poly->deviations->data.F32[m]); */ 469 /* } */ 470 } 471 if (k > 0) { 472 if ( ( logL->data.F64[k - 1] - logL->data.F64[k] ) > 1) { // Hard coded criterion for a ~5% limit with one degree of freedom 473 k_best = k; 474 } 475 } 476 if ((xOut <= 600) && (yOut <= 600)) { 477 psTrace("psModules.detrend",3,"pmDarkCombine: %d %d: models: Norders: %d logL: %g BestOrders: %d\n", 478 xOut,yOut,k,logL->data.F64[k],k_best); 479 } 480 } 481 if (k_best > 1) { 482 k_best = 1; 483 } 484 /* k_best = 1; */ 485 // Select the polynomial that seems best. 486 psPolynomialMD *poly = poly_set->data[k_best]; 487 488 // for (int k = 0; k < poly->coeff->n; k++) { 489 for (int k = 0; k < max_orders->n + 1; k++) { // There is one more coefficient than is stored here. 434 490 pmReadout *ro = output->readouts->data[k]; // Readout of interest 435 ro->image->data.F32[yOut][xOut] = poly->coeff->data.F64[k]; 491 if (k < poly->coeff->n) { 492 ro->image->data.F32[yOut][xOut] = poly->coeff->data.F64[k]; 493 } 494 else { 495 ro->image->data.F32[yOut][xOut] = 0.0; 496 } 436 497 } 437 498 counts->data.U16[yOut][xOut] = poly->numFit; -
branches/czw_branch/20120906/psModules/src/objects/Makefile.am
r34403 r34442 111 111 pmSourceOutputs.h \ 112 112 pmSourceIO.h \ 113 pmSourceSatstar.h \ 113 114 pmSourcePlots.h \ 114 115 pmSourceVisual.h \ -
branches/czw_branch/20120906/psModules/src/objects/pmFootprintCullPeaks.c
r34198 r34442 91 91 92 92 // max flux is above threshold for brightest peak 93 pmPeak *maxPeak = fp->peaks->data[0]; 93 pmPeak *maxPeak = NULL; 94 for (int i = 0; i < fp->peaks->n; i++) { 95 pmPeak *testPeak = fp->peaks->data[i]; 96 float this_peak = useSmoothedImage ? testPeak->smoothFlux : testPeak->rawFlux; 97 98 if (isfinite(this_peak)) { 99 maxPeak = fp->peaks->data[i]; 100 break; 101 } 102 } 103 psAssert(maxPeak,"maxPeak was not set in these peaks"); 104 // = fp->peaks->data[0]; 94 105 float maxFlux = useSmoothedImage ? maxPeak->smoothFlux : maxPeak->rawFlux; 95 106 -
branches/czw_branch/20120906/pswarp/src/pswarpArguments.c
r34411 r34442 170 170 psWarning("BACKGROUND.MODEL is not set in the %s recipe -- defaulting to FALSE.", PSWARP_RECIPE); 171 171 } 172 int bkgXgrid = psMetadataLookup Bool(&status,recipe, "BKG.XGRID"); ///< Xsize of background model172 int bkgXgrid = psMetadataLookupS32(&status,recipe, "BKG.XGRID"); ///< Xsize of background model 173 173 if (!status) { 174 174 bkgXgrid = 10; 175 175 psWarning("BKG.XGRID is not set in the %s recipe -- defaultint to %d.",PSWARP_RECIPE,bkgXgrid); 176 176 } 177 int bkgYgrid = psMetadataLookup Bool(&status,recipe, "BKG.YGRID"); ///< Xsize of background model177 int bkgYgrid = psMetadataLookupS32(&status,recipe, "BKG.YGRID"); ///< Xsize of background model 178 178 if (!status) { 179 179 bkgYgrid = 10; 180 180 psWarning("BKG.YGRID is not set in the %s recipe -- defaultint to %d.",PSWARP_RECIPE,bkgYgrid); 181 181 } 182 182 183 183 184 184 // Set recipe values in the recipe (since we've possibly altered some) -
branches/czw_branch/20120906/pswarp/src/pswarpLoop.c
r34411 r34442 159 159 } 160 160 } 161 161 pmAstromWCS *WCSF = pmAstromWCSfromHeader(phu->header); 162 163 fprintf(stderr,"WCSFI: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", 164 WCSF->crval1,WCSF->crval2, 165 WCSF->crpix1,WCSF->crpix2, 166 WCSF->cdelt1,WCSF->cdelt2, 167 WCSF->trans->x->coeff[1][0], 168 WCSF->trans->x->coeff[0][1], 169 WCSF->trans->y->coeff[1][0], 170 WCSF->trans->y->coeff[0][1], 171 -1.0,-1.0); 172 psFree(WCSF); 162 173 psList *cells = psListAlloc(NULL); // List of cells, for concepts averaging 163 174 … … 197 208 } 198 209 } 210 pmAstromWCS *WCSF = pmAstromWCSfromHeader(hdu->header); 211 212 fprintf(stderr,"WCSFIB: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", 213 WCSF->crval1,WCSF->crval2, 214 WCSF->crpix1,WCSF->crpix2, 215 WCSF->cdelt1,WCSF->cdelt2, 216 WCSF->trans->x->coeff[1][0], 217 WCSF->trans->x->coeff[0][1], 218 WCSF->trans->y->coeff[1][0], 219 WCSF->trans->y->coeff[0][1], 220 -1.0,-1.0); 221 psFree(WCSF); 199 222 200 223 … … 574 597 bool bilevelAstrometry = false; 575 598 pmHDU *phu = pmFPAviewThisPHU(view, astrom->fpa); 599 600 pmAstromWCS *WCSF = pmAstromWCSfromHeader(phu->header); 601 602 fprintf(stderr,"WCSF: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", 603 WCSF->crval1,WCSF->crval2, 604 WCSF->crpix1,WCSF->crpix2, 605 WCSF->cdelt1,WCSF->cdelt2, 606 WCSF->trans->x->coeff[1][0], 607 WCSF->trans->x->coeff[0][1], 608 WCSF->trans->y->coeff[1][0], 609 WCSF->trans->y->coeff[0][1], 610 -1.0,-1.0); 611 /* #define CORRECT_INPUT_WCS 1 */ 612 /* #if CORRECT_INPUT_WCS */ 613 /* // Correct the input WCS */ 614 /* pmAstromWCS *WCS = pmAstromWCSfromHeader(phu->header); */ 615 616 /* double cd1f = 1.0 * 400; */ 617 /* double cd2f = 1.0 * 400; */ 618 /* fprintf(stderr,"WCS: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", */ 619 /* WCS->crval1,WCS->crval2, */ 620 /* WCS->crpix1,WCS->crpix2, */ 621 /* WCS->cdelt1,WCS->cdelt2, */ 622 /* WCS->trans->x->coeff[1][0], */ 623 /* WCS->trans->x->coeff[0][1], */ 624 /* WCS->trans->y->coeff[1][0], */ 625 /* WCS->trans->y->coeff[0][1], */ 626 /* cd1f,cd2f); */ 627 628 /* WCS->crpix1 = WCS->crpix1 / cd1f; */ 629 /* WCS->crpix2 = WCS->crpix2 / cd2f; */ 630 631 /* WCS->cdelt1 *= cd1f; */ 632 /* WCS->cdelt2 *= cd2f; */ 633 634 /* // WCS->trans->x->nX/nY */ 635 /* for (int q = 0; q < WCS->trans->x->nX; q++) { */ 636 /* for (int r = 0; r < WCS->trans->x->nY; r++) { */ 637 /* WCS->trans->x->coeff[q][r] *= cd1f; */ 638 /* } */ 639 /* } */ 640 /* for (int q = 0; q < WCS->trans->y->nX; q++) { */ 641 /* for (int r = 0; r < WCS->trans->y->nY; r++) { */ 642 /* WCS->trans->y->coeff[q][r] *= cd2f; */ 643 /* } */ 644 /* } */ 645 /* fprintf(stderr,"WCS: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", */ 646 /* WCS->crval1,WCS->crval2, */ 647 /* WCS->crpix1,WCS->crpix2, */ 648 /* WCS->cdelt1,WCS->cdelt2, */ 649 /* WCS->trans->x->coeff[1][0], */ 650 /* WCS->trans->x->coeff[0][1], */ 651 /* WCS->trans->y->coeff[1][0], */ 652 /* WCS->trans->y->coeff[0][1], */ 653 /* cd1f,cd2f); */ 654 /* pmAstromWCStoHeader (phu->header,WCS); */ 655 /* // End WCS work. */ 656 /* #endif */ 657 658 659 660 576 661 if (phu) { 577 662 char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1"); … … 610 695 // read WCS data from the corresponding header 611 696 pmHDU *hdu = pmFPAviewThisHDU (view, astrom->fpa); 612 psMetadataAddS32(config->arguments,PS_LIST_TAIL, 613 "INTERPOLATION.MODE",PS_META_REPLACE,"", PS_INTERPOLATE_BILINEAR); ///< Mode 614 psMetadataAddS32(config->arguments,PS_LIST_TAIL, 615 "INTERPOLATION.NUM",PS_META_REPLACE,"", 64); ///< Mode 697 698 pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header); 699 700 double cd1f = 1.0 * 400; 701 double cd2f = 1.0 * 400; 702 fprintf(stderr,"WCSC: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", 703 WCS->crval1,WCS->crval2, 704 WCS->crpix1,WCS->crpix2, 705 WCS->cdelt1,WCS->cdelt2, 706 WCS->trans->x->coeff[1][0], 707 WCS->trans->x->coeff[0][1], 708 WCS->trans->y->coeff[1][0], 709 WCS->trans->y->coeff[0][1], 710 cd1f,cd2f); 711 712 713 WCS->cdelt1 *= cd1f; 714 WCS->cdelt2 *= cd2f; 715 WCS->crpix1 = WCS->crpix1 / cd1f + 46.0 / 400.0; 716 WCS->crpix2 = WCS->crpix2 / cd2f + 68.0 / 400.0; 717 718 // WCS->trans->x->nX/nY 719 for (int q = 0; q < WCS->trans->x->nX; q++) { 720 for (int r = 0; r < WCS->trans->x->nY; r++) { 721 fprintf(stderr,"%d %d %g\n",q,r,WCS->trans->x->coeff[q][r]); 722 WCS->trans->x->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r); 723 fprintf(stderr,"%d %d %g\n",q,r,WCS->trans->x->coeff[q][r]); 724 } 725 } 726 for (int q = 0; q < WCS->trans->y->nX; q++) { 727 for (int r = 0; r < WCS->trans->y->nY; r++) { 728 fprintf(stderr,"%d %d %g\n",q,r,WCS->trans->y->coeff[q][r]); 729 WCS->trans->y->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r); 730 fprintf(stderr,"%d %d %g\n",q,r,WCS->trans->y->coeff[q][r]); 731 } 732 } 733 fprintf(stderr,"WCSO: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", 734 WCS->crval1,WCS->crval2, 735 WCS->crpix1,WCS->crpix2, 736 WCS->cdelt1,WCS->cdelt2, 737 WCS->trans->x->coeff[1][0], 738 WCS->trans->x->coeff[0][1], 739 WCS->trans->y->coeff[1][0], 740 WCS->trans->y->coeff[0][1], 741 cd1f,cd2f); 742 743 fprintf(stderr,"Size: %d %d %d %d\n",WCS->trans->x->nX,WCS->trans->x->nY,WCS->trans->y->nX,WCS->trans->y->nY); 744 pmAstromWCStoHeader (hdu->header,WCS); 616 745 617 746 if (bilevelAstrometry) { … … 624 753 } else { 625 754 // we use a default FPA pixel scale of 1.0 626 if (!pmAstromReadWCS ( input->fpa, chip, hdu->header, 1.0)) {755 if (!pmAstromReadWCS (astrom->fpa, chip, hdu->header, 1.0)) { 627 756 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input FPA."); 628 757 psFree(view); … … 631 760 } 632 761 } 633 #define CORRECT_INPUT_WCS 1 634 #if CORRECT_INPUT_WCS 635 // Correct the input WCS 636 pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header); 637 638 double cd1f = 1.0 * 400; 639 double cd2f = 1.0 * 400; 640 641 WCS->crpix1 = WCS->crpix1 / cd1f + 0.5; 642 WCS->crpix2 = WCS->crpix2 / cd2f - 0.5; 643 644 WCS->cdelt1 *= cd1f; 645 WCS->cdelt2 *= cd2f; 646 647 WCS->trans->x->coeff[1][0] *= cd1f; 648 WCS->trans->x->coeff[0][1] *= cd2f; 649 WCS->trans->y->coeff[1][0] *= cd1f; 650 WCS->trans->y->coeff[0][1] *= cd2f; 651 652 653 pmAstromWCStoHeader (hdu->header,WCS); 654 // End WCS work. 655 #endif 762 // Modify structure here. 763 656 764 657 765 pmCell *cell; … … 679 787 // Copy the detections from the astrometry carrier to the input, so they can be accessed by 680 788 // pswarpTransformReadout 681 pmReadout *astromRO = pmFPAviewThisReadout(view, astrom->fpa); // Readout for astrometry 682 pmDetections *detections = psMetadataLookupPtr(&mdok, astromRO->analysis, "PSPHOT.DETECTIONS"); // Sources from astrometry 683 if (detections) { 684 psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY, "Sources from input astrometry", detections); 685 } 686 789 /* pmReadout *astromRO = pmFPAviewThisReadout(view, astrom->fpa); // Readout for astrometry */ 790 /* pmDetections *detections = psMetadataLookupPtr(&mdok, astromRO->analysis, "PSPHOT.DETECTIONS"); // Sources from astrometry */ 791 /* if (detections) { */ 792 /* psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY | PS_META_REPLACE, "Sources from input astrometry", detections); */ 793 /* } */ 794 687 795 for (int x = 0; x < readout->image->numCols; x++) { 688 796 for (int y = 0; y < readout->image->numRows; y++) { … … 692 800 } 693 801 } 694 psMetadataAddS32(config->arguments,PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "", 2);695 /* psMetadataAddS32(config->arguments,PS_LIST_TAIL, "GRID.NX",PS_META_REPLACE,"",100); ///< Number of grid points in x */ 696 /* psMetadataAddS32(config->arguments,PS_LIST_TAIL, "GRID.NY",PS_META_REPLACE,"",100); ///< Number of grid points in y */ 697 802 803 psMetadataAddS32(config->arguments,PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "", 8); 804 805 fprintf(stderr,"Transforming Readout!\n"); 698 806 pswarpTransformReadout(output, readout, config); 699 807 -
branches/czw_branch/20120906/pswarp/src/pswarpTransformReadout.c
r34411 r34442 172 172 } else { 173 173 pswarpTransformTileArgs *args = job->args->data[0]; 174 // fprintf (stderr, "finished job %d,%d, Nargs: %ld\n", args->gridX, args->gridY, job->args->n); 174 // fprintf (stderr, "finished job %d,%d, Nargs: %ld (%d %d %d %d) (%d %d %d %d)\n", args->gridX, args->gridY, job->args->n, 175 // xMin,xMax,yMin,yMax,args->xMin,args->xMax,args->yMin,args->yMax); 175 176 goodPixels += args->goodPixels; 176 177 xMin = PS_MIN(args->xMin, xMin); -
branches/czw_branch/20120906/pswarp/src/pswarpTransformSources.c
r34411 r34442 41 41 if (!outDetections) { 42 42 outDetections = pmDetectionsAlloc(); 43 psMetadataAddPtr(output->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY , "Warped sources", outDetections);43 psMetadataAddPtr(output->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY , "Warped sources", outDetections); 44 44 } 45 45 psArray *outSources = outDetections->allSources; -
branches/czw_branch/20120906/pswarp/src/pswarpTransformTile.c
r29331 r34442 83 83 // Iterate over the output image pixels (parent frame) 84 84 long goodPixels = 0; ///< Number of input pixels landing on the output image 85 psTrace("pswarp",3,"Size: %d %d\n",xMax,yMax); 85 86 for (int y = yMin; y < yMax; y++) { 86 87 for (int x = xMin; x < xMax; x++) { 88 /* if ((x == 931)||(x == 717)||(x == 924)) { */ 89 /* /\* if ((y == 1348)||(y == 1249)||(y == 1081)) { *\/ */ 90 /* /\* fprintf(stderr,"BEcause: %d %d [%d %d %d %d]\n",x,y,yMin,yMax,xMin,xMax); *\/ */ 91 /* /\* } *\/ */ 92 /* } */ 93 if (((x == 931)&&(y == 1348))|| 94 ((x == 717)&&(y == 1249))|| 95 ((x == 924)&&(y == 1081))) { 96 psTrace("pswarp",3,"TT: A\n"); 97 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 98 99 } 87 100 88 101 // Only transform those pixels requested … … 90 103 continue; 91 104 } 105 if (((x == 931)&&(y == 1348))|| 106 ((x == 717)&&(y == 1249))|| 107 ((x == 924)&&(y == 1081))) { 108 psTrace("pswarp",3,"TT: B\n"); 109 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 110 111 } 92 112 93 113 // pswarpMapApply converts the output coordinate (x,y) to the input coordinate. … … 95 115 double xIn, yIn; // Input pixel coordinates 96 116 pswarpMapApply(&xIn, &yIn, map, x + 0.5, y + 0.5); 117 if (((x == 931)&&(y == 1348))|| 118 ((x == 717)&&(y == 1249))|| 119 ((x == 924)&&(y == 1081))) { 120 psTrace("pswarp",3,"TT: Ct\n"); 121 psTrace("pswarp",3,"TT: %d %d %d %d %g %g %d %d\n",xMin,xMax,yMin,yMax,xIn,yIn,inNumCols,inNumRows); 122 123 } 124 97 125 if (xIn < 0 || xIn >= inNumCols || yIn < 0 || yIn >= inNumRows) { 98 126 continue; 99 127 } 128 if (((x == 931)&&(y == 1348))|| 129 ((x == 717)&&(y == 1249))|| 130 ((x == 924)&&(y == 1081))) { 131 psTrace("pswarp",3,"TT: C\n"); 132 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 133 134 } 100 135 101 136 // psImagePixelInterpolate determines the value at pixel coordinate (x,y) in child coordinates … … 109 144 int xOut = x - outCol0, yOut = y - outRow0; ///< Position on output image 110 145 146 if ((xIn >= args->interp->image->numCols - 1)|| 147 (yIn >= args->interp->image->numRows - 1)) { 148 imageValue = NAN; 149 } 111 150 if (outImageData) { 112 151 outImageData[yOut][xOut] = imageValue * jacobian; … … 120 159 121 160 goodPixels++; 161 162 if ((x == 931)||(x == 717)||(x == 924)) { 163 if ((y == 1348)||(y == 1249)||(y == 1081)) { 164 psTrace("pswarp",3,"TT: %d %d %g %g %d %d %g %g (%g) %ld %g %g %g %g\n",x,y,xIn,yIn,xOut,yOut,imageValue,jacobian, 165 args->input->image->data.F32[(int) yIn][(int) xIn],(long) args->interp, 166 0.0,0.0,0.0,0.0); 167 /* inImage->data.F32[(int) yIn][(int) xIn], */ 168 /* inImage->data.F32[(int) yIn+1][(int) xIn], */ 169 /* inImage->data.F32[(int) yIn+1][(int) xIn+1], */ 170 /* inImage->data.F32[(int) yIn][(int) xIn+1]); */ 171 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 172 } 173 } 174 175 if (((xOut == 931)&&(yOut == 1348))|| 176 ((xOut == 717)&&(yOut == 1249))|| 177 ((xOut == 924)&&(yOut == 1081))) { 178 psTrace("pswarp",3,"TT: %d %d %g %g %d %d %g %g (%g) %ld %g %g %g %g\n",x,y,xIn,yIn,xOut,yOut,imageValue,jacobian, 179 args->input->image->data.F32[(int) yIn][(int) xIn],(long) args->interp, 180 0.0,0.0,0.0,0.0); 181 /* inImage->data.F32[(int) yIn][(int) xIn], */ 182 /* inImage->data.F32[(int) yIn+1][(int) xIn], */ 183 /* inImage->data.F32[(int) yIn+1][(int) xIn+1], */ 184 /* inImage->data.F32[(int) yIn][(int) xIn+1]); */ 185 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 186 187 } 188 if ((xOut == 443)&&(yOut == 659)) { 189 psTrace("pswarp",3,"TT: %d %d %g %g %d %d %g %g (%g) %ld\n",x,y,xIn,yIn,xOut,yOut,imageValue,jacobian, 190 args->input->image->data.F32[(int) yIn][(int) xIn],(long) args->interp); 191 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 192 193 } 194 if ((xOut == 524)&&(yOut == 576)) { 195 psTrace("pswarp",3,"TT: %d %d %g %g %d %d %g %g (%g) %ld\n",x,y,xIn,yIn,xOut,yOut,imageValue,jacobian, 196 args->input->image->data.F32[(int) yIn][(int) xIn],(long) args->interp); 197 psTrace("pswarp",3,"TT: %d %d %d %d\n",xMin,xMax,yMin,yMax); 198 199 } 122 200 } 123 201 }
Note:
See TracChangeset
for help on using the changeset viewer.
