Changeset 20796
- Timestamp:
- Nov 18, 2008, 5:50:56 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroAstromGuess.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroAstromGuess.c
r19977 r20796 265 265 psVector *cornerDn = psVectorAllocEmpty (100, PS_TYPE_F32); 266 266 267 psVector *cornerMK = psVectorAllocEmpty (100, PS_TYPE_U8); 268 267 269 if (DEBUG) psastroDumpCorners ("corners.up.guess3.dat", "corners.dn.guess3.dat", fpa); 268 270 … … 272 274 while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) { 273 275 if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; } 276 277 // XXX we are currently inconsistent with marking the good vs the bad data 278 // psastroChipAstrom sets data_exists to false if the fit is bad. this is 279 // probably wrong since it implies there is no data! 280 281 // skip chips for which the astrometry failed (NASTRO == 0) 282 if (!chip->cells->n) goto skip_chip; 283 pmCell *cell = chip->cells->data[0]; 284 if (!cell) goto skip_chip; 285 286 if (!cell->readouts->n) goto skip_chip; 287 pmReadout *readout = cell->readouts->data[0]; 288 if (!readout) goto skip_chip; 289 290 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 291 if (!updates) goto skip_chip; 292 293 int nAstro = psMetadataLookupS32 (&status, updates, "NASTRO"); 294 if (!nAstro) goto skip_chip; 295 296 float astError = psMetadataLookupF32 (&status, updates, "CERROR"); 297 if (fabs(astError) < 1e-6) goto skip_chip; 274 298 275 299 psPlane ptCH, ptFP, ptTP; … … 290 314 psVectorAppend (cornerRn, ptSky.r); 291 315 psVectorAppend (cornerDn, ptSky.d); 316 psVectorAppend (cornerMK, 0); 317 continue; 318 319 skip_chip: 320 // new corner locations based on the calibrated astrometry 321 psVectorAppend (cornerLn, 0.0); 322 psVectorAppend (cornerMn, 0.0); 323 psVectorAppend (cornerPn, 0.0); 324 psVectorAppend (cornerQn, 0.0); 325 psVectorAppend (cornerRn, 0.0); 326 psVectorAppend (cornerDn, 0.0); 327 psVectorAppend (cornerMK, 1); 292 328 } 293 329 … … 314 350 map->y->coeffMask[1][1] = PS_POLY_MASK_SET; 315 351 316 psVectorFitPolynomial2D (map->x, NULL, 0, cornerPn, NULL, cornerPs, cornerQs); 317 psVectorFitPolynomial2D (map->y, NULL, 0, cornerQn, NULL, cornerPs, cornerQs); 352 // fit the valid chips, mask the invalid chips 353 psVectorFitPolynomial2D (map->x, cornerMK, 1, cornerPn, NULL, cornerPs, cornerQs); 354 psVectorFitPolynomial2D (map->y, cornerMK, 1, cornerQn, NULL, cornerPs, cornerQs); 318 355 319 356 // apply the linear fit... … … 328 365 psStats *statsQ = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV); 329 366 330 psVectorStats (statsP, cornerPd, NULL, NULL, 0);331 psVectorStats (statsQ, cornerQd, NULL, NULL, 0);367 psVectorStats (statsP, cornerPd, NULL, cornerMK, 1); 368 psVectorStats (statsQ, cornerQd, NULL, cornerMK, 1); 332 369 333 370 float angle = atan2 (map->y->coeff[1][0], map->x->coeff[1][0]); … … 353 390 psMetadataAddF32 (header, PS_LIST_TAIL, "AST_DS", PS_META_REPLACE, "boresite scatter in DEC (TP units)", statsQ->sampleStdev); 354 391 355 if ( 0) {392 if (DEBUG) { 356 393 FILE *f = fopen ("corners.dat", "w"); 357 394 for (int i = 0; i < cornerRo->n; i++) { … … 370 407 psFree (statsP); 371 408 psFree (statsQ); 409 410 psFree (cornerMK); 372 411 373 412 psFree (cornerLn);
Note:
See TracChangeset
for help on using the changeset viewer.
