- Timestamp:
- Oct 28, 2008, 1:20:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.
