Changeset 18472
- Timestamp:
- Jul 11, 2008, 8:35:04 AM (18 years ago)
- Location:
- branches/eam_branch_20080706
- Files:
-
- 44 edited
-
ppImage/src/Makefile.am (modified) (2 diffs)
-
ppImage/src/ppImage.h (modified) (3 diffs)
-
ppImage/src/ppImageDetrendReadout.c (modified) (1 diff)
-
ppImage/src/ppImageLoop.c (modified) (1 diff)
-
ppImage/src/ppImageMetadataStats.c (modified) (2 diffs)
-
ppImage/src/ppImageMosaic.c (modified) (1 diff)
-
ppImage/src/ppImageOptions.c (modified) (2 diffs)
-
ppImage/src/ppImagePixelStats.c (modified) (2 diffs)
-
ppImage/src/ppImageReplaceBackground.c (modified) (1 diff)
-
ppImage/src/ppImageSetMaskBits.c (modified) (1 diff)
-
ppImage/src/ppImageStats.c (modified) (1 diff)
-
psModules/src/camera/pmFPAMaskWeight.h (modified) (3 diffs)
-
psModules/src/camera/pmFPAfileFitsIO.c (modified) (2 diffs)
-
psModules/src/camera/pmFPAfileIO.c (modified) (2 diffs)
-
psModules/src/camera/pmHDUUtils.c (modified) (1 diff)
-
psModules/src/config/pmConfigMask.c (modified) (5 diffs)
-
psModules/src/config/pmConfigMask.h (modified) (2 diffs)
-
psModules/src/detrend/pmMaskBadPixels.c (modified) (2 diffs)
-
psModules/src/objects/pmPSF.c (modified) (5 diffs)
-
psModules/src/objects/pmPSFtry.c (modified) (7 diffs)
-
psModules/src/objects/pmSource.c (modified) (2 diffs)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (6 diffs)
-
psModules/src/objects/pmSourcePhotometry.h (modified) (2 diffs)
-
psModules/src/objects/pmSourcePlotMoments.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceSky.c (modified) (7 diffs)
-
psphot/doc/notes.txt (modified) (1 diff)
-
psphot/src/Makefile.am (modified) (2 diffs)
-
psphot/src/psphot.h (modified) (4 diffs)
-
psphot/src/psphotApResid.c (modified) (3 diffs)
-
psphot/src/psphotBlendFit.c (modified) (3 diffs)
-
psphot/src/psphotChoosePSF.c (modified) (3 diffs)
-
psphot/src/psphotExtendedSourceFits.c (modified) (3 diffs)
-
psphot/src/psphotFitSourcesLinear.c (modified) (7 diffs)
-
psphot/src/psphotGuessModels.c (modified) (2 diffs)
-
psphot/src/psphotMagnitudes.c (modified) (2 diffs)
-
psphot/src/psphotMaskReadout.c (modified) (1 diff)
-
psphot/src/psphotModelTest.c (modified) (4 diffs)
-
psphot/src/psphotMosaicChip.c (modified) (1 diff)
-
psphot/src/psphotPSFConvModel.c (modified) (2 diffs)
-
psphot/src/psphotParseCamera.c (modified) (1 diff)
-
psphot/src/psphotRadiusChecks.c (modified) (6 diffs)
-
psphot/src/psphotSourceFits.c (modified) (11 diffs)
-
psphot/src/psphotSourceStats.c (modified) (3 diffs)
-
psphot/src/psphotTestPSF.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080706/ppImage/src/Makefile.am
r16084 r18472 29 29 ppImageReplaceBackground.c \ 30 30 ppImageDefineFile.c \ 31 ppImageSetMaskBits.c \ 31 32 ppImageFileCheck.c \ 32 33 ppImageVersion.c \ … … 58 59 ppImageReplaceBackground.c \ 59 60 ppImageDefineFile.c \ 61 ppImageSetMaskBits.c \ 60 62 ppImageFileCheck.c \ 61 63 ppImageVersion.c \ -
branches/eam_branch_20080706/ppImage/src/ppImage.h
r16084 r18472 56 56 // make values for abstract concepts of masking 57 57 psMaskType maskValue; // apply this bit-mask to choose masked bits 58 psMaskType markValue; // apply this bit-mask to choose masked bits 58 59 psMaskType satMask; // Mask value to give saturated pixels 59 60 psMaskType badMask; // Mask value to give bad pixels … … 101 102 // Determine what type of camera, and initialise 102 103 ppImageOptions *ppImageParseCamera(pmConfig *config); 104 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options); 103 105 104 106 // Loop over the input … … 134 136 bool ppImageMosaicFPA (pmConfig *config, const ppImageOptions *options, 135 137 const char *outFile, const char *inFile); 138 139 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options); 136 140 137 141 void ppImageFileCheck (pmConfig *config); -
branches/eam_branch_20080706/ppImage/src/ppImageDetrendReadout.c
r17218 r18472 74 74 if (options->doShutter) { 75 75 pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER"); 76 if (!pmShutterCorrectionApply(input, shutter, pmConfigMask ("FLAT", config))) {76 if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) { 77 77 return false; 78 78 } -
branches/eam_branch_20080706/ppImage/src/ppImageLoop.c
r18430 r18472 65 65 // XXX set the options->*Mask values here (after the mask images have been loaded 66 66 // and before any of the value are used) 67 ppImageSetMaskBits (config, options); 67 if (!ppImageSetMaskBits (config, options)) 68 ESCAPE ("Unable to set bit masks"); 68 69 69 70 // perform the detrend analysis -
branches/eam_branch_20080706/ppImage/src/ppImageMetadataStats.c
r18430 r18472 13 13 return true; 14 14 } 15 16 // XXX should this be just options->maskValue?? I think so...17 psMaskType maskVal = options->satMask | options->badMask | options->maskValue;18 15 19 16 // Extract statistics from the last output fpa … … 51 48 pmFPAview *view = pmFPAviewAlloc(0); 52 49 53 if (!ppStatsMetadata(stats, output->fpa, view, maskVal, config)) {50 if (!ppStatsMetadata(stats, output->fpa, view, options->maskValue, config)) { 54 51 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 55 52 psFree(view); -
branches/eam_branch_20080706/ppImage/src/ppImageMosaic.c
r18430 r18472 32 32 in->name, out->name, in->xBin, in->yBin, out->xBin, out->yBin); 33 33 34 // XXX mosaic the chip, making a deep copy. this has the side effect of making the 35 // output image products pure trimmed images, but also increases the memory footprint. 36 // XXX I think we should be using options->maskValue 34 // Mosaic the chip, making a deep copy. This has the side effect of making the output 35 // image products pure trimmed images, but also increases the memory footprint. 37 36 status = pmChipMosaic(outChip, inChip, true, options->blankMask); 38 37 return status; -
branches/eam_branch_20080706/ppImage/src/ppImageOptions.c
r18430 r18472 50 50 51 51 // default flags for various activities 52 options->maskValue = 0x00; // Default mask value 53 options->satMask = 0x00; // Saturated pixels 54 options->badMask = 0x00; // Bad pixels 55 options->flatMask = 0x00; // Bad flat pixels 56 options->blankMask = 0x00; // Blank (no data, cell gap) pixels 52 options->maskValue = 0x00; // Default mask value (used to skip / ignore pixels) 53 options->satMask = 0x00; // Saturated pixels (supplied to pmReadoutGenerateMask) 54 options->badMask = 0x00; // Bad (low) pixels (supplied to pmReadoutGenerateMask) 55 options->flatMask = 0x00; // Bad flat pixels (supplied to pmFlatField) 56 options->blankMask = 0x00; // Blank (no data, cell gap) pixels (supplied to pmChipMosaic, pmFPAMosaic) 57 options->markValue = 0x00; // A safe bit for internal marking 57 58 58 59 // Non-linearity default options … … 190 191 options->doWeightBuild = psMetadataLookupBool(NULL, recipe, "WEIGHT.BUILD"); 191 192 192 // Mask recipe options 193 // XXX we cannot set these values here; wait until just before ppImageDetrend 193 // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c) 194 194 options->doMask = psMetadataLookupBool(NULL, recipe, "MASK"); 195 196 # if (0)197 const char *masks = psMetadataLookupStr(&status, recipe, "MASK.VALUE");198 if (status) {199 options->maskValue = pmConfigMask(masks, config);200 }201 options->satMask = pmConfigMask("SAT", config);202 options->badMask = pmConfigMask("BAD", config);203 options->flatMask = pmConfigMask("FLAT", config);204 options->blankMask = pmConfigMask("BLANK", config);205 // XXX should it be an error for these to not exist?206 # endif207 195 208 196 options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS"); -
branches/eam_branch_20080706/ppImage/src/ppImagePixelStats.c
r18430 r18472 9 9 10 10 bool mdok; // Status of MD lookup 11 12 // XXX should this be just options->maskValue?? I think so...13 psMaskType maskVal = options->satMask | options->badMask | options->maskValue;14 11 15 12 // loop over the cells/readouts for this chip … … 49 46 } 50 47 51 if (!ppStatsPixels(stats, output->fpa, view, maskVal, config)) {48 if (!ppStatsPixels(stats, output->fpa, view, options->maskValue, config)) { 52 49 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 53 50 psFree (view); -
branches/eam_branch_20080706/ppImage/src/ppImageReplaceBackground.c
r18430 r18472 40 40 psAssert (replaceSkyMode != MODE_NONE, "replace sky mode not defined"); 41 41 42 // define the mask value to be used in ppImage43 // XXX should this be just options->maskValue?? I think so... (but it should certainly include flat!)44 psMaskType maskVal = options-> satMask | options->badMask | options->flatMask | options->blankMask;42 // XXX Should this be options->maskValue or & ~options->satMask? the latter will leave saturated pixels high 43 // psMaskType maskVal = options->maskValue & ~options->satMask; 44 psMaskType maskVal = options->maskValue; 45 45 46 46 pmFPAfile *modelFile = NULL; -
branches/eam_branch_20080706/ppImage/src/ppImageSetMaskBits.c
r18430 r18472 7 7 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options) { 8 8 9 // Mask recipe options 10 const char *masks = psMetadataLookupStr(&status, recipe, "MASK.VALUE"); 11 if (status) { 12 options->maskValue = pmConfigMask(masks, config); 9 if (!pmConfigMaskSetBits (&options->maskValue, &options->markValue, config)) { 10 psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values"); 11 return false; 13 12 } 14 13 15 darkMask = pmConfigMask("DARK", config); 16 options->flatMask = pmConfigMask("FLAT", config); 17 options->blankMask = pmConfigMask("BLANK", config); 18 detectorMask = pmConfigMask("DETECTOR", config); 14 // at this point we know we have valid values for required entries SAT, BAD, FLAT, BLANK: 19 15 20 options->satMask = pmConfigMask("SAT", config); 21 options->badMask = pmConfigMask("BAD", config); 16 // mask for non-linear flat corrections 17 options->flatMask = pmConfigMaskGet("FLAT", config); 18 psAssert (options->flatMask, "flat mask not set"); 22 19 23 rangeMask = pmConfigMask("RANGE", config); 20 // mask for non-existent data (default to DETECTOR if not defined) 21 options->blankMask = pmConfigMaskGet("BLANK", config); 22 psAssert (options->blankMask, "blank mask not set"); 24 23 25 crMask = pmConfigMask("CR", config); 26 ghostMask = pmConfigMask("GHOST", config); 24 // mask for saturated data (default to RANGE if not defined) 25 options->satMask = pmConfigMaskGet("SAT", config); 26 psAssert (options->satMask, "sat mask not set"); 27 28 // mask for below-range data (default to RANGE if not defined) 29 options->badMask = pmConfigMaskGet("BAD", config); 30 psAssert (options->badMask, "bad mask not set"); 27 31 28 // XXX it should be an error for these to not exist 29 if (!options->flatMask) { 30 psWarning ("FLAT MASK is not set"); 32 // save MASK and MARK on the PSPHOT recipe 33 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); 34 if (!recipe) { 35 psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE); 36 return false; 31 37 } 32 if (!options->flatMask) { 33 psWarning ("FLAT MASK is not set"); 34 } 38 39 // set maskValue and markValue in the psphot recipe 40 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", options->maskValue); 41 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", options->markValue); 35 42 36 43 return true; -
branches/eam_branch_20080706/ppImage/src/ppImageStats.c
r14000 r18472 57 57 } 58 58 59 if (!ppStatsFPA(stats, output->fpa, view, 60 options->satMask | options->badMask | options->maskValue, 61 config)) { 59 if (!ppStatsFPA(stats, output->fpa, view, options->maskValue, config)) { 62 60 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 63 61 psFree(view); -
branches/eam_branch_20080706/psModules/src/camera/pmFPAMaskWeight.h
r17732 r18472 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 5-17 02:42:01$7 * @version $Revision: 1.13.8.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-11 18:35:04 $ 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 -
branches/eam_branch_20080706/psModules/src/camera/pmFPAfileFitsIO.c
r18330 r18472 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: -
branches/eam_branch_20080706/psModules/src/camera/pmFPAfileIO.c
r18430 r18472 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 -
branches/eam_branch_20080706/psModules/src/camera/pmHDUUtils.c
r18431 r18472 12 12 pmHDU *pmHDUGetFirst (const pmFPA *fpa) { 13 13 14 // XXX we probably should have an indicator in pmFPA about the depths.14 // XXX we probably should have an indicator in pmFPA about the depths. 15 15 16 if (!fpa) return NULL;17 if (fpa->hdu) return fpa->hdu;16 if (!fpa) return NULL; 17 if (fpa->hdu) return fpa->hdu; 18 18 19 for (int i = 0; i < fpa->chips->n; i++) { 20 pmChip *chip = fpa->chips[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[j]; 26 if (!cell) continue; 27 if (cell->hdu) return cell->hdu; 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 } 28 29 } 29 } 30 return NULL; 30 return NULL; 31 31 } 32 32 -
branches/eam_branch_20080706/psModules/src/config/pmConfigMask.c
r18430 r18472 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); … … 40 40 } 41 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 42 58 // replace the named masks in the recipe with values in the header: 43 59 // replace only the names in the header in the recipe 44 void pmConfigMasksReadHeader (pmConfig *config, psMetadata *header) { 60 bool pmConfigMaskReadHeader (pmConfig *config, psMetadata *header) { 61 62 bool status = false; 63 char namekey[80]; 64 char valuekey[80]; 45 65 46 66 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe … … 68 88 psMetadataItem *item = psMetadataLookup (header, name); 69 89 if (!item) { 70 psWarning("mask recipe entry %s not in recipe\n", name);71 psMetadataAddU8 (recipe, PS_LIST_TAIL, name, 0, "Bitmask bit value", bit);90 psWarning("mask recipe entry %s not in recipe\n", name); 91 psMetadataAddU8 (recipe, PS_LIST_TAIL, name, 0, "Bitmask bit value", bit); 72 92 } else { 73 item->data.U8 = bit;93 item->data.U8 = bit; 74 94 } 75 95 } … … 79 99 80 100 // write the named mask bits to the header 81 bool pmConfigMasksWriteHeader (pmConfig *config, psMetadata *header) { 101 bool pmConfigMaskWriteHeader (pmConfig *config, psMetadata *header) { 102 103 char namekey[80]; 104 char valuekey[80]; 82 105 83 106 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe … … 110 133 return true; 111 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 } -
branches/eam_branch_20080706/psModules/src/config/pmConfigMask.h
r16816 r18472 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.2.14.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-07-11 18:35:04 $ 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 -
branches/eam_branch_20080706/psModules/src/detrend/pmMaskBadPixels.c
r18364 r18472 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 { -
branches/eam_branch_20080706/psModules/src/objects/pmPSF.c
r15983 r18472 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-02 20:41:55$8 * @version $Revision: 1.35.18.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-11 18:35:04 $ 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 -
branches/eam_branch_20080706/psModules/src/objects/pmPSFtry.c
r18040 r18472 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.56 $ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 6-10 01:32:15$7 * @version $Revision: 1.56.8.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-11 18:35:04 $ 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; -
branches/eam_branch_20080706/psModules/src/objects/pmSource.c
r18042 r18472 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 6-10 02:26:17$8 * @version $Revision: 1.54.8.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-11 18:35:04 $ 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); -
branches/eam_branch_20080706/psModules/src/objects/pmSourcePhotometry.c
r17998 r18472 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $6 * @date $Date: 2008-0 6-09 00:43:46$5 * @version $Revision: 1.42.8.1 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-07-11 18:35:04 $ 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); -
branches/eam_branch_20080706/psModules/src/objects/pmSourcePhotometry.h
r13898 r18472 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-06-20 02:22:26$6 * @version $Revision: 1.10.34.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-07-11 18:35:04 $ 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); -
branches/eam_branch_20080706/psModules/src/objects/pmSourcePlotMoments.c
r15562 r18472 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-11-10 01:09:20$7 * @version $Revision: 1.10.20.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-11 18:35:04 $ 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 -
branches/eam_branch_20080706/psModules/src/objects/pmSourceSky.c
r15980 r18472 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-02 20:39:04 $8 * @version $Revision: 1.16.18.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-11 18:35:04 $ 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); -
branches/eam_branch_20080706/psphot/doc/notes.txt
r17396 r18472 1 2 2008.06.25 3 4 timing : footprints 5 6 on GPC1, with FFT: 7 pass 1 : convolved with grow disc: 17.558344 sec 8 pass 2 : convolved with grow disc: 8.915036 sec 1 9 2 10 2008.01.31 -
branches/eam_branch_20080706/psphot/src/Makefile.am
r18467 r18472 15 15 psphotImageLoop.c \ 16 16 psphotMosaicChip.c \ 17 psphotSetMaskBits.c \ 17 18 psphotParseCamera.c 18 19 … … 85 86 psphotAddNoise.c 86 87 88 # dropped? psphotGrowthCurve.c 89 87 90 include_HEADERS = \ 88 91 psphot.h \ -
branches/eam_branch_20080706/psphot/src/psphot.h
r18000 r18472 25 25 bool psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmDetections *detections, pmPSF *psf, psArray *sources); 26 26 bool psphotDefineFiles (pmConfig *config, pmFPAfile *input); 27 bool psphotSetMaskBits (pmConfig *config); 27 28 28 29 // XXX test functions … … 70 71 // functions to set the correct source pixels 71 72 bool psphotInitRadiusPSF (const psMetadata *recipe, const pmModelType type); 72 bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model );73 bool psphotCheckRadiusPSFBlend (pmReadout *readout, pmSource *source, pmModel *model, float dR);73 bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model, psMaskType markVal); 74 bool psphotCheckRadiusPSFBlend (pmReadout *readout, pmSource *source, pmModel *model, psMaskType markVal, float dR); 74 75 bool psphotInitRadiusEXT (psMetadata *recipe, pmModelType type); 75 bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model );76 bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model, psMaskType markVal); 76 77 77 78 // output functions … … 91 92 bool psphotInitLimitsPSF (psMetadata *recipe, pmReadout *readout); 92 93 bool psphotInitLimitsEXT (psMetadata *recipe); 93 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal );94 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal );95 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal );96 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal );97 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal );94 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal); 95 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal, psMaskType markVal); 96 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal); 97 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, psMaskType markVal); 98 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal, psMaskType markVal); 98 99 99 100 // functions to support simultaneous multi-source fitting … … 124 125 bool psphotMakeResiduals (psArray *sources, psMetadata *recipe, pmPSF *psf, psMaskType maskVal); 125 126 126 pmModel *psphotPSFConvModel (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, int psfSize);127 pmModel *psphotPSFConvModel (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, psMaskType markVal, int psfSize); 127 128 128 129 psKernel *psphotKernelFromPSF (pmSource *source, int nPix); -
branches/eam_branch_20080706/psphot/src/psphotApResid.c
r17288 r18472 25 25 } 26 26 27 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)28 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels27 // bit-masks to test for good/bad pixels 28 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 29 29 assert (maskVal); 30 30 31 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 32 psMaskType mark = psMetadataLookupU8(&status, recipe, "MASK.MARK"); // Mask value for bad pixels 33 assert (mark); 31 // bit-mask to mark pixels not used in analysis 32 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 33 assert (markVal); 34 35 // maskVal is used to test for rejected pixels, and must include markVal 36 maskVal |= markVal; 34 37 35 38 // S/N limit to perform full non-linear fits … … 65 68 psf->growth = pmGrowthCurveAlloc (PSF_FIT_PAD, 100.0, REF_RADIUS); 66 69 67 if (!pmGrowthCurveGenerate (readout, psf, IGNORE_GROWTH, maskVal, mark )) {70 if (!pmGrowthCurveGenerate (readout, psf, IGNORE_GROWTH, maskVal, markVal)) { 68 71 psError(PSPHOT_ERR_APERTURE, false, "Fitting aperture corrections"); 69 72 psFree(psf->growth); psf->growth = NULL; … … 92 95 // get growth-corrected, apTrend-uncorrected magnitudes in scaled apertures 93 96 // will fail if below S/N threshold or model is missing 94 if (!pmSourceMagnitudes (source, psf, photMode, maskVal , mark)) {97 if (!pmSourceMagnitudes (source, psf, photMode, maskVal)) { 95 98 Nskip ++; 96 99 psTrace ("psphot", 3, "skip : bad source mag"); -
branches/eam_branch_20080706/psphot/src/psphotBlendFit.c
r17396 r18472 12 12 psTimerStart ("psphot"); 13 13 14 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)15 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels14 // bit-masks to test for good/bad pixels 15 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 16 16 assert (maskVal); 17 18 // bit-mask to mark pixels not used in analysis 19 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 20 assert (markVal); 21 22 // maskVal is used to test for rejected pixels, and must include markVal 23 maskVal |= markVal; 17 24 18 25 // source analysis is done in S/N order (brightest first) … … 81 88 // I should try EXT if the source size measurement says it is large 82 89 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 83 if (psphotFitBlob (readout, source, sources, psf, maskVal )) {90 if (psphotFitBlob (readout, source, sources, psf, maskVal, markVal)) { 84 91 source->type = PM_SOURCE_TYPE_EXTENDED; 85 92 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->moments->x, source->moments->y); … … 88 95 } 89 96 } else { 90 if (psphotFitBlend (readout, source, psf, maskVal )) {97 if (psphotFitBlend (readout, source, psf, maskVal, markVal)) { 91 98 source->type = PM_SOURCE_TYPE_STAR; 92 99 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->moments->x, source->moments->y); -
branches/eam_branch_20080706/psphot/src/psphotChoosePSF.c
r18323 r18472 8 8 psTimerStart ("psphot"); 9 9 10 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)11 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels10 // bit-masks to test for good/bad pixels 11 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 12 12 assert (maskVal); 13 13 14 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 15 psMaskType mark = psMetadataLookupU8(&status, recipe, "MASK.MARK"); // Mask value for bad pixels 16 assert (mark); 14 // bit-mask to mark pixels not used in analysis 15 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 16 assert (markVal); 17 18 // maskVal is used to test for rejected pixels, and must include markVal 19 maskVal |= markVal; 17 20 18 21 // examine PSF sources in S/N order (brightest first) … … 147 150 for (int i = 0; i < modelNames->n; i++) { 148 151 char *modelName = modelNames->data[i]; 149 pmPSFtry *try = pmPSFtryModel (stars, modelName, options, maskVal, mark ); // Attempt at fit152 pmPSFtry *try = pmPSFtryModel (stars, modelName, options, maskVal, markVal); // Attempt at fit 150 153 if (!try) { 151 154 // No big deal --- we'll try another model … … 321 324 // use pmModelSub because modelFlux has not been generated 322 325 assert (source->maskObj); 323 psImageKeepCircle (source->maskObj, x, y, options->radius, "OR", PM_MASK_MARK);326 psImageKeepCircle (source->maskObj, x, y, options->radius, "OR", markVal); 324 327 pmModelSub (source->pixels, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL, maskVal); 325 psImageKeepCircle (source->maskObj, x, y, options->radius, "AND", PS_NOT_U8( PM_MASK_MARK));328 psImageKeepCircle (source->maskObj, x, y, options->radius, "AND", PS_NOT_U8(markVal)); 326 329 } 327 330 -
branches/eam_branch_20080706/psphot/src/psphotExtendedSourceFits.c
r17396 r18472 15 15 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 16 16 assert (maskVal); 17 18 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); // Mask value for bad pixels 19 assert (markVal); 20 21 // maskVal is used to test for rejected pixels, and must include markVal 22 maskVal |= markVal; 17 23 18 24 // perform full extended source non-linear fits? … … 155 161 pmModel *modelFit = NULL; 156 162 if (convolved) { 157 modelFit = psphotPSFConvModel (readout, source, modelType, maskVal, psfSize);163 modelFit = psphotPSFConvModel (readout, source, modelType, maskVal, markVal, psfSize); 158 164 if (!modelFit) { 159 165 psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->x, source->moments->y); … … 168 174 psFree (source->modelFlux); 169 175 source->modelFlux = NULL; 170 modelFit = psphotFitEXT (readout, source, modelType, maskVal );176 modelFit = psphotFitEXT (readout, source, modelType, maskVal, markVal); 171 177 if (!modelFit) { 172 178 psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->x, source->moments->y); -
branches/eam_branch_20080706/psphot/src/psphotFitSourcesLinear.c
r17516 r18472 10 10 // the analysis is performed wrt the simulated pixel values 11 11 12 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER );12 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psMaskType markVal); 13 13 14 14 bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, bool final) { … … 22 22 psTimerStart ("psphot"); 23 23 24 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)25 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels24 // bit-masks to test for good/bad pixels 25 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 26 26 assert (maskVal); 27 28 // bit-mask to mark pixels not used in analysis 29 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 30 assert (markVal); 31 32 // maskVal is used to test for rejected pixels, and must include markVal 33 maskVal |= markVal; 27 34 28 35 // source analysis is done in spatial order … … 157 164 158 165 // set the sky, sky_x, sky_y components of border matrix 159 SetBorderMatrixElements (border, readout, fitSources, CONSTANT_PHOTOMETRIC_WEIGHTS, SKY_FIT_ORDER );166 SetBorderMatrixElements (border, readout, fitSources, CONSTANT_PHOTOMETRIC_WEIGHTS, SKY_FIT_ORDER, markVal); 160 167 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "set border: %f (%d elements)\n", psTimerMark ("psphot"), sparse->Nelem); 161 168 … … 221 228 // on the pixels which correspond to all of the sources of interest. These elements fill in 222 229 // the border matrix components in the sparse matrix equation. 223 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER ) {230 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psMaskType markVal) { 224 231 225 232 // generate the image-wide weight terms … … 227 234 psRegion fullArray = psRegionSet (0, 0, 0, 0); 228 235 fullArray = psRegionForImage (readout->mask, fullArray); 229 psImageMaskRegion (readout->mask, fullArray, "OR", PM_MASK_MARK);236 psImageMaskRegion (readout->mask, fullArray, "OR", markVal); 230 237 psLogMsg ("psphot.ensemble", PS_LOG_INFO, "step 1: %f sec\n", psTimerMark ("psphot")); 231 238 … … 237 244 float x = model->params->data.F32[PM_PAR_XPOS]; 238 245 float y = model->params->data.F32[PM_PAR_YPOS]; 239 psImageMaskCircle (source->maskView, x, y, model->radiusFit, "AND", PS_NOT_U8( PM_MASK_MARK));246 psImageMaskCircle (source->maskView, x, y, model->radiusFit, "AND", PS_NOT_U8(markVal)); 240 247 } 241 248 psLogMsg ("psphot.ensemble", PS_LOG_INFO, "step 2: %f sec\n", psTimerMark ("psphot")); … … 279 286 280 287 // turn off MARK for all image pixels 281 psImageMaskRegion (readout->mask, fullArray, "AND", PS_NOT_U8( PM_MASK_MARK));288 psImageMaskRegion (readout->mask, fullArray, "AND", PS_NOT_U8(markVal)); 282 289 psLogMsg ("psphot.ensemble", PS_LOG_INFO, "step 4: %f sec\n", psTimerMark ("psphot")); 283 290 -
branches/eam_branch_20080706/psphot/src/psphotGuessModels.c
r16820 r18472 23 23 psTimerStart ("psphot"); 24 24 25 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)26 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels25 // bit-masks to test for good/bad pixels 26 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 27 27 assert (maskVal); 28 29 // bit-mask to mark pixels not used in analysis 30 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 31 assert (markVal); 32 33 // maskVal is used to test for rejected pixels, and must include markVal 34 maskVal |= markVal; 28 35 29 36 // setup the PSF fit radius details … … 85 92 // XXX need to define the guess flux? 86 93 // set the fit radius based on the object flux limit and the model 87 psphotCheckRadiusPSF (readout, source, modelPSF );94 psphotCheckRadiusPSF (readout, source, modelPSF, markVal); 88 95 89 96 // set the source PSF model -
branches/eam_branch_20080706/psphot/src/psphotMagnitudes.c
r16820 r18472 8 8 psTimerStart ("psphot"); 9 9 10 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)11 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels10 // bit-masks to test for good/bad pixels 11 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 12 12 assert (maskVal); 13 13 14 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 15 psMaskType mark = psMetadataLookupU8(&status, recipe, "MASK.MARK"); // Mask value for bad pixels 16 assert (mark); 14 // bit-mask to mark pixels not used in analysis 15 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 16 assert (markVal); 17 18 // maskVal is used to test for rejected pixels, and must include markVal 19 maskVal |= markVal; 17 20 18 21 pmSourceMagnitudesInit (recipe); … … 35 38 for (int i = 0; i < sources->n; i++) { 36 39 pmSource *source = (pmSource *) sources->data[i]; 37 status = pmSourceMagnitudes (source, psf, photMode, maskVal , mark);40 status = pmSourceMagnitudes (source, psf, photMode, maskVal); 38 41 if (status) Nap ++; 39 42 -
branches/eam_branch_20080706/psphot/src/psphotMaskReadout.c
r16820 r18472 7 7 8 8 // ** Interpret the mask values: 9 10 // single-bit named masks 11 psMaskType maskMark = pmConfigMask("MARK", config); // Mask value for marking 12 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.MARK", PS_META_REPLACE, "user-defined mask", maskMark); 13 14 psMaskType maskSat = pmConfigMask("SAT", config); // Mask value for saturated pixels 9 // XXX drop the write to recipe and move config into psphotRoughClass? 10 psMaskType maskSat = pmConfigMaskGet("SAT", config); // Mask value for saturated pixels 15 11 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.SAT", PS_META_REPLACE, "user-defined mask", maskSat); 16 12 17 psMaskType maskBad = pmConfigMask ("BAD",config); // Mask value for bad pixels13 psMaskType maskBad = pmConfigMaskGet("BAD", config); // Mask value for bad pixels 18 14 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.BAD", PS_META_REPLACE, "user-defined mask", maskBad); 19 20 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)21 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "PSPHOT"); // Mask value for bad pixels22 if (!maskVal) {23 const char *maskValStr = psMetadataLookupStr(NULL, recipe, "MASKVAL"); // String with mask names24 if (!maskValStr) {25 psError(PSPHOT_ERR_CONFIG, false, "Missing recipe item: MASKVAL(STR)");26 return false;27 }28 maskVal = pmConfigMask(maskValStr, config); // Mask values to mask against29 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskVal);30 assert (maskVal);31 }32 15 33 16 // generate mask & weight images if they don't already exit -
branches/eam_branch_20080706/psphot/src/psphotModelTest.c
r17396 r18472 12 12 pmSourceFitMode fitMode; 13 13 14 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 15 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 16 psMaskType mark = psMetadataLookupU8(&status, recipe, "MASK.MARK"); // Mask value for bad pixels 14 // bit-masks to test for good/bad pixels 15 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 17 16 assert (maskVal); 18 assert (mark); 17 18 // bit-mask to mark pixels not used in analysis 19 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 20 assert (markVal); 21 22 // maskVal is used to test for rejected pixels, and must include markVal 23 maskVal |= markVal; 19 24 20 25 // run model fitting tests on a single source? … … 130 135 131 136 // find the local sky 132 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, mark );137 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 133 138 if (!status) psAbort("pmSourceLocalSky error"); 134 139 … … 195 200 196 201 // define the pixels used for the fit 197 psImageKeepCircle (source->maskObj, xObj, yObj, RADIUS, "OR", mark );202 psImageKeepCircle (source->maskObj, xObj, yObj, RADIUS, "OR", markVal); 198 203 psphotSaveImage (NULL, source->maskObj, "mask1.fits"); 199 204 … … 213 218 assert (status); 214 219 215 model = psphotPSFConvModel (readout, source, modelType, maskVal, psfSize);220 model = psphotPSFConvModel (readout, source, modelType, maskVal, markVal, psfSize); 216 221 params = model->params->data.F32; 217 222 } else { -
branches/eam_branch_20080706/psphot/src/psphotMosaicChip.c
r13900 r18472 25 25 } 26 26 27 psMaskType blankMask = pmConfigMaskGet("BLANK", config); 28 27 29 // mosaic the chip, forcing a deep copy (resulting images are not subimages) 28 30 psTrace("pmChipMosaic", 5, "mosaic chip %s to %s (xbin,ybin: %d,%d to %d,%d)\n", 29 31 in->name, out->name, in->xBin, in->yBin, out->xBin, out->yBin); 30 status = pmChipMosaic(outChip, inChip, true, pmConfigMask("BLANK", config));32 status = pmChipMosaic(outChip, inChip, true, blankMask); 31 33 return status; 32 34 } -
branches/eam_branch_20080706/psphot/src/psphotPSFConvModel.c
r17396 r18472 9 9 // modelConv to contain the fitted parameters, and the modelFlux to contain the 10 10 // convolved model image. 11 pmModel *psphotPSFConvModel (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, int psfSize) {11 pmModel *psphotPSFConvModel (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, psMaskType markVal, int psfSize) { 12 12 13 // maskVal is used to test for rejected pixels, and must include markVal 14 maskVal |= markVal; 15 13 16 // make sure we save a cached copy of the psf flux 14 17 pmSourceCachePSF (source, maskVal); … … 65 68 psVector *dparams = modelConv->dparams; 66 69 67 psphotCheckRadiusEXT (readout, source, modelConv );70 psphotCheckRadiusEXT (readout, source, modelConv, markVal); 68 71 69 72 // create the minimization constraints -
branches/eam_branch_20080706/psphot/src/psphotParseCamera.c
r13528 r18472 17 17 // if MASK or WEIGHT was supplied on command line, bind files to 'load' 18 18 // the mask and weight will be mosaicked with the image 19 pmFPAfile BindFromArgs (&status, load, config, "PSPHOT.MASK","MASK");19 pmFPAfile *mask = pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.MASK", "MASK"); 20 20 if (!status) { 21 21 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 22 22 return NULL; 23 23 } 24 24 if (mask) { 25 // XXX need to load the mask bit names from one of the headers 26 // this grabs the first available hdu : no guarantee that it will be valid, though 27 pmHDU *hdu = pmHDUGetFirst (mask->fpa); 28 if (!hdu) { 29 psError(PS_ERR_IO, true, "no valid HDU for PSPHOT.MASK"); 30 return NULL; 31 } 32 // XXX should this be done in pmFPAfileIO.c read functions? 33 if (!pmConfigMaskReadHeader (config, hdu->header)) { 34 psError(PS_ERR_IO, false, "error in mask bits"); 35 return NULL; 36 } 37 } 38 if (!psphotSetMaskBits (config)) { 39 psError (PS_ERR_UNKNOWN, false, "failed to set mask bit values"); 40 return NULL; 41 } 42 25 43 pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.WEIGHT", "WEIGHT"); 26 44 if (!status) { -
branches/eam_branch_20080706/psphot/src/psphotRadiusChecks.c
r14655 r18472 7 7 // and a per-object radius is calculated) 8 8 9 bool psphotInitRadiusPSF(const psMetadata *recipe, 10 const pmModelType type) 11 { 9 bool psphotInitRadiusPSF(const psMetadata *recipe, const pmModelType type) { 10 12 11 bool status = true; 13 12 … … 20 19 21 20 // call this function whenever you (re)-define the PSF model 22 bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model )21 bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model, psMaskType markVal) 23 22 { 24 23 psF32 *PAR = model->params->data.F32; … … 47 46 48 47 // set the mask to flag the excluded pixels 49 psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", PM_MASK_MARK);48 psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", markVal); 50 49 return status; 51 50 } 52 51 53 bool psphotCheckRadiusPSFBlend (pmReadout *readout, pmSource *source, pmModel *model, float dR) {52 bool psphotCheckRadiusPSFBlend (pmReadout *readout, pmSource *source, pmModel *model, psMaskType markVal, float dR) { 54 53 55 54 psF32 *PAR = model->params->data.F32; … … 69 68 70 69 // set the mask to flag the excluded pixels 71 psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", PM_MASK_MARK);70 psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", markVal); 72 71 return status; 73 72 } … … 87 86 88 87 // call this function whenever you (re)-define the EXT model 89 bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model ) {88 bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model, psMaskType markVal) { 90 89 91 90 psF32 *PAR = model->params->data.F32; … … 102 101 103 102 // set the mask to flag the excluded pixels 104 psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", PM_MASK_MARK);103 psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", markVal); 105 104 return status; 106 105 } -
branches/eam_branch_20080706/psphot/src/psphotSourceFits.c
r17396 r18472 21 21 } 22 22 23 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal ) {23 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal) { 24 24 25 25 float x, y, dR; 26 27 // maskVal is used to test for rejected pixels, and must include markVal 28 maskVal |= markVal; 26 29 27 30 // if this source is not a possible blend, just fit as PSF 28 31 if ((source->blends == NULL) || (source->mode & PM_SOURCE_MODE_SATSTAR)) { 29 bool status = psphotFitPSF (readout, source, psf, maskVal );32 bool status = psphotFitPSF (readout, source, psf, maskVal, markVal); 30 33 return status; 31 34 } … … 80 83 81 84 // extend source radius as needed 82 psphotCheckRadiusPSFBlend (readout, source, PSF, dR);85 psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, dR); 83 86 84 87 // fit PSF model (set/unset the pixel mask) … … 139 142 } 140 143 141 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal ) {144 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal) { 142 145 143 146 double chiTrend; 147 148 // maskVal is used to test for rejected pixels, and must include markVal 149 maskVal |= markVal; 144 150 145 151 NfitPSF ++; … … 150 156 151 157 // extend source radius as needed 152 psphotCheckRadiusPSF (readout, source, PSF );158 psphotCheckRadiusPSF (readout, source, PSF, markVal); 153 159 154 160 // fit PSF model (set/unset the pixel mask) … … 197 203 } 198 204 199 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal ) {205 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal, psMaskType markVal) { 200 206 201 207 bool okEXT, okDBL; … … 215 221 psTrace ("psphot", 5, "trying blob...\n"); 216 222 217 // psTraceSetLevel("psModules.objects.pmSourceFitSet", 5); 223 // maskVal is used to test for rejected pixels, and must include markVal 224 maskVal |= markVal; 218 225 219 226 // this temporary source is used as a place-holder by the psphotEval functions below 220 227 pmSource *tmpSrc = pmSourceAlloc (); 221 228 222 pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal );229 pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal); 223 230 okEXT = psphotEvalEXT (tmpSrc, EXT); 224 231 chiEXT = EXT->chisq / EXT->nDOF; 225 232 226 psArray *DBL = psphotFitDBL (readout, source, maskVal );233 psArray *DBL = psphotFitDBL (readout, source, maskVal, markVal); 227 234 okDBL = psphotEvalDBL (tmpSrc, DBL->data[0]); 228 235 okDBL &= psphotEvalDBL (tmpSrc, DBL->data[1]); … … 306 313 307 314 // fit a double PSF source to an extended blob 308 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal ) {315 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal, psMaskType markVal) { 309 316 310 317 float dx, dy; … … 317 324 NfitDBL ++; 318 325 326 // maskVal is used to test for rejected pixels, and must include markVal 327 maskVal |= markVal; 328 319 329 // make a guess at the position of the two sources 320 330 moments.x2 = source->moments->Sx; … … 329 339 // save the PSF model from the Ensemble fit 330 340 PSF = source->modelPSF; 331 psphotCheckRadiusPSFBlend (readout, source, PSF, 8.0);341 psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0); 332 342 if (isnan(PSF->params->data.F32[1])) psAbort("nan in dbl fit"); 333 343 … … 351 361 } 352 362 353 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal ) {363 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, psMaskType markVal) { 354 364 355 365 NfitEXT ++; 366 367 // maskVal is used to test for rejected pixels, and must include markVal 368 maskVal |= markVal; 356 369 357 370 // use the source moments, etc to guess basic model parameters … … 361 374 // if (isnan(EXT->params->data.F32[1])) psAbort("nan in ext fit"); 362 375 363 psphotCheckRadiusEXT (readout, source, EXT );376 psphotCheckRadiusEXT (readout, source, EXT, markVal); 364 377 365 378 if ((source->moments->Sx < 1e-3) || (source->moments->Sx < 1e-3)) { -
branches/eam_branch_20080706/psphot/src/psphotSourceStats.c
r18241 r18472 9 9 psTimerStart ("psphot"); 10 10 11 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)12 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels11 // bit-masks to test for good/bad pixels 12 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); 13 13 assert (maskVal); 14 14 15 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 16 psMaskType mark = psMetadataLookupU8(&status, recipe, "MASK.MARK"); // Mask value for bad pixels 17 assert (mark); 15 // bit-mask to mark pixels not used in analysis 16 psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT"); 17 assert (markVal); 18 19 // maskVal is used to test for rejected pixels, and must include markVal 20 maskVal |= markVal; 18 21 19 22 // determine properties (sky, moments) of initial sources … … 67 70 // measure a local sky value 68 71 // the local sky is now ignored; kept here for reference only 69 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, mark );72 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 70 73 if (!status) { 71 74 psFree (source); … … 77 80 // measure the local sky variance (needed if noise is not sqrt(signal)) 78 81 // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken 79 status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, mark );82 status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 80 83 if (!status) { 81 84 psFree (source); -
branches/eam_branch_20080706/psphot/src/psphotTestPSF.c
r13035 r18472 109 109 // set temporary object mask and fit object 110 110 // fit model as EXT, not PSF 111 psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PM_MASK_MARK);111 psImageKeepCircle (source->mask, x, y, RADIUS, "OR", markVal); 112 112 status = pmSourceFitModel (source, model, PM_SOURCE_FIT_EXT); 113 psImageKeepCircle (source->mask, x, y, RADIUS, "AND", PS_NOT_U8( PM_MASK_MARK));113 psImageKeepCircle (source->mask, x, y, RADIUS, "AND", PS_NOT_U8(markVal)); 114 114 115 115 // write fitted parameters to file
Note:
See TracChangeset
for help on using the changeset viewer.
