Changeset 20443
- Timestamp:
- Oct 28, 2008, 1:20:29 PM (18 years ago)
- Location:
- branches/cnb_branch_20081011
- Files:
-
- 7 edited
-
psModules/src/astrom/pmAstrometryObjects.c (modified) (2 diffs)
-
psModules/src/astrom/pmAstrometryVisual.c (modified) (10 diffs)
-
psModules/src/astrom/pmAstrometryVisual.h (modified) (1 diff)
-
psastro/src/psastro.h (modified) (1 diff)
-
psastro/src/psastroFixChips.c (modified) (10 diffs)
-
psastro/src/psastroUtils.c (modified) (1 diff)
-
psastro/src/psastroVisual.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branch_20081011/psModules/src/astrom/pmAstrometryObjects.c
r20415 r20443 8 8 * @author EAM, IfA 9 9 * 10 * @version $Revision: 1.41.4. 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2008-10-2 7 22:50:07$10 * @version $Revision: 1.41.4.3 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2008-10-28 23:20:29 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 871 871 tweak->offset.y += yPeak; 872 872 873 pmAstromVisualPlotTweak (xHist , yHist, xHistNew, yHistNew, xBin, yBin);873 pmAstromVisualPlotTweak (xHistNew, yHistNew, xBin, yBin); 874 874 875 875 psFree (rot); -
branches/cnb_branch_20081011/psModules/src/astrom/pmAstrometryVisual.c
r20415 r20443 259 259 260 260 261 /** Plot the refinements that pmAstromGridTweak makes to the offset between raw and ref stars */ 262 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, psVector *xHistNew, psVector *yHistNew, int xBin, int yBin) 261 /** Plot the refinements made within pmAstromGridTweak. 262 * After pmAstromGridMatch finds the best rotaion/scale/offset between raw and reference stars 263 * within a coarse grid of rotations/scales, pmAstromGridTweak computes a higher precision 264 * estimate of the offset. It computes the 2 point correlation function between raw and ref 265 * stars along horizontal and vertical cuts through the first-guess offset. It finds the peak 266 * of these two profiles and adjusts the offset accordingly. This procedure plots the profiles. 267 */ 268 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, int xBin, int yBin) 263 269 { 264 270 //make sure we want to plot this … … 274 280 psVector *xIndices = psVectorAlloc (xHist->n, PS_TYPE_F32); 275 281 psVector *yIndices = psVectorAlloc (yHist->n, PS_TYPE_F32); 276 277 282 278 283 //populate the Indices vectors … … 298 303 KapaSendLabel (kapa, "Horizontal Profile", 299 304 KAPA_LABEL_XP); 300 graphdata.style = 2;305 graphdata.style = 1; 301 306 graphdata.ptype = 0; 302 307 graphdata.size = 0.4; … … 307 312 KapaPlotVector (kapa, xHist->n, xHist->data.F32, "y"); 308 313 309 //overplot smoothed line310 graphdata.style = 1;311 graphdata.color = KapaColorByName ("red");312 KapaPrepPlot (kapa, xHist->n, &graphdata);313 KapaPlotVector (kapa, xHist->n, xIndices->data.F32, "x");314 KapaPlotVector (kapa, xHist->n, xHistNew->data.F32, "y");315 316 314 //overplot the peak 317 315 float x[2] = {xBin, xBin}; 318 316 float y[2] = {-500, 500}; 319 graphdata.color = KapaColorByName (" black");317 graphdata.color = KapaColorByName ("red"); 320 318 KapaPrepPlot (kapa, 2, &graphdata); 321 319 KapaPlotVector (kapa, 2, x, "x"); … … 328 326 KapaSetFont(kapa, "helvetica", 14); 329 327 KapaBox(kapa, &graphdata); 330 KapaSendLabel (kapa, " Xoffset Bin", KAPA_LABEL_XM);328 KapaSendLabel (kapa, "Y offset Bin", KAPA_LABEL_XM); 331 329 KapaSendLabel (kapa, "Number of Sources", KAPA_LABEL_YM); 332 330 KapaSendLabel (kapa, "Vertical Profile", 333 331 KAPA_LABEL_XP); 334 graphdata.style = 2;332 graphdata.style = 1; 335 333 graphdata.ptype = 0; 336 334 graphdata.size = 0.4; … … 341 339 KapaPlotVector (kapa, yHist->n, yHist->data.F32, "y"); 342 340 343 //overplot smoothed line344 graphdata.style = 1;345 graphdata.color = KapaColorByName ("red");346 KapaPrepPlot (kapa, yHist->n, &graphdata);347 KapaPlotVector (kapa, yHist->n, yIndices->data.F32, "x");348 KapaPlotVector (kapa, yHist->n, yHistNew->data.F32, "y");349 350 341 //overplot the peak 351 342 x[0] = x[1] = yBin; 352 graphdata.color = KapaColorByName (" black");343 graphdata.color = KapaColorByName ("red"); 353 344 KapaPrepPlot (kapa, 2, &graphdata); 354 345 KapaPlotVector (kapa, 2, x, "x"); … … 356 347 357 348 //plot title 349 graphdata.color = KapaColorByName("black"); 358 350 KapaSection section3 = {"s3", 0, 0, 1, 1}; 359 351 KapaSetSection( kapa, §ion3); … … 366 358 psFree(yIndices); 367 359 return true; 368 } 369 370 371 /** p sastroVisualScaleGraphdata360 } //end of pmAstromPlotTweak 361 362 363 /** pmAstromScaleGraphdata 372 364 * Scale the graphdata structure based on x and y coordinates. Use sigma clipping to 373 365 * prevent outliers from making te plot region too big. … … 441 433 442 434 443 444 435 # else 445 436 … … 449 440 bool pmAstromVisualClose() { return true; } 450 441 bool pmAstromVisualPlotGridMatch (const psArray *raw, const psArray *ref, psImage *gridNP, double offsetX, double offsetY, double maxOffpix, double Scale, double Offset) { return true; } 442 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, int xBin, int yBin) {return true;} 451 443 452 444 # endif -
branches/cnb_branch_20081011/psModules/src/astrom/pmAstrometryVisual.h
r20415 r20443 4 4 bool pmAstromVisualClose(); 5 5 bool pmAstromVisualPlotGridMatch (const psArray *raw, const psArray *ref, psImage *gridNP, double offsetX, double offsetY, double maxOffpix, double Scale, double Offset); 6 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, psVector *xHistNew, psVector *yHistNew,int xBin, int yBin);6 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, int xBin, int yBin); -
branches/cnb_branch_20081011/psastro/src/psastro.h
r20335 r20443 83 83 bool psastroVisualPlotRefStars (psArray *refstars, psMetadata *recipe); 84 84 bool psastroVisualPlotRemoveClumps (psArray *input, psImage *count, int scale, float limit); 85 bool psastroVisualPlotFixChips (pmFPAfile *input, psVector *xOld, psVector *yOld); 85 86 bool psastroVisualPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe); 86 87 bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, psVector *cornerQo, psVector *cornerPn, psVector *cornerQn, psVector *cornerPd, psVector *cornerQd); 87 88 bool psastroVisualPlotMosaicOneChip (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe); 89 bool psastroVisualPlotCommonScale (pmFPA *fpa, psVector *oldScale); 88 90 bool psastroVisualPlotMosaicMatches (psArray *rawstars, psArray *refstars, psArray *match, int iteration, psMetadata *recipe); 89 91 -
branches/cnb_branch_20081011/psastro/src/psastroFixChips.c
r16077 r20443 109 109 } 110 110 xObs->n = yObs->n = xRef->n = yRef->n = nPts; 111 111 112 112 psPlaneTransform *map = psPlaneTransformAlloc (1, 1); 113 113 114 114 psVector *mask = psVectorAlloc (nPts, PS_TYPE_U8); 115 115 psVectorInit (mask, 0); … … 127 127 128 128 // loop over all chips, select the outliers, and replace the measured astrometry with the model 129 // the measured transformation above must be applied to make the comparison, and also then applied to the 129 // the measured transformation above must be applied to make the comparison, and also then applied to the 130 130 // model transformation 131 131 132 psFree (xObs);133 psFree (yObs);134 132 psFree (xRef); 135 133 psFree (yRef); … … 159 157 psPlaneTransformApply (&tmpCoord, refChip->toFPA, &refPixel); 160 158 psPlaneTransformApply (&refCoord, map, &tmpCoord); 161 159 162 160 psPlane offPixel = {100.0, 0.0, 100.0, 0.0}; 163 161 psPlane obsOffPt, refOffPt; … … 169 167 psPlaneTransformApply (&tmpCoord, refChip->toFPA, &offPixel); 170 168 psPlaneTransformApply (&refOffPt, map, &tmpCoord); 171 169 172 170 double obsAngle = PM_DEG_RAD*atan2 (obsOffPt.y - obsCoord.y, obsOffPt.x - obsCoord.x); 173 171 double refAngle = PM_DEG_RAD*atan2 (refOffPt.y - refCoord.y, refOffPt.x - refCoord.x); … … 183 181 184 182 psLogMsg ("psastro", PS_LOG_INFO, "fixing chip %d, angle: %f, pixel: %f,%f\n", 185 view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y);183 view->chip, obsAngle - refAngle, obsCoord.x - refCoord.x, obsCoord.y - refCoord.y); 186 184 187 185 psFree (obsChip->toFPA); … … 192 190 psPlaneTransform *toFPA = psPlaneTransformAlloc(refChip->toFPA->x->nX, refChip->toFPA->x->nY); 193 191 for (int i = 0; i <= refChip->toFPA->x->nX; i++) { 194 for (int j = 0; j <= refChip->toFPA->x->nY; j++) {195 double f1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->x->coeff[1][0]*refChip->toFPA->x->coeff[i][j];196 double f2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->x->coeff[0][1]*refChip->toFPA->y->coeff[i][j];197 toFPA->x->coeff[i][j] = f1 + f2;198 199 double g1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->y->coeff[1][0]*refChip->toFPA->x->coeff[i][j];200 double g2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->y->coeff[0][1]*refChip->toFPA->y->coeff[i][j];201 toFPA->y->coeff[i][j] = g1 + g2;202 }192 for (int j = 0; j <= refChip->toFPA->x->nY; j++) { 193 double f1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->x->coeff[1][0]*refChip->toFPA->x->coeff[i][j]; 194 double f2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->x->coeff[0][1]*refChip->toFPA->y->coeff[i][j]; 195 toFPA->x->coeff[i][j] = f1 + f2; 196 197 double g1 = refChip->toFPA->x->coeffMask[i][j] ? 0.0 : map->y->coeff[1][0]*refChip->toFPA->x->coeff[i][j]; 198 double g2 = refChip->toFPA->y->coeffMask[i][j] ? 0.0 : map->y->coeff[0][1]*refChip->toFPA->y->coeff[i][j]; 199 toFPA->y->coeff[i][j] = g1 + g2; 200 } 203 201 } 204 202 toFPA->x->coeff[0][0] += map->x->coeff[0][0]; … … 209 207 obsChip->fromFPA = psPlaneTransformInvert(NULL, obsChip->toFPA, *region, 50); 210 208 psFree (region); 211 209 212 210 // XXX this stuff below should be applied to each readout... 213 211 // XXX for now, just use first readout … … 226 224 // the absolute minimum number of stars is 4 (for order = 1) 227 225 if ((rawstars->n < 4) || (refstars->n < 4)) { 228 readout->data_exists = false;229 psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", 230 rawstars->n, refstars->n);231 continue;232 } 226 readout->data_exists = false; 227 psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", 228 rawstars->n, refstars->n); 229 continue; 230 } 233 231 234 232 psastroUpdateChipToFPA (input->fpa, obsChip, rawstars, refstars); … … 237 235 psMetadata *updates = psMemIncrRefCounter (psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER")); 238 236 if (!updates) { 239 updates = psMetadataAlloc ();237 updates = psMetadataAlloc (); 240 238 } 241 239 242 240 // XXX update the header with info to reflect the failure 243 241 if (!psastroOneChipFit (input->fpa, obsChip, refstars, rawstars, recipe, updates)) { 244 readout->data_exists = false;245 psLogMsg ("psastro", 3, "failed to find a solution\n");246 psFree (updates);247 continue;242 readout->data_exists = false; 243 psLogMsg ("psastro", 3, "failed to find a solution\n"); 244 psFree (updates); 245 continue; 248 246 } 249 247 … … 253 251 } 254 252 253 psastroVisualPlotFixChips (input, xObs, yObs); 254 psFree (xObs); 255 psFree (yObs); 255 256 psFree (map); 256 257 psFree (view); -
branches/cnb_branch_20081011/psastro/src/psastroUtils.c
r12806 r20443 20 20 21 21 float pixelScaleUse = 1.0, pixelScale1 = 1.0, pixelScale2 = 1.0, pixelScale = 1.0; 22 psVector *oldScale = psVectorAllocEmpty (fpa->chips->n, PS_TYPE_F32); 22 23 23 24 char *option = psMetadataLookupStr (NULL, recipe, "PSASTRO.COMMON.SCALE.OPTION"); 24 25 if (option == NULL) { 25 psError(PSASTRO_ERR_DATA, false, "no choice set for common scale option\n");26 return false;26 psError(PSASTRO_ERR_DATA, false, "no choice set for common scale option\n"); 27 return false; 27 28 } 28 29 29 30 bool useExternal = true; 31 int nobj = 0; 30 32 31 33 // find the min or max scale chip 32 34 if (!strcasecmp (option, "MIN") || !strcasecmp (option, "MAX")) { 33 35 34 bool useMax = !strcasecmp (option, "MAX"); 35 pixelScaleUse = (useMax) ? FLT_MIN : FLT_MAX; 36 37 for (int i = 0; i < fpa->chips->n; i++) { 38 pmChip *chip = fpa->chips->data[i]; 39 if (!chip->process || !chip->file_exists) { continue; } 40 if (!chip->toFPA) { continue; } 41 42 pixelScale1 = hypot (chip->toFPA->x->coeff[1][0], chip->toFPA->x->coeff[0][1]); 43 pixelScale2 = hypot (chip->toFPA->y->coeff[1][0], chip->toFPA->y->coeff[0][1]); 44 pixelScale = 0.5*(pixelScale1 + pixelScale2); 45 46 pixelScaleUse = (useMax) ? PS_MAX (pixelScale, pixelScaleUse) : PS_MIN (pixelScale, pixelScaleUse); 47 } 48 useExternal = false; 49 } 36 bool useMax = !strcasecmp (option, "MAX"); 37 pixelScaleUse = (useMax) ? FLT_MIN : FLT_MAX; 38 39 for (int i = 0; i < fpa->chips->n; i++) { 40 pmChip *chip = fpa->chips->data[i]; 41 if (!chip->process || !chip->file_exists) { continue; } 42 if (!chip->toFPA) { continue; } 43 44 pixelScale1 = hypot (chip->toFPA->x->coeff[1][0], chip->toFPA->x->coeff[0][1]); 45 pixelScale2 = hypot (chip->toFPA->y->coeff[1][0], chip->toFPA->y->coeff[0][1]); 46 pixelScale = 0.5*(pixelScale1 + pixelScale2); 47 oldScale->data.F32[nobj++] = pixelScale; 48 pixelScaleUse = (useMax) ? PS_MAX (pixelScale, pixelScaleUse) : PS_MIN (pixelScale, pixelScaleUse); 49 } 50 useExternal = false; 51 oldScale->n = nobj; 52 } 53 50 54 51 55 // rescale each chip by the reference scale 52 56 for (int i = 0; i < fpa->chips->n; i++) { 53 pmChip *chip = fpa->chips->data[i];54 if (!chip->process || !chip->file_exists) { continue; }55 if (!chip->toFPA) { continue; }56 57 psPlaneTransform *toFPA = chip->toFPA;58 psPlaneTransform *fromFPA = chip->fromFPA;59 60 pixelScale1 = hypot (toFPA->x->coeff[1][0], toFPA->x->coeff[0][1]);61 pixelScale2 = hypot (toFPA->y->coeff[1][0], toFPA->y->coeff[0][1]);62 63 if (useExternal) {64 pixelScaleUse = getChipPixelScale (chip);65 }66 67 for (int i = 0; i <= toFPA->x->nX; i++) {68 for (int j = 0; j <= toFPA->x->nX; j++) {69 toFPA->x->coeff[i][j] *= pixelScaleUse/pixelScale1;70 toFPA->y->coeff[i][j] *= pixelScaleUse/pixelScale2;71 fromFPA->x->coeff[i][j] *= pixelScale1/pixelScaleUse;72 fromFPA->y->coeff[i][j] *= pixelScale2/pixelScaleUse;73 }74 }57 pmChip *chip = fpa->chips->data[i]; 58 if (!chip->process || !chip->file_exists) { continue; } 59 if (!chip->toFPA) { continue; } 60 61 psPlaneTransform *toFPA = chip->toFPA; 62 psPlaneTransform *fromFPA = chip->fromFPA; 63 64 pixelScale1 = hypot (toFPA->x->coeff[1][0], toFPA->x->coeff[0][1]); 65 pixelScale2 = hypot (toFPA->y->coeff[1][0], toFPA->y->coeff[0][1]); 66 67 if (useExternal) { 68 pixelScaleUse = getChipPixelScale (chip); 69 } 70 71 for (int i = 0; i <= toFPA->x->nX; i++) { 72 for (int j = 0; j <= toFPA->x->nX; j++) { 73 toFPA->x->coeff[i][j] *= pixelScaleUse/pixelScale1; 74 toFPA->y->coeff[i][j] *= pixelScaleUse/pixelScale2; 75 fromFPA->x->coeff[i][j] *= pixelScale1/pixelScaleUse; 76 fromFPA->y->coeff[i][j] *= pixelScale2/pixelScaleUse; 77 } 78 } 75 79 76 80 } 77 81 psastroMosaicSetAstrom (fpa); 82 if (!useExternal) { 83 psastroVisualPlotCommonScale (fpa, oldScale); 84 } 85 psFree (oldScale); 78 86 return true; 79 87 } -
branches/cnb_branch_20081011/psastro/src/psastroVisual.c
r20416 r20443 2 2 /***Diagnostic plots for psastro****/ 3 3 /***********************************/ 4 #ifdef HAVE_CONFIG_H 5 #include <config.h> 6 #endif 7 4 8 # include "psastroInternal.h" 5 9 # include <string.h> … … 20 24 static bool plotRemoveClumps = false; 21 25 static bool plotOneChipFit = false; 26 static bool plotFixChips = true; 22 27 static bool plotAstromGuessCheck = false; 23 28 static bool plotMosaicMatches = false; 29 static bool plotCommonScale = true; 24 30 static bool plotMosaicOneChip = false; 25 31 … … 29 35 30 36 // helper routine prototypes 37 bool psastroVisualInitGraph (int kapa, KapaSection *section, Graphdata *graphdata); 31 38 bool psastroVisualTriplePlot (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing); 32 39 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec); … … 538 545 539 546 547 /** Plots the chip corners in the FP before and after chips with inconsistent solutions have been fixed. 548 * Invoked during psastroFixChips 549 */ 550 bool psastroVisualPlotFixChips (pmFPAfile *input, ///< focal plane array file 551 psVector *xOld, ///< old X location of chip cornerss 552 psVector *yOld ///< old Y location of chip corners 553 ) 554 { 555 //make sure we want to plot this 556 if(!isVisual || !plotFixChips) return true; 557 558 if(!psastroVisualInitWindow(&kapa, "psastro:plots")) return false; 559 560 KapaSection section = {"s1", .05, .05, .9, .9}; 561 Graphdata graphdata; 562 KapaInitGraph( &graphdata); 563 KapaClearPlots (kapa); 564 graphdata.ptype = 2; 565 graphdata.style = 2; 566 567 psVector *xNew = psVectorAllocEmpty (xOld->n, PS_TYPE_F32); 568 psVector *yNew = psVectorAllocEmpty (yOld->n, PS_TYPE_F32); 569 570 // copy of the code in psastroFixChips that generated xOld, yOld, but for xNew, yNew 571 pmFPAview *view = pmFPAviewAlloc (0); 572 int nPts = 0; 573 pmChip *obsChip = NULL; 574 while ((obsChip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 575 if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; } 576 577 psRegion *region = pmChipPixels (obsChip); 578 psPlane ptCP, ptFP; 579 580 ptCP.x = region->x0; ptCP.y = region->y0; 581 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 582 xNew->data.F32[nPts] = ptFP.x; 583 yNew->data.F32[nPts] = ptFP.y; 584 nPts ++; 585 586 ptCP.x = region->x0; ptCP.y = region->y1; 587 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 588 xNew->data.F32[nPts] = ptFP.x; 589 yNew->data.F32[nPts] = ptFP.y; 590 nPts ++; 591 592 ptCP.x = region->x1; ptCP.y = region->y1; 593 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 594 xNew->data.F32[nPts] = ptFP.x; 595 yNew->data.F32[nPts] = ptFP.y; 596 nPts ++; 597 598 ptCP.x = region->x1; ptCP.y = region->y0; 599 psPlaneTransformApply (&ptFP, obsChip->toFPA, &ptCP); 600 xNew->data.F32[nPts] = ptFP.x; 601 yNew->data.F32[nPts] = ptFP.y; 602 nPts ++; 603 604 psFree (region); 605 } 606 xNew->n = yNew->n = nPts; 607 608 //set up graph 609 psastroVisualScaleGraphdata(&graphdata, xOld, yOld); 610 psastroVisualInitGraph(kapa, §ion, &graphdata); 611 KapaSendLabel (kapa, "L (FP)", KAPA_LABEL_XM); 612 KapaSendLabel (kapa, "M (FP)", KAPA_LABEL_YM); 613 KapaSendLabel (kapa, "Chip corners before (black) and after (red) FixChips", KAPA_LABEL_XP); 614 KapaPrepPlot (kapa, xOld->n, &graphdata); 615 KapaPlotVector (kapa, xOld->n, xOld->data.F32, "x"); 616 KapaPlotVector (kapa, xOld->n, yOld->data.F32, "y"); 617 618 graphdata.ptype = 1; 619 graphdata.color = KapaColorByName("red"); 620 KapaPrepPlot (kapa, xNew->n, &graphdata); 621 KapaPlotVector (kapa, xNew->n, xNew->data.F32, "x"); 622 KapaPlotVector (kapa, xNew->n, yNew->data.F32, "y"); 623 624 psastroVisualAskUser(&plotFixChips); 625 psFree(xNew); 626 psFree(yNew); 627 psFree(view); 628 return true; 629 } 630 631 540 632 /** 541 633 * Plots the fpa chip corners projected on to the tangential plane before and after … … 631 723 } 632 724 725 /** psastroVisualPlotCommonScale (fpa, oldScale, newScale) 726 * Plots the pixel scales of the fpa before they are 727 * equalized in psastroMosaicCommonScale 728 */ 729 730 bool psastroVisualPlotCommonScale (pmFPA *fpa, ///< the fpa 731 psVector *oldScale) ///< the old pixel scale of each chip in the fpa 732 { 733 //make sure we want to plot this 734 if (!isVisual || !plotCommonScale) return false; 735 736 if (!psastroVisualInitWindow(&kapa, "psastro:plots")) return false; 737 738 KapaSection section = {"s1", .05, .05, .9, .9}; 739 Graphdata graphdata; 740 psPlane ptCH, ptFP; 741 ptCH.x = 0; 742 ptCH.y = 0; 743 psVector *xVec = psVectorAllocEmpty (oldScale->n, PS_TYPE_F32); 744 psVector *yVec = psVectorAllocEmpty (oldScale->n, PS_TYPE_F32); 745 int nobj = 0; 746 747 //project each chip corner to the Focal Plane 748 for(int i = 0; i < fpa->chips->n; i++) { 749 pmChip *chip = fpa->chips->data[i]; 750 if (!chip->process || !chip->file_exists) { continue; } 751 if (!chip->toFPA) { continue; } 752 753 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH); 754 xVec->data.F32[nobj] = ptFP.x; 755 yVec->data.F32[nobj] = ptFP.y; 756 nobj++; 757 } 758 759 //set up plot window 760 KapaInitGraph (&graphdata); 761 KapaClearPlots (kapa); 762 KapaSetSection (kapa, §ion); 763 psastroVisualInitGraph(kapa, §ion, &graphdata); 764 psastroVisualTriplePlot (kapa, &graphdata, xVec, yVec, oldScale, false); 765 KapaSendLabel (kapa, "L (FP)", KAPA_LABEL_XM); 766 KapaSendLabel (kapa, "M (FP)", KAPA_LABEL_YM); 767 KapaSendLabel (kapa, "Old Pixel Scale of FPA Chips (Not to Scale)", KAPA_LABEL_XP); 768 769 psastroVisualAskUser (&plotCommonScale); 770 return true; 771 } 772 633 773 634 774 /** … … 663 803 //make sure we want to plot this 664 804 if (!isVisual || !plotMosaicMatches) return true; 665 char *title; 666 switch(iteration) { 667 case 0: 668 title = "Matches found during psastroMosaicSetMatch iteration 0"; 669 break; 670 case 1 : 671 title = "Matches found during psastroMosaicSetMatch iteration 1"; 672 break; 673 case 2: 674 title = "Matches found during psastroMosaicSetMatch iteration 2"; 675 break; 676 case 3: 677 title = "Matches found during psastroMosaicSetMatch iteration 3"; 678 break; 679 case 4: 680 title = "Matches found during psastroMosaicSetMatch iteration 4"; 681 break; 682 default: 683 title = "Matches found during psastroMosaicSetMatch"; 684 break; 685 } 805 806 char title[60]; 807 sprintf(title, "Matches found during psastroMosaicSetMatch iteration %d", iteration); 686 808 687 809 if (!psastroVisualResidPlot(rawstars, refstars, match, recipe, title)) … … 698 820 /*********************/ 699 821 822 /** psastroVisualInitGraph (kapa, *section, *graphdata) 823 * Initializes graph, sets the section, sets the font, 824 * sets the limits, draws the box 825 */ 826 827 bool psastroVisualInitGraph (int kapa, KapaSection *section, Graphdata *graphdata) 828 { 829 KapaSetSection (kapa, section); 830 KapaSetFont (kapa, "helvetica", 14); 831 KapaSetLimits (kapa, graphdata); 832 KapaBox (kapa, graphdata); 833 return true; 834 } 700 835 701 836 /** psastroVisualTriplePlot … … 1125 1260 return true; 1126 1261 } 1262 #else 1263 1264 bool psastroSetVisual (bool mode) {return true}; 1265 bool psastroVisualClose() {return true}; 1266 bool psastroVisualPlotLuminosityFunction (psVector *lnMag, psVector *Mag, pmLumFunc *lumFunc, pmLumFunc *rawFunc) {return true}; 1267 bool psastroVisualPlotRawStars (psArray *rawstars, pmFPA *fpa, pmChip *chip, psMetadata *recipe) {return true}; 1268 bool psastroVisualPlotRefStars (psArray *refstars, psMetadata *recipe) {return true}; 1269 bool psastroVisualPlotRemoveClumps (psArray *input, psImage *count, int scale, float limit) {return true}; 1270 bool psastroVisualPlotFixChips (pmFPAfile *input, psVector *xOld, psVector *yOld) {return true}; 1271 bool psastroVisualPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe) {return true}; 1272 bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, psVector *cornerQo, psVector *cornerPn, psVector *cornerQn, psVector *cornerPd, psVector *cornerQd) {return true}; 1273 bool psastroVisualPlotMosaicOneChip (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe) {return true}; 1274 bool psastroVisualPlotCommonScale (pmFPA *fpa, psVector *oldScale) {return true}; 1275 bool psastroVisualPlotMosaicMatches (psArray *rawstars, psArray *refstars, psArray *match, int iteration, psMetadata *recipe) {return true}; 1127 1276 1128 1277 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
