Changeset 21422 for trunk/psastro/src
- Timestamp:
- Feb 9, 2009, 11:25:34 AM (17 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 13 edited
-
Makefile.am (modified) (1 diff)
-
psastro.h (modified) (5 diffs)
-
psastroArguments.c (modified) (2 diffs)
-
psastroAstromGuess.c (modified) (21 diffs)
-
psastroCleanup.c (modified) (3 diffs)
-
psastroFixChips.c (modified) (7 diffs)
-
psastroLoadRefstars.c (modified) (6 diffs)
-
psastroLuminosityFunction.c (modified) (2 diffs)
-
psastroMosaicOneChip.c (modified) (2 diffs)
-
psastroMosaicSetMatch.c (modified) (2 diffs)
-
psastroOneChipFit.c (modified) (6 diffs)
-
psastroRemoveClumps.c (modified) (2 diffs)
-
psastroUtils.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/Makefile.am
r20805 r21422 53 53 psastroErrorCodes.c \ 54 54 psastroVersion.c \ 55 psastroVisual.c \56 55 psastroDefineFiles.c \ 57 56 psastroAnalysis.c \ -
trunk/psastro/src/psastro.h
r21409 r21422 1 1 /** @file psastro.h 2 2 * 3 * @brief This file defines the library functions available to external 4 * programs. 3 * @brief This file defines the library functions available to external 4 * programs. 5 5 * 6 * It must be included by programs which are compiled against 6 * It must be included by programs which are compiled against 7 7 * psphot functions. 8 8 * … … 10 10 * 11 11 * @author IfA 12 * @version $Revision: 1.4 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2009-02-0 7 02:03:34 $12 * @version $Revision: 1.49 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2009-02-09 21:25:34 $ 14 14 * Copyright 2009 Institute for Astronomy, University of Hawaii 15 15 */ … … 30 30 # define SIGN(X) (((X) == 0) ? 0 : ((fabs((double)(X))) / (X))) 31 31 32 #if 0 32 33 /** 33 34 * this structure represents a fit to the logN / logS curve for a set of stars … … 43 44 int sPeak; ///< sum of stars to peak bin 44 45 } pmLumFunc; 46 #endif 45 47 46 48 bool psastroDataSave (pmConfig *config); … … 95 97 psString psastroVersionLong(void); 96 98 97 // psastroVisual functions98 bool psastroSetVisual (bool mode);99 bool psastroVisualClose();100 bool psastroVisualPlotLuminosityFunction (psVector *lnMag, psVector *Mag, pmLumFunc *lumFunc, pmLumFunc *rawFunc);101 bool psastroVisualPlotRawStars (psArray *rawstars, pmFPA *fpa, pmChip *chip, psMetadata *recipe);102 bool psastroVisualPlotRefStars (psArray *refstars, psMetadata *recipe);103 bool psastroVisualPlotRemoveClumps (psArray *input, psImage *count, int scale, float limit);104 bool psastroVisualPlotFixChips (pmFPAfile *input, psVector *xOld, psVector *yOld);105 bool psastroVisualPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe);106 bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, psVector *cornerQo, psVector *cornerPn, psVector *cornerQn, psVector *cornerPd, psVector *cornerQd);107 bool psastroVisualPlotMosaicOneChip (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe);108 bool psastroVisualPlotCommonScale (pmFPA *fpa, psVector *oldScale);109 bool psastroVisualPlotMosaicMatches (psArray *rawstars, psArray *refstars, psArray *match, int iteration, psMetadata *recipe);110 111 99 // demo plots 112 100 bool psastroPlotRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip, psMetadata *recipe); -
trunk/psastro/src/psastroArguments.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 100 100 if ((N = psArgumentGet (argc, argv, "-visual"))) { 101 101 psArgumentRemove (N, &argc, argv); 102 psastroSetVisual (true);103 102 pmAstromSetVisual (true); 104 103 } -
trunk/psastro/src/psastroAstromGuess.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 42 42 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSASTRO_RECIPE); 43 43 if (!recipe) { 44 psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!");45 return false;44 psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!"); 45 return false; 46 46 } 47 47 … … 49 49 bool useModel = psMetadataLookupBool (&status, config->arguments, "PSASTRO.USE.MODEL"); 50 50 if (!status) { 51 useModel = psMetadataLookupBool (&status, recipe, "PSASTRO.USE.MODEL");51 useModel = psMetadataLookupBool (&status, recipe, "PSASTRO.USE.MODEL"); 52 52 } 53 53 … … 55 55 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); 56 56 if (!input) { 57 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");58 return false;57 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data"); 58 return false; 59 59 } 60 60 … … 62 62 double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE"); 63 63 if (!status) { 64 psError(PS_ERR_IO, true, "Failed to lookup pixel scale"); 65 return false; 66 } 64 psError(PS_ERR_IO, true, "Failed to lookup pixel scale"); 65 return false; 66 } 67 67 68 68 psVector *cornerL = psVectorAllocEmpty (100, PS_TYPE_F32); … … 80 80 bool bilevelAstrometry = false; 81 81 if (!useModel) { 82 psastroAstromGuessSetFPA (fpa, &bilevelAstrometry);82 psastroAstromGuessSetFPA (fpa, &bilevelAstrometry); 83 83 } 84 84 … … 88 88 if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; } 89 89 90 if (!useModel) {91 if (!psastroAstromGuessSetChip (fpa, chip, view, pixelScale, bilevelAstrometry)) continue;92 }90 if (!useModel) { 91 if (!psastroAstromGuessSetChip (fpa, chip, view, pixelScale, bilevelAstrometry)) continue; 92 } 93 93 94 94 if (newFPA) { 95 95 newFPA = false; 96 while (fpa->toSky->R < 0) fpa->toSky->R += 2.0*M_PI;97 while (fpa->toSky->R > 2.0*M_PI) fpa->toSky->R -= 2.0*M_PI;96 while (fpa->toSky->R < 0) fpa->toSky->R += 2.0*M_PI; 97 while (fpa->toSky->R > 2.0*M_PI) fpa->toSky->R -= 2.0*M_PI; 98 98 RAminSky = fpa->toSky->R - M_PI; 99 99 RAmaxSky = fpa->toSky->R + M_PI; 100 100 } 101 101 102 // report and save the current best guess for the chip 0,0 pixel coordinates103 { 104 psPlane ptCH, ptFP, ptTP;105 psSphere ptSky;106 107 ptCH.x = 0;108 ptCH.y = 0;109 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);110 psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);111 psDeproject (&ptSky, &ptTP, fpa->toSky);112 psLogMsg ("psastro", 3, "0,0 pix for chip %3d = %f,%f\n", view->chip, DEG_RAD*ptSky.r, DEG_RAD*ptSky.d);113 114 psVectorAppend (cornerL, ptFP.x);115 psVectorAppend (cornerM, ptFP.y);116 psVectorAppend (cornerP, ptTP.x);117 psVectorAppend (cornerQ, ptTP.y);118 psVectorAppend (cornerR, ptSky.r);119 psVectorAppend (cornerD, ptSky.d);120 }102 // report and save the current best guess for the chip 0,0 pixel coordinates 103 { 104 psPlane ptCH, ptFP, ptTP; 105 psSphere ptSky; 106 107 ptCH.x = 0; 108 ptCH.y = 0; 109 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH); 110 psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP); 111 psDeproject (&ptSky, &ptTP, fpa->toSky); 112 psLogMsg ("psastro", 3, "0,0 pix for chip %3d = %f,%f\n", view->chip, DEG_RAD*ptSky.r, DEG_RAD*ptSky.d); 113 114 psVectorAppend (cornerL, ptFP.x); 115 psVectorAppend (cornerM, ptFP.y); 116 psVectorAppend (cornerP, ptTP.x); 117 psVectorAppend (cornerQ, ptTP.y); 118 psVectorAppend (cornerR, ptSky.r); 119 psVectorAppend (cornerD, ptSky.d); 120 } 121 121 122 122 // apply the new WCS guess data to all of the data in the readouts … … 132 132 if (rawstars == NULL) { continue; } 133 133 134 *nStars += rawstars->n;134 *nStars += rawstars->n; 135 135 for (int i = 0; i < rawstars->n; i++) { 136 136 pmAstromObj *raw = rawstars->data[i]; … … 151 151 } 152 152 153 // dump or plot the resulting projected positions154 if (psTraceGetLevel("psastro.dump") > 0) {155 psastroDumpRawstars (rawstars, fpa, chip);156 }157 158 p sastroVisualPlotRawStars(rawstars, fpa, chip, recipe);159 160 if (psTraceGetLevel("psastro.plot") > 0) {161 psastroPlotRawstars (rawstars, fpa, chip, recipe);162 }153 // dump or plot the resulting projected positions 154 if (psTraceGetLevel("psastro.dump") > 0) { 155 psastroDumpRawstars (rawstars, fpa, chip); 156 } 157 158 pmAstromVisualPlotRawStars(rawstars, fpa, chip, recipe); 159 160 if (psTraceGetLevel("psastro.plot") > 0) { 161 psastroPlotRawstars (rawstars, fpa, chip, recipe); 162 } 163 163 } 164 164 } … … 170 170 psMetadataAddS32 (recipe, PS_LIST_TAIL, "NTOTSTAR", PS_META_REPLACE, "", *nStars); 171 171 if (*nStars == 0) { 172 psLogMsg ("psastro", 2, "no sources available for astrometry\n");173 psFree (view);174 return true;175 } 176 177 psLogMsg ("psastro", 2, "loaded raw data from %f,%f to %f,%f\n", 178 DEG_RAD*RAmin, DEG_RAD*DECmin, 179 DEG_RAD*RAmax, DEG_RAD*DECmax);172 psLogMsg ("psastro", 2, "no sources available for astrometry\n"); 173 psFree (view); 174 return true; 175 } 176 177 psLogMsg ("psastro", 2, "loaded raw data from %f,%f to %f,%f\n", 178 DEG_RAD*RAmin, DEG_RAD*DECmin, 179 DEG_RAD*RAmax, DEG_RAD*DECmax); 180 180 181 181 psMetadataAddF32 (recipe, PS_LIST_TAIL, "RA_MIN", PS_META_REPLACE, "", RAmin); … … 216 216 pmHDU *hdu = pmFPAviewThisHDU (view, fpa); 217 217 if (bilevelAstrometry) { 218 if (!pmAstromReadBilevelChip (chip, hdu->header)) {219 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 220 return false;221 } 218 if (!pmAstromReadBilevelChip (chip, hdu->header)) { 219 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 220 return false; 221 } 222 222 } else { 223 if (!pmAstromReadWCS (fpa, chip, hdu->header, pixelScale)) {224 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 225 return false;226 } 223 if (!pmAstromReadWCS (fpa, chip, hdu->header, pixelScale)) { 224 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 225 return false; 226 } 227 227 } 228 228 return true; … … 238 238 // load mosaic-level astrometry? 239 239 if (phu) { 240 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");241 if (ctype) {242 *bilevelAstrometry = !strcmp (&ctype[4], "-DIS");243 }240 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); 241 if (ctype) { 242 *bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 243 } 244 244 } 245 245 if (*bilevelAstrometry) { 246 pmAstromReadBilevelMosaic (fpa, phu->header);247 } 246 pmAstromReadBilevelMosaic (fpa, phu->header); 247 } 248 248 psFree (view); 249 249 return true; … … 258 258 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); 259 259 if (!input) { 260 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");261 return false;260 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data"); 261 return false; 262 262 } 263 263 … … 290 290 if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; } 291 291 292 // XXX we are currently inconsistent with marking the good vs the bad data293 // psastroChipAstrom sets data_exists to false if the fit is bad. this is294 // probably wrong since it implies there is no data!295 296 // skip chips for which the astrometry failed (NASTRO == 0)297 if (!chip->cells->n) goto skip_chip;298 pmCell *cell = chip->cells->data[0];299 if (!cell) goto skip_chip;300 301 if (!cell->readouts->n) goto skip_chip;302 pmReadout *readout = cell->readouts->data[0];303 if (!readout) goto skip_chip;304 305 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER");306 if (!updates) goto skip_chip;307 308 int nAstro = psMetadataLookupS32 (&status, updates, "NASTRO");309 if (!nAstro) goto skip_chip;310 311 float astError = psMetadataLookupF32 (&status, updates, "CERROR");312 if (fabs(astError) < 1e-6) goto skip_chip;313 314 psPlane ptCH, ptFP, ptTP;315 psSphere ptSky;316 317 ptCH.x = 0;318 ptCH.y = 0;319 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);320 psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);321 psDeproject (&ptSky, &ptTP, fpa->toSky);322 psLogMsg ("psastro", 3, "0,0 pix for chip %3d = %f,%f\n", view->chip, DEG_RAD*ptSky.r, DEG_RAD*ptSky.d);323 324 // new corner locations based on the calibrated astrometry325 psVectorAppend (cornerLn, ptFP.x);326 psVectorAppend (cornerMn, ptFP.y);327 psVectorAppend (cornerPn, ptTP.x);328 psVectorAppend (cornerQn, ptTP.y);329 psVectorAppend (cornerRn, ptSky.r);330 psVectorAppend (cornerDn, ptSky.d);331 psVectorAppend (cornerMK, 0);332 continue;292 // XXX we are currently inconsistent with marking the good vs the bad data 293 // psastroChipAstrom sets data_exists to false if the fit is bad. this is 294 // probably wrong since it implies there is no data! 295 296 // skip chips for which the astrometry failed (NASTRO == 0) 297 if (!chip->cells->n) goto skip_chip; 298 pmCell *cell = chip->cells->data[0]; 299 if (!cell) goto skip_chip; 300 301 if (!cell->readouts->n) goto skip_chip; 302 pmReadout *readout = cell->readouts->data[0]; 303 if (!readout) goto skip_chip; 304 305 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 306 if (!updates) goto skip_chip; 307 308 int nAstro = psMetadataLookupS32 (&status, updates, "NASTRO"); 309 if (!nAstro) goto skip_chip; 310 311 float astError = psMetadataLookupF32 (&status, updates, "CERROR"); 312 if (fabs(astError) < 1e-6) goto skip_chip; 313 314 psPlane ptCH, ptFP, ptTP; 315 psSphere ptSky; 316 317 ptCH.x = 0; 318 ptCH.y = 0; 319 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH); 320 psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP); 321 psDeproject (&ptSky, &ptTP, fpa->toSky); 322 psLogMsg ("psastro", 3, "0,0 pix for chip %3d = %f,%f\n", view->chip, DEG_RAD*ptSky.r, DEG_RAD*ptSky.d); 323 324 // new corner locations based on the calibrated astrometry 325 psVectorAppend (cornerLn, ptFP.x); 326 psVectorAppend (cornerMn, ptFP.y); 327 psVectorAppend (cornerPn, ptTP.x); 328 psVectorAppend (cornerQn, ptTP.y); 329 psVectorAppend (cornerRn, ptSky.r); 330 psVectorAppend (cornerDn, ptSky.d); 331 psVectorAppend (cornerMK, 0); 332 continue; 333 333 334 334 skip_chip: 335 // new corner locations based on the calibrated astrometry336 psVectorAppend (cornerLn, 0.0);337 psVectorAppend (cornerMn, 0.0);338 psVectorAppend (cornerPn, 0.0);339 psVectorAppend (cornerQn, 0.0);340 psVectorAppend (cornerRn, 0.0);341 psVectorAppend (cornerDn, 0.0);342 psVectorAppend (cornerMK, 1);335 // new corner locations based on the calibrated astrometry 336 psVectorAppend (cornerLn, 0.0); 337 psVectorAppend (cornerMn, 0.0); 338 psVectorAppend (cornerPn, 0.0); 339 psVectorAppend (cornerQn, 0.0); 340 psVectorAppend (cornerRn, 0.0); 341 psVectorAppend (cornerDn, 0.0); 342 psVectorAppend (cornerMK, 1); 343 343 } 344 344 … … 349 349 350 350 for (int i = 0; i < cornerRo->n; i++) { 351 352 psPlane ptTP;353 psSphere ptSky;354 355 ptSky.r = cornerRo->data.F32[i];356 ptSky.d = cornerDo->data.F32[i];357 358 psProject (&ptTP, &ptSky, fpa->toSky);359 psVectorAppend (cornerPs, ptTP.x);360 psVectorAppend (cornerQs, ptTP.y);351 352 psPlane ptTP; 353 psSphere ptSky; 354 355 ptSky.r = cornerRo->data.F32[i]; 356 ptSky.d = cornerDo->data.F32[i]; 357 358 psProject (&ptTP, &ptSky, fpa->toSky); 359 psVectorAppend (cornerPs, ptTP.x); 360 psVectorAppend (cornerQs, ptTP.y); 361 361 } 362 362 … … 364 364 map->x->coeffMask[1][1] = PS_POLY_MASK_SET; 365 365 map->y->coeffMask[1][1] = PS_POLY_MASK_SET; 366 366 367 367 // fit the valid chips, mask the invalid chips 368 368 psVectorFitPolynomial2D (map->x, cornerMK, 1, cornerPn, NULL, cornerPs, cornerQs); 369 369 psVectorFitPolynomial2D (map->y, cornerMK, 1, cornerQn, NULL, cornerPs, cornerQs); 370 370 371 371 // apply the linear fit... 372 372 psVector *cornerPf = psPolynomial2DEvalVector (map->x, cornerPs, cornerQs); … … 377 377 psVector *cornerQd = (psVector *) psBinaryOp (NULL, cornerQn, "-", cornerQf); 378 378 379 p sastroVisualPlotAstromGuessCheck (cornerPo, cornerQo, cornerPn, cornerQn, cornerPd, cornerQd);379 pmAstromVisualPlotAstromGuessCheck (cornerPo, cornerQo, cornerPn, cornerQn, cornerPd, cornerQd); 380 380 381 381 psStats *statsP = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV); … … 387 387 float angle = atan2 (map->y->coeff[1][0], map->x->coeff[1][0]); 388 388 float scale = hypot (map->y->coeff[1][0], map->x->coeff[1][0]); 389 389 390 390 psLogMsg ("psastro", 3, "boresite offset : %f,%f\n", map->x->coeff[0][0], map->y->coeff[0][0]); 391 391 psLogMsg ("psastro", 3, "boresite angle : %f, scale: %f", angle*PS_DEG_RAD, scale); … … 395 395 psMetadata *header = psMetadataLookupMetadata (&status, input->fpa->analysis, "PSASTRO.HEADER"); 396 396 if (!header) { 397 header = psMetadataAlloc();398 psMetadataAddMetadata (input->fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", header);399 psFree (header); // drop this reference397 header = psMetadataAlloc(); 398 psMetadataAddMetadata (input->fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", header); 399 psFree (header); // drop this reference 400 400 } 401 401 … … 408 408 409 409 if (DEBUG) { 410 FILE *f = fopen ("corners.dat", "w");411 for (int i = 0; i < cornerRo->n; i++) {412 fprintf (f, "%10.6f %10.6f %9.2f %9.2f %9.2f %9.2f | %10.6f %10.6f %9.2f %9.2f %9.2f %9.2f\n",413 cornerRn->data.F32[i], cornerDn->data.F32[i], cornerPn->data.F32[i], cornerQn->data.F32[i], cornerLn->data.F32[i], cornerMn->data.F32[i], 414 cornerRo->data.F32[i], cornerDo->data.F32[i], cornerPo->data.F32[i], cornerQo->data.F32[i], cornerLo->data.F32[i], cornerMo->data.F32[i]);415 }416 fclose (f);410 FILE *f = fopen ("corners.dat", "w"); 411 for (int i = 0; i < cornerRo->n; i++) { 412 fprintf (f, "%10.6f %10.6f %9.2f %9.2f %9.2f %9.2f | %10.6f %10.6f %9.2f %9.2f %9.2f %9.2f\n", 413 cornerRn->data.F32[i], cornerDn->data.F32[i], cornerPn->data.F32[i], cornerQn->data.F32[i], cornerLn->data.F32[i], cornerMn->data.F32[i], 414 cornerRo->data.F32[i], cornerDo->data.F32[i], cornerPo->data.F32[i], cornerQo->data.F32[i], cornerLo->data.F32[i], cornerMo->data.F32[i]); 415 } 416 fclose (f); 417 417 } 418 418 … … 437 437 psFree (map); 438 438 psFree (view); 439 439 440 440 441 441 return true; -
trunk/psastro/src/psastroCleanup.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 16 16 17 17 psFree (config); 18 pmAstromVisualClose (); 18 19 19 20 psTimerStop (); … … 23 24 pmConceptsDone (); 24 25 pmConfigDone (); 25 psastroVisualClose ();26 pmAstromVisualClose ();27 26 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "psastro"); 28 27 // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "psastro"); -
trunk/psastro/src/psastroFixChips.c
r21409 r21422 1 1 /** @file psastroFixChips.c 2 2 * 3 * @brief 3 * @brief 4 4 * 5 5 * @ingroup libpsastro 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 25 25 bool fixChips = psMetadataLookupBool (&status, config->arguments, "PSASTRO.FIX.CHIPS"); 26 26 if (!status) { 27 fixChips = psMetadataLookupBool (&status, recipe, "PSASTRO.FIX.CHIPS");27 fixChips = psMetadataLookupBool (&status, recipe, "PSASTRO.FIX.CHIPS"); 28 28 } 29 29 if (!fixChips) return true; … … 37 37 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); 38 38 if (!input) { 39 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");40 return false;39 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data"); 40 return false; 41 41 } 42 42 … … 60 60 // files associated with the science image 61 61 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 62 psError (PS_ERR_IO, false, "Can't load the astrometry model file");63 return false;62 psError (PS_ERR_IO, false, "Can't load the astrometry model file"); 63 return false; 64 64 } 65 65 … … 76 76 77 77 if (DEBUG) { 78 f = fopen ("corners.raw.dat", "w");79 chipName = NULL;78 f = fopen ("corners.raw.dat", "w"); 79 chipName = NULL; 80 80 } 81 81 82 82 pmChip *obsChip = NULL; 83 83 while ((obsChip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 84 if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; }85 86 // XXX we are currently inconsistent with marking the good vs the bad data87 // psastroChipAstrom sets data_exists to false if the fit is bad. this is88 // probably wrong since it implies there is no data!89 90 // skip chips for which the astrometry failed (NASTRO == 0)91 if (!obsChip->cells->n) continue;92 pmCell *cell = obsChip->cells->data[0];93 if (!cell) continue;94 95 if (!cell->readouts->n) continue;96 pmReadout *readout = cell->readouts->data[0];97 if (!readout) continue;98 99 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER");100 if (!updates) continue;101 102 int nAstro = psMetadataLookupS32 (&status, updates, "NASTRO");103 if (!nAstro) continue;104 105 // set the chip astrometry using the astrom file106 pmChip *refChip = pmFPAviewThisChip (view, astrom->fpa);107 108 psRegion *region = pmChipPixels (obsChip);109 psPlane ptCP, ptFP;110 111 ptCP.x = region->x0; ptCP.y = region->y0;112 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP);113 xObs->data.F32[nPts] = ptFP.x;114 yObs->data.F32[nPts] = ptFP.y;115 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP);116 xRef->data.F32[nPts] = ptFP.x;117 yRef->data.F32[nPts] = ptFP.y;118 119 if (DEBUG) {120 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME");121 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]);122 }123 nPts ++;124 125 ptCP.x = region->x0; ptCP.y = region->y1;126 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP);127 xObs->data.F32[nPts] = ptFP.x;128 yObs->data.F32[nPts] = ptFP.y;129 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP);130 xRef->data.F32[nPts] = ptFP.x;131 yRef->data.F32[nPts] = ptFP.y;132 133 if (DEBUG) {134 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME");135 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]);136 }137 nPts ++;138 139 ptCP.x = region->x1; ptCP.y = region->y1;140 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP);141 xObs->data.F32[nPts] = ptFP.x;142 yObs->data.F32[nPts] = ptFP.y;143 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP);144 xRef->data.F32[nPts] = ptFP.x;145 yRef->data.F32[nPts] = ptFP.y;146 147 if (DEBUG) {148 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME");149 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]);150 }151 nPts ++;152 153 ptCP.x = region->x1; ptCP.y = region->y0;154 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP);155 xObs->data.F32[nPts] = ptFP.x;156 yObs->data.F32[nPts] = ptFP.y;157 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP);158 xRef->data.F32[nPts] = ptFP.x;159 yRef->data.F32[nPts] = ptFP.y;160 161 if (DEBUG) {162 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME");163 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]);164 }165 nPts ++;166 167 psFree (region);84 if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; } 85 86 // XXX we are currently inconsistent with marking the good vs the bad data 87 // psastroChipAstrom sets data_exists to false if the fit is bad. this is 88 // probably wrong since it implies there is no data! 89 90 // skip chips for which the astrometry failed (NASTRO == 0) 91 if (!obsChip->cells->n) continue; 92 pmCell *cell = obsChip->cells->data[0]; 93 if (!cell) continue; 94 95 if (!cell->readouts->n) continue; 96 pmReadout *readout = cell->readouts->data[0]; 97 if (!readout) continue; 98 99 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 100 if (!updates) continue; 101 102 int nAstro = psMetadataLookupS32 (&status, updates, "NASTRO"); 103 if (!nAstro) continue; 104 105 // set the chip astrometry using the astrom file 106 pmChip *refChip = pmFPAviewThisChip (view, astrom->fpa); 107 108 psRegion *region = pmChipPixels (obsChip); 109 psPlane ptCP, ptFP; 110 111 ptCP.x = region->x0; ptCP.y = region->y0; 112 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 113 xObs->data.F32[nPts] = ptFP.x; 114 yObs->data.F32[nPts] = ptFP.y; 115 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP); 116 xRef->data.F32[nPts] = ptFP.x; 117 yRef->data.F32[nPts] = ptFP.y; 118 119 if (DEBUG) { 120 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME"); 121 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]); 122 } 123 nPts ++; 124 125 ptCP.x = region->x0; ptCP.y = region->y1; 126 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 127 xObs->data.F32[nPts] = ptFP.x; 128 yObs->data.F32[nPts] = ptFP.y; 129 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP); 130 xRef->data.F32[nPts] = ptFP.x; 131 yRef->data.F32[nPts] = ptFP.y; 132 133 if (DEBUG) { 134 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME"); 135 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]); 136 } 137 nPts ++; 138 139 ptCP.x = region->x1; ptCP.y = region->y1; 140 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 141 xObs->data.F32[nPts] = ptFP.x; 142 yObs->data.F32[nPts] = ptFP.y; 143 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP); 144 xRef->data.F32[nPts] = ptFP.x; 145 yRef->data.F32[nPts] = ptFP.y; 146 147 if (DEBUG) { 148 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME"); 149 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]); 150 } 151 nPts ++; 152 153 ptCP.x = region->x1; ptCP.y = region->y0; 154 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 155 xObs->data.F32[nPts] = ptFP.x; 156 yObs->data.F32[nPts] = ptFP.y; 157 psPlaneTransformApply (&ptFP, refChip->toFPA, &ptCP); 158 xRef->data.F32[nPts] = ptFP.x; 159 yRef->data.F32[nPts] = ptFP.y; 160 161 if (DEBUG) { 162 chipName = psMetadataLookupStr(NULL, obsChip->concepts, "CHIP.NAME"); 163 fprintf (f, "%s %f %f %f %f\n", chipName, xObs->data.F32[nPts], yObs->data.F32[nPts], xRef->data.F32[nPts], yRef->data.F32[nPts]); 164 } 165 nPts ++; 166 167 psFree (region); 168 168 } 169 169 xObs->n = yObs->n = xRef->n = yRef->n = nPts; 170 170 if (DEBUG) fclose (f); 171 171 172 172 psPlaneTransform *map = psPlaneTransformAlloc (1, 1); 173 173 174 174 psVector *mask = psVectorAlloc (nPts, PS_TYPE_VECTOR_MASK); 175 175 psVectorInit (mask, 0); … … 179 179 180 180 for (int i = 0; i < 3; i++) { 181 psVectorClipFitPolynomial2D (map->x, stats, mask, 0xff, xObs, NULL, xRef, yRef);182 psTrace ("psModules.astrom", 3, "x resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, xObs->n);183 184 psVectorClipFitPolynomial2D (map->y, stats, mask, 0xff, yObs, NULL, xRef, yRef);185 psTrace ("psModules.astrom", 3, "y resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, yObs->n);181 psVectorClipFitPolynomial2D (map->x, stats, mask, 0xff, xObs, NULL, xRef, yRef); 182 psTrace ("psModules.astrom", 3, "x resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, xObs->n); 183 184 psVectorClipFitPolynomial2D (map->y, stats, mask, 0xff, yObs, NULL, xRef, yRef); 185 psTrace ("psModules.astrom", 3, "y resid: %f +/- %f (%ld of %ld)\n", stats->clippedMean, stats->clippedStdev, stats->clippedNvalues, yObs->n); 186 186 } 187 187 188 188 // loop over all chips, select the outliers, and replace the measured astrometry with the model 189 // the measured transformation above must be applied to make the comparison, and also then applied to the 189 // the measured transformation above must be applied to make the comparison, and also then applied to the 190 190 // model transformation 191 191 192 192 if (DEBUG) { 193 f = fopen ("corners.fit.dat", "w");194 for (int i = 0; i < xObs->n; i++) {195 psPlane obsCoord, refCoord;196 refCoord.x = xRef->data.F32[i];197 refCoord.y = yRef->data.F32[i];198 psPlaneTransformApply (&obsCoord, map, &refCoord);199 fprintf (f, "%f %f %f %f %f %f\n", xObs->data.F32[i], yObs->data.F32[i], xRef->data.F32[i], yRef->data.F32[i], obsCoord.x, obsCoord.y);200 }201 fclose (f);193 f = fopen ("corners.fit.dat", "w"); 194 for (int i = 0; i < xObs->n; i++) { 195 psPlane obsCoord, refCoord; 196 refCoord.x = xRef->data.F32[i]; 197 refCoord.y = yRef->data.F32[i]; 198 psPlaneTransformApply (&obsCoord, map, &refCoord); 199 fprintf (f, "%f %f %f %f %f %f\n", xObs->data.F32[i], yObs->data.F32[i], xRef->data.F32[i], yRef->data.F32[i], obsCoord.x, obsCoord.y); 200 } 201 fclose (f); 202 202 } 203 203 … … 211 211 212 212 while ((obsChip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 213 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, obsChip->file_exists, obsChip->process);214 if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; }215 216 // set the chip astrometry using the astrom file217 pmChip *refChip = pmFPAviewThisChip (view, astrom->fpa);218 219 // bad Astrometry test: ref pixel or angle outside nominal220 221 psPlane refPixel = {0.0, 0.0, 0.0, 0.0};222 psPlane obsCoord, refCoord, tmpCoord;223 224 // find location of 0,0 pixel in focal plane coords for this chip225 psPlaneTransformApply (&obsCoord, obsChip->toFPA, &refPixel);226 227 // find location of 0,0 pixel in focal plane coords for ref chip228 // apply the global field rotation and offset before comparing229 psPlaneTransformApply (&tmpCoord, refChip->toFPA, &refPixel);230 psPlaneTransformApply (&refCoord, map, &tmpCoord);231 232 psPlane offPixel = {100.0, 0.0, 100.0, 0.0};233 psPlane obsOffPt, refOffPt;234 235 // find location of 0,0 pixel in focal plane coords for this chip236 psPlaneTransformApply (&obsOffPt, obsChip->toFPA, &offPixel);237 238 // find location of 0,0 pixel in focal plane coords for ref chip239 psPlaneTransformApply (&tmpCoord, refChip->toFPA, &offPixel);240 psPlaneTransformApply (&refOffPt, map, &tmpCoord);241 242 double obsAngle = PM_DEG_RAD*atan2 (obsOffPt.y - obsCoord.y, obsOffPt.x - obsCoord.x);243 double refAngle = PM_DEG_RAD*atan2 (refOffPt.y - refCoord.y, refOffPt.x - refCoord.x);244 245 bool badAstrom = false;246 badAstrom |= fabs(obsCoord.x - refCoord.x) > pixelTol;247 badAstrom |= fabs(obsCoord.y - refCoord.y) > pixelTol;248 badAstrom |= fabs(obsAngle - refAngle) > angleTol;249 250 fprintf (stderr, "chip %d, angle: %f, pixel: %f,%f\n", view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y);251 252 // XXX for now, just use first readout253 pmCell *cell = obsChip->cells->data[0];254 pmReadout *readout = cell->readouts->data[0];255 256 // update the header (pull or create local view to entry on readout->analysis)257 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER");258 if (!updates) {259 updates = psMetadataAlloc ();260 psMetadataAddMetadata (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates);261 psFree (updates);262 }263 264 psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_DX", PS_META_REPLACE, "chip x offset wrt model", obsCoord.x - refCoord.x);265 psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_DY", PS_META_REPLACE, "chip y offset wrt model", obsCoord.y - refCoord.y);266 psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_DT", PS_META_REPLACE, "chip rot offset wrt model", obsAngle - refAngle);267 268 // for successful chips, save the measured offsets in the header269 if (!badAstrom) continue;270 271 // XXX for now, let's just fail on the bad chips. In the future, let's try to recover, but we still need to 272 // catch the failures relative to the model273 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", 0);274 continue;275 276 psLogMsg ("psastro", PS_LOG_INFO, "fixing chip %d, angle: %f, pixel: %f,%f\n",277 view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y);278 279 psFree (obsChip->toFPA);280 psFree (obsChip->fromFPA);281 282 // apply the exiting fromTPA transformation to make the new toFPA consistent with the toTPA layter283 // XXX this only works if toTPA is at most a linear transformation284 psPlaneTransform *toFPA = psPlaneTransformAlloc(refChip->toFPA->x->nX, refChip->toFPA->x->nY);285 for (int i = 0; i <= refChip->toFPA->x->nX; i++) {286 for (int j = 0; j <= refChip->toFPA->x->nY; j++) {287 double f1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->x->coeff[1][0]*refChip->toFPA->x->coeff[i][j];288 double f2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->x->coeff[0][1]*refChip->toFPA->y->coeff[i][j];289 toFPA->x->coeff[i][j] = f1 + f2;290 291 double g1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->y->coeff[1][0]*refChip->toFPA->x->coeff[i][j];292 double g2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->y->coeff[0][1]*refChip->toFPA->y->coeff[i][j];293 toFPA->y->coeff[i][j] = g1 + g2;294 }295 }296 toFPA->x->coeff[0][0] += map->x->coeff[0][0];297 toFPA->y->coeff[0][0] += map->y->coeff[0][0];298 299 psRegion *region = pmChipPixels (obsChip);300 obsChip->toFPA = toFPA;301 obsChip->fromFPA = psPlaneTransformInvert(NULL, obsChip->toFPA, *region, 50);302 psFree (region);303 304 // use the new position to re-try the match fit305 // select the raw objects for this readout306 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");307 if (rawstars == NULL) { continue; }308 309 // select the raw objects for this readout310 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");311 if (refstars == NULL) { continue; }312 313 // the absolute minimum number of stars is 4 (for order = 1)314 if ((rawstars->n < 4) || (refstars->n < 4)) {315 readout->data_exists = false;316 psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", 317 rawstars->n, refstars->n);318 continue;319 } 320 321 psastroUpdateChipToFPA (input->fpa, obsChip, rawstars, refstars);322 323 // XXX update the header with info to reflect the failure324 if (!psastroOneChipFit (input->fpa, obsChip, refstars, rawstars, recipe, updates)) {325 readout->data_exists = false;326 psLogMsg ("psastro", 3, "failed to find a solution\n");327 continue;328 }329 330 pmAstromWriteWCS (updates, input->fpa, obsChip, NONLIN_TOL);331 } 332 333 p sastroVisualPlotFixChips (input, xObs, yObs);213 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, obsChip->file_exists, obsChip->process); 214 if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; } 215 216 // set the chip astrometry using the astrom file 217 pmChip *refChip = pmFPAviewThisChip (view, astrom->fpa); 218 219 // bad Astrometry test: ref pixel or angle outside nominal 220 221 psPlane refPixel = {0.0, 0.0, 0.0, 0.0}; 222 psPlane obsCoord, refCoord, tmpCoord; 223 224 // find location of 0,0 pixel in focal plane coords for this chip 225 psPlaneTransformApply (&obsCoord, obsChip->toFPA, &refPixel); 226 227 // find location of 0,0 pixel in focal plane coords for ref chip 228 // apply the global field rotation and offset before comparing 229 psPlaneTransformApply (&tmpCoord, refChip->toFPA, &refPixel); 230 psPlaneTransformApply (&refCoord, map, &tmpCoord); 231 232 psPlane offPixel = {100.0, 0.0, 100.0, 0.0}; 233 psPlane obsOffPt, refOffPt; 234 235 // find location of 0,0 pixel in focal plane coords for this chip 236 psPlaneTransformApply (&obsOffPt, obsChip->toFPA, &offPixel); 237 238 // find location of 0,0 pixel in focal plane coords for ref chip 239 psPlaneTransformApply (&tmpCoord, refChip->toFPA, &offPixel); 240 psPlaneTransformApply (&refOffPt, map, &tmpCoord); 241 242 double obsAngle = PM_DEG_RAD*atan2 (obsOffPt.y - obsCoord.y, obsOffPt.x - obsCoord.x); 243 double refAngle = PM_DEG_RAD*atan2 (refOffPt.y - refCoord.y, refOffPt.x - refCoord.x); 244 245 bool badAstrom = false; 246 badAstrom |= fabs(obsCoord.x - refCoord.x) > pixelTol; 247 badAstrom |= fabs(obsCoord.y - refCoord.y) > pixelTol; 248 badAstrom |= fabs(obsAngle - refAngle) > angleTol; 249 250 fprintf (stderr, "chip %d, angle: %f, pixel: %f,%f\n", view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y); 251 252 // XXX for now, just use first readout 253 pmCell *cell = obsChip->cells->data[0]; 254 pmReadout *readout = cell->readouts->data[0]; 255 256 // update the header (pull or create local view to entry on readout->analysis) 257 psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 258 if (!updates) { 259 updates = psMetadataAlloc (); 260 psMetadataAddMetadata (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates); 261 psFree (updates); 262 } 263 264 psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_DX", PS_META_REPLACE, "chip x offset wrt model", obsCoord.x - refCoord.x); 265 psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_DY", PS_META_REPLACE, "chip y offset wrt model", obsCoord.y - refCoord.y); 266 psMetadataAddF32 (updates, PS_LIST_TAIL, "AST_DT", PS_META_REPLACE, "chip rot offset wrt model", obsAngle - refAngle); 267 268 // for successful chips, save the measured offsets in the header 269 if (!badAstrom) continue; 270 271 // XXX for now, let's just fail on the bad chips. In the future, let's try to recover, but we still need to 272 // catch the failures relative to the model 273 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", 0); 274 continue; 275 276 psLogMsg ("psastro", PS_LOG_INFO, "fixing chip %d, angle: %f, pixel: %f,%f\n", 277 view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y); 278 279 psFree (obsChip->toFPA); 280 psFree (obsChip->fromFPA); 281 282 // apply the exiting fromTPA transformation to make the new toFPA consistent with the toTPA layter 283 // XXX this only works if toTPA is at most a linear transformation 284 psPlaneTransform *toFPA = psPlaneTransformAlloc(refChip->toFPA->x->nX, refChip->toFPA->x->nY); 285 for (int i = 0; i <= refChip->toFPA->x->nX; i++) { 286 for (int j = 0; j <= refChip->toFPA->x->nY; j++) { 287 double f1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->x->coeff[1][0]*refChip->toFPA->x->coeff[i][j]; 288 double f2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->x->coeff[0][1]*refChip->toFPA->y->coeff[i][j]; 289 toFPA->x->coeff[i][j] = f1 + f2; 290 291 double g1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->y->coeff[1][0]*refChip->toFPA->x->coeff[i][j]; 292 double g2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->y->coeff[0][1]*refChip->toFPA->y->coeff[i][j]; 293 toFPA->y->coeff[i][j] = g1 + g2; 294 } 295 } 296 toFPA->x->coeff[0][0] += map->x->coeff[0][0]; 297 toFPA->y->coeff[0][0] += map->y->coeff[0][0]; 298 299 psRegion *region = pmChipPixels (obsChip); 300 obsChip->toFPA = toFPA; 301 obsChip->fromFPA = psPlaneTransformInvert(NULL, obsChip->toFPA, *region, 50); 302 psFree (region); 303 304 // use the new position to re-try the match fit 305 // select the raw objects for this readout 306 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS"); 307 if (rawstars == NULL) { continue; } 308 309 // select the raw objects for this readout 310 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS"); 311 if (refstars == NULL) { continue; } 312 313 // the absolute minimum number of stars is 4 (for order = 1) 314 if ((rawstars->n < 4) || (refstars->n < 4)) { 315 readout->data_exists = false; 316 psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", 317 rawstars->n, refstars->n); 318 continue; 319 } 320 321 psastroUpdateChipToFPA (input->fpa, obsChip, rawstars, refstars); 322 323 // XXX update the header with info to reflect the failure 324 if (!psastroOneChipFit (input->fpa, obsChip, refstars, rawstars, recipe, updates)) { 325 readout->data_exists = false; 326 psLogMsg ("psastro", 3, "failed to find a solution\n"); 327 continue; 328 } 329 330 pmAstromWriteWCS (updates, input->fpa, obsChip, NONLIN_TOL); 331 } 332 333 pmAstromVisualPlotFixChips (input, xObs, yObs); 334 334 psFree (xObs); 335 335 psFree (yObs); -
trunk/psastro/src/psastroLoadRefstars.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 150 150 } 151 151 152 p sastroVisualPlotRefStars (refstars, recipe);152 pmAstromVisualPlotRefStars (refstars, recipe); 153 153 154 154 if (psTraceGetLevel("psastro.plot") > 0) { … … 251 251 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT"); 252 252 if (!input) { 253 psLogMsg ("psastro", PS_LOG_DETAIL, "no supplied reference header data");254 photcode = psStringCopy ("NONE");255 return photcode;253 psLogMsg ("psastro", PS_LOG_DETAIL, "no supplied reference header data"); 254 photcode = psStringCopy ("NONE"); 255 return photcode; 256 256 } 257 257 assert (input->fpa); … … 259 259 *maxRho = psMetadataLookupF32(&status, recipe, "DVO.GETSTAR.MAX.RHO"); 260 260 if (!status) { 261 psError(PSASTRO_ERR_CONFIG, false, "DVO.GETSTAR.MAX.RHO missing from recipe");262 return NULL;261 psError(PSASTRO_ERR_CONFIG, false, "DVO.GETSTAR.MAX.RHO missing from recipe"); 262 return NULL; 263 263 } 264 264 … … 278 278 if (!status) ESCAPE ("missing DVO.GETSTAR.MIN.MAG.INST"); 279 279 280 // PHOTCODE.DATA is a multi of metadata items 280 // PHOTCODE.DATA is a multi of metadata items 281 281 psListIterator *iter = psListIteratorAlloc(item->data.list, PS_LIST_HEAD, false); 282 282 283 283 psMetadataItem *refItem = NULL; 284 284 while ((refItem = psListGetAndIncrement (iter))) { 285 if (refItem->type != PS_DATA_METADATA) ESCAPE ("PHOTCODE.DATA entry is not a metadata folder");286 287 char *refFilter = psMetadataLookupStr (&status, refItem->data.md, "FILTER");288 if (!status) {289 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");290 continue;291 }292 293 // does this entry match the current filter?294 if (strcmp (refFilter, filter)) continue;295 296 psLogMsg ("psastro", PS_LOG_DETAIL, "PHOTCODE.DATA found for filter %s", filter);297 298 float zeropt = psMetadataLookupF32 (&status, refItem->data.md, "ZEROPT");299 if (!status) {300 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");301 continue;302 }303 photcode = psMetadataLookupStr (&status, refItem->data.md, "PHOTCODE");304 if (!status) {305 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");306 continue;307 }308 309 // convert the minInst to a calibrated minimum magnitude310 *minMag = minInst + 2.5*log10(exptime) + zeropt;311 312 psFree (iter);313 return photcode;314 } 285 if (refItem->type != PS_DATA_METADATA) ESCAPE ("PHOTCODE.DATA entry is not a metadata folder"); 286 287 char *refFilter = psMetadataLookupStr (&status, refItem->data.md, "FILTER"); 288 if (!status) { 289 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER"); 290 continue; 291 } 292 293 // does this entry match the current filter? 294 if (strcmp (refFilter, filter)) continue; 295 296 psLogMsg ("psastro", PS_LOG_DETAIL, "PHOTCODE.DATA found for filter %s", filter); 297 298 float zeropt = psMetadataLookupF32 (&status, refItem->data.md, "ZEROPT"); 299 if (!status) { 300 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER"); 301 continue; 302 } 303 photcode = psMetadataLookupStr (&status, refItem->data.md, "PHOTCODE"); 304 if (!status) { 305 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER"); 306 continue; 307 } 308 309 // convert the minInst to a calibrated minimum magnitude 310 *minMag = minInst + 2.5*log10(exptime) + zeropt; 311 312 psFree (iter); 313 return photcode; 314 } 315 315 psFree (iter); 316 316 … … 318 318 photcode = psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR.PHOTCODE"); 319 319 PS_ASSERT (photcode, NULL); 320 320 321 321 // give up and use fixed value 322 322 *minMag = psMetadataLookupF32(NULL, recipe, "DVO.GETSTAR.MIN.MAG"); -
trunk/psastro/src/psastroLuminosityFunction.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 141 141 lumFunc->sPeak = sPeak; 142 142 143 p sastroVisualPlotLuminosityFunction(lnMag, Mag, lumFunc, rawFunc);143 pmAstromVisualPlotLuminosityFunction(lnMag, Mag, lumFunc, rawFunc); 144 144 145 145 psFree (lnMag); -
trunk/psastro/src/psastroMosaicOneChip.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 160 160 161 161 //plot results 162 p sastroVisualPlotMosaicOneChip(rawstars, refstars, match, recipe);162 pmAstromVisualPlotMosaicOneChip(rawstars, refstars, match, recipe); 163 163 164 164 psFree (fitStats); -
trunk/psastro/src/psastroMosaicSetMatch.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 69 69 psTrace ("psastro", 4, "Matched %ld refstars\n", matches->n); 70 70 71 p sastroVisualPlotMosaicMatches(rawstars, refstars, matches, iteration, recipe);71 pmAstromVisualPlotMosaicMatches(rawstars, refstars, matches, iteration, recipe); 72 72 73 73 // XXX drop the old one -
trunk/psastro/src/psastroOneChipFit.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 23 23 24 24 // default value for match/fit : radius is in pixels 25 REQUIRED_RECIPE_VALUE (double RADIUS, "PSASTRO.MATCH.RADIUS", F32); 25 REQUIRED_RECIPE_VALUE (double RADIUS, "PSASTRO.MATCH.RADIUS", F32); 26 26 27 27 // run the match/fit sequence NITER times 28 REQUIRED_RECIPE_VALUE (int nIter, "PSASTRO.MATCH.FIT.NITER", S32); 28 REQUIRED_RECIPE_VALUE (int nIter, "PSASTRO.MATCH.FIT.NITER", S32); 29 29 30 30 // correct radius to FP units (physical pixel scale in microns per pixel) 31 REQUIRED_RECIPE_VALUE (double pixelScale, "PSASTRO.PIXEL.SCALE", F32); 31 REQUIRED_RECIPE_VALUE (double pixelScale, "PSASTRO.PIXEL.SCALE", F32); 32 32 RADIUS *= pixelScale; 33 33 … … 44 44 45 45 for (int iter = 0; iter < nIter; iter++) { 46 47 char name[128];48 46 49 sprintf (name, "PSASTRO.MATCH.RADIUS.N%d", iter); 50 float radius = psMetadataLookupF32 (&status, recipe, name); 51 radius *= pixelScale; 52 if (!status || (radius == 0.0)) { 53 radius = RADIUS; 54 } 47 char name[128]; 48 49 sprintf (name, "PSASTRO.MATCH.RADIUS.N%d", iter); 50 float radius = psMetadataLookupF32 (&status, recipe, name); 51 radius *= pixelScale; 52 if (!status || (radius == 0.0)) { 53 radius = RADIUS; 54 } 55 55 56 56 57 // use small radius to match stars58 match = pmAstromRadiusMatchFP (rawstars, refstars, radius);59 if (match == NULL) {60 psLogMsg ("psastro", 3, "failed to find radius-matched sources\n");61 return false;62 }57 // use small radius to match stars 58 match = pmAstromRadiusMatchFP (rawstars, refstars, radius); 59 if (match == NULL) { 60 psLogMsg ("psastro", 3, "failed to find radius-matched sources\n"); 61 return false; 62 } 63 63 64 // modify the order to correspond to the actual number of matched stars:65 int Ndof_min = 3;66 int order_max = 0.5*(3 + sqrt(4*match->n - 4*Ndof_min + 1));67 order = PS_MIN (order, order_max);64 // modify the order to correspond to the actual number of matched stars: 65 int Ndof_min = 3; 66 int order_max = 0.5*(3 + sqrt(4*match->n - 4*Ndof_min + 1)); 67 order = PS_MIN (order, order_max); 68 68 69 // if ((match->n < 11) && (order >= 3)) order = 2;70 // if ((match->n < 7) && (order >= 2)) order = 1;71 // if ((match->n < 4) && (order >= 1)) order = 0;69 // if ((match->n < 11) && (order >= 3)) order = 2; 70 // if ((match->n < 7) && (order >= 2)) order = 1; 71 // if ((match->n < 4) && (order >= 1)) order = 0; 72 72 73 if (order < 1) {74 psLogMsg ("psastro", 3, "insufficient stars or invalid order: %ld stars", match->n); 75 psFree (match);76 return false; 77 } 73 if (order < 1) { 74 psLogMsg ("psastro", 3, "insufficient stars or invalid order: %ld stars", match->n); 75 psFree (match); 76 return false; 77 } 78 78 79 // create output toFPA; set masks appropriate to the Elixir DVO astrometry format80 psFree (chip->toFPA);81 chip->toFPA = psPlaneTransformAlloc (order, order);82 for (int i = 0; i <= chip->toFPA->x->nX; i++) {83 for (int j = 0; j <= chip->toFPA->x->nY; j++) {84 if (i + j > order) {85 chip->toFPA->x->coeffMask[i][j] = PS_POLY_MASK_SET;86 chip->toFPA->y->coeffMask[i][j] = PS_POLY_MASK_SET;87 }88 }89 }79 // create output toFPA; set masks appropriate to the Elixir DVO astrometry format 80 psFree (chip->toFPA); 81 chip->toFPA = psPlaneTransformAlloc (order, order); 82 for (int i = 0; i <= chip->toFPA->x->nX; i++) { 83 for (int j = 0; j <= chip->toFPA->x->nY; j++) { 84 if (i + j > order) { 85 chip->toFPA->x->coeffMask[i][j] = PS_POLY_MASK_SET; 86 chip->toFPA->y->coeffMask[i][j] = PS_POLY_MASK_SET; 87 } 88 } 89 } 90 90 91 // XXX allow statitic to be set by the user92 // fitStats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);93 fitStats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);94 fitStats->clipSigma = psMetadataLookupF32 (&status, recipe, "PSASTRO.CHIP.NSIGMA");95 fitStats->clipIter = psMetadataLookupS32 (&status, recipe, "PSASTRO.CHIP.NITER");91 // XXX allow statitic to be set by the user 92 // fitStats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV); 93 fitStats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 94 fitStats->clipSigma = psMetadataLookupF32 (&status, recipe, "PSASTRO.CHIP.NSIGMA"); 95 fitStats->clipIter = psMetadataLookupS32 (&status, recipe, "PSASTRO.CHIP.NITER"); 96 96 97 // improved fit for astrometric terms 98 results = pmAstromMatchFit (chip->toFPA, rawstars, refstars, match, fitStats); 99 if (!results) { 100 psLogMsg ("psastro", 3, "failed to perform the matched fit\n"); 101 psFree (match); 102 psFree (fitStats); 103 return false; 104 } 105 106 // determine fromFPA transformation and apply new transformation to raw & ref stars 107 psastroUpdateChipToFPA (fpa, chip, rawstars, refstars); 108 109 // toSky converts from FPA & TPA units (microns) to sky units (radians) 110 float plateScale = 0.5*(fpa->toSky->Xs + fpa->toSky->Ys)*3600.0*PM_DEG_RAD; 111 // float astError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) * plateScale; 112 float astError = 0.5*(results->xStats->robustStdev + results->yStats->robustStdev) * plateScale; 113 int astNstar = results->yStats->clippedNvalues; 114 psLogMsg ("psastro", PS_LOG_INFO, "pass %d, error: %f arcsec, Nstars: %d", iter, astError, astNstar); 97 // improved fit for astrometric terms 98 results = pmAstromMatchFit (chip->toFPA, rawstars, refstars, match, fitStats); 99 if (!results) { 100 psLogMsg ("psastro", 3, "failed to perform the matched fit\n"); 101 psFree (match); 102 psFree (fitStats); 103 return false; 104 } 115 105 116 if (iter < nIter - 1) { 117 psFree (fitStats); 118 psFree (results); 119 psFree (match); 120 } 106 // determine fromFPA transformation and apply new transformation to raw & ref stars 107 psastroUpdateChipToFPA (fpa, chip, rawstars, refstars); 108 109 // toSky converts from FPA & TPA units (microns) to sky units (radians) 110 float plateScale = 0.5*(fpa->toSky->Xs + fpa->toSky->Ys)*3600.0*PM_DEG_RAD; 111 // float astError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) * plateScale; 112 float astError = 0.5*(results->xStats->robustStdev + results->yStats->robustStdev) * plateScale; 113 int astNstar = results->yStats->clippedNvalues; 114 psLogMsg ("psastro", PS_LOG_INFO, "pass %d, error: %f arcsec, Nstars: %d", iter, astError, astNstar); 115 116 if (iter < nIter - 1) { 117 psFree (fitStats); 118 psFree (results); 119 psFree (match); 120 } 121 121 } 122 122 … … 139 139 if (astError > maxError) { 140 140 psLogMsg("psastro", PS_LOG_INFO, "residual error is too large, failed to find a solution: %f > %f", astError, maxError); 141 validSolution = false;141 validSolution = false; 142 142 } 143 143 if (astNstar < minNstar) { 144 144 psLogMsg("psastro", PS_LOG_INFO, "solution uses too few stars: %d < %d", astNstar, minNstar); 145 validSolution = false;145 validSolution = false; 146 146 } 147 147 … … 150 150 psMetadataAddF32 (updates, PS_LIST_TAIL, "CERROR", PS_META_REPLACE, "astrometry error (arcsec)", astError); 151 151 if (validSolution) { 152 psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", astError/sqrt(astNstar));153 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", astNstar);152 psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", astError/sqrt(astNstar)); 153 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", astNstar); 154 154 } else { 155 psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", 0.0);156 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", 0);155 psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", 0.0); 156 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", 0); 157 157 } 158 158 psMetadataAddF32 (updates, PS_LIST_TAIL, "EQUINOX", PS_META_REPLACE, "equinox of ref catalog", 2000.0); // XXX this is bogus: should be defined based on equinox of refstars … … 160 160 // XXX drop from here : determine fromFPA transformation and apply new transformation to raw & ref stars 161 161 // psastroUpdateChipToFPA (fpa, chip, rawstars, refstars); 162 162 163 163 // XXX check if we correctly applied the new transformation: 164 164 if (psTraceGetLevel("psastro.dump") > 0) { 165 psastroDumpRawstars (rawstars, fpa, chip);166 psastroDumpMatchedStars ("match.dat", rawstars, refstars, match);167 psastroDumpStars (refstars, "refstars.cal.dat");165 psastroDumpRawstars (rawstars, fpa, chip); 166 psastroDumpMatchedStars ("match.dat", rawstars, refstars, match); 167 psastroDumpStars (refstars, "refstars.cal.dat"); 168 168 } 169 169 170 p sastroVisualPlotOneChipFit (rawstars, refstars, match, recipe);170 pmAstromVisualPlotOneChipFit (rawstars, refstars, match, recipe); 171 171 172 172 if (psTraceGetLevel("psastro.plot") > 0) { 173 psastroPlotOneChipFit (rawstars, refstars, match, recipe);173 psastroPlotOneChipFit (rawstars, refstars, match, recipe); 174 174 } 175 175 -
trunk/psastro/src/psastroRemoveClumps.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 69 69 psTrace ("psastro", 4, "skipping stars in cells with more than %f stars\n", limit); 70 70 71 p sastroVisualPlotRemoveClumps (input, count, scale, limit);71 pmAstromVisualPlotRemoveClumps (input, count, scale, limit); 72 72 73 73 // find and exclude objects in bad pixels -
trunk/psastro/src/psastroUtils.c
r21409 r21422 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 7 02:03:34 $8 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-09 21:25:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 54 54 if (!chip->toFPA) { continue; } 55 55 56 if (chip->cells->n == 0) { continue; }57 pmCell *cell = chip->cells->data[0];56 if (chip->cells->n == 0) { continue; } 57 pmCell *cell = chip->cells->data[0]; 58 58 if (!cell->process || !cell->file_exists) { continue; } 59 59 60 if (cell->readouts->n == 0) { continue; }61 pmReadout *readout = cell->readouts->data[0];62 if (! readout->data_exists) { continue; }60 if (cell->readouts->n == 0) { continue; } 61 pmReadout *readout = cell->readouts->data[0]; 62 if (! readout->data_exists) { continue; } 63 63 64 64 pixelScale1 = hypot (chip->toFPA->x->coeff[1][0], chip->toFPA->x->coeff[0][1]); … … 100 100 psastroMosaicSetAstrom (fpa); 101 101 if (!useExternal) { 102 p sastroVisualPlotCommonScale (fpa, oldScale);102 pmAstromVisualPlotCommonScale (fpa, oldScale); 103 103 } 104 104 psFree (oldScale);
Note:
See TracChangeset
for help on using the changeset viewer.
