Changeset 35560 for trunk/psModules
- Timestamp:
- May 9, 2013, 12:19:21 PM (13 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 29 edited
-
models/pmModel_DEV.c (modified) (1 diff)
-
models/pmModel_DEV.h (modified) (1 diff)
-
models/pmModel_EXP.c (modified) (1 diff)
-
models/pmModel_EXP.h (modified) (1 diff)
-
models/pmModel_GAUSS.c (modified) (1 diff)
-
models/pmModel_GAUSS.h (modified) (1 diff)
-
models/pmModel_PGAUSS.c (modified) (1 diff)
-
models/pmModel_PGAUSS.h (modified) (1 diff)
-
models/pmModel_PS1_V1.c (modified) (1 diff)
-
models/pmModel_PS1_V1.h (modified) (1 diff)
-
models/pmModel_QGAUSS.c (modified) (1 diff)
-
models/pmModel_QGAUSS.h (modified) (1 diff)
-
models/pmModel_RGAUSS.c (modified) (1 diff)
-
models/pmModel_RGAUSS.h (modified) (1 diff)
-
models/pmModel_SERSIC.c (modified) (1 diff)
-
models/pmModel_SERSIC.h (modified) (1 diff)
-
models/pmModel_TRAIL.c (modified) (4 diffs)
-
models/pmModel_TRAIL.h (modified) (1 diff)
-
pmModelFuncs.h (modified) (1 diff)
-
pmPSF.c (modified) (2 diffs)
-
pmPSFtryFitEXT.c (modified) (1 diff)
-
pmSourceFitModel.c (modified) (4 diffs)
-
pmSourceFitPCM.c (modified) (1 diff)
-
pmSourceIO.c (modified) (3 diffs)
-
pmSourceIO_MatchedRefs.c (modified) (1 diff)
-
pmSourceMoments.c (modified) (3 diffs)
-
pmSourceSky.c (modified) (1 diff)
-
pmSourceUtils.c (modified) (3 diffs)
-
pmSourceUtils.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/models/pmModel_DEV.c
r34403 r35560 295 295 // make an initial guess for parameters 296 296 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 297 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )297 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 298 298 { 299 299 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_DEV.h
r29004 r35560 5 5 psF32 pmModelFunc_DEV(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_DEV(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_DEV(pmModel *model, pmSource *source );7 bool pmModelGuess_DEV(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_DEV(const psVector *params); 9 9 psF64 pmModelRadius_DEV(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_EXP.c
r34403 r35560 287 287 // make an initial guess for parameters 288 288 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 289 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )289 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 290 290 { 291 291 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_EXP.h
r29004 r35560 5 5 psF32 pmModelFunc_EXP(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_EXP(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_EXP(pmModel *model, pmSource *source );7 bool pmModelGuess_EXP(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_EXP(const psVector *params); 9 9 psF64 pmModelRadius_EXP(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_GAUSS.c
r34403 r35560 192 192 // make an initial guess for parameters 193 193 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 195 195 { 196 196 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_GAUSS.h
r25738 r35560 5 5 psF32 pmModelFunc_GAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_GAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_GAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_GAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_GAUSS(const psVector *params); 9 9 psF64 pmModelRadius_GAUSS(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_PGAUSS.c
r34403 r35560 193 193 // make an initial guess for parameters 194 194 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 195 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )195 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 196 196 { 197 197 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_PGAUSS.h
r25738 r35560 5 5 psF32 pmModelFunc_PGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_PGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_PGAUSS(const psVector *params); 9 9 psF64 pmModelRadius_PGAUSS(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_PS1_V1.c
r34403 r35560 212 212 // make an initial guess for parameters 213 213 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 215 215 { 216 216 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_PS1_V1.h
r25738 r35560 5 5 psF32 pmModelFunc_PS1_V1(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_PS1_V1(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source );7 bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_PS1_V1(const psVector *params); 9 9 psF64 pmModelRadius_PS1_V1(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_QGAUSS.c
r34403 r35560 213 213 // make an initial guess for parameters 214 214 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 215 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )215 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 216 216 { 217 217 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_QGAUSS.h
r25738 r35560 5 5 psF32 pmModelFunc_QGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_QGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_QGAUSS(const psVector *params); 9 9 psF64 pmModelRadius_QGAUSS(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_RGAUSS.c
r34403 r35560 202 202 // make an initial guess for parameters 203 203 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 204 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )204 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 205 205 { 206 206 psF32 *PAR = model->params->data.F32; -
trunk/psModules/src/objects/models/pmModel_RGAUSS.h
r25738 r35560 5 5 psF32 pmModelFunc_RGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_RGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_RGAUSS(const psVector *params); 9 9 psF64 pmModelRadius_RGAUSS(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_SERSIC.c
r34403 r35560 307 307 // make an initial guess for parameters 308 308 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 309 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )309 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 310 310 { 311 311 pmMoments *moments = source->moments; -
trunk/psModules/src/objects/models/pmModel_SERSIC.h
r25738 r35560 5 5 psF32 pmModelFunc_SERSIC(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_SERSIC(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_SERSIC(pmModel *model, pmSource *source );7 bool pmModelGuess_SERSIC(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_SERSIC(const psVector *params); 9 9 psF64 pmModelRadius_SERSIC(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/models/pmModel_TRAIL.c
r35215 r35560 168 168 dPAR[PM_PAR_THETA] = PAR[PM_PAR_I0] * dPdT; 169 169 dPAR[PM_PAR_SIGMA] = 0; // we don't actually allow this to vary, so we do not need to calculate it 170 171 for (int i = 0; i < 7; i++) { 172 if (isnan(dPAR[i])) { 173 fprintf (stderr, "*"); 174 } 175 } 176 } 177 if (isnan(f)) { 178 fprintf (stderr, "!"); 170 179 } 171 180 return(f); … … 228 237 } 229 238 239 # define NA 21 240 # define NR 21 241 static float flux[NA][NR]; 242 static float npix[NA][NR]; 243 244 bool pmTrailGetAngle (float *To, float *Io, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal, float sigma) { 245 246 float Xo, Yo; 247 if (!pmModelSetPosition(&Xo, &Yo, source)) return false; 248 249 psImage *image = source->pixels; 250 psImage *mask = source->maskObj; 251 psF32 **imData = image->data.F32; 252 psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA; 253 254 // do a loop over the pixels, generating (dX,dY) dot (cos(theta),sin(theta)) 255 int dP; 256 int dX = Xo - mask->col0; 257 dP = mask->numCols - dX; 258 int DX = PS_MAX(dP, dX); 259 int NX = mask->numCols; 260 261 int dY = Yo - mask->row0; 262 dP = mask->numRows - dY; 263 int DY = PS_MAX(dP, dY); 264 int NY = mask->numRows; 265 266 // just hard wire this for now... 267 float radius = 10.0; 268 float radius2 = PS_SQR(radius); 269 270 // we have an array of Angles x Radii 271 float dT = M_PI / NA; 272 for (int na = 0; na < NA; na++) { 273 memset (flux[na], 0, NR*sizeof(float)); 274 memset (npix[na], 0, NR*sizeof(float)); 275 } 276 277 // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius) 278 // ix and iy track pixels relative to the centroid 279 for (int ix = -DX; ix < DX + 1; ix++) { 280 if (ix > radius) continue; 281 int mx = ix + dX; 282 for (int iy = -DY; iy < DY + 1; iy++) { 283 if (iy > radius) continue; 284 if (ix*ix + iy*iy > radius2) continue; 285 int my = iy + dY; 286 287 // include count only the unmasked pixels within the image area 288 if (mx < 0) continue; 289 if (my < 0) continue; 290 if (mx >= NX) continue; 291 if (my >= NY) continue; 292 293 // count pixels which are masked only with bad pixels 294 if (mkData[my][mx] & maskVal)continue; 295 296 // we have defined NA to be 21 297 int na = 0; 298 for (float angle = 0.0; na < NA; angle += dT, na ++) { 299 300 // XXX optimization : pre-compute the angle sines and cosines 301 float Rad = (ix * cos(angle)) + (iy * sin(angle)); 302 int nr = PS_MAX (PS_MIN (NR, Rad + 0.5*NR), 0); 303 304 flux[na][nr] += imData[my][mx]; 305 npix[na][nr] ++; 306 } 307 } 308 } 309 310 // generate a psf model (with integral of 1.0) 311 float Ao = 1.0 / sqrt(2*M_PI) / sigma; 312 float psf[NR]; 313 for (int nr = 0; nr < NR; nr++) { 314 psf[nr] = Ao*exp(-0.5*PS_SQR((nr - 0.5*NR)/sigma)); 315 } 316 317 float fangle[NA]; 318 for (int na = 0; na < NA; na++) { 319 float fpsf = 0.0; 320 for (int nr = 0; nr < NR; nr++) { 321 fpsf += psf[nr]*flux[na][nr]; 322 } 323 fangle[na] = fpsf; 324 // fprintf (stderr, "fpsf: %f, theta = %f\n", fpsf, PS_DEG_RAD*dT*na); 325 } 326 327 float peak = fangle[0]; 328 int pbin = 0; 329 for (int na = 0; na < NA; na++) { 330 if (fangle[na] > peak) { 331 peak = fangle[na]; 332 pbin = na; 333 } 334 } 335 336 // result is peak, pbin -> angle 337 *To = dT * pbin; 338 *Io = peak * Ao; 339 340 return true; 341 } 342 230 343 // make an initial guess for parameters 231 344 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 232 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )345 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 233 346 { 234 347 psF32 *PAR = model->params->data.F32; … … 260 373 //else { size = psfAxes.major; } 261 374 375 float theta, peak; 376 pmTrailGetAngle (&theta, &peak, source, maskVal, markVal, psfAxes.major); 377 262 378 // axes.major is a sigma in the major direction; scale to 263 379 PAR[PM_PAR_LENGTH] = 1.5*2.35*size; // a tophat of length L has L = 1.5 * 2.35 * sigma … … 266 382 267 383 // set the model normalization 268 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 269 return false; 270 } 384 // if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 385 // return false; 386 // } 387 PAR[PM_PAR_I0] = peak; 271 388 272 389 // set the model position -
trunk/psModules/src/objects/models/pmModel_TRAIL.h
r34259 r35560 5 5 psF32 pmModelFunc_TRAIL(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_TRAIL(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_TRAIL(pmModel *model, pmSource *source );7 bool pmModelGuess_TRAIL(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_TRAIL(const psVector *params); 9 9 psF64 pmModelRadius_TRAIL(const psVector *params, psF64 flux); -
trunk/psModules/src/objects/pmModelFuncs.h
r34259 r35560 107 107 // This function provides the model guess parameters based on the details of 108 108 // the given source. 109 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source );109 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 110 110 111 111 // This function constructs the PSF model for the given source based on the -
trunk/psModules/src/objects/pmPSF.c
r35455 r35560 350 350 shape.sx = modelPar[PM_PAR_SXX]; 351 351 shape.sy = modelPar[PM_PAR_SYY]; 352 shape.sxy = modelPar[PM_PAR_SXY]; // This is potentially wrong? 352 shape.sxy = modelPar[PM_PAR_SXY] / 2.0; 353 // XXX I *think* dividing by 2.0 is the right direction, but this 354 // needs to be checked with a real test 353 355 } else { 354 356 shape.sx = modelPar[PM_PAR_SXX] / M_SQRT2; … … 392 394 modelPar[PM_PAR_SXX] = shape.sx; 393 395 modelPar[PM_PAR_SYY] = shape.sy; 394 modelPar[PM_PAR_SXY] = shape.sxy ; // This is potentially wrong?396 modelPar[PM_PAR_SXY] = shape.sxy * 2.0; // XXX NEED factor of 2 here for correct angle conversion 395 397 } else { 396 398 modelPar[PM_PAR_SXX] = shape.sx * M_SQRT2; -
trunk/psModules/src/objects/pmPSFtryFitEXT.c
r34403 r35560 83 83 } 84 84 85 source->modelEXT = pmSourceModelGuess (source, options->type );85 source->modelEXT = pmSourceModelGuess (source, options->type, maskVal, markVal); 86 86 if (source->modelEXT == NULL) { 87 87 psTrace ("psModules.objects", 4, "masking %d (%d,%d) : failed to generate model guess\n", i, source->peak->x, source->peak->y); -
trunk/psModules/src/objects/pmSourceFitModel.c
r34403 r35560 75 75 PS_ASSERT_PTR_NON_NULL(source->pixels, false); 76 76 PS_ASSERT_PTR_NON_NULL(source->maskObj, false); 77 PS_ASSERT_PTR_NON_NULL(source->variance, false); 77 78 // XXX if variance is NULL, use pixels instead (wrong, but not badly wrong) 79 // PS_ASSERT_PTR_NON_NULL(source->variance, false); 78 80 79 81 psBool fitStatus = true; … … 93 95 float Xo = model->params->data.F32[PM_PAR_XPOS]; 94 96 float Yo = model->params->data.F32[PM_PAR_YPOS]; 97 98 // if variance is NULL, we pretend pixels == variance 99 float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32; 95 100 96 101 // fill in the coordinate and value entries … … 103 108 } 104 109 // skip zero-variance points 105 if ( source->variance->data.F32[i][j] == 0) {110 if (vWgt[i][j] == 0) { 106 111 continue; 107 112 } 108 113 // skip nan values in image 109 114 if (!isfinite(source->pixels->data.F32[i][j])) { 115 fprintf (stderr, "WARNING: unmasked nan in image : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal); 110 116 continue; 111 117 } 112 118 113 119 // skip nan values in image 114 if (!isfinite( source->variance->data.F32[i][j])) {115 fprintf (stderr, " impossible!%x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);120 if (!isfinite(vWgt[i][j])) { 121 fprintf (stderr, "WARNING: unmasked nan in variance : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal); 116 122 continue; 117 123 } … … 140 146 // source sky variance 141 147 if (options->poissonErrors) { 142 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j];148 yErr->data.F32[nPix] = 1.0 / vWgt[i][j]; 143 149 } else { 144 150 yErr->data.F32[nPix] = 1.0 / options->weight; -
trunk/psModules/src/objects/pmSourceFitPCM.c
r34403 r35560 145 145 bool pmSourceModelGuessPCM (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) { 146 146 147 if (!pcm->modelConv->modelGuess(pcm->modelConv, source)) {147 if (!pcm->modelConv->modelGuess(pcm->modelConv, source, maskVal, markVal)) { 148 148 return false; 149 149 } -
trunk/psModules/src/objects/pmSourceIO.c
r34720 r35560 980 980 return false; 981 981 } 982 982 983 // if this is not TRUE, the output files only contain the psf measurements. 983 984 bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_ANALYSIS"); … … 1005 1006 hdu->header = psFitsReadHeader (NULL, file->fits); 1006 1007 } 1008 1009 // "WCS" is CMF without detected objects 1010 if (file->type == PM_FPA_FILE_WCS) { 1011 psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname); 1012 psFree (headname); 1013 psFree (dataname); 1014 psFree (deteffname); 1015 break; 1016 } 1017 1018 // EXTDATA is the PSF data associated with this image header 1007 1019 1008 1020 // we need to find the corresponding table EXTNAME. … … 1126 1138 readout->data_exists = true; 1127 1139 1140 // if we have a prior set of detections on this readout, we will replace them here 1128 1141 pmDetections *detections = pmDetectionsAlloc(); 1129 1142 detections->allSources = sources; 1130 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY , "input sources", detections);1143 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY | PS_META_REPLACE, "input sources", detections); 1131 1144 psFree (detections); 1132 1145 return true; -
trunk/psModules/src/objects/pmSourceIO_MatchedRefs.c
r34403 r35560 200 200 psFree (rows); 201 201 202 // note that we have already read this dataa 203 psMetadataAddBool (fpa->analysis, PS_LIST_TAIL, "READ.REFMATCH", PS_META_REPLACE, "attempted to read MATCHED_REFS", true); 204 202 205 return true; 203 206 } -
trunk/psModules/src/objects/pmSourceMoments.c
r34403 r35560 151 151 152 152 float *vPix = source->pixels->data.F32[row]; 153 float *vWgt = source->variance ->data.F32[row];153 float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row]; 154 154 155 155 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; … … 266 266 267 267 float **vPix = source->pixels->data.F32; 268 float **vWgt = source->variance ->data.F32;269 psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;268 float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32; 269 psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA; 270 270 271 271 float RF = 0.0; … … 467 467 468 468 float *vPix = source->pixels->data.F32[row]; 469 float *vWgt = source->variance ->data.F32[row];469 float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row]; 470 470 471 471 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; -
trunk/psModules/src/objects/pmSourceSky.c
r34403 r35560 122 122 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 123 123 PS_ASSERT_PTR_NON_NULL(source, false); 124 PS_ASSERT_IMAGE_NON_NULL(source->variance, false);125 124 PS_ASSERT_IMAGE_NON_NULL(source->maskObj, false); 126 125 PS_ASSERT_PTR_NON_NULL(source->peak, false); 127 126 PS_ASSERT_INT_POSITIVE(Radius, false); 127 128 if (source->variance == NULL) { 129 // XXX this is needed so psphotCheckRadiusPSF has a real value 130 source->moments->dSky = 1.0; 131 return true; 132 } 128 133 129 134 // maskVal is used to test for rejected pixels, and must include markVal -
trunk/psModules/src/objects/pmSourceUtils.c
r34403 r35560 46 46 47 47 /****************************************************************************** 48 pmSourceModelGuess(source, model ): This function allocates a new49 pmModel structure based on the given modelType specified in the argument list. 50 The corresponding pmModelGuess function is returned, and used to51 supply the values of theparams array in the pmModel structure.48 pmSourceModelGuess(source, model, maskVal, markVal): This function allocates a new 49 pmModel structure based on the given modelType specified in the argument list. The 50 corresponding pmModelGuess function is returned, and used to supply the values of the 51 params array in the pmModel structure. 52 52 53 53 XXX: Many parameters are based on the src->moments structure, which is in … … 55 55 functions will be in image, not subImage coords. Remember this. 56 56 *****************************************************************************/ 57 pmModel *pmSourceModelGuess(pmSource *source, 58 pmModelType modelType) 57 pmModel *pmSourceModelGuess(pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) 59 58 { 60 59 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); … … 65 64 pmModel *model = pmModelAlloc(modelType); 66 65 67 if (!model->modelGuess(model, source )) {66 if (!model->modelGuess(model, source, maskVal, markVal)) { 68 67 psFree (model); 69 68 return NULL; -
trunk/psModules/src/objects/pmSourceUtils.h
r31451 r35560 27 27 pmModel *pmSourceModelGuess( 28 28 pmSource *source, ///< The input pmSource 29 pmModelType model ///< The type of model to be created. 29 pmModelType model, ///< The type of model to be created. 30 psImageMaskType maskVal, 31 psImageMaskType markVal 30 32 ); 31 33
Note:
See TracChangeset
for help on using the changeset viewer.
