Changeset 10859 for trunk/psModules/src/astrom/pmAstrometryDistortion.c
- Timestamp:
- Dec 29, 2006, 5:27:19 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometryDistortion.c
r10851 r10859 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-12- 29 18:29:59 $9 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-12-30 03:27:19 $ 11 11 * 12 12 * Copyright 2006 Institute for Astronomy, University of Hawaii … … 128 128 fscanf (stdin, "%c", &key); 129 129 130 // fit the collection of positions and offsets with a local 1st order gradient131 // 3hi/3lo sigma clipping on the rflux vs metric fit130 // stats structure and mask for use in measuring the clipping statistic 131 // this analysis has too few data points to use the robust median method 132 132 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 133 133 psVector *mask = psVectorAlloc (Npts, PS_TYPE_MASK); … … 136 136 pmAstromGradient *grad = pmAstromGradientAlloc (); 137 137 138 psVectorStats (stats, L, NULL, NULL, 0); 139 grad->FP.x = stats->sampleMedian; 140 141 psVectorStats (stats, M, NULL, NULL, 0); 142 grad->FP.y = stats->sampleMedian; 143 144 // test how many survive and include / exclude points on that basis 138 // fit the collection of positions and offsets with a local 1st order gradient 139 // apply 3hi/3lo sigma clipping to the fitted data values 140 // the mask is used to mark the points which pass / fail the fit 145 141 if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dP, NULL, L, M)) { 146 142 psFree (grad); … … 151 147 grad->dTPdM.x = local->coeff[0][1]; 152 148 149 // fit the collection of positions and offsets with a local 1st order gradient 150 // apply 3hi/3lo sigma clipping to the fitted data values 151 // the mask is used to mark the points which pass / fail the fit 153 152 if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dQ, NULL, L, M)) { 154 153 psFree (grad); … … 159 158 grad->dTPdM.y = local->coeff[0][1]; 160 159 160 // also measure the L and M median positions as a representative coordinate 161 psVectorStats (stats, L, NULL, NULL, 0); 162 grad->FP.x = stats->sampleMedian; 163 164 psVectorStats (stats, M, NULL, NULL, 0); 165 grad->FP.y = stats->sampleMedian; 166 161 167 psArrayAdd (gradients, 100, grad); 162 168 psFree (grad); 169 psFree (stats); 170 psFree (mask); 163 171 } 164 172 } … … 210 218 fscanf (stdin, "%c", &key); 211 219 220 // mask and stats structure for measuring the clipping statistic 221 // this analysis has too few data points to use the robust median method 212 222 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 213 223 psVector *mask = psVectorAlloc (gradients->n, PS_TYPE_MASK); … … 217 227 // determine the gradient order(s) from the fpa->toTP structure 218 228 localX = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, fpa->toTPA->x->nX-1, fpa->toTPA->x->nY); 219 220 229 localY = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, fpa->toTPA->x->nX, fpa->toTPA->x->nY-1); 221 230 222 // set masks based on fpa->toTP 231 // set masks based on fpa->toTPA 223 232 for (int i = 0; i <= fpa->toTPA->x->nX; i++) { 224 233 for (int j = 0; j <= fpa->toTPA->x->nY; j++) { … … 246 255 247 256 // XXX test: generate fit 248 psVector *dPdLf = psPolynomial2DEvalVector (localX, L, M);249 psVector *dPdMf = psPolynomial2DEvalVector (localY, L, M);257 psVector *dPdLfit = psPolynomial2DEvalVector (localX, L, M); 258 psVector *dPdMfit = psPolynomial2DEvalVector (localY, L, M); 250 259 251 260 // update fpa->toTP distortion terms … … 291 300 292 301 // XXX test: generate fit 293 psVector *dQdLf = psPolynomial2DEvalVector (localX, L, M);294 psVector *dQdMf = psPolynomial2DEvalVector (localY, L, M);302 psVector *dQdLfit = psPolynomial2DEvalVector (localX, L, M); 303 psVector *dQdMfit = psPolynomial2DEvalVector (localY, L, M); 295 304 296 305 FILE *f = fopen ("gradients.dat", "w"); 297 for (int i = 0; i < dPdLf ->n; i++) {306 for (int i = 0; i < dPdLfit->n; i++) { 298 307 fprintf (f, "%f %f | %f %f %f %f | %f %f %f %f\n", 299 308 L->data.F32[i], M->data.F32[i], 300 309 dPdL->data.F32[i], dPdM->data.F32[i], 301 310 dQdL->data.F32[i], dQdM->data.F32[i], 302 dPdLf ->data.F32[i], dPdMf->data.F32[i],303 dQdLf ->data.F32[i], dQdMf->data.F32[i]);311 dPdLfit->data.F32[i], dPdMfit->data.F32[i], 312 dQdLfit->data.F32[i], dQdMfit->data.F32[i]); 304 313 } 305 314 fclose (f); 315 psFree (dPdLfit); 316 psFree (dPdMfit); 317 psFree (dQdLfit); 318 psFree (dQdMfit); 306 319 307 320 // update fpa->toTP distortion terms … … 337 350 psFree (mask); 338 351 339 // XXX need to reset the fromFPA terms here 340 352 // XXX need to reset the fromTPA terms here 353 // XXX choose an appropriate region based on the range of values 354 // in L and M? 355 psRegion region = psRegionSet (0, 4000, 0, 4000); 356 psPlaneTransformInvert(fpa->fromTPA, fpa->toTPA, region, 50); 341 357 342 358 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
