Changeset 21090
- Timestamp:
- Jan 7, 2009, 6:43:53 PM (17 years ago)
- Location:
- branches/eam_branch_20081230
- Files:
-
- 17 edited
-
ppSim/src/ppSimPhotom.c (modified) (1 diff)
-
ppStack/src/ppStackArguments.c (modified) (1 diff)
-
ppStack/src/ppStackLoop.c (modified) (17 diffs)
-
ppStack/src/ppStackMatch.c (modified) (2 diffs)
-
ppStack/src/ppStackPhotometry.c (modified) (3 diffs)
-
ppStack/src/ppStackReadout.c (modified) (3 diffs)
-
ppStack/src/ppStackSources.c (modified) (1 diff)
-
ppSub/src/ppSubArguments.c (modified) (1 diff)
-
ppSub/src/ppSubBackground.c (modified) (3 diffs)
-
ppSub/src/ppSubReadout.c (modified) (8 diffs)
-
psphot/src/psphotMakeResiduals.c (modified) (9 diffs)
-
psphot/src/psphotModelWithPSF.c (modified) (1 diff)
-
pswarp/src/pswarpLoop.c (modified) (1 diff)
-
pswarp/src/pswarpPixelFraction.c (modified) (3 diffs)
-
pswarp/src/pswarpSetMaskBits.c (modified) (6 diffs)
-
pswarp/src/pswarpTransformReadout.c (modified) (2 diffs)
-
pswarp/src/pswarpTransformTile.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081230/ppSim/src/ppSimPhotom.c
r21087 r21090 15 15 psphotInit (); 16 16 17 XXX : should this be a psImageMaskType? 18 int blankMask = 0; // XXX not sure what this should be set to... 17 psImageMaskType blankMask = 1; // XXX not sure what this should be set to... 19 18 ppSimMosaicChip(config, blankMask, view, "PPSIM.FORCE.CHIP", "PPSIM.INPUT"); 20 19 ppSimMosaicChip(config, blankMask, view, "PPSIM.FAKE.CHIP", "PPSIM.OUTPUT"); -
branches/eam_branch_20081230/ppStack/src/ppStackArguments.c
r20995 r21090 79 79 } \ 80 80 } \ 81 ps MaskType value = pmConfigMaskGet(name, config); \82 psMetadataAdd U8(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \81 psImageMaskType value = pmConfigMaskGet(name, config); \ 82 psMetadataAddImageMask(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \ 83 83 } 84 84 -
branches/eam_branch_20081230/ppStack/src/ppStackLoop.c
r20997 r21090 401 401 int numGood = 0; // Number of good frames 402 402 int numCols = 0, numRows = 0; // Size of image 403 psVector *inputMask = psVectorAlloc(num, PS_TYPE_ U8); // Mask for inputs403 psVector *inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs 404 404 psVectorInit(inputMask, 0); 405 405 psVector *matchChi2 = psVectorAlloc(num, PS_TYPE_F32); // chi^2 for stamps when matching … … 445 445 sourceLists->data[i], targetPSF, rng, config)) { 446 446 psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i); 447 inputMask->data. U8[i] = PPSTACK_MASK_MATCH;447 inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_MATCH; 448 448 psErrorClear(); 449 449 continue; … … 501 501 psVector *values = psVectorAllocEmpty(num, PS_TYPE_F32); // Values to sort 502 502 for (int i = 0; i < num; i++) { 503 if (inputMask->data.PS_TYPE_ MASK_DATA[i] & PPSTACK_MASK_ALL) {503 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PPSTACK_MASK_ALL) { 504 504 continue; 505 505 } … … 534 534 numGood = 0; // Number of good images 535 535 for (int i = 0; i < num; i++) { 536 if (inputMask->data.PS_TYPE_MASK_DATA[i] & PPSTACK_MASK_ALL) {536 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PPSTACK_MASK_ALL) { 537 537 continue; 538 538 } 539 539 if (matchChi2->data.F32[i] > thresh) { 540 540 numRej++; 541 inputMask->data.PS_TYPE_ MASK_DATA[i] |= PPSTACK_MASK_CHI2;541 inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_CHI2; 542 542 psLogMsg("ppStack", PS_LOG_INFO, "Rejecting image %d because of large matching chi^2: %f", 543 543 i, matchChi2->data.F32[i]); … … 612 612 613 613 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 614 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels614 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 615 615 if (!pmReadoutStackDefineOutput(outRO, col0, row0, numCols, numRows, true, true, maskBad)) { 616 616 psError(PS_ERR_UNKNOWN, false, "Unable to prepare output."); … … 714 714 inspect = psArrayAlloc(num); 715 715 for (int i = 0; i < num; i++) { 716 if (inputMask->data. U8[i]) {716 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 717 717 continue; 718 718 } … … 725 725 psArray *results = job->results; // Results of job 726 726 for (int i = 0; i < num; i++) { 727 if (inputMask->data. U8[i]) {727 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 728 728 continue; 729 729 } … … 751 751 // Count images rejected out of hand 752 752 for (int i = 0; i < num; i++) { 753 if (inputMask->data. U8[i]) {753 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 754 754 numRejected++; 755 755 } … … 757 757 758 758 for (int i = 0; i < num; i++) { 759 if (inputMask->data. U8[i]) {759 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 760 760 continue; 761 761 } … … 802 802 // Reject bad pixels 803 803 for (int i = 0; i < num; i++) { 804 if (inputMask->data. U8[i]) {804 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 805 805 continue; 806 806 } … … 845 845 psWarning("Rejection on image %d didn't work --- reject entire image.", i); 846 846 numRejected++; 847 inputMask->data. U8[i] = PPSTACK_MASK_REJECT;847 inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_REJECT; 848 848 } else { 849 849 float frac = reject->n / (float)(numCols * numRows); // Pixel fraction … … 856 856 // reject == NULL means reject image completely 857 857 reject = NULL; 858 inputMask->data. U8[i] = PPSTACK_MASK_BAD;858 inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_BAD; 859 859 numRejected++; 860 860 } … … 968 968 { 969 969 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits for bad 970 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels970 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 971 971 if (!pmReadoutMaskApply(outRO, maskBad)) { 972 972 psWarning("Unable to apply mask"); … … 979 979 float totExposure = 0.0; // Total exposure time 980 980 for (int i = 0; i < num; i++) { 981 if (inputMask->data. U8[i]) {981 if (inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 982 982 continue; 983 983 } … … 1044 1044 pmCell *cell1 = pmFPAfileThisCell(config->files, view, "PPSTACK.OUTPUT.JPEG1"); 1045 1045 pmCell *cell2 = pmFPAfileThisCell(config->files, view, "PPSTACK.OUTPUT.JPEG2"); 1046 ps MaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask1046 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 1047 1047 1048 1048 pmReadout *ro1 = pmReadoutAlloc(cell1), *ro2 = pmReadoutAlloc(cell2); // Binned readouts … … 1066 1066 int renormNum = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); // Number of samples 1067 1067 float renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width of Gaussian phot 1068 ps MaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask1068 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 1069 1069 if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth, 1070 1070 renormMean, renormStdev, NULL)) { … … 1112 1112 psTrace("ppStack", 1, "Gathering statistics on stacked image....\n"); 1113 1113 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits for bad 1114 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels1114 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 1115 1115 1116 1116 ppStatsFPA(stats, outRO->parent->parent->parent, view, maskBad, config); -
branches/eam_branch_20081230/ppStack/src/ppStackMatch.c
r21021 r21090 104 104 105 105 // Generate a background model of the readout we're matching 106 psImage *stackBackgroundModel(pmReadout *ro, ps MaskType maskVal, const psArray *sources, int size)106 psImage *stackBackgroundModel(pmReadout *ro, psImageMaskType maskVal, const psArray *sources, int size) 107 107 { 108 108 psImage *image = ro->image, *mask = ro->mask; // Image and mask of readout … … 169 169 170 170 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of bits to mask going in 171 ps MaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch171 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 172 172 psString maskPoorStr = psMetadataLookupStr(NULL, recipe, "MASK.POOR"); // Name of bits to mask for poor 173 ps MaskType maskPoor = pmConfigMaskGet(maskPoorStr, config); // Bits to mask for poor pixels173 psImageMaskType maskPoor = pmConfigMaskGet(maskPoorStr, config); // Bits to mask for poor pixels 174 174 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 175 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels175 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 176 176 177 177 bool mdok; // Status of MD lookup -
branches/eam_branch_20081230/ppStack/src/ppStackPhotometry.c
r20995 r21090 45 45 return false; 46 46 } 47 ps MaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask47 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask 48 48 49 49 psImage *image = ro->image, *mask = ro->mask; // Image and mask from readout … … 85 85 float dy2 = PS_SQR(y - v); // Distance from centroid 86 86 for (int u = xMin; u <= xMax; u++) { 87 if (mask->data.PS_TYPE_ MASK_DATA[v][u] & maskVal) {87 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[v][u] & maskVal) { 88 88 numBadPix++; 89 89 continue; … … 133 133 134 134 // set maskValue and markValue in the psphot recipe 135 ps MaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask136 ps MaskType markValue = pmConfigMaskGet("MARK.VALUE", config); // Bits to use for marking137 psMetadataAdd U8(recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue);138 psMetadataAdd U8(recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for mark", markValue);135 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 136 psImageMaskType markValue = pmConfigMaskGet("MARK.VALUE", config); // Bits to use for marking 137 psMetadataAddImageMask (recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue); 138 psMetadataAddImageMask (recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for mark", markValue); 139 139 140 140 if (!psphotReadout(config, view)) { -
branches/eam_branch_20081230/ppStack/src/ppStackReadout.c
r21072 r21090 114 114 115 115 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of bits to mask going in 116 ps MaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch116 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 117 117 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 118 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels118 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 119 119 120 120 int num = readouts->n; // Number of inputs … … 141 141 // Ensure there is a mask, or pmStackCombine will complain 142 142 if (!ro->mask) { 143 ro->mask = psImageAlloc(ro->image->numCols, ro->image->numRows, PS_TYPE_ MASK);143 ro->mask = psImageAlloc(ro->image->numCols, ro->image->numRows, PS_TYPE_IMAGE_MASK); 144 144 psImageInit(ro->mask, 0); 145 145 } … … 208 208 209 209 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of bits to mask going in 210 ps MaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch210 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 211 211 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 212 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels212 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 213 213 214 214 int num = readouts->n; // Number of inputs -
branches/eam_branch_20081230/ppStack/src/ppStackSources.c
r21016 r21090 109 109 psVectorInit(mag, NAN); 110 110 for (int j = 0; j < match->num; j++) { 111 if (match->mask->data.PS_TYPE_ MASK_DATA[j]) {111 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 112 112 continue; 113 113 } -
branches/eam_branch_20081230/ppSub/src/ppSubArguments.c
r20568 r21090 216 216 psMetadataAddF32(arguments, PS_LIST_TAIL, "-rej", 0, "Rejection thresold (sigma)", NAN); 217 217 psMetadataAddF32(arguments, PS_LIST_TAIL, "-sys", 0, "Relative systematic error in kernel", NAN); 218 psMetadataAdd U8(arguments, PS_LIST_TAIL, "-mask-bad", 0, "Mask value for bad pixels", 0);219 psMetadataAdd U8(arguments, PS_LIST_TAIL, "-mask-poor", 0, "Mask value for poor pixels", 0);218 psMetadataAddImageMask(arguments, PS_LIST_TAIL, "-mask-bad", 0, "Mask value for bad pixels", 0); 219 psMetadataAddImageMask(arguments, PS_LIST_TAIL, "-mask-poor", 0, "Mask value for poor pixels", 0); 220 220 psMetadataAddF32(arguments, PS_LIST_TAIL, "-poor-frac", 0, "Fraction of weight for poor pixels", NAN); 221 221 psMetadataAddF32(arguments, PS_LIST_TAIL, "-badfrac", 0, "Maximum fraction of bad pixels to accept", 1.0); -
branches/eam_branch_20081230/ppSub/src/ppSubBackground.c
r20775 r21090 30 30 31 31 psString maskBadStr = psMetadataLookupStr(NULL, ppSubRecipe, "MASK.BAD"); // Name of bits to mask for bad 32 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels32 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 33 33 34 34 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 35 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskBad);35 psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskBad); 36 36 37 37 psImage *image = ro->image, *mask = ro->mask; // Image and mask of interest … … 59 59 for (int y = 0; y < numRows; y++) { 60 60 for (int x = 0; x < numCols; x++) { 61 if (mask && mask->data.PS_TYPE_ MASK_DATA[y][x] & maskBad) {61 if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskBad) { 62 62 image->data.F32[y][x] = 0.0; 63 63 } else { … … 65 65 if (!isfinite(value)) { 66 66 image->data.F32[y][x] = NAN; 67 mask->data.PS_TYPE_ MASK_DATA[y][x] |= maskBad;67 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskBad; 68 68 } else { 69 69 image->data.F32[y][x] -= value; -
branches/eam_branch_20081230/ppSub/src/ppSubReadout.c
r21072 r21090 103 103 float penalty = psMetadataLookupF32(NULL, recipe, "PENALTY"); // Penalty for wideness 104 104 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.IN"); // Name of bits to mask going in 105 ps MaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch105 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 106 106 psString maskPoorStr = psMetadataLookupStr(NULL, recipe, "MASK.POOR"); // Name of bits to mask for poor 107 ps MaskType maskPoor = pmConfigMaskGet(maskPoorStr, config); // Bits to mask for poor pixels107 psImageMaskType maskPoor = pmConfigMaskGet(maskPoorStr, config); // Bits to mask for poor pixels 108 108 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 109 ps MaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels109 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 110 110 float badFrac = psMetadataLookupF32(NULL, recipe, "BADFRAC"); // Maximum bad fraction 111 111 const char *stampsName = psMetadataLookupStr(&mdok, config->arguments, "STAMPS"); // Filename for stamps … … 146 146 pmReadoutSetMask(inRO, pmConfigMaskGet("SAT", config), pmConfigMaskGet("BAD", config)); 147 147 } else { 148 inRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_ MASK);148 inRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 149 149 psImageInit(inRO->mask, 0); 150 150 } … … 154 154 pmReadoutSetMask(refRO, pmConfigMaskGet("SAT", config), pmConfigMaskGet("BAD", config)); 155 155 } else { 156 refRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_ MASK);156 refRO->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 157 157 psImageInit(refRO->mask, 0); 158 158 } … … 363 363 } 364 364 if (minuend->mask) { 365 outRO->mask = psImageCopy(outRO->mask, minuend->mask, PS_TYPE_ MASK);365 outRO->mask = psImageCopy(outRO->mask, minuend->mask, PS_TYPE_IMAGE_MASK); 366 366 } 367 367 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; 368 368 369 369 if (psMetadataLookupBool(&mdok, recipe, "RENORM")) { 370 ps MaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask370 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 371 371 if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth, 372 372 renormMean, renormStdev, NULL)) { … … 399 399 400 400 // set maskValue and markValue in the psphot recipe 401 ps MaskType maskValue = maskVal;402 ps MaskType markValue = pmConfigMaskGet("MARK.VALUE", config); // Bits to use for marking403 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue);404 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for marking",401 psImageMaskType maskValue = maskVal; 402 psImageMaskType markValue = pmConfigMaskGet("MARK.VALUE", config); // Bits to use for marking 403 psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue); 404 psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for marking", 405 405 markValue); 406 406 … … 477 477 for (int y = 0; y < outRO->image->numRows; y++) { 478 478 for (int x = 0; x < outRO->image->numCols; x++) { 479 if (isnan(outRO->image->data.F32[y][x]) && !(outRO->mask->data. U8[y][x] & maskVal)) {480 printf("Unmasked NAN at %d %d --> %d\n", x, y, outRO->mask->data. U8[y][x]);479 if (isnan(outRO->image->data.F32[y][x]) && !(outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal)) { 480 printf("Unmasked NAN at %d %d --> %d\n", x, y, outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x]); 481 481 } 482 482 } … … 568 568 569 569 if (psMetadataLookupBool(&mdok, recipe, "RENORM")) { 570 ps MaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask570 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 571 571 if (!pmReadoutWeightRenormPhot(outRO, maskValue, renormNum, renormWidth, 572 572 renormMean, renormStdev, NULL)) { … … 669 669 // Renormalising for pixels, because that's what magic desires 670 670 if (psMetadataLookupBool(&mdok, recipe, "RENORM")) { 671 ps MaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask671 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 672 672 if (!pmReadoutWeightRenormPixels(outRO, maskValue, renormMean, renormStdev, NULL)) { 673 673 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances."); -
branches/eam_branch_20081230/psphot/src/psphotMakeResiduals.c
r21087 r21090 1 1 # include "psphotInternal.h" 2 2 3 XXX this function is probably broken: fmasks is confused between Image and Vector. it is used by psVectorStats, so it must be Vector, but4 is populated by mflux, which seems to be Image..5 3 bool psphotMakeResiduals (psArray *sources, psMetadata *recipe, pmPSF *psf, psImageMaskType maskVal) { 6 4 … … 71 69 // - set output pixel, weight, and mask 72 70 73 XXX need to set these correctly based on the RECIPE values 74 const int badMask = 1; // mask bits 75 const int poorMask = 2; // from psImageInterpolate 76 const int clippedMask = 4; // mask bit set for clipped values 71 // these mask values do not correspond to the recipe values: they 72 // are not propagated to images: they just need to fit in an 8-bit 73 // value. they are supplied to psImageInterpolate, which takes a 74 // psImageMaskType; the mask portion of the result from 75 // psImageInterpolate is supplied to fmasks, which is then used by 76 // psVectorStats 77 78 const psImageMaskType badMask = 0x01; // mask bits 79 const psImageMaskType poorMask = 0x02; // from psImageInterpolate 80 const psImageMaskType clippedMask = 0x04; // mask bit set for clipped values 81 const psVectorMaskType fmaskVal = badMask | poorMask | clippedMask; 77 82 78 83 // determine the maximum image size from the input sources … … 105 110 psBinaryOp (weight, weight, "/", psScalarAlloc(Io*Io, PS_TYPE_F32)); 106 111 107 // we willinterpolate the image and weight - include the mask or not?108 // XXX consider better values for the mask bits 109 psImageInterpolation *interp =110 psImageInterpolationAlloc(mode, image, weight, NULL, 0xff, 0.0, 0.0, badMask, poorMask, 0.0, 0);111 psArrayAdd (input, 100, interp);112 // we interpolate the image and weight - include the mask or not? 113 // XXX why not the mask? 114 // psImageInterpolation *interp = psImageInterpolationAlloc(mode, image, weight, mask, maskVal, 0.0, 0.0, badMask, poorMask, 0.0, 0); 115 psImageInterpolation *interp = psImageInterpolationAlloc(mode, image, weight, NULL, 0xff, 0.0, 0.0, badMask, poorMask, 0.0, 0); 116 psArrayAdd (input, 100, interp); 112 117 113 118 // save the X,Y position for future reference … … 166 171 bool offImage = false; 167 172 if (psImageInterpolate (&flux, &dflux, &mflux, ix, iy, interp) == PS_INTERPOLATE_STATUS_OFF) { 173 // fprintf (stderr, "off image: %f %f : %f %f\n", ix, iy, flux, dflux); 168 174 // This pixel is off the image 169 175 offImage = true; 170 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1;171 // fprintf (stderr, "off image: %f %f : %f %f\n", ix, iy, flux, dflux);172 } 173 fluxes->data.F32[i] = flux; 174 dfluxes->data.F32[i] = dflux;175 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = mflux; // XXX is mflux IMAGE or VECTOR type? 176 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = badMask; 177 } else { 178 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = mflux; // XXX is mflux IMAGE or VECTOR type? 179 } 180 fluxes->data.F32[i] = flux; 181 dfluxes->data.F32[i] = dflux; 176 182 if (isnan(flux)) { 177 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1;183 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = badMask; 178 184 } 179 185 if (fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] == 0) { … … 182 188 } 183 189 184 // skip pixels w hich are off the image...190 // skip pixels with insufficient data 185 191 bool validPixel = (SPATIAL_ORDER == 0) ? (nGoodPixel > 1) : (nGoodPixel > 3); 186 192 if (!validPixel) { … … 188 194 resid->Rx->data.F32[oy][ox] = 0.0; 189 195 resid->Ry->data.F32[oy][ox] = 0.0; 190 resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox] = 1;196 resid->mask->data.PS_TYPE_IMAGE_MASK_DATA[oy][ox] = badMask; 191 197 continue; 192 198 } … … 194 200 // measure the robust median to determine a baseline reference value 195 201 *fluxClip = *fluxClipDef; 196 psVectorStats (fluxClip, fluxes, NULL, fmasks, 0xff);202 psVectorStats (fluxClip, fluxes, NULL, fmasks, fmaskVal); 197 203 psErrorClear(); // clear (ignore) any outstanding errors 198 204 … … 204 210 float swing = fabs(delta) / sigma; 205 211 206 // make this a user option 212 // mask pixels which are out of range 207 213 if (swing > nSigma) { 208 214 fmasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = clippedMask; … … 214 220 // measure the desired statistic on the unclipped pixels 215 221 *fluxStats = *fluxStatsDef; 216 psVectorStats (fluxStats, fluxes, NULL, fmasks, 0xff);222 psVectorStats (fluxStats, fluxes, NULL, fmasks, fmaskVal); 217 223 psErrorClear(); // clear (ignore) any outstanding errors 218 224 -
branches/eam_branch_20081230/psphot/src/psphotModelWithPSF.c
r21087 r21090 20 20 paramMask = constraint->paramMask; 21 21 if (paramMask != NULL) { 22 PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_VECTOR_ TYPE, false);22 PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_VECTOR_MASK, false); 23 23 PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMask, false); 24 24 } -
branches/eam_branch_20081230/pswarp/src/pswarpLoop.c
r20348 r21090 80 80 81 81 // output mask bits 82 ps MaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");82 psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT"); 83 83 psAssert (status, "MASK.OUTPUT was not defined"); 84 84 -
branches/eam_branch_20081230/pswarp/src/pswarpPixelFraction.c
r21072 r21090 20 20 PS_ASSERT_IMAGE_NON_NULL(readout->mask, false); 21 21 PS_ASSERT_IMAGES_SIZE_EQUAL(readout->mask, readout->image, false); 22 PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_ MASK, false);22 PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_IMAGE_MASK, false); 23 23 24 24 if (stats) { … … 40 40 41 41 // output mask bits 42 ps MaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");42 psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT"); 43 43 psAssert (status, "MASK.OUTPUT was not defined"); 44 44 … … 55 55 for (int y = 0; y < numRows; y++) { 56 56 for (int x = 0; x < numCols; x++) { 57 if (mask->data.PS_TYPE_ MASK_DATA[y][x] & maskValue) {57 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValue) { 58 58 numBad++; 59 59 } else { -
branches/eam_branch_20081230/pswarp/src/pswarpSetMaskBits.c
r21072 r21090 10 10 bool pswarpSetMaskBits (pmConfig *config) { 11 11 12 psMaskType maskIn = 0x00; // mask for the input image 13 psMaskType markIn = 0x00; // mark for the input image 14 psMaskType maskOut = 0x00; // mask for the output image 15 psMaskType markOut = 0x00; // mark for the output image 12 psImageMaskType maskIn = 0x00; // mask for the input image 13 psImageMaskType markIn = 0x00; // mark for the input image 14 psImageMaskType maskOut = 0x00; // mask for the output image 16 15 17 16 // this function sets the required single-image mask bits … … 22 21 23 22 // mask for non-linear flat regions (default to DETECTOR if not defined) 24 ps MaskType badMask = pmConfigMaskGet("BAD.WARP", config);23 psImageMaskType badMask = pmConfigMaskGet("BAD.WARP", config); 25 24 if (!badMask) { 26 25 badMask = 0x01; … … 30 29 31 30 // mask for non-linear flat regions (default to DETECTOR if not defined) 32 ps MaskType poorMask = pmConfigMaskGet("POOR.WARP", config);31 psImageMaskType poorMask = pmConfigMaskGet("POOR.WARP", config); 33 32 if (!poorMask) { 34 33 poorMask = 0x02; … … 38 37 39 38 // search for an unset bit to use for MARK: 40 markOut = 0x80; 39 psImageMaskType markOut = 0x00; 40 psImageMaskType markTrial = 0x01; 41 41 42 int nBits = sizeof(ps MaskType) * 8;42 int nBits = sizeof(psImageMaskType) * 8; 43 43 for (int i = 0; !markOut && (i < nBits); i++) { 44 if (maskOut & markOut) {45 markOut >>= 1;46 } else {47 markOut = markOut;48 }44 if (maskOut & markTrial) { 45 markTrial <<= 1; 46 } else { 47 markOut = markTrial; 48 } 49 49 } 50 51 50 if (!markOut) { 52 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");53 return false;51 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!"); 52 return false; 54 53 } 55 54 … … 63 62 // set maskOut and markOut in the psphot recipe 64 63 // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here 65 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MASK.INPUT", PS_META_REPLACE, "user-defined mask", maskIn);66 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MARK.INPUT", PS_META_REPLACE, "user-defined mask", markIn);67 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut);68 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut);64 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.INPUT", PS_META_REPLACE, "user-defined mask", maskIn); 65 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.INPUT", PS_META_REPLACE, "user-defined mask", markIn); 66 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut); 67 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut); 69 68 70 69 // update the psphot recipe … … 77 76 // set maskOut and markOut in the psphot recipe 78 77 // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here 79 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut);80 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut);78 psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut); 79 psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut); 81 80 82 81 return true; -
branches/eam_branch_20081230/pswarp/src/pswarpTransformReadout.c
r20334 r21090 22 22 23 23 // output mask bits 24 ps MaskType maskIn = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT");25 ps MaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);26 ps MaskType maskBad = pmConfigMaskGet("BAD.WARP", config);24 psImageMaskType maskIn = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT"); 25 psImageMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config); 26 psImageMaskType maskBad = pmConfigMaskGet("BAD.WARP", config); 27 27 psAssert(mdok, "MASK.INPUT was not defined"); 28 28 … … 80 80 } 81 81 if ((input->mask || maskPoor || maskBad) && !output->mask) { 82 output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_ MASK);82 output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_IMAGE_MASK); 83 83 psImageInit(output->mask, maskBad); 84 84 } -
branches/eam_branch_20081230/pswarp/src/pswarpTransformTile.c
r21072 r21090 49 49 psF32 **outImageData = args->output->image->data.F32; 50 50 psF32 **outVarData = (args->output->weight) ? args->output->weight->data.F32 : NULL; 51 ps MaskType **outMaskData = (args->output->mask) ? args->output->mask->data.PS_TYPE_MASK_DATA : NULL;52 ps MaskType **inMaskData = (args->input->mask) ? args->input->mask->data.PS_TYPE_MASK_DATA : NULL;51 psImageMaskType **outMaskData = (args->output->mask) ? args->output->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL; 52 psImageMaskType **inMaskData = (args->input->mask) ? args->input->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL; 53 53 54 54 pswarpMap *map = args->grid->maps[args->gridX][args->gridY]; // Map for this tile … … 67 67 68 68 // Only transform those pixels requested 69 if (region && region->data. U8[y][x]) {69 if (region && region->data.PS_TYPE_IMAGE_MASK_DATA[y][x]) { 70 70 continue; 71 71 } … … 82 82 // psImagePixelInterpolate determines the value at pixel coordinate (x,y) in child coordinates 83 83 double imageValue, varValue; // Value of image and variance map 84 ps MaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask84 psImageMaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask 85 85 if (!psImageInterpolate(&imageValue, &varValue, &maskValue, xIn, yIn, args->interp)) { 86 86 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
Note:
See TracChangeset
for help on using the changeset viewer.
