Changeset 29448
- Timestamp:
- Oct 17, 2010, 9:03:30 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823/psModules/src/objects/pmSourceIO_CMF_PS1_V3.c
r29124 r29448 66 66 psF32 xPos, yPos; 67 67 psF32 xErr, yErr; 68 psF32 errMag,chisq, apRadius;68 psF32 chisq, apRadius; 69 69 psS32 nPix, nDOF; 70 70 … … 84 84 } 85 85 float zeroptErr = psMetadataLookupF32 (&status2, imageHeader, "ZPT_ERR"); 86 87 // we need a measure of the image quality (FWHM) for this image, in order to get the positional errors 88 float fwhmMajor = psMetadataLookupF32(&status1, readout->analysis, "FWHM_MAJ"); 89 if (!status1) { 90 fwhmMajor = psMetadataLookupF32(&status1, readout->analysis, "IQ_FW1"); 91 } 92 float fwhmMinor = psMetadataLookupF32(&status1, readout->analysis, "FWHM_MIN"); 93 if (!status1) { 94 fwhmMinor = psMetadataLookupF32(&status1, readout->analysis, "IQ_FW2"); 95 } 86 96 87 97 // if the sequence is defined, write these in seq order; otherwise … … 124 134 yErr = dPAR[PM_PAR_YPOS]; 125 135 } else { 126 // in linear-fit mode, there is no error on the centroid 127 xErr = source->peak->dx; 128 yErr = source->peak->dy; 136 xErr = fwhmMajor * source->errMag / 2.35; 137 yErr = fwhmMinor * source->errMag / 2.35; 129 138 } 130 139 if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) { … … 139 148 nPix = model->nPix; 140 149 apRadius = source->apRadius; 141 errMag = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];142 150 } else { 143 xPos = source->peak->xf; 144 yPos = source->peak->yf; 145 xErr = source->peak->dx; 146 yErr = source->peak->dy; 151 bool useMoments = true; 152 useMoments = (useMoments && source->moments); // can't if there are no moments 153 useMoments = (useMoments && source->moments->nPixels); // can't if the moments were not measured 154 useMoments = (useMoments && !(source->mode && PM_SOURCE_MODE_MOMENTS_FAILURE)); // can't if the moments failed... 155 156 if (source->moments) { 157 xPos = source->moments->Mx; 158 yPos = source->moments->My; 159 xErr = fwhmMajor * source->errMag / 2.35; 160 yErr = fwhmMinor * source->errMag / 2.35; 161 } else { 162 xPos = source->peak->xf; 163 yPos = source->peak->yf; 164 xErr = source->peak->dx; 165 yErr = source->peak->dy; 166 } 147 167 axes.major = NAN; 148 168 axes.minor = NAN; … … 152 172 nPix = 0; 153 173 apRadius = NAN; 154 errMag = NAN;155 174 } 156 175 … … 168 187 psMetadataAdd (row, PS_LIST_TAIL, "X_PSF", PS_DATA_F32, "PSF x coordinate", xPos); 169 188 psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF", PS_DATA_F32, "PSF y coordinate", yPos); 170 psMetadataAdd (row, PS_LIST_TAIL, "X_PSF_SIG", PS_DATA_F32, "Sigma in PSF x coordinate", xErr); // XXX this is only measured for non-linear fits171 psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF_SIG", PS_DATA_F32, "Sigma in PSF y coordinate", yErr); // XXX this is only measured for non-linear fits189 psMetadataAdd (row, PS_LIST_TAIL, "X_PSF_SIG", PS_DATA_F32, "Sigma in PSF x coordinate", xErr); 190 psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF_SIG", PS_DATA_F32, "Sigma in PSF y coordinate", yErr); 172 191 psMetadataAdd (row, PS_LIST_TAIL, "POSANGLE", PS_DATA_F32, "position angle at source (degrees)", posAngle*PS_DEG_RAD); 173 192 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", pltScale*PS_DEG_RAD*3600.0); 174 193 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 175 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", errMag);194 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->errMag); 176 195 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX", PS_DATA_F32, "PSF fit instrumental flux (counts)", source->psfFlux); 177 196 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental flux", source->psfFluxErr); … … 179 198 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW", PS_DATA_F32, "magnitude in reported aperture", source->apMagRaw); 180 199 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", apRadius); 181 // XXX need ap_mag error 182 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); 200 183 201 psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG", PS_DATA_F32, "PSF Magnitude using supplied calibration", calMag); 184 202 psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG_SIG", PS_DATA_F32, "measured scatter of zero point calibration", zeroptErr); 203 204 // NOTE: RA & DEC (both double) need to be on an 8-byte boundary... 185 205 psMetadataAdd (row, PS_LIST_TAIL, "RA_PSF", PS_DATA_F64, "PSF RA coordinate (degrees)", ptSky.r*PS_DEG_RAD); 186 206 psMetadataAdd (row, PS_LIST_TAIL, "DEC_PSF", PS_DATA_F64, "PSF DEC coordinate (degrees)", ptSky.d*PS_DEG_RAD); 207 208 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); 187 209 psMetadataAdd (row, PS_LIST_TAIL, "SKY", PS_DATA_F32, "Sky level", source->sky); 188 210 psMetadataAdd (row, PS_LIST_TAIL, "SKY_SIGMA", PS_DATA_F32, "Sigma of sky level", source->skyErr); … … 237 259 psMetadataAdd (row, PS_LIST_TAIL, "FLAGS", PS_DATA_U32, "psphot analysis flags", source->mode); 238 260 psMetadataAdd (row, PS_LIST_TAIL, "FLAGS2", PS_DATA_U32, "psphot analysis flags", source->mode2); 261 psMetadataAdd (row, PS_LIST_TAIL, "PADDING2", PS_DATA_S32, "more padding", 0); 239 262 240 263 // XXX not sure how to get this : need to load Nimages with weight?
Note:
See TracChangeset
for help on using the changeset viewer.
