- Timestamp:
- Dec 31, 2008, 10:31:29 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081230/psModules/src/objects/pmPSFtry.c
r20937 r21075 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $8 * @date $Date: 2008-12- 08 02:51:14$7 * @version $Revision: 1.67.4.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-12-31 20:31:29 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 115 115 test->metricErr = psVectorAlloc (sources->n, PS_TYPE_F32); 116 116 test->fitMag = psVectorAlloc (sources->n, PS_TYPE_F32); 117 test->mask = psVectorAlloc (sources->n, PS_TYPE_ U8);117 test->mask = psVectorAlloc (sources->n, PS_TYPE_VECTOR_MASK); 118 118 119 119 psVectorInit (test->mask, 0); … … 148 148 149 149 // 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)150 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal) 151 151 { 152 152 bool status; … … 189 189 190 190 // clear object mask to define valid pixels 191 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));191 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 192 192 193 193 // exclude the poor fits 194 194 if (!status) { 195 psfTry->mask->data. U8[i] = PSFTRY_MASK_EXT_FAIL;195 psfTry->mask->data.PS_TYPE_IMAGE_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 196 196 psTrace ("psModules.objects", 4, "masking %d (%d,%d) : status is poor\n", i, source->peak->x, source->peak->y); 197 197 continue; … … 222 222 223 223 // masked for: bad model fit, outlier in parameters 224 if (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL) {224 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) { 225 225 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : source is masked\n", i, source->peak->x, source->peak->y); 226 226 continue; … … 230 230 source->modelPSF = pmModelFromPSF (source->modelEXT, psfTry->psf); 231 231 if (source->modelPSF == NULL) { 232 psfTry->mask->data. U8[i] = PSFTRY_MASK_BAD_MODEL;232 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_BAD_MODEL; 233 233 abort(); 234 234 continue; … … 244 244 // skip poor fits 245 245 if (!status) { 246 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));247 psfTry->mask->data. U8[i] = PSFTRY_MASK_PSF_FAIL;246 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 247 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_PSF_FAIL; 248 248 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y); 249 249 continue; … … 252 252 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal); 253 253 if (!status || isnan(source->apMag)) { 254 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));255 psfTry->mask->data. U8[i] = PSFTRY_MASK_BAD_PHOT;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_BAD_PHOT; 256 256 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y); 257 257 continue; … … 259 259 260 260 // clear object mask to define valid pixels 261 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_ U8(markVal));261 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 262 262 263 263 psfTry->fitMag->data.F32[i] = source->psfMag; … … 291 291 flux->data.F32[i] = 0.0; 292 292 chisq->data.F32[i] = 0.0; 293 mask->data. U8[i] = 0xff;293 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 294 294 } else { 295 295 flux->data.F32[i] = source->modelPSF->params->data.F32[PM_PAR_I0]; 296 296 chisq->data.F32[i] = source->modelPSF->chisq / source->modelPSF->nDOF; 297 mask->data. U8[i] = 0;297 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0; 298 298 } 299 299 } … … 361 361 362 362 for (int i = 0; i < psfTry->sources->n; i++) { 363 if (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL)363 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) 364 364 continue; 365 365 r2rflux->data.F32[i] = PS_SQR(RADIUS) * pow(10.0, 0.4*psfTry->fitMag->data.F32[i]); … … 370 370 FILE *f = fopen ("apresid.dat", "w"); 371 371 for (int i = 0; i < psfTry->sources->n; i++) { 372 int keep = (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL);372 int keep = (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL); 373 373 374 374 pmSource *source = psfTry->sources->data[i]; … … 418 418 psVector *apfit = psPolynomial1DEvalVector (poly, r2rflux); 419 419 for (int i = 0; i < psfTry->sources->n; i++) { 420 int keep = (psfTry->mask->data. U8[i] & PSFTRY_MASK_ALL);420 int keep = (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL); 421 421 422 422 pmSource *source = psfTry->sources->data[i]; … … 613 613 614 614 psVector *dz = NULL; 615 psVector *mask = psVectorAlloc (sources->n, PS_TYPE_ U8);615 psVector *mask = psVectorAlloc (sources->n, PS_TYPE_VECTOR_MASK); 616 616 617 617 // check the fit residuals and increase Nx,Ny until the error is minimized … … 647 647 // copy mask back to srcMask 648 648 for (int i = 0; i < mask->n; i++) { 649 srcMask->data. U8[i] = mask->data.U8[i];649 srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = mask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 650 650 } 651 651 … … 720 720 pmTrend2DEval (psf->params->data[PM_PAR_E1], x->data.F32[i], y->data.F32[i]), 721 721 pmTrend2DEval (psf->params->data[PM_PAR_E2], x->data.F32[i], y->data.F32[i]), 722 srcMask->data. U8[i]);722 srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i]); 723 723 } 724 724 fclose (f); … … 835 835 836 836 // the mask marks the values not used to calculate the ApTrend 837 psVector *fitMask = psVectorAlloc (x_fit->n, PS_TYPE_ U8);837 psVector *fitMask = psVectorAlloc (x_fit->n, PS_TYPE_VECTOR_MASK); 838 838 psVectorInit (fitMask, 0); 839 839 … … 924 924 // XXX copy fitMask values back to mask 925 925 for (int i = 0; i < fitMask->n; i++) { 926 mask->data. U8[i] = fitMask->data.U8[i];926 mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = fitMask->data.PS_TYPE_VECTOR_MASK_DATA[i]; 927 927 } 928 928 psFree (fitMask); … … 975 975 psVector *dE1subset = psVectorAllocEmpty (nGroup, PS_TYPE_F32); 976 976 psVector *dE2subset = psVectorAllocEmpty (nGroup, PS_TYPE_F32); 977 psVector *mkSubset = psVectorAllocEmpty (nGroup, PS_TYPE_ U8);977 psVector *mkSubset = psVectorAllocEmpty (nGroup, PS_TYPE_VECTOR_MASK); 978 978 979 979 int n = 0; … … 988 988 dE2subset->data.F32[j] = e2res->data.F32[N]; 989 989 990 mkSubset->data. U8[j] = mask->data.U8[N];991 if (!mask->data. U8[N]) nValid ++;990 mkSubset->data.PS_TYPE_VECTOR_MASK_DATA[j] = mask->data.PS_TYPE_VECTOR_MASK_DATA[N]; 991 if (!mask->data.PS_TYPE_VECTOR_MASK_DATA[N]) nValid ++; 992 992 } 993 993 if (nValid < 3) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
