Changeset 20478
- Timestamp:
- Oct 30, 2008, 1:22:53 PM (18 years ago)
- Location:
- branches/cnb_branch_20081011
- Files:
-
- 3 edited
-
psModules/src/astrom/pmAstrometryVisual.c (modified) (5 diffs)
-
psastro/src/psastroUtils.c (modified) (1 diff)
-
psastro/src/psastroVisual.c (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branch_20081011/psModules/src/astrom/pmAstrometryVisual.c
r20443 r20478 25 25 # include <kapa.h> 26 26 27 # define KAPAX 80028 # define KAPAY 80027 # define KAPAX 700 28 # define KAPAY 700 29 29 30 30 31 31 //variables to determine when things are plotted 32 32 static bool isVisual = false; 33 static bool plotGridMatch = false;33 static bool plotGridMatch = true; 34 34 static bool plotTweak = true; 35 35 … … 266 266 * of these two profiles and adjusts the offset accordingly. This procedure plots the profiles. 267 267 */ 268 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, int xBin, int yBin) 268 bool pmAstromVisualPlotTweak (psVector *xHist, ///< Smoothed Horizontal cut through the histogram 269 psVector *yHist, ///< Smoothed Vertical cut throug the histogram 270 int xBin, ///< X Bin index of the histogram peak 271 int yBin ///< Y bin index of the histogram peak 272 ) 269 273 { 270 274 //make sure we want to plot this … … 294 298 295 299 // plot the X histogram 296 pmAstromVisualScaleGraphdata(&graphdata, xIndices, xHist New, false);300 pmAstromVisualScaleGraphdata(&graphdata, xIndices, xHist, false); 297 301 KapaSetSection(kapa, §ion1); 298 302 KapaSetLimits (kapa, &graphdata); … … 321 325 322 326 //plot the Y histogram 323 pmAstromVisualScaleGraphdata(&graphdata, yIndices, yHist New, false);327 pmAstromVisualScaleGraphdata(&graphdata, yIndices, yHist, false); 324 328 KapaSetSection(kapa, §ion2); 325 329 KapaSetLimits (kapa, &graphdata); 326 330 KapaSetFont(kapa, "helvetica", 14); 331 graphdata.color = KapaColorByName ("black"); 327 332 KapaBox(kapa, &graphdata); 328 333 KapaSendLabel (kapa, "Y offset Bin", KAPA_LABEL_XM); … … 333 338 graphdata.ptype = 0; 334 339 graphdata.size = 0.4; 335 graphdata.color = KapaColorByName ("black");336 340 337 341 KapaPrepPlot (kapa, yHist->n, &graphdata); -
branches/cnb_branch_20081011/psastro/src/psastroUtils.c
r20443 r20478 77 77 } 78 78 } 79 80 79 } 81 80 psastroMosaicSetAstrom (fpa); -
branches/cnb_branch_20081011/psastro/src/psastroVisual.c
r20443 r20478 14 14 # include <kapa.h> 15 15 16 # define KAPAX 80017 # define KAPAY 80016 # define KAPAX 700 17 # define KAPAY 700 18 18 19 19 //variables to determine when things are plotted 20 20 static bool isVisual = false; 21 static bool plotRawStars = false;21 static bool plotRawStars = true; 22 22 static bool plotRefStars = false; 23 static bool plotLumFunc = false;24 static bool plotRemoveClumps = false;25 static bool plotOneChipFit = false;23 static bool plotLumFunc = true; 24 static bool plotRemoveClumps = true; 25 static bool plotOneChipFit = true; 26 26 static bool plotFixChips = true; 27 static bool plotAstromGuessCheck = false;28 static bool plotMosaicMatches = false;27 static bool plotAstromGuessCheck = true; 28 static bool plotMosaicMatches = true; 29 29 static bool plotCommonScale = true; 30 static bool plotMosaicOneChip = false;30 static bool plotMosaicOneChip = true; 31 31 32 32 // variables to store plotting window indices … … 37 37 bool psastroVisualInitGraph (int kapa, KapaSection *section, Graphdata *graphdata); 38 38 bool psastroVisualTriplePlot (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing); 39 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec );39 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec, bool clip); 40 40 bool psastroVisualTripleOverplot (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing); 41 41 bool psastroVisualCreateScaleVec (psVector *zVec, psVector *zScale, bool increasing); … … 81 81 if (key[0] == 'a') { 82 82 psastroSetVisual(false); 83 pmAstromSetVisual(false); 83 84 } 84 85 return true; … … 101 102 102 103 103 /** psastroVisualPlotRawStars104 /** 104 105 * Plot raw stars as determined from first pass astrometry fit 105 106 * Called within psastroAstromGeuss … … 269 270 270 271 271 /** psastroVisualPlotRefStars272 /** 272 273 * plot the location of references stars over the entire fpa 273 274 * invoked during psastroChooseRefStars … … 277 278 //make sure we want to plot this 278 279 if (!isVisual || !plotRefStars) return true; 279 Graphdata graphdata;280 280 281 281 //set up plotting variables … … 283 283 return false; 284 284 285 Graphdata graphdata; 285 286 KapaInitGraph (&graphdata); 286 287 KapaClearSections (kapa); … … 333 334 334 335 335 /** psastroVisualPlotLuminosityFunction336 /** 336 337 * Plot the two luminosity functions created within psastroRefStarSubset 337 338 * The luminosity functions are used to select a subset of reference stars, 338 339 * so we plot the cutoff that defines this subset 339 340 */ 340 bool psastroVisualPlotLuminosityFunction (psVector *lnMag, psVector *Mag, 341 pmLumFunc *lumFunc, pmLumFunc *rawFunc) { 341 bool psastroVisualPlotLuminosityFunction (psVector *lnMag, ///< Log(n) for each magnitude bin 342 psVector *Mag, ///< magnitude bins 343 pmLumFunc *lumFunc,///< Fit to the reference star luminosity function 344 pmLumFunc *rawFunc ///< Fit to the raw star luminoisty function 345 ) 346 { 342 347 343 348 // make sure we want to plot this … … 361 366 362 367 //Determine Plot Limits 363 psastroVisualScaleGraphdata(&graphdata, Mag, lnMag );368 psastroVisualScaleGraphdata(&graphdata, Mag, lnMag, false); 364 369 365 370 //Make a line for the fit … … 422 427 423 428 424 /** psastroVisualPlotRemoveClumps429 /** 425 430 * Plot the stars in a region, and indicate which stars are part of 'clumps' 426 431 * These stars are flagged during astrometric fitting, since dense regions are 427 432 * harder to cross-match than sparse ones. Called during psastroRemoveClumps. 428 433 */ 429 bool psastroVisualPlotRemoveClumps (psArray *input, psImage *count, int scale, float limit) { 434 bool psastroVisualPlotRemoveClumps (psArray *input, ///< Array containing the field stars 435 psImage *count, ///< A 2D histogram of the field star distribution 436 int scale, ///< The pixel size of the histogram 437 float limit ///< The minimum numuber of stars in a bin flagged as a clump 438 ) 439 { 430 440 431 441 //make sure we want to plot this … … 524 534 525 535 526 /** psastroVisualPlotOneChipFit527 * assess the goodness of fit for a signle chip by536 /** 537 * Assess the goodness of fit for a signle chip by 528 538 * plotting the fit residuals 529 539 * invoked during psastroOneChipFit 530 540 */ 531 bool psastroVisualPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe) { 541 bool psastroVisualPlotOneChipFit (psArray *rawstars, ///< stars detected in the image 542 psArray *refstars, ///< reference stars over the same region 543 psArray *match, ///< contains which rawstars match to which refstars 544 psMetadata *recipe ///< data reduction recipe 545 ) 546 { 532 547 533 548 //make sure we want to plot this … … 545 560 546 561 547 /** Plots the chip corners in the FP before and after chips with inconsistent solutions have been fixed. 562 /** 563 * Plots the chip corners in the FP before and after chips with inconsistent solutions have been fixed. 548 564 * Invoked during psastroFixChips 549 565 */ 550 566 bool psastroVisualPlotFixChips (pmFPAfile *input, ///< focal plane array file 551 psVector *xOld, ///< old X location of chip cornerss552 psVector *yOld ///< old Y location of chip corners553 )567 psVector *xOld, ///< old X location of chip cornerss 568 psVector *yOld ///< old Y location of chip corners 569 ) 554 570 { 555 571 //make sure we want to plot this … … 565 581 graphdata.style = 2; 566 582 567 psVector *xNew = psVectorAlloc Empty(xOld->n, PS_TYPE_F32);568 psVector *yNew = psVectorAlloc Empty(yOld->n, PS_TYPE_F32);583 psVector *xNew = psVectorAlloc (xOld->n, PS_TYPE_F32); 584 psVector *yNew = psVectorAlloc (yOld->n, PS_TYPE_F32); 569 585 570 586 // copy of the code in psastroFixChips that generated xOld, yOld, but for xNew, yNew … … 607 623 608 624 //set up graph 609 psastroVisualScaleGraphdata(&graphdata, xOld, yOld );625 psastroVisualScaleGraphdata(&graphdata, xOld, yOld, true); 610 626 psastroVisualInitGraph(kapa, §ion, &graphdata); 611 627 KapaSendLabel (kapa, "L (FP)", KAPA_LABEL_XM); … … 637 653 * old to new coordinates 638 654 */ 639 bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, psVector *cornerQo, 640 psVector *cornerPn, psVector *cornerQn, 641 psVector *cornerPd, psVector *cornerQd) { 655 bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, ///< P coordinates of chip corners before fitting 656 psVector *cornerQo, ///< Q coordinates of chip corners before fitting 657 psVector *cornerPn, ///< P coordinates of chip corners after fitting 658 psVector *cornerQn, ///< Q coordinates of chip corners after fitting 659 psVector *cornerPd, ///< P coordinate residuals of fit from old to new coordinates 660 psVector *cornerQd ///< Q coordinate residuals of fit from old to new coordinates 661 ) 662 { 642 663 643 664 //make sure we want to plot this … … 668 689 psFree(section.name); 669 690 670 psastroVisualScaleGraphdata (&graphdata, cornerPo, cornerPo );691 psastroVisualScaleGraphdata (&graphdata, cornerPo, cornerPo, true); 671 692 KapaSetLimits (kapa, &graphdata); 672 693 KapaBox (kapa, &graphdata); … … 705 726 psFree(section.name); 706 727 707 psastroVisualScaleGraphdata (&graphdata, xResid, yResid );728 psastroVisualScaleGraphdata (&graphdata, xResid, yResid, true); 708 729 KapaSetLimits (kapa, &graphdata); 709 730 KapaBox (kapa, &graphdata); … … 723 744 } 724 745 725 /** psastroVisualPlotCommonScale (fpa, oldScale, newScale) 746 747 /** 726 748 * Plots the pixel scales of the fpa before they are 727 749 * equalized in psastroMosaicCommonScale 728 750 */ 729 730 751 bool psastroVisualPlotCommonScale (pmFPA *fpa, ///< the fpa 731 psVector *oldScale) ///< the old pixel scale of each chip in the fpa 752 psVector *oldScale ///< the old pixel scale of each chip in the fpa 753 ) 732 754 { 733 755 //make sure we want to plot this … … 741 763 ptCH.x = 0; 742 764 ptCH.y = 0; 743 psVector *xVec = psVectorAllocEmpty (oldScale->n, PS_TYPE_F32); 744 psVector *yVec = psVectorAllocEmpty (oldScale->n, PS_TYPE_F32); 765 psVector *xVec = psVectorAlloc (oldScale->n, PS_TYPE_F32); 766 psVector *yVec = psVectorAlloc (oldScale->n, PS_TYPE_F32); 767 745 768 int nobj = 0; 746 769 … … 761 784 KapaClearPlots (kapa); 762 785 KapaSetSection (kapa, §ion); 763 psastroVisualInitGraph(kapa, §ion, &graphdata);786 KapaSetFont (kapa, "helvetica", 14); 764 787 psastroVisualTriplePlot (kapa, &graphdata, xVec, yVec, oldScale, false); 765 788 KapaSendLabel (kapa, "L (FP)", KAPA_LABEL_XM); … … 773 796 774 797 /** 775 * psastroVisualPlotMosaicOneChip (rawstars, refstars, match);776 798 * plot the residuals between raw stars and ref stars after 777 799 * fitting in psastroMosaicOneChip … … 820 842 /*********************/ 821 843 844 822 845 /** psastroVisualInitGraph (kapa, *section, *graphdata) 823 846 * Initializes graph, sets the section, sets the font, 824 847 * sets the limits, draws the box 825 848 */ 826 827 849 bool psastroVisualInitGraph (int kapa, KapaSection *section, Graphdata *graphdata) 828 850 { … … 834 856 } 835 857 858 836 859 /** psastroVisualTriplePlot 837 860 * plot 2 vectors whose point sizes are scaled by a third vector … … 840 863 bool psastroVisualTriplePlot (int kapid, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing) 841 864 { 842 psastroVisualScaleGraphdata (graphdata, xVec, yVec );865 psastroVisualScaleGraphdata (graphdata, xVec, yVec, true); 843 866 //printf("%f %f %f %f \n",graphdata->xmin, graphdata->xmax, graphdata->ymin, graphdata->ymax); 844 867 // set the scale vector … … 851 874 852 875 // the point size will be scaled from the z vector 876 graphdata->ptype = 7; 877 graphdata->style = 2; 853 878 graphdata->size = -1; 854 879 KapaPrepPlot (kapid, xVec->n, graphdata); … … 916 941 * prevent outliers from making te plot region too big. 917 942 */ 918 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec ) {943 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec, bool clip) { 919 944 920 945 graphdata->xmin = +FLT_MAX; … … 929 954 psVectorStats (statsY, yVec, NULL, NULL, 0); 930 955 931 float xhi = statsX->sampleMedian + 3 *statsX->sampleStdev; 932 float xlo = statsX->sampleMedian - 3 *statsX->sampleStdev; 933 float yhi = statsY->sampleMedian + 3 *statsY->sampleStdev; 934 float ylo = statsY->sampleMedian - 3 *statsY->sampleStdev; 956 float xhi = +FLT_MAX, xlo = -FLT_MAX, yhi = +FLT_MAX, ylo = -FLT_MAX; 957 if (clip) { 958 xhi = statsX->sampleMedian + 3 *statsX->sampleStdev; 959 xlo = statsX->sampleMedian - 3 *statsX->sampleStdev; 960 yhi = statsY->sampleMedian + 3 *statsY->sampleStdev; 961 ylo = statsY->sampleMedian - 3 *statsY->sampleStdev; 962 } 935 963 936 964 // abort if there is no good data … … 1220 1248 float xmax = graphdata.xmax; 1221 1249 float ymax = graphdata.ymax; 1222 psastroVisualScaleGraphdata(&graphdata, xVec, yVec );1250 psastroVisualScaleGraphdata(&graphdata, xVec, yVec, true); 1223 1251 graphdata.xmin = PS_MIN(xmin, graphdata.xmin); 1224 1252 graphdata.ymin = PS_MIN(ymin, graphdata.ymin); … … 1260 1288 return true; 1261 1289 } 1290 1291 // END OF PROGRAM 1262 1292 #else 1263 1293
Note:
See TracChangeset
for help on using the changeset viewer.
