Changeset 21183 for trunk/psModules/src/objects
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (17 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 26 edited
-
pmFootprintArrayGrow.c (modified) (2 diffs)
-
pmFootprintFindAtPoint.c (modified) (7 diffs)
-
pmGrowthCurveGenerate.c (modified) (6 diffs)
-
pmModel.c (modified) (9 diffs)
-
pmModel.h (modified) (5 diffs)
-
pmPSF.h (modified) (2 diffs)
-
pmPSF_IO.c (modified) (2 diffs)
-
pmPSFtry.c (modified) (28 diffs)
-
pmPSFtry.h (modified) (4 diffs)
-
pmResiduals.c (modified) (2 diffs)
-
pmResiduals.h (modified) (2 diffs)
-
pmSource.c (modified) (11 diffs)
-
pmSource.h (modified) (3 diffs)
-
pmSourceFitModel.c (modified) (9 diffs)
-
pmSourceFitModel.h (modified) (3 diffs)
-
pmSourceFitSet.c (modified) (9 diffs)
-
pmSourceFitSet.h (modified) (2 diffs)
-
pmSourceMatch.c (modified) (7 diffs)
-
pmSourceMoments.c (modified) (4 diffs)
-
pmSourcePhotometry.c (modified) (14 diffs)
-
pmSourcePhotometry.h (modified) (2 diffs)
-
pmSourceSky.c (modified) (5 diffs)
-
pmSourceSky.h (modified) (3 diffs)
-
pmSourceVisual.c (modified) (1 diff)
-
pmTrend2D.c (modified) (3 diffs)
-
pmTrend2D.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmFootprintArrayGrow.c
r20937 r21183 3 3 * @author RHL, Princeton & IfA; EAM, IfA 4 4 * 5 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $6 * @date $Date: 200 8-12-08 02:51:14$5 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2009-01-27 06:39:38 $ 7 7 * Copyright 2006 Institute for Astronomy, University of Hawaii 8 8 */ … … 45 45 // Use a separable convolution: should be faster 46 46 idImage = (psImage*)psBinaryOp(idImage, idImage, "MIN", psScalarAlloc(1, PS_TYPE_S32)); 47 psImage *idImageMask = psImageCopy(NULL, idImage, PS_TYPE_ MASK); // Image with 1 = object47 psImage *idImageMask = psImageCopy(NULL, idImage, PS_TYPE_IMAGE_MASK); // Image with 1 = object 48 48 psImage *grownIdImage = psImageConvolveMask(NULL, idImageMask, 0x01, 0x01, -r, r, -r, r); // Grown mask 49 49 if (!grownIdImage) { -
trunk/psModules/src/objects/pmFootprintFindAtPoint.c
r20937 r21183 4 4 * @author RHL, Princeton & IfA; EAM, IfA 5 5 * 6 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $7 * @date $Date: 200 8-12-08 02:51:14$6 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2009-01-27 06:39:38 $ 8 8 * Copyright 2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 77 77 78 78 if (mask != NULL) { // remember that we've detected these pixels 79 ps MaskType *mpix = &mask->data.PS_TYPE_MASK_DATA[span->y - mask->row0][span->x0 - mask->col0];79 psImageMaskType *mpix = &mask->data.PS_TYPE_IMAGE_MASK_DATA[span->y - mask->row0][span->x0 - mask->col0]; 80 80 81 81 for (int i = 0; i <= span->x1 - span->x0; i++) { … … 143 143 psF32 *imgRowF32 = NULL; // row pointer if F32 144 144 psS32 *imgRowS32 = NULL; // " " " " !F32 145 ps MaskType *maskRow = NULL; // masks's row pointer145 psImageMaskType *maskRow = NULL; // masks's row pointer 146 146 147 147 const int row0 = img->row0; … … 186 186 imgRowF32 = img->data.F32[i]; // only one of 187 187 imgRowS32 = img->data.S32[i]; // these is valid! 188 maskRow = mask->data.PS_TYPE_ MASK_DATA[i];188 maskRow = mask->data.PS_TYPE_IMAGE_MASK_DATA[i]; 189 189 // 190 190 // Search left from the pixel diagonally to the left of (i - di, x0). If there's … … 354 354 * looking for the rest of the pmFootprint. These are generally set from peaks. 355 355 */ 356 psImage *mask = psImageAlloc(numCols, numRows, PS_TYPE_ MASK);356 psImage *mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 357 357 P_PSIMAGE_SET_ROW0(mask, row0); 358 358 P_PSIMAGE_SET_COL0(mask, col0); … … 365 365 for (int i = 0; i < peaks->n; i++) { 366 366 pmPeak *peak = peaks->data[i]; 367 mask->data.PS_TYPE_ MASK_DATA[peak->y - mask->row0][peak->x - mask->col0] |= PM_SSPAN_STOP;367 mask->data.PS_TYPE_IMAGE_MASK_DATA[peak->y - mask->row0][peak->x - mask->col0] |= PM_SSPAN_STOP; 368 368 } 369 369 } … … 375 375 imgRowF32 = img->data.F32[row]; // only one of 376 376 imgRowS32 = img->data.S32[row]; // these is valid! 377 ps MaskType *maskRow = mask->data.PS_TYPE_MASK_DATA[row];377 psImageMaskType *maskRow = mask->data.PS_TYPE_IMAGE_MASK_DATA[row]; 378 378 { 379 379 int i; -
trunk/psModules/src/objects/pmGrowthCurveGenerate.c
r20937 r21183 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 200 8-12-08 02:51:14$7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2009-01-27 06:39:38 $ 9 9 * 10 10 * Copyright 2004 Institute for Astronomy, University of Hawaii … … 41 41 #include "pmErrorCodes.h" 42 42 43 pmGrowthCurve *pmGrowthCurveForPosition (psImage *image, pmPSF *psf, bool ignore, ps MaskType maskVal, psMaskType markVal, float xc, float yc);43 pmGrowthCurve *pmGrowthCurveForPosition (psImage *image, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType markVal, float xc, float yc); 44 44 45 45 /*****************************************************************************/ … … 48 48 49 49 // we generate the growth curve for the center of the image with the specified psf model 50 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, ps MaskType maskVal, psMaskType markVal)50 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType markVal) 51 51 { 52 52 PS_ASSERT_PTR_NON_NULL(readout, false); … … 119 119 } 120 120 121 pmGrowthCurve *pmGrowthCurveForPosition (psImage *image, pmPSF *psf, bool ignore, ps MaskType maskVal, psMaskType markVal, float xc, float yc) {121 pmGrowthCurve *pmGrowthCurveForPosition (psImage *image, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType markVal, float xc, float yc) { 122 122 123 123 float fitMag, apMag; … … 162 162 psImage *view = psImageSubset (image, region); 163 163 psImage *pixels = psImageCopy (NULL, view, PS_TYPE_F32); 164 psImage *mask = psImageCopy (NULL, view, PS_TYPE_ U8);164 psImage *mask = psImageCopy (NULL, view, PS_TYPE_IMAGE_MASK); 165 165 166 166 psImageInit (pixels, 0.0); … … 189 189 return NULL; 190 190 } 191 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_ U8(markVal));191 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 192 192 193 193 // the 'ignore' mode is for testing -
trunk/psModules/src/objects/pmModel.c
r20592 r21183 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-11-09 00:28:18 $8 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 172 172 pmModelOpMode mode, 173 173 bool add, 174 ps MaskType maskVal,174 psImageMaskType maskVal, 175 175 int dx, 176 176 int dy … … 229 229 psF32 **Rx = NULL; 230 230 psF32 **Ry = NULL; 231 ps U8**Rm = NULL;231 psImageMaskType **Rm = NULL; 232 232 233 233 if (model->residuals) { … … 237 237 Rx = (model->residuals->Rx) ? model->residuals->Rx->data.F32 : NULL; 238 238 Ry = (model->residuals->Ry) ? model->residuals->Ry->data.F32 : NULL; 239 Rm = (model->residuals->mask) ? model->residuals->mask->data. U8: NULL;239 Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL; 240 240 if (Ro) { 241 241 NX = model->residuals->Ro->numCols; … … 249 249 for (psS32 iy = 0; iy < image->numRows; iy++) { 250 250 for (psS32 ix = 0; ix < image->numCols; ix++) { 251 if ((mask != NULL) && (mask->data. U8[iy][ix] & maskVal))251 if ((mask != NULL) && (mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal)) 252 252 continue; 253 253 … … 351 351 pmModel *model, 352 352 pmModelOpMode mode, 353 ps MaskType maskVal)353 psImageMaskType maskVal) 354 354 { 355 355 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 365 365 pmModel *model, 366 366 pmModelOpMode mode, 367 ps MaskType maskVal)367 psImageMaskType maskVal) 368 368 { 369 369 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 379 379 pmModel *model, 380 380 pmModelOpMode mode, 381 ps MaskType maskVal,381 psImageMaskType maskVal, 382 382 int dx, 383 383 int dy) … … 395 395 pmModel *model, 396 396 pmModelOpMode mode, 397 ps MaskType maskVal,397 psImageMaskType maskVal, 398 398 int dx, 399 399 int dy) -
trunk/psModules/src/objects/pmModel.h
r20945 r21183 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $8 * @date $Date: 200 8-12-09 21:16:09$7 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2009-01-27 06:39:38 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 150 150 pmModel *model, ///< The input pmModel 151 151 pmModelOpMode mode, ///< mode to control how the model is added into the image 152 ps MaskType maskVal///< Value to mask152 psImageMaskType maskVal ///< Value to mask 153 153 ); 154 154 … … 168 168 pmModel *model, ///< The input pmModel 169 169 pmModelOpMode mode, ///< mode to control how the model is added into the image 170 ps MaskType maskVal///< Value to mask170 psImageMaskType maskVal ///< Value to mask 171 171 ); 172 172 … … 175 175 pmModel *model, 176 176 pmModelOpMode mode, 177 ps MaskType maskVal,177 psImageMaskType maskVal, 178 178 int dx, 179 179 int dy); … … 183 183 pmModel *model, 184 184 pmModelOpMode mode, 185 ps MaskType maskVal,185 psImageMaskType maskVal, 186 186 int dx, 187 187 int dy); -
trunk/psModules/src/objects/pmPSF.h
r20945 r21183 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-12-09 21:16:09$8 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ … … 102 102 double pmPSF_SXYtoModel (psF32 *fittedPar); 103 103 104 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, ps MaskType maskVal, psMaskType mark);104 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType mark); 105 105 pmPSF *pmPSFBuildSimple (char *typeName, float sxx, float syy, float sxy, ...); 106 106 -
trunk/psModules/src/objects/pmPSF_IO.c
r20937 r21183 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-12-08 02:51:14$8 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 871 871 psFitsReadImageBuffer(psf->residuals->Ry, file->fits, fullImage, 2); // Desired pixels 872 872 } 873 // XXX notice that we are not saving the resid->mask 873 874 } 874 875 -
trunk/psModules/src/objects/pmPSFtry.c
r21173 r21183 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.68 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2009-01-27 00:01:33 $ 9 * 7 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2009-01-27 06:39:38 $ 10 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 10 * … … 115 114 test->metricErr = psVectorAlloc (sources->n, PS_TYPE_F32); 116 115 test->fitMag = psVectorAlloc (sources->n, PS_TYPE_F32); 117 test->mask = psVectorAlloc (sources->n, PS_TYPE_ U8);116 test->mask = psVectorAlloc (sources->n, PS_TYPE_VECTOR_MASK); 118 117 119 118 psVectorInit (test->mask, 0); … … 148 147 149 148 // generate a pmPSFtry with a copy of the test PSF sources 150 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, ps MaskType maskVal, psMaskType markVal)149 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal) 151 150 { 152 151 bool status; … … 176 175 pmSource *source = psfTry->sources->data[i]; 177 176 if (!source->moments) { 178 psfTry->mask->data. U8[i] = PSFTRY_MASK_EXT_FAIL;177 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 179 178 continue; 180 179 } 181 180 if (!source->moments->nPixels) { 182 psfTry->mask->data. U8[i] = PSFTRY_MASK_EXT_FAIL;181 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 183 182 continue; 184 183 } … … 186 185 source->modelEXT = pmSourceModelGuess (source, psfTry->psf->type); 187 186 if (source->modelEXT == NULL) { 188 psfTry->mask->data. U8[i] = PSFTRY_MASK_EXT_FAIL;187 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 189 188 psTrace ("psModules.objects", 4, "masking %d (%d,%d) : failed to generate model guess\n", i, source->peak->x, source->peak->y); 190 189 continue; … … 198 197 199 198 // clear object mask to define valid pixels 200 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));199 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 201 200 202 201 // exclude the poor fits 203 202 if (!status) { 204 psfTry->mask->data. U8[i] = PSFTRY_MASK_EXT_FAIL;203 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 205 204 psTrace ("psModules.objects", 4, "masking %d (%d,%d) : status is poor\n", i, source->peak->x, source->peak->y); 206 205 continue; … … 231 230 232 231 // masked for: bad model fit, outlier in parameters 233 if (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL) {232 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) { 234 233 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : source is masked\n", i, source->peak->x, source->peak->y); 235 234 continue; … … 239 238 source->modelPSF = pmModelFromPSF (source->modelEXT, psfTry->psf); 240 239 if (source->modelPSF == NULL) { 241 psfTry->mask->data. U8[i] = PSFTRY_MASK_BAD_MODEL;240 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_BAD_MODEL; 242 241 abort(); 243 242 continue; … … 253 252 // skip poor fits 254 253 if (!status) { 255 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));256 psfTry->mask->data. U8[i] = PSFTRY_MASK_PSF_FAIL;254 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 255 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_PSF_FAIL; 257 256 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y); 258 257 continue; … … 261 260 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal); 262 261 if (!status || isnan(source->apMag)) { 263 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));264 psfTry->mask->data. U8[i] = PSFTRY_MASK_BAD_PHOT;262 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 263 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_BAD_PHOT; 265 264 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y); 266 265 continue; … … 268 267 269 268 // clear object mask to define valid pixels 270 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));269 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 271 270 272 271 psfTry->fitMag->data.F32[i] = source->psfMag; … … 292 291 psVector *flux = psVectorAlloc (psfTry->sources->n, PS_TYPE_F32); 293 292 psVector *chisq = psVectorAlloc (psfTry->sources->n, PS_TYPE_F32); 294 psVector *mask = psVectorAlloc (psfTry->sources->n, PS_TYPE_ MASK);293 psVector *mask = psVectorAlloc (psfTry->sources->n, PS_TYPE_VECTOR_MASK); 295 294 296 295 // generate the x and y vectors, and mask missing models … … 300 299 flux->data.F32[i] = 0.0; 301 300 chisq->data.F32[i] = 0.0; 302 mask->data. U8[i] = 0xff;301 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 303 302 } else { 304 303 flux->data.F32[i] = source->modelPSF->params->data.F32[PM_PAR_I0]; 305 304 chisq->data.F32[i] = source->modelPSF->chisq / source->modelPSF->nDOF; 306 mask->data. U8[i] = 0;305 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0; 307 306 } 308 307 } … … 312 311 313 312 // linear clipped fit of chisq trend vs flux 314 bool result = psVectorClipFitPolynomial1D(psfTry->psf->ChiTrend, options->stats, mask, 315 0xff, chisq, NULL, flux); 313 bool result = psVectorClipFitPolynomial1D(psfTry->psf->ChiTrend, options->stats, mask, 0xff, chisq, NULL, flux); 316 314 psStatsOptions meanStat = psStatsMeanOption(options->stats->options); // Statistic for mean 317 315 psStatsOptions stdevStat = psStatsStdevOption(options->stats->options); // Statistic for stdev … … 370 368 371 369 for (int i = 0; i < psfTry->sources->n; i++) { 372 if (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL)370 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) 373 371 continue; 374 372 r2rflux->data.F32[i] = PS_SQR(RADIUS) * pow(10.0, 0.4*psfTry->fitMag->data.F32[i]); … … 379 377 FILE *f = fopen ("apresid.dat", "w"); 380 378 for (int i = 0; i < psfTry->sources->n; i++) { 381 int keep = (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL);379 int keep = (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL); 382 380 383 381 pmSource *source = psfTry->sources->data[i]; … … 427 425 psVector *apfit = psPolynomial1DEvalVector (poly, r2rflux); 428 426 for (int i = 0; i < psfTry->sources->n; i++) { 429 int keep = (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL);427 int keep = (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL); 430 428 431 429 pmSource *source = psfTry->sources->data[i]; … … 603 601 for (int i = 0; i < sources->n; i++) { 604 602 // skip any masked sources (failed to fit one of the model steps or get a magnitude) 605 if (srcMask->data. U8[i]) continue;603 if (srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue; 606 604 607 605 pmSource *source = sources->data[i]; … … 624 622 625 623 psVector *dz = NULL; 626 psVector *mask = psVectorAlloc (sources->n, PS_TYPE_ U8);624 psVector *mask = psVectorAlloc (sources->n, PS_TYPE_VECTOR_MASK); 627 625 628 626 // check the fit residuals and increase Nx,Ny until the error is minimized … … 632 630 // copy srcMask to mask (we do not want the mask values set in pmPSFFitShapeParamsMap to be sticky) 633 631 for (int i = 0; i < mask->n; i++) { 634 mask->data. U8[i] = srcMask->data.U8[i];632 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 635 633 } 636 634 if (!pmPSFFitShapeParamsMap (psf, i, &scatterTotal, mask, x, y, mag, e0, e1, e2, dz)) { … … 651 649 // copy srcMask to mask (we do not want the mask values set in pmPSFFitShapeParamsMap to be sticky) 652 650 for (int i = 0; i < mask->n; i++) { 653 mask->data. U8[i] = srcMask->data.U8[i];651 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 654 652 } 655 653 if (!pmPSFFitShapeParamsMap (psf, entryMin, &scatterTotal, mask, x, y, mag, e0, e1, e2, dz)) { … … 663 661 // copy mask back to srcMask 664 662 for (int i = 0; i < mask->n; i++) { 665 srcMask->data. U8[i] = mask->data.U8[i];663 srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = mask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 666 664 } 667 665 … … 736 734 pmTrend2DEval (psf->params->data[PM_PAR_E1], x->data.F32[i], y->data.F32[i]), 737 735 pmTrend2DEval (psf->params->data[PM_PAR_E2], x->data.F32[i], y->data.F32[i]), 738 srcMask->data. U8[i]);736 srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i]); 739 737 } 740 738 fclose (f); … … 851 849 852 850 // the mask marks the values not used to calculate the ApTrend 853 psVector *fitMask = psVectorAlloc (x_fit->n, PS_TYPE_ U8);851 psVector *fitMask = psVectorAlloc (x_fit->n, PS_TYPE_VECTOR_MASK); 854 852 // copy mask values to fitMask as a starting point 855 853 for (int i = 0; i < fitMask->n; i++) { 856 fitMask->data. U8[i] = mask->data.U8[i];854 fitMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = mask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 857 855 } 858 856 … … 943 941 // XXX copy fitMask values back to mask 944 942 for (int i = 0; i < fitMask->n; i++) { 945 mask->data. U8[i] = fitMask->data.U8[i];943 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = fitMask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 946 944 } 947 945 psFree (fitMask); … … 951 949 952 950 // calculate the scatter of the parameters 953 bool pmPSFShapeParamsScatter(float *scatterTotal, psVector *e0res, psVector *e1res, psVector *e2res, psVector *mask, ps MaskType maskValue, psStatsOptions stdevOpt)951 bool pmPSFShapeParamsScatter(float *scatterTotal, psVector *e0res, psVector *e1res, psVector *e2res, psVector *mask, psVectorMaskType maskValue, psStatsOptions stdevOpt) 954 952 { 955 953 … … 994 992 psVector *dE1subset = psVectorAllocEmpty (nGroup, PS_TYPE_F32); 995 993 psVector *dE2subset = psVectorAllocEmpty (nGroup, PS_TYPE_F32); 996 psVector *mkSubset = psVectorAllocEmpty (nGroup, PS_TYPE_ U8);994 psVector *mkSubset = psVectorAllocEmpty (nGroup, PS_TYPE_VECTOR_MASK); 997 995 998 996 int n = 0; … … 1007 1005 dE2subset->data.F32[j] = e2res->data.F32[N]; 1008 1006 1009 mkSubset->data. U8[j] = mask->data.U8[N];1010 if (!mask->data. U8[N]) nValid ++;1007 mkSubset->data.PS_TYPE_VECTOR_MASK_DATA[j] = mask->data.PS_TYPE_VECTOR_MASK_DATA[N]; 1008 if (!mask->data.PS_TYPE_VECTOR_MASK_DATA[N]) nValid ++; 1011 1009 } 1012 1010 if (nValid < 3) continue; -
trunk/psModules/src/objects/pmPSFtry.h
r21174 r21183 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-27 0 0:02:16$8 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ … … 48 48 pmPSF *psf; ///< Add comment. 49 49 psArray *sources; ///< pointers to the original sources 50 psVector *mask; ///< Add comment.50 psVector *mask; ///< PS_TYPE_VECTOR_MASK to flag good and bad sources 51 51 psVector *metric; ///< Add comment. 52 52 psVector *metricErr; ///< Add comment. … … 89 89 * 90 90 */ 91 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, ps MaskType maskVal, psMaskType mark);91 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType mark); 92 92 93 93 /** pmPSFtryMetric() … … 129 129 bool pmPSFFitShapeParams (pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask); 130 130 bool pmPSFFitShapeParamsMap (pmPSF *psf, int scale, float *scatterTotal, psVector *mask, psVector *x, psVector *y, psVector *mag, psVector *e0obs, psVector *e1obs, psVector *e2obs, psVector *dz); 131 bool pmPSFShapeParamsScatter(float *scatterTotal, psVector *e0res, psVector *e1res, psVector *e2res, psVector *mask, ps MaskType maskValue, psStatsOptions stdevOpt);131 bool pmPSFShapeParamsScatter(float *scatterTotal, psVector *e0res, psVector *e1res, psVector *e2res, psVector *mask, psVectorMaskType maskValue, psStatsOptions stdevOpt); 132 132 bool pmPSFShapeParamsErrors (float *errorFloor, psVector *mag, psVector *e0res, psVector *e1res, psVector *e2res, psVector *mask, int nGroup, psStatsOptions stdevOpt); 133 133 -
trunk/psModules/src/objects/pmResiduals.c
r15562 r21183 4 4 * 5 5 * @author EAM, IfA 6 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-11-10 01:09:20$6 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2009-01-27 06:39:38 $ 8 8 * Copyright 2004 IfA, University of Hawaii 9 9 */ … … 43 43 resid->Ry = psImageAlloc (nX, nY, PS_TYPE_F32); 44 44 resid->weight = psImageAlloc (nX, nY, PS_TYPE_F32); 45 resid->mask = psImageAlloc (nX, nY, PS_TYPE_U8); 45 resid->mask = psImageAlloc (nX, nY, PM_TYPE_RESID_MASK); 46 47 // NOTE : the residual mask is internal only : 1 byte is sufficient 46 48 47 49 resid->xBin = xBin; -
trunk/psModules/src/objects/pmResiduals.h
r15562 r21183 4 4 * 5 5 * @author EAM, IfA 6 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-11-10 01:09:20$6 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2009-01-27 06:39:38 $ 8 8 * Copyright 2004 IfA, University of Hawaii 9 9 */ … … 31 31 bool psMemCheckResiduals(psPtr ptr); 32 32 33 // macros to abstract the resid mask type : these values must be consistent 34 #define PM_TYPE_RESID_MASK PS_TYPE_U8 /**< the psElemType to use for mask image */ 35 #define PM_TYPE_RESID_MASK_DATA U8 /**< the data member to use for mask image */ 36 #define PM_TYPE_RESID_MASK_NAME "psU8" /**< the data type for mask as a string */ 37 typedef psU8 pmResidMaskType; ///< the C datatype for a mask image 38 #define PM_NOT_RESID_MASK(A)(UINT8_MAX-(A)) 39 33 40 /// @} 34 41 # endif -
trunk/psModules/src/objects/pmSource.c
r20937 r21183 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.6 6$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-12-08 02:51:14$8 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 171 171 172 172 // the maskObj is a unique mask array; create a new mask image 173 source->maskObj = in->maskObj ? psImageCopy (NULL, in->maskObj, PS_TYPE_ MASK) : NULL;173 source->maskObj = in->maskObj ? psImageCopy (NULL, in->maskObj, PS_TYPE_IMAGE_MASK) : NULL; 174 174 175 175 source->type = in->type; … … 205 205 mySource->maskView = psImageSubset(readout->mask, srcRegion); 206 206 // the object mask is a copy, and used to define the source pixels 207 mySource->maskObj = psImageCopy(NULL, mySource->maskView, PS_TYPE_ MASK);207 mySource->maskObj = psImageCopy(NULL, mySource->maskView, PS_TYPE_IMAGE_MASK); 208 208 } 209 209 mySource->region = srcRegion; … … 255 255 // re-copy the main mask pixels. NOTE: the user will need to reset the object mask 256 256 // pixels (eg, with psImageKeepCircle) 257 mySource->maskObj = psImageCopy (mySource->maskObj, mySource->maskView, PS_TYPE_ MASK);257 mySource->maskObj = psImageCopy (mySource->maskObj, mySource->maskView, PS_TYPE_IMAGE_MASK); 258 258 259 259 // drop the old modelFlux pixels and force the user to re-create … … 505 505 *****************************************************************************/ 506 506 507 bool pmSourceRoughClass(psRegion *region, psArray *sources, psMetadata *recipe, pmPSFClump clump, ps MaskType maskSat)507 bool pmSourceRoughClass(psRegion *region, psArray *sources, psMetadata *recipe, pmPSFClump clump, psImageMaskType maskSat) 508 508 { 509 509 psTrace("psModules.objects", 5, "---- begin ----"); … … 738 738 psF32 *vPix = source->pixels->data.F32[row]; 739 739 psF32 *vWgt = source->weight->data.F32[row]; 740 ps U8 *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.U8[row];740 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 741 741 742 742 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 848 848 # endif 849 849 // construct a realization of the source model 850 bool pmSourceCacheModel (pmSource *source, ps MaskType maskVal) {850 bool pmSourceCacheModel (pmSource *source, psImageMaskType maskVal) { 851 851 PS_ASSERT_PTR_NON_NULL(source, false); 852 852 // select appropriate model … … 867 867 // construct a realization of the source model 868 868 // XXX this function should optionally save an existing psf image from modelFlux 869 bool pmSourceCachePSF (pmSource *source, ps MaskType maskVal) {869 bool pmSourceCachePSF (pmSource *source, psImageMaskType maskVal) { 870 870 PS_ASSERT_PTR_NON_NULL(source, false); 871 871 … … 885 885 886 886 // should we call pmSourceCacheModel if it does not exist? 887 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, ps MaskType maskVal, int dx, int dy)887 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psImageMaskType maskVal, int dx, int dy) 888 888 { 889 889 PS_ASSERT_PTR_NON_NULL(source, false); … … 915 915 } 916 916 917 ps U8**mask = NULL;917 psImageMaskType **mask = NULL; 918 918 if (source->maskObj) { 919 mask = source->maskObj->data. U8;919 mask = source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA; 920 920 } 921 921 … … 957 957 } 958 958 959 bool pmSourceAdd (pmSource *source, pmModelOpMode mode, ps MaskType maskVal) {959 bool pmSourceAdd (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal) { 960 960 return pmSourceOp (source, mode, true, maskVal, 0, 0); 961 961 } 962 962 963 bool pmSourceSub (pmSource *source, pmModelOpMode mode, ps MaskType maskVal) {963 bool pmSourceSub (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal) { 964 964 return pmSourceOp (source, mode, false, maskVal, 0, 0); 965 965 } 966 966 967 bool pmSourceAddWithOffset (pmSource *source, pmModelOpMode mode, ps MaskType maskVal, int dx, int dy) {967 bool pmSourceAddWithOffset (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal, int dx, int dy) { 968 968 return pmSourceOp (source, mode, true, maskVal, dx, dy); 969 969 } 970 970 971 bool pmSourceSubWithOffset (pmSource *source, pmModelOpMode mode, ps MaskType maskVal, int dx, int dy) {971 bool pmSourceSubWithOffset (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal, int dx, int dy) { 972 972 return pmSourceOp (source, mode, false, maskVal, dx, dy); 973 973 } -
trunk/psModules/src/objects/pmSource.h
r20945 r21183 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $6 * @date $Date: 200 8-12-09 21:16:09$5 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2009-01-27 06:39:38 $ 7 7 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 8 8 */ … … 210 210 psMetadata *metadata, ///< Contains classification parameters 211 211 pmPSFClump clump, ///< Statistics about the PSF clump 212 ps MaskType maskSat///< Mask value for saturated pixels212 psImageMaskType maskSat ///< Mask value for saturated pixels 213 213 ); 214 214 … … 231 231 pmModel *pmSourceGetModel (bool *isPSF, const pmSource *source); 232 232 233 bool pmSourceAdd (pmSource *source, pmModelOpMode mode, ps MaskType maskVal);234 bool pmSourceSub (pmSource *source, pmModelOpMode mode, ps MaskType maskVal);235 bool pmSourceAddWithOffset (pmSource *source, pmModelOpMode mode, ps MaskType maskVal, int dx, int dy);236 bool pmSourceSubWithOffset (pmSource *source, pmModelOpMode mode, ps MaskType maskVal, int dx, int dy);237 238 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, ps MaskType maskVal, int dx, int dy);239 bool pmSourceCacheModel (pmSource *source, ps MaskType maskVal);240 bool pmSourceCachePSF (pmSource *source, ps MaskType maskVal);233 bool pmSourceAdd (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal); 234 bool pmSourceSub (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal); 235 bool pmSourceAddWithOffset (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal, int dx, int dy); 236 bool pmSourceSubWithOffset (pmSource *source, pmModelOpMode mode, psImageMaskType maskVal, int dx, int dy); 237 238 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psImageMaskType maskVal, int dx, int dy); 239 bool pmSourceCacheModel (pmSource *source, psImageMaskType maskVal); 240 bool pmSourceCachePSF (pmSource *source, psImageMaskType maskVal); 241 241 242 242 int pmSourceSortBySN (const void **a, const void **b); -
trunk/psModules/src/objects/pmSourceFitModel.c
r20937 r21183 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-12-08 02:51:14$8 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 pmModel *model, 57 57 pmSourceFitMode mode, 58 ps MaskType maskVal)58 psImageMaskType maskVal) 59 59 { 60 60 psTrace("psModules.objects", 5, "---- %s begin ----\n", __func__); … … 81 81 for (psS32 j = 0; j < source->pixels->numCols; j++) { 82 82 // skip masked points 83 if (source->maskObj->data. U8[i][j] & maskVal) {83 if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j] & maskVal) { 84 84 continue; 85 85 } … … 121 121 // create the minimization constraints 122 122 psMinConstraint *constraint = psMinConstraintAlloc(); 123 constraint->paramMask = psVectorAlloc (params->n, PS_TYPE_ U8);123 constraint->paramMask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK); 124 124 constraint->checkLimits = model->modelLimits; 125 125 … … 131 131 nParams = 1; 132 132 psVectorInit (constraint->paramMask, 1); 133 constraint->paramMask->data. U8[PM_PAR_I0] = 0;133 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_I0] = 0; 134 134 break; 135 135 case PM_SOURCE_FIT_PSF: … … 137 137 nParams = 3; 138 138 psVectorInit (constraint->paramMask, 1); 139 constraint->paramMask->data. U8[PM_PAR_I0] = 0;140 constraint->paramMask->data. U8[PM_PAR_XPOS] = 0;141 constraint->paramMask->data. U8[PM_PAR_YPOS] = 0;139 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_I0] = 0; 140 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_XPOS] = 0; 141 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_YPOS] = 0; 142 142 break; 143 143 case PM_SOURCE_FIT_EXT: … … 145 145 nParams = params->n - 1; 146 146 psVectorInit (constraint->paramMask, 0); 147 constraint->paramMask->data. U8[PM_PAR_SKY] = 1;147 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_SKY] = 1; 148 148 break; 149 149 default: … … 175 175 fprintf (stderr, "%f ", params->data.F32[i]); 176 176 } 177 if ((constraint->paramMask != NULL) && constraint->paramMask->data. U8[i])177 if ((constraint->paramMask != NULL) && constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) 178 178 continue; 179 179 dparams->data.F32[i] = sqrt(covar->data.F32[i][i]); … … 192 192 if (constraint->paramMask != NULL) { 193 193 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F32); 194 psVector *altmask = psVectorAlloc (params->n, PS_TYPE_ U8);195 altmask->data. U8[0] = 1;194 psVector *altmask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK); 195 altmask->data.PS_TYPE_VECTOR_MASK_DATA[0] = 1; 196 196 for (int i = 1; i < dparams->n; i++) { 197 altmask->data. U8[i] = (constraint->paramMask->data.U8[i]) ? 0 : 1;197 altmask->data.PS_TYPE_VECTOR_MASK_DATA[i] = (constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) ? 0 : 1; 198 198 } 199 199 psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, model->modelFunc); 200 200 201 201 for (int i = 0; i < dparams->n; i++) { 202 if (!constraint->paramMask->data. U8[i])202 if (!constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) 203 203 continue; 204 204 // note that delta is the value *subtracted* from the parameter -
trunk/psModules/src/objects/pmSourceFitModel.h
r13898 r21183 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $6 * @date $Date: 200 7-06-20 02:22:26$5 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2009-01-27 06:39:38 $ 7 7 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 8 8 */ … … 41 41 pmModel *model, ///< model to be fitted 42 42 pmSourceFitMode mode, ///< define parameters to be fitted 43 ps MaskType maskVal///< Value to mask43 psImageMaskType maskVal ///< Value to mask 44 44 ); 45 45 … … 71 71 psArray *modelSet, ///< model to be fitted 72 72 pmSourceFitMode mode, ///< define parameters to be fitted 73 ps MaskType maskVal///< Vale to mask73 psImageMaskType maskVal ///< Vale to mask 74 74 75 75 ); -
trunk/psModules/src/objects/pmSourceFitSet.c
r21163 r21183 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-24 20:52:26 $ 10 * 8 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 11 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 12 11 * … … 394 393 for (int j = 0; j < paramOne->n; j++) { 395 394 if (j == PM_PAR_I0) continue; 396 constraint->paramMask->data. U8[n + j] = 1;395 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[n + j] = 1; 397 396 } 398 397 break; … … 403 402 if (j == PM_PAR_YPOS) continue; 404 403 if (j == PM_PAR_I0) continue; 405 constraint->paramMask->data. U8[n + j] = 1;404 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[n + j] = 1; 406 405 } 407 406 break; 408 407 case PM_SOURCE_FIT_EXT: 409 408 // EXT model fits all params (except sky) 410 constraint->paramMask->data. U8[n + PM_PAR_SKY] = 1;409 constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[n + PM_PAR_SKY] = 1; 411 410 break; 412 411 default: … … 445 444 psArray *modelSet, 446 445 pmSourceFitMode mode, 447 ps MaskType maskVal)446 psImageMaskType maskVal) 448 447 { 449 448 psTrace("psModules.objects", 3, "---- %s begin ----\n", __func__); … … 469 468 for (psS32 j = 0; j < source->pixels->numCols; j++) { 470 469 // skip masked points 471 if (source->maskObj->data. U8[i][j] & maskVal) {470 if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j] & maskVal) { 472 471 continue; 473 472 } … … 515 514 // create the minimization constraints 516 515 psMinConstraint *constraint = psMinConstraintAlloc(); 517 constraint->paramMask = psVectorAlloc (thisSet->nParamSet, PS_TYPE_ U8);516 constraint->paramMask = psVectorAlloc (thisSet->nParamSet, PS_TYPE_VECTOR_MASK); 518 517 constraint->checkLimits = pmSourceFitSetCheckLimits; 519 518 … … 528 527 if (psTraceGetLevel("psModules.objects") >= 5) { 529 528 for (int i = 0; i < params->n; i++) { 530 fprintf (stderr, "%d %f %d\n", i, params->data.F32[i], constraint->paramMask->data. U8[i]);529 fprintf (stderr, "%d %f %d\n", i, params->data.F32[i], constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]); 531 530 } 532 531 } … … 560 559 psVector *dparams = psVectorAlloc (thisSet->nParamSet, PS_TYPE_F32); 561 560 for (int i = 0; i < dparams->n; i++) { 562 if ((constraint->paramMask != NULL) && constraint->paramMask->data. U8[i])561 if ((constraint->paramMask != NULL) && constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) 563 562 continue; 564 563 dparams->data.F32[i] = sqrt(covar->data.F32[i][i]); … … 568 567 if (constraint->paramMask != NULL) { 569 568 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F32); 570 psVector *altmask = psVectorAlloc (params->n, PS_TYPE_ U8);571 altmask->data. U8[0] = 1;569 psVector *altmask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK); 570 altmask->data.PS_TYPE_VECTOR_MASK_DATA[0] = 1; 572 571 for (int i = 1; i < dparams->n; i++) { 573 altmask->data. U8[i] = (constraint->paramMask->data.U8[i]) ? 0 : 1;572 altmask->data.PS_TYPE_VECTOR_MASK_DATA[i] = (constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) ? 0 : 1; 574 573 } 575 574 psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, pmSourceFitSetFunction); 576 575 577 576 for (int i = 0; i < dparams->n; i++) { 578 if (!constraint->paramMask->data. U8[i])577 if (!constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) 579 578 continue; 580 579 // note that delta is the value *subtracted* from the parameter -
trunk/psModules/src/objects/pmSourceFitSet.h
r21163 r21183 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $6 * @date $Date: 2009-01-2 4 20:52:26$5 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2009-01-27 06:39:38 $ 7 7 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 8 8 */ … … 54 54 */ 55 55 bool pmSourceFitSet( 56 pmSource *source, ///< The input pmSource57 psArray *modelSet, ///< model to be fitted58 pmSourceFitMode mode, ///< define parameters to be fitted59 ps MaskType maskVal///< Vale to mask56 pmSource *source, ///< The input pmSource 57 psArray *modelSet, ///< model to be fitted 58 pmSourceFitMode mode, ///< define parameters to be fitted 59 psImageMaskType maskVal ///< Vale to mask 60 60 61 61 ); -
trunk/psModules/src/objects/pmSourceMatch.c
r21105 r21183 122 122 match->image = psVectorAllocEmpty(num, PS_TYPE_U32); 123 123 match->index = psVectorAllocEmpty(num, PS_TYPE_U32); 124 match->mask = psVectorAllocEmpty(num, PS_TYPE_ MASK);124 match->mask = psVectorAllocEmpty(num, PS_TYPE_VECTOR_MASK); 125 125 126 126 return match; … … 143 143 match->image->data.S32[num] = image; 144 144 match->index->data.S32[num] = index; 145 match->mask->data.PS_TYPE_ MASK_DATA[num] = 0;145 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 0; 146 146 match->num++; 147 147 … … 316 316 double star = 0.0, starErr = 0.0; // Accumulators for star 317 317 for (int j = 0; j < match->num; j++) { 318 if (match->mask->data.PS_TYPE_ MASK_DATA[j]) {318 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 319 319 continue; 320 320 } … … 347 347 pmSourceMatch *match = matches->data[i]; // Matched stars 348 348 for (int j = 0; j < match->num; j++) { 349 if (match->mask->data.PS_TYPE_ MASK_DATA[j]) {349 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 350 350 continue; 351 351 } … … 373 373 pmSourceMatch *match = matches->data[i]; // Matched stars 374 374 for (int j = 0; j < match->num; j++) { 375 if (match->mask->data.PS_TYPE_ MASK_DATA[j]) {375 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 376 376 continue; 377 377 } … … 474 474 pmSourceMatch *match = matches->data[i]; // Matched stars 475 475 for (int j = 0; j < match->num; j++) { 476 if (match->mask->data.PS_TYPE_ MASK_DATA[j]) {476 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 477 477 continue; 478 478 } … … 488 488 if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) { 489 489 numRejected++; 490 match->mask->data.PS_TYPE_ MASK_DATA[j] = 0xFF;490 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF; 491 491 } 492 492 } -
trunk/psModules/src/objects/pmSourceMoments.c
r20937 r21183 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-12-08 02:51:14$8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 100 100 psF32 *vPix = source->pixels->data.F32[row]; 101 101 psF32 *vWgt = source->weight->data.F32[row]; 102 ps U8 *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.U8[row];102 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 103 103 104 104 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 190 190 psF32 *vPix = source->pixels->data.F32[row]; 191 191 psF32 *vWgt = source->weight->data.F32[row]; 192 ps U8 *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.U8[row];192 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 193 193 194 194 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 342 342 psF32 *vPix = source->pixels->data.F32[row]; 343 343 psF32 *vWgt = source->weight->data.F32[row]; 344 ps U8 *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.U8[row];344 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 345 345 346 346 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { -
trunk/psModules/src/objects/pmSourcePhotometry.c
r20937 r21183 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.4 7$ $Name: not supported by cvs2svn $6 * @date $Date: 200 8-12-08 02:51:14$5 * @version $Revision: 1.48 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2009-01-27 06:39:38 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 66 66 67 67 // XXX masked region should be (optionally) elliptical 68 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, ps MaskType maskVal)68 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal) 69 69 { 70 70 PS_ASSERT_PTR_NON_NULL(source, false); … … 306 306 307 307 // return source aperture magnitude 308 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, ps MaskType maskVal)308 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psImageMaskType maskVal) 309 309 { 310 310 PS_ASSERT_PTR_NON_NULL(apMag, false); … … 324 324 325 325 psF32 **imData = image->data.F32; 326 ps U8 **mkData = mask->data.U8;326 psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA; 327 327 328 328 // measure apMag … … 344 344 345 345 // return source aperture magnitude 346 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, ps MaskType maskVal)346 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psImageMaskType maskVal) 347 347 { 348 348 PS_ASSERT_PTR_NON_NULL(pixWeight, false); … … 412 412 if (my >= NY) 413 413 continue; 414 if (mask->data. U8[my][mx] & maskVal)414 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal) 415 415 continue; 416 416 … … 475 475 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 476 476 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 477 if (Ti->data. U8[yi][xi])478 continue; 479 if (Tj->data. U8[yj][xj])477 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi]) 478 continue; 479 if (Tj->data.PS_TYPE_IMAGE_MASK_DATA[yj][xj]) 480 480 continue; 481 481 … … 540 540 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 541 541 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 542 if (Ti->data. U8[yi][xi])543 continue; 544 if (Tj->data. U8[yj][xj])542 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi]) 543 continue; 544 if (Tj->data.PS_TYPE_IMAGE_MASK_DATA[yj][xj]) 545 545 continue; 546 546 … … 578 578 for (int yi = 0; yi < Pi->numRows; yi++) { 579 579 for (int xi = 0; xi < Pi->numCols; xi++) { 580 if (Ti->data. U8[yi][xi])580 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi]) 581 581 continue; 582 582 if (!unweighted_sum) { … … 613 613 614 614 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, 615 ps MaskType maskVal)615 psImageMaskType maskVal) 616 616 { 617 617 PS_ASSERT_PTR_NON_NULL(model, false); … … 624 624 for (int j = 0; j < image->numRows; j++) { 625 625 for (int i = 0; i < image->numCols; i++) { 626 if (mask->data. U8[j][i] & maskVal)626 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[j][i] & maskVal) 627 627 continue; 628 628 if (weight->data.F32[j][i] <= 0) … … 657 657 for (int yi = 0; yi < Pi->numRows; yi++) { 658 658 for (int xi = 0; xi < Pi->numCols; xi++) { 659 if (Ti->data. U8[yi][xi])659 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi]) 660 660 continue; 661 661 if (!unweighted_sum) { … … 734 734 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 735 735 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 736 if (Ti->data. U8[yi][xi])737 continue; 738 if (Tj->data. U8[yj][xj])736 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi]) 737 continue; 738 if (Tj->data.PS_TYPE_IMAGE_MASK_DATA[yj][xj]) 739 739 continue; 740 740 … … 798 798 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 799 799 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 800 if (Ti->data. U8[yi][xi])801 continue; 802 if (Tj->data. U8[yj][xj])800 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi]) 801 continue; 802 if (Tj->data.PS_TYPE_IMAGE_MASK_DATA[yj][xj]) 803 803 continue; 804 804 -
trunk/psModules/src/objects/pmSourcePhotometry.h
r18554 r21183 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $7 * @date $Date: 200 8-07-15 20:25:00$6 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2009-01-27 06:39:38 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 46 46 psImage *image, ///< image pixels to be used 47 47 psImage *mask, ///< mask of pixels to ignore 48 ps MaskType maskVal///< Value to mask48 psImageMaskType maskVal ///< Value to mask 49 49 ); 50 50 51 51 bool pmSourceMagnitudesInit (psMetadata *config); 52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, ps MaskType maskVal);53 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, ps MaskType maskVal);54 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, ps MaskType maskVal);52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal); 53 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psImageMaskType maskVal); 54 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psImageMaskType maskVal); 55 55 56 56 -
trunk/psModules/src/objects/pmSourceSky.c
r20937 r21183 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 200 8-12-08 02:51:14$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-27 06:39:38 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 52 52 psStatsOptions statsOptions, 53 53 psF32 Radius, 54 ps MaskType maskVal,55 ps MaskType markVal)54 psImageMaskType maskVal, 55 psImageMaskType markVal) 56 56 { 57 57 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 86 86 return false; 87 87 } 88 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_ U8(markVal));88 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_IMAGE_MASK(markVal)); 89 89 double value = psStatsGetValue(myStats, statistic); 90 90 psFree(myStats); … … 107 107 psStatsOptions statsOptions, 108 108 psF32 Radius, 109 ps MaskType maskVal,110 ps MaskType markVal109 psImageMaskType maskVal, 110 psImageMaskType markVal 111 111 ) 112 112 { … … 142 142 return false; 143 143 } 144 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_ U8(markVal));144 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_IMAGE_MASK(markVal)); 145 145 double value = psStatsGetValue(myStats, statistic); 146 146 psFree(myStats); -
trunk/psModules/src/objects/pmSourceSky.h
r13898 r21183 2 2 * @author EAM, IfA; GLG, MHPCC 3 3 * 4 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $5 * @date $Date: 200 7-06-20 02:22:26$4 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 5 * @date $Date: 2009-01-27 06:39:38 $ 6 6 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 7 7 */ … … 30 30 psStatsOptions statsOptions, ///< The statistic used in calculating the background sky 31 31 float Radius, ///< The inner radius of the square annulus to exclude 32 ps MaskType maskVal, ///< Value to mask33 ps MaskType mark ///< Mask value for marking32 psImageMaskType maskVal, ///< Value to mask 33 psImageMaskType mark ///< Mask value for marking 34 34 ); 35 35 … … 40 40 psStatsOptions statsOptions, ///< The statistic used in calculating the background sky 41 41 float Radius, ///< The inner radius of the square annulus to exclude 42 ps MaskType maskVal, ///< Value to mask43 ps MaskType mark ///< Mask value for marking42 psImageMaskType maskVal, ///< Value to mask 43 psImageMaskType mark ///< Mask value for marking 44 44 ); 45 45 -
trunk/psModules/src/objects/pmSourceVisual.c
r20582 r21183 57 57 model->data.F32[i] = pmTrend2DEval (trend, x->data.F32[i], y->data.F32[i]); 58 58 resid->data.F32[i] = param->data.F32[i] - model->data.F32[i]; 59 if (mask->data. U8[i]) continue;59 if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue; 60 60 min = PS_MIN (min, resid->data.F32[i]); 61 61 max = PS_MAX (max, resid->data.F32[i]); -
trunk/psModules/src/objects/pmTrend2D.c
r21172 r21183 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $6 * @date $Date: 2009-01-27 0 0:00:44$5 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2009-01-27 06:39:38 $ 7 7 * Copyright 2004 Institute for Astronomy, University of Hawaii 8 8 * … … 179 179 } 180 180 181 bool pmTrend2DFit(pmTrend2D *trend, psVector *mask, ps MaskType maskVal, const psVector *x,181 bool pmTrend2DFit(pmTrend2D *trend, psVector *mask, psVectorMaskType maskVal, const psVector *x, 182 182 const psVector *y, const psVector *f, const psVector *df) 183 183 { … … 234 234 } 235 235 236 psVector *pmTrend2DEvalVector(const pmTrend2D *trend, psVector *mask, ps MaskType maskValue, const psVector *x, const psVector *y)236 psVector *pmTrend2DEvalVector(const pmTrend2D *trend, psVector *mask, psVectorMaskType maskValue, const psVector *x, const psVector *y) 237 237 { 238 238 PM_ASSERT_TREND2D_NON_NULL(trend, NULL); -
trunk/psModules/src/objects/pmTrend2D.h
r21172 r21183 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $8 * @date $Date: 2009-01-27 0 0:00:45$7 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2009-01-27 06:39:38 $ 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 10 10 */ … … 80 80 bool pmTrend2DFit(pmTrend2D *trend, 81 81 psVector *mask, // Warning: mask is modified! 82 ps MaskType maskVal,82 psVectorMaskType maskVal, 83 83 const psVector *x, 84 84 const psVector *y, … … 90 90 float x, float y 91 91 ); 92 psVector *pmTrend2DEvalVector(const pmTrend2D *trend, psVector *mask, ps MaskType maskValue,92 psVector *pmTrend2DEvalVector(const pmTrend2D *trend, psVector *mask, psVectorMaskType maskValue, 93 93 const psVector *x, const psVector *y 94 94 );
Note:
See TracChangeset
for help on using the changeset viewer.
