Changeset 18554
- Timestamp:
- Jul 15, 2008, 10:25:00 AM (18 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 16 edited
-
camera/pmFPAMaskWeight.h (modified) (3 diffs)
-
camera/pmFPAfileDefine.c (modified) (5 diffs)
-
camera/pmFPAfileFitsIO.c (modified) (2 diffs)
-
camera/pmFPAfileIO.c (modified) (3 diffs)
-
camera/pmHDUUtils.c (modified) (1 diff)
-
camera/pmHDUUtils.h (modified) (2 diffs)
-
config/pmConfigMask.c (modified) (2 diffs)
-
config/pmConfigMask.h (modified) (2 diffs)
-
detrend/pmMaskBadPixels.c (modified) (2 diffs)
-
objects/pmPSF.c (modified) (5 diffs)
-
objects/pmPSFtry.c (modified) (7 diffs)
-
objects/pmSource.c (modified) (2 diffs)
-
objects/pmSourcePhotometry.c (modified) (6 diffs)
-
objects/pmSourcePhotometry.h (modified) (2 diffs)
-
objects/pmSourcePlotMoments.c (modified) (2 diffs)
-
objects/pmSourceSky.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMaskWeight.h
r17732 r18554 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 5-17 02:42:01$7 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-15 20:25:00 $ 9 9 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 10 10 */ … … 32 32 PM_MASK_MARK = 0x80, ///< The pixel is marked as temporarily ignored 33 33 } pmMaskValue; 34 #else35 34 #define PM_MASK_MARK 0x80 ///< The pixel is marked as temporarily ignored 36 35 #define PM_MASK_SAT 0x04 ///< The pixel is saturated in the image of interest … … 43 42 /// iterating using pmReadoutReadNext, in which case the HDU can't be generated. 44 43 bool pmReadoutSetMask(pmReadout *readout, ///< Readout for which to set mask 45 psMaskType sat ,///< Mask value to give saturated pixels46 psMaskType bad ///< Mask value to give bad (low) pixels44 psMaskType satMask, ///< Mask value to give saturated pixels 45 psMaskType badMask ///< Mask value to give bad (low) pixels 47 46 ); 48 47 -
trunk/psModules/src/camera/pmFPAfileDefine.c
r18061 r18554 10 10 #include "pmErrorCodes.h" 11 11 #include "pmConfig.h" 12 #include "pmConfigMask.h" 12 13 #include "pmDetrendDB.h" 13 14 … … 489 490 psFree(realName); 490 491 return NULL; 492 } 493 494 if (file->type == PM_FPA_FILE_MASK) { 495 if (!pmConfigMaskReadHeader (config, phu)) { 496 psError(PS_ERR_IO, false, "error in mask bits"); 497 return NULL; 498 } 491 499 } 492 500 … … 660 668 file->fileLevel = input->fileLevel; 661 669 670 662 671 // define the rule to identify these files in the file->names data 663 672 psFree (file->filerule); … … 735 744 psMetadataAddStr (file->names, PS_LIST_TAIL, name, 0, "", infiles->data[i]); 736 745 746 if ((i == 0) && (file->type == PM_FPA_FILE_MASK)) { 747 if (!pmConfigMaskReadHeader (config, phu)) { 748 psError(PS_ERR_IO, false, "error in mask bits"); 749 return NULL; 750 } 751 } 752 737 753 psFree(view); 738 754 psFree(name); … … 806 822 psFree(formatName); 807 823 return NULL; 824 } 825 826 if (file->type == PM_FPA_FILE_MASK) { 827 if (!pmConfigMaskReadHeader (config, phu)) { 828 psError(PS_ERR_IO, false, "error in mask bits"); 829 return NULL; 830 } 808 831 } 809 832 -
trunk/psModules/src/camera/pmFPAfileFitsIO.c
r18330 r18554 7 7 8 8 #include "pmConfig.h" 9 #include "pmConfigMask.h" 9 10 #include "pmDetrendDB.h" 10 11 … … 496 497 } 497 498 499 // whenever we write out a mask image, we should define the bits which represent mask concepts 500 if (file->type == PM_FPA_FILE_MASK) { 501 assert (phu->header); 502 if (!pmConfigMaskWriteHeader (config, phu->header)) { 503 psError(PS_ERR_UNKNOWN, false, "failed to set the bitmask names in the PHU header for Image %s (%s)\n", file->filename, file->name); 504 return false; 505 } 506 } 507 498 508 switch (file->fileLevel) { 499 509 case PM_FPA_LEVEL_FPA: -
trunk/psModules/src/camera/pmFPAfileIO.c
r18330 r18554 9 9 10 10 #include "pmConfig.h" 11 #include "pmConfigMask.h" 11 12 #include "pmDetrendDB.h" 12 13 … … 428 429 } 429 430 pmConfigConformHeader(hdu->header, file->format); 431 432 // whenever we write out a mask image, we should define the bits which represent mask concepts 433 if (file->type == PM_FPA_FILE_MASK) { 434 assert (hdu->header); 435 if (!pmConfigMaskWriteHeader (config, hdu->header)) { 436 psError(PS_ERR_UNKNOWN, false, "failed to set the bitmask names in the PHU header for Image %s (%s)\n", file->filename, file->name); 437 return false; 438 } 439 } 430 440 } 431 441 … … 792 802 } 793 803 804 // XXX if we have a mask file, then we need to read the mask bit names 805 // defined for this file 806 if (file->type == PM_FPA_FILE_MASK) { 807 if (!pmConfigMaskReadHeader (config, phu)) { 808 psError(PS_ERR_IO, false, "error in mask bits"); 809 return false; 810 } 811 } 812 794 813 // determine the current format from the header 795 814 // determine camera if not specified already -
trunk/psModules/src/camera/pmHDUUtils.c
r12768 r18554 9 9 #include "pmFPA.h" 10 10 #include "pmHDUUtils.h" 11 12 pmHDU *pmHDUGetFirst (const pmFPA *fpa) { 13 14 // XXX we probably should have an indicator in pmFPA about the depths. 15 16 if (!fpa) return NULL; 17 if (fpa->hdu) return fpa->hdu; 18 19 for (int i = 0; i < fpa->chips->n; i++) { 20 pmChip *chip = fpa->chips->data[i]; 21 if (!chip) continue; 22 if (chip->hdu) return chip->hdu; 23 if (!chip->cells) continue; 24 for (int j = 0; j < chip->cells->n; j++) { 25 pmCell *cell = chip->cells->data[j]; 26 if (!cell) continue; 27 if (cell->hdu) return cell->hdu; 28 } 29 } 30 return NULL; 31 } 11 32 12 33 pmHDU *pmHDUFromFPA(const pmFPA *fpa) -
trunk/psModules/src/camera/pmHDUUtils.h
r12696 r18554 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-03-30 21:12:56$6 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-07-15 20:25:00 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 14 14 /// @addtogroup Camera Camera Layout 15 15 /// @{ 16 17 /// Get the first HDU encountered in the hierarchy 18 pmHDU *pmHDUGetFirst (const pmFPA *fpa); 16 19 17 20 /// Get the lowest HDU in the hierarchy -
trunk/psModules/src/config/pmConfigMask.c
r16815 r18554 9 9 #include "pmConfigMask.h" 10 10 11 psMaskType pmConfigMask (const char *masks, const pmConfig *config)11 psMaskType pmConfigMaskGet(const char *masks, const pmConfig *config) 12 12 { 13 13 assert (config); … … 39 39 return mask; 40 40 } 41 42 bool pmConfigMaskSet(const pmConfig *config, const char *maskName, psMaskType maskValue) 43 { 44 assert (config); 45 PS_ASSERT_STRING_NON_EMPTY(maskName, false); 46 47 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe 48 if (!recipe) { 49 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find MASKS recipe."); 50 return false; 51 } 52 53 psMetadataAddU8 (recipe, PS_LIST_TAIL, maskName, PS_META_REPLACE, "user-defined mask", maskValue); 54 55 return true; 56 } 57 58 // replace the named masks in the recipe with values in the header: 59 // replace only the names in the header in the recipe 60 bool pmConfigMaskReadHeader (pmConfig *config, psMetadata *header) { 61 62 bool status = false; 63 char namekey[80]; 64 char valuekey[80]; 65 66 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe 67 if (!recipe) { 68 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find MASKS recipe."); 69 return false; 70 } 71 72 int nMask = psMetadataLookupS32 (&status, header, "MSKNUM"); 73 if (!status) { 74 psError(PS_ERR_UNKNOWN, true, "Unable to find MSKNUM in header."); 75 return false; 76 } 77 78 for (int i = 0; i < nMask; i++) { 79 80 snprintf (namekey, 64, "MSKNAM%02d", i); 81 snprintf (valuekey, 64, "MSKVAL%02d", i); 82 83 char *name = psMetadataLookupStr (&status, header, namekey); 84 psU8 bit = psMetadataLookupU8 (&status, header, valuekey); 85 86 // XXX validate that bit is a 2^n value? 87 88 psMetadataItem *item = psMetadataLookup (header, name); 89 if (!item) { 90 psWarning("mask recipe entry %s not in recipe\n", name); 91 psMetadataAddU8 (recipe, PS_LIST_TAIL, name, 0, "Bitmask bit value", bit); 92 } else { 93 item->data.U8 = bit; 94 } 95 } 96 97 return true; 98 } 99 100 // write the named mask bits to the header 101 bool pmConfigMaskWriteHeader (pmConfig *config, psMetadata *header) { 102 103 char namekey[80]; 104 char valuekey[80]; 105 106 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe 107 if (!recipe) { 108 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find MASKS recipe."); 109 return false; 110 } 111 112 int nMask = 0; 113 114 psMetadataIterator *iter = psMetadataIteratorAlloc(recipe, PS_LIST_HEAD, NULL); // Iterator 115 116 psMetadataItem *item; // Item from iteration 117 while ((item = psMetadataGetAndIncrement(iter))) { 118 119 if (item->type != PS_DATA_U8) { 120 psWarning("mask recipe entry %s is not a bit value\n", item->name); 121 continue; 122 } 123 124 snprintf (namekey, 64, "MSKNAM%02d", nMask); 125 snprintf (valuekey, 64, "MSKVAL%02d", nMask); 126 127 psMetadataAddStr (header, PS_LIST_TAIL, namekey, 0, "Bitmask bit name", item->name); 128 psMetadataAddU8 (header, PS_LIST_TAIL, valuekey, 0, "Bitmask bit value", item->data.U8); 129 nMask ++; 130 } 131 132 psMetadataAddS32 (header, PS_LIST_TAIL, "MSKNUM", 0, "Bitmask bit count", nMask); 133 return true; 134 } 135 136 // examine named mask values in mask recipe and set the bits for maskValue and markValue 137 // this function sets an appropriate value for the following required named mask concepts: 138 // FLAT (used to mark out-of-range corrections in the flat-fielding) 139 // BLANK (used to mark non-existent pixels) 140 // SAT (used to mark pixels with values out-of-range on the high end) 141 // BAD (used to mark pixels with values out-of-range on the low end) 142 // If there is no explicit value for the above, the 'DETECTOR' and 'RANGE' bits are used 143 // If these latter do not exist, the value 0x01 is used. 144 // The values actually used for these names are written back to the config file 145 bool pmConfigMaskSetBits (psMaskType *outMaskValue, psMaskType *outMarkValue, pmConfig *config) { 146 147 psMaskType maskValue = 0; 148 149 // mask for generic detector defect 150 psMaskType detectorMask = pmConfigMaskGet("DETECTOR", config); 151 maskValue |= detectorMask; 152 153 // mask for dark structures 154 psMaskType darkMask = pmConfigMaskGet("DARK", config); 155 maskValue |= darkMask; 156 157 // mask for non-linear flat regions (default to DETECTOR if not defined) 158 psMaskType flatMask = pmConfigMaskGet("FLAT", config); 159 if (!flatMask) { 160 flatMask = detectorMask; 161 pmConfigMaskSet (config, "FLAT", flatMask); 162 } 163 if (!flatMask) { 164 flatMask = 0x01; 165 pmConfigMaskSet (config, "FLAT", flatMask); 166 } 167 maskValue |= flatMask; 168 169 // mask for non-existent data (default to DETECTOR if not defined) 170 psMaskType blankMask = pmConfigMaskGet("BLANK", config); 171 if (!blankMask) { 172 blankMask = detectorMask; 173 pmConfigMaskSet (config, "BLANK", blankMask); 174 } 175 if (!blankMask) { 176 blankMask = 0x01; 177 pmConfigMaskSet (config, "BLANK", blankMask); 178 } 179 maskValue |= blankMask; 180 181 // mask for generic data range errors 182 psMaskType rangeMask = pmConfigMaskGet("RANGE", config); 183 maskValue |= rangeMask; 184 185 // mask for saturated data (default to RANGE if not defined) 186 psMaskType satMask = pmConfigMaskGet("SAT", config); 187 if (!satMask) { 188 satMask = rangeMask; 189 pmConfigMaskSet (config, "SAT", satMask); 190 } 191 if (!satMask) { 192 satMask = 0x01; 193 pmConfigMaskSet (config, "SAT", satMask); 194 } 195 maskValue |= satMask; 196 197 // mask for below-range data (default to RANGE if not defined) 198 psMaskType badMask = pmConfigMaskGet("BAD", config); 199 if (!badMask) { 200 badMask = rangeMask; 201 pmConfigMaskSet (config, "BAD", badMask); 202 } 203 if (!badMask) { 204 badMask = 0x01; 205 pmConfigMaskSet (config, "BAD", badMask); 206 } 207 maskValue |= badMask; 208 209 // XXX not sure what to do with these 210 psMaskType crMask = pmConfigMaskGet("CR", config); 211 maskValue |= crMask; 212 213 psMaskType ghostMask = pmConfigMaskGet("GHOST", config); 214 maskValue |= ghostMask; 215 216 // search for an unset bit to use for MARK: 217 psMaskType markValue = 0x80; 218 219 int nBits = sizeof(psMaskType) * 8; 220 for (int i = 0; !markValue && (i < nBits); i++) { 221 if (maskValue & markValue) { 222 markValue >>= 1; 223 } else { 224 markValue = markValue; 225 } 226 } 227 if (!markValue) { 228 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!"); 229 return false; 230 } 231 232 // update the config table 233 pmConfigMaskSet (config, "MASK.VALUE", maskValue); 234 pmConfigMaskSet (config, "MARK.VALUE", markValue); 235 236 *outMaskValue = maskValue; 237 *outMarkValue = markValue; 238 239 return true; 240 } -
trunk/psModules/src/config/pmConfigMask.h
r16816 r18554 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-0 3-05 01:06:37$6 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-07-15 20:25:00 $ 8 8 * Copyright 2007 Institute for Astronomy, University of Hawaii 9 9 */ … … 23 23 /// 24 24 /// The mask values are derived from the MASKS recipe 25 psMaskType pmConfigMask (const char *masks, ///< List of symbolic names, space/comma delimited25 psMaskType pmConfigMaskGet(const char *masks, ///< List of symbolic names, space/comma delimited 26 26 const pmConfig *config ///< Configuration 27 27 ); 28 28 29 bool pmConfigMaskSet(const pmConfig *config, const char *maskName, psMaskType maskValue); 30 31 // replace the named masks in the recipe with values in the header: 32 // replace only the names in the header in the recipe 33 bool pmConfigMaskReadHeader (pmConfig *config, psMetadata *header); 34 35 // write the named mask bits to the header 36 bool pmConfigMaskWriteHeader (pmConfig *config, psMetadata *header); 37 38 bool pmConfigMaskSetBits (psMaskType *outMaskValue, psMaskType *outMarkValue, pmConfig *config); 39 29 40 #endif -
trunk/psModules/src/detrend/pmMaskBadPixels.c
r18364 r18554 123 123 psTrace ("psModules.detrend", 3, "suspect: %f +/- %f\n", median, stdev); 124 124 125 // XXX this loop could result in pixels with suspect = 0.0 but no valid input pixels (all 126 // masked). need to track the number of good as well as suspect pixels? 125 127 for (int y = 0; y < image->numRows; y++) { 126 128 for (int x = 0; x < image->numCols; x++) { 127 if (fabs((image->data.F32[y][x] - median) / stdev) >= rej && 128 (!mask || !(mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal))) { 129 suspect->data.F32[y][x] += 1.0; 130 } 129 if (fabs((image->data.F32[y][x] - median) / stdev) < rej) continue; 130 if (mask && (mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal)) continue; 131 suspect->data.F32[y][x] += 1.0; 131 132 } 132 133 } … … 140 141 } 141 142 143 // the maskVal supplied here is the value SET for this mask (ie, it is not used to avoid pixels) 142 144 bool pmMaskIdentifyBadPixels(pmReadout *output, psMaskType maskVal, float thresh, pmMaskIdentifyMode mode) 143 145 { -
trunk/psModules/src/objects/pmPSF.c
r15983 r18554 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-02 20:41:55$8 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-15 20:25:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 404 404 405 405 // we generate the growth curve for the center of the image with the specified psf model 406 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark )406 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType markVal) 407 407 { 408 408 PS_ASSERT_PTR_NON_NULL(readout, false); … … 416 416 // create template model 417 417 pmModel *modelRef = pmModelAlloc(psf->type); 418 419 // maskVal is used to test for rejected pixels, and must include markVal 420 maskVal |= markVal; 418 421 419 422 // use the center of the center pixel of the image … … 465 468 466 469 // mask the given aperture and measure the apMag 467 psImageKeepCircle (mask, xc, yc, radius, "OR", mark );470 psImageKeepCircle (mask, xc, yc, radius, "OR", markVal); 468 471 if (!pmSourcePhotometryAper (&apMag, model, image, mask, maskVal)) { 469 472 psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius); … … 473 476 break; 474 477 } 475 476 // XXX since we re-mask on each pass, this could be dropped. 477 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(mark)); 478 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(markVal)); 478 479 479 480 // the 'ignore' mode is for testing -
trunk/psModules/src/objects/pmPSFtry.c
r18040 r18554 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.5 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 6-10 01:32:15$7 * @version $Revision: 1.57 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-15 20:25:00 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 98 98 99 99 // generate a pmPSFtry with a copy of the test PSF sources 100 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType mark )100 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType markVal) 101 101 { 102 102 bool status; … … 116 116 return NULL; 117 117 } 118 119 // maskVal is used to test for rejected pixels, and must include markVal 120 maskVal |= markVal; 118 121 119 122 // stage 1: fit an EXT model to all candidates PSF sources … … 129 132 } 130 133 131 // set object mask to define valid pixels -- XXX not unset?132 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark );134 // set object mask to define valid pixels 135 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", markVal); 133 136 134 137 // fit model as EXT, not PSF 135 138 status = pmSourceFitModel (source, source->modelEXT, PM_SOURCE_FIT_EXT, maskVal); 139 140 // clear object mask to define valid pixels 141 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 136 142 137 143 // exclude the poor fits … … 170 176 source->modelPSF->radiusFit = options->radius; 171 177 172 // set object mask to define valid pixels -- XXX not unset?173 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark );178 // set object mask to define valid pixels 179 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", markVal); 174 180 175 181 // fit the PSF model to the source … … 178 184 // skip poor fits 179 185 if (!status) { 186 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 180 187 psfTry->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL; 181 188 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y); … … 183 190 } 184 191 185 // XXX : use a different aperture radius from the fit radius? 186 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, mark); 192 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal); 187 193 if (!status || isnan(source->apMag)) { 194 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 188 195 psfTry->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT; 189 196 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y); 190 197 continue; 191 198 } 199 200 // clear object mask to define valid pixels 201 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 192 202 193 203 psfTry->fitMag->data.F32[i] = source->psfMag; -
trunk/psModules/src/objects/pmSource.c
r18042 r18554 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.5 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 6-10 02:26:17$8 * @version $Revision: 1.55 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-15 20:25:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 838 838 839 839 // should we call pmSourceCacheModel if it does not exist? 840 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, 841 psMaskType maskVal, int dx, int dy) 840 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy) 842 841 { 843 842 PS_ASSERT_PTR_NON_NULL(source, false); -
trunk/psModules/src/objects/pmSourcePhotometry.c
r17998 r18554 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2008-0 6-09 00:43:46$5 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-07-15 20:25:00 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 64 64 65 65 // XXX masked region should be (optionally) elliptical 66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, 67 psMaskType maskVal, psMaskType mark) 66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal) 68 67 { 69 68 PS_ASSERT_PTR_NON_NULL(source, false); … … 230 229 mask = source->maskObj; 231 230 } 232 // set aperture mask circle to model radius233 // XXX use a different radius for apertures and fits...234 // XXX can I remove this? the source should have the mask defined when it is constructed or235 // when the fit / aperture radius is changed...236 psImageKeepCircle (source->maskObj, x, y, model->radiusFit, "OR", mark);237 231 238 232 // measure the weight of included pixels 239 233 // XXX is this supposed to use the weight or the flux? 240 234 if (mode & PM_SOURCE_PHOT_WEIGHT) { 241 pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal | mark);235 pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal); 242 236 } 243 237 244 238 // measure object aperture photometry 245 status = pmSourcePhotometryAper (&source->apMag, model, flux, mask, maskVal | mark);239 status = pmSourcePhotometryAper (&source->apMag, model, flux, mask, maskVal); 246 240 if (!status) { 247 241 psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag"); … … 264 258 psFree(mask); 265 259 } 266 267 // unmask aperture268 // XXX can I remove this? this will probably break things downstream...269 psImageKeepCircle (source->maskObj, x, y, model->radiusFit, "AND", PS_NOT_U8(mark));270 260 271 261 // if source was originally subtracted, re-subtract object, leave local sky … … 308 298 309 299 // return source aperture magnitude 310 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, 311 psMaskType maskVal) 300 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal) 312 301 { 313 302 PS_ASSERT_PTR_NON_NULL(apMag, false); … … 347 336 348 337 // return source aperture magnitude 349 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, 350 psMaskType maskVal) 338 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal) 351 339 { 352 340 PS_ASSERT_PTR_NON_NULL(pixWeight, false); -
trunk/psModules/src/objects/pmSourcePhotometry.h
r13898 r18554 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-06-20 02:22:26$6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-07-15 20:25:00 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 50 50 51 51 bool pmSourceMagnitudesInit (psMetadata *config); 52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal , psMaskType mark);52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal); 53 53 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal); 54 54 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psMaskType maskVal); -
trunk/psModules/src/objects/pmSourcePlotMoments.c
r15562 r18554 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-11-10 01:09:20 $7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-15 20:25:00 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 95 95 graphdata.xmin = -0.05; 96 96 graphdata.ymin = -0.05; 97 graphdata.xmax = + 2.05;98 graphdata.ymax = + 2.05;97 graphdata.xmax = +4.05; 98 graphdata.ymax = +4.05; 99 99 KapaSetLimits (kapa, &graphdata); 100 100 -
trunk/psModules/src/objects/pmSourceSky.c
r15980 r18554 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-02 20:39:04$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-15 20:25:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 43 43 The source.pixels and source.mask must already exist 44 45 This function modifies the source mask; it should only be called before the object aperture is defined 44 46 *****************************************************************************/ 45 47 … … 49 51 psF32 Radius, 50 52 psMaskType maskVal, 51 psMaskType mark )53 psMaskType markVal) 52 54 { 53 55 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 69 71 psRegion srcRegion; 70 72 73 // maskVal is used to test for rejected pixels, and must include markVal 74 maskVal |= markVal; 75 71 76 srcRegion = psRegionForSquare(peak->x, peak->y, Radius); 72 77 srcRegion = psRegionForImage(mask, srcRegion); 73 78 74 psImageMaskRegion(mask, srcRegion, "OR", mark );79 psImageMaskRegion(mask, srcRegion, "OR", markVal); 75 80 psStats *myStats = psStatsAlloc(statsOptions); 76 if (!psImageStats(myStats, image, mask, maskVal | mark)) {81 if (!psImageStats(myStats, image, mask, maskVal)) { 77 82 psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n"); 78 83 psFree(myStats); 79 84 return false; 80 85 } 81 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(mark ));86 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(markVal)); 82 87 double value = psStatsGetValue(myStats, statistic); 83 88 psFree(myStats); … … 101 106 psF32 Radius, 102 107 psMaskType maskVal, 103 psMaskType mark 108 psMaskType markVal 104 109 ) 105 110 { … … 110 115 PS_ASSERT_PTR_NON_NULL(source->peak, false); 111 116 PS_ASSERT_INT_POSITIVE(Radius, false); 117 118 // maskVal is used to test for rejected pixels, and must include markVal 119 maskVal |= markVal; 112 120 113 121 psStatsOptions statistic = psStatsSingleOption(statsOptions); … … 125 133 srcRegion = psRegionForImage(mask, srcRegion); 126 134 127 psImageMaskRegion(mask, srcRegion, "OR", mark );135 psImageMaskRegion(mask, srcRegion, "OR", markVal); 128 136 psStats *myStats = psStatsAlloc(statsOptions); 129 if (!psImageStats(myStats, image, mask, maskVal | mark)) {137 if (!psImageStats(myStats, image, mask, maskVal)) { 130 138 psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n"); 131 139 psFree(myStats); 132 140 return false; 133 141 } 134 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(mark ));142 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(markVal)); 135 143 double value = psStatsGetValue(myStats, statistic); 136 144 psFree(myStats);
Note:
See TracChangeset
for help on using the changeset viewer.
