Changeset 39125 for trunk/Ohana/src/addstar
- Timestamp:
- Nov 13, 2015, 5:19:12 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/loadgalphot_readstars.c
r39122 r39125 217 217 stars[i].found = FALSE; 218 218 219 dvo_galphot_init (&stars[i].galphot); 220 219 221 // stars[i].galphot.R = R; 220 222 // stars[i].galphot.D = D; … … 238 240 239 241 // I want to use this flag to set a bit in secfilt. is that possible? or maybe galphot.dummy becomes flags 240 if (!FitChisqMinimum (fit, &stars[i].galphot, &GAL_CHISQ[Nsample*i], &GAL_FLUX[Nsample*i], &GAL_FLUX_ERR[Nsample*i], Nsample, FR_MAJOR_MIN[i], FR_MAJOR_MAX[i], FR_MAJOR_DEL[i], FR_MINOR_MIN[i], FR_MINOR_MAX[i], FR_MINOR_DEL[i])) { 241 stars[i].flag = TRUE; 242 } 242 FitChisqMinimum (fit, &stars[i].galphot, &GAL_CHISQ[Nsample*i], &GAL_FLUX[Nsample*i], &GAL_FLUX_ERR[Nsample*i], Nsample, FR_MAJOR_MIN[i], FR_MAJOR_MAX[i], FR_MAJOR_DEL[i], FR_MINOR_MIN[i], FR_MINOR_MAX[i], FR_MINOR_DEL[i]); 243 243 244 244 // I could either multiply FR_MAJOR_MIN, etc above or the fitted values below … … 330 330 } 331 331 332 if (Nvalid < 6) goto bad_fit;332 if (Nvalid < 6) { galphot->flags |= ID_GALPHOT_TOO_FEW; goto bad_fit; } 333 333 334 334 # if (0) … … 344 344 // fit with 3 iterations, 5 sigma clipping (set above after fit2d_init) 345 345 // on failure (for any reason), the stars[i].flag is set to TRUE (XXX bad choice) 346 if (!fit2d (fit, Xpt, Ypt, chisq, chisqFit, mask, Npts)) goto bad_fit;346 if (!fit2d (fit, Xpt, Ypt, chisq, chisqFit, mask, Npts)) { galphot->flags |= ID_GALPHOT_FAIL_FIT; goto bad_fit; } 347 347 348 348 // get X,Y for the chisq min from the fit: … … 358 358 inRange = inRange && (Ymin < MinorMax + MinorDel); 359 359 360 if (!inRange) goto bad_fit;360 if (!inRange) { galphot->flags |= ID_GALPHOT_OUT_OF_RANGE; goto bad_fit; } 361 361 362 362 // chisqMin @ (Xmin,Ymin) … … 368 368 C = -1; 369 369 Q = B*B - 4*A*C; 370 if (Q < 0.0) goto bad_err; 370 if (Q < 0.0) { galphot->flags |= ID_GALPHOT_BAD_ERROR; goto bad_err; } 371 if (A <= 0.0) { galphot->flags |= ID_GALPHOT_BAD_ERROR; goto bad_err; } 371 372 372 373 float dXmin = (-B + sqrt(Q)) / (2.0 * A); … … 377 378 C = -1; 378 379 Q = B*B - 4*A*C; 379 if (Q < 0.0) goto bad_err; 380 if (Q < 0.0) { galphot->flags |= ID_GALPHOT_BAD_ERROR; goto bad_err; } 381 if (A <= 0.0) { galphot->flags |= ID_GALPHOT_BAD_ERROR; goto bad_err; } 380 382 381 383 float dYmin = (-B + sqrt(Q)) / (2.0 * A); … … 443 445 galphot->majorAxisErr = MajorDel; 444 446 galphot->minorAxisErr = MinorDel; 447 448 galphot->mag = -2.5*log10(flux[iMin]) + ZeroPt; // correct for exptime? 449 galphot->magErr = sqrt(fluxErr[iMin]) / flux[iMin]; 450 galphot->chisq = chisqMin; 445 451 return FALSE; 446 452 }
Note:
See TracChangeset
for help on using the changeset viewer.
