Changeset 20801 for trunk/psModules/src/astrom/pmAstrometryObjects.c
- Timestamp:
- Nov 19, 2008, 3:26:07 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/astrom/pmAstrometryObjects.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometryObjects.c
r20039 r20801 8 8 * @author EAM, IfA 9 9 * 10 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2008-1 0-10 02:33:35$10 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2008-11-20 01:26:07 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 29 29 #include <unistd.h> // for unlink 30 30 #include <pslib.h> 31 #include <kapa.h> // cnb: do I need an IFDEF?32 31 33 32 #include "pmHDU.h" … … 35 34 #include "pmAstrometryObjects.h" 36 35 #include "pmKapaPlots.h" 36 #include "pmAstrometryVisual.h" 37 37 38 38 #define PM_ASTROMETRYOBJECTS_DEBUG 1 … … 120 120 i++; 121 121 } 122 123 122 return (matches); 124 123 } … … 564 563 psF32 **D2 = gridD2->data.F32; 565 564 566 #ifdef PLOTS567 // vectors to hold dX and dY568 int nplot = raw->n * ref->n;569 float dXplot[nplot];570 float dYplot[nplot];571 #endif572 565 573 566 // accumulate grids for focal plane (L,M) matches … … 579 572 dY = ob1->FP->y - ob2->FP->y; 580 573 581 #ifdef PLOTS582 dXplot[(i * ref->n) + j] = dX;583 dYplot[(i * ref->n) + j] = dY;584 // fprintf (f, "dX,dY: %8.2f %8.2f : %8.2f %8.2f : %8.2f %8.2f\n", dX, dY, ob1->FP->x, ob2->FP->x, ob1->FP->y, ob2->FP->y);585 #endif586 574 // find bin coordinates for this delta-delta 587 575 if (!AstromGridBin (&iX, &iY, dX, dY)) { … … 618 606 } 619 607 620 # if 0608 # if 0 621 609 char line[16]; 622 610 psFits *fits = psFitsOpen ("grid.image.fits", "w"); … … 625 613 fprintf (stderr, "wrote grid image, press return to continue\n"); 626 614 fgets (line, 15, stdin); 627 # endif615 # endif 628 616 629 617 // only check bins with at least 1/2 of max bin … … 670 658 } 671 659 660 pmAstromVisualPlotGridMatch(raw, ref, gridNP, stats->offset.x, stats->offset.y, 661 maxOffpix, Scale, Offset); 662 672 663 psFree (imStats); 673 664 // XXX EAM : This routine, and pmAstromGridMatch, need to handle failure cases better … … 689 680 // fprintf (stderr, "sigma: nMatch: %d, nTest: %d, nTen: %d\n", stats->nMatch, stats->nTest, sort->data.U32[sort->n - 10]); 690 681 691 #ifdef PLOTS692 /*** plot DXs and DYs ***/693 KapaSection section = {"s1", 0.00, 0.00, 1.0, 1.0};694 //KapaSection left = {"s2", 0.05, 0.05, 0.35, 0.8};695 //KapaSection right = {"s3", 0.55, 0.05, 0.35, 0.8};696 //KapaSection yprof = {"s4", 0.45, 0.05, 0.10, 0.9};697 //KapaSection xprof = {"s5", .05, .90, .35, .1};698 699 Graphdata graphdata;700 int kapa = pmKapaOpen(true);701 KapaClearPlots(kapa);702 KapaInitGraph(&graphdata);703 KapaSetSection(kapa, §ion);704 graphdata.xmin = stats->offset.x - 1.5 * maxOffpix;705 graphdata.xmax = stats->offset.x + 1.5 * maxOffpix;706 graphdata.ymin = stats->offset.y - 1.5 * maxOffpix;707 graphdata.ymax = stats->offset.y + 1.5 * maxOffpix;708 709 KapaSetLimits(kapa, &graphdata);710 KapaSetFont(kapa, "helvetica", 14);711 KapaBox(kapa, &graphdata);712 KapaSendLabel (kapa, "X offset", KAPA_LABEL_XM);713 KapaSendLabel (kapa, "Y offset", KAPA_LABEL_YM);714 KapaSendLabel (kapa, "pmAstromGridAngle residuals. Big Box: Serach Region. Small Box: Correlation Peak.",715 KAPA_LABEL_XP);716 graphdata.style = 2;717 graphdata.ptype = 0;718 graphdata.size = 0.4;719 graphdata.color = KapaColorByName ("black");720 KapaPrepPlot(kapa, nplot, &graphdata);721 KapaPlotVector (kapa, nplot, dXplot, "x");722 KapaPlotVector (kapa, nplot, dYplot, "y");723 724 //Overplot bounding box, peak of distribution725 float xbound[5] = { -maxOffpix, maxOffpix, maxOffpix, -maxOffpix, -maxOffpix};726 float ybound[5] = { -maxOffpix, -maxOffpix, maxOffpix, maxOffpix, -maxOffpix};727 float xbin[5] = {stats->offset.x - 0.5 * Scale, stats->offset.x + 0.5 * Scale, stats->offset.x + 0.5 * Scale,728 stats->offset.x - 0.5 * Scale, stats->offset.x - 0.5 * Scale};729 float ybin[5] = {stats->offset.y - 0.5 * Scale, stats->offset.y - 0.5 * Scale, stats->offset.y + 0.5 * Scale,730 stats->offset.y + 0.5 * Scale, stats->offset.y - 0.5 * Scale};731 graphdata.color = KapaColorByName("red");732 graphdata.style = 0;733 graphdata.size = 1.0;734 KapaPrepPlot(kapa, 5, &graphdata);735 KapaPlotVector (kapa, 5, xbound, "x");736 KapaPlotVector (kapa, 5, ybound, "y");737 KapaPrepPlot(kapa, 5, &graphdata);738 KapaPlotVector (kapa, 5, xbin, "x");739 KapaPlotVector (kapa, 5, ybin, "y");740 741 KapaPNG(kapa, "dXdY.png");742 char c;743 fscanf(stdin, "%c", &c);744 /*** end ***/745 #endif746 682 747 683 psFree (sort); … … 767 703 PS_ASSERT_PTR_NON_NULL(ref, NULL); 768 704 PS_ASSERT_PTR_NON_NULL(config, NULL); 769 770 705 bool status; 771 706 double xMin, xMax, yMin, yMax; … … 911 846 psVector *xHistNew = psVectorSmooth(NULL, xHist, tweakSmooth, tweakNsigma); 912 847 psVector *yHistNew = psVectorSmooth(NULL, yHist, tweakSmooth, tweakNsigma); 913 psFree(xHist);914 psFree(yHist);915 xHist = xHistNew;916 yHist = yHistNew;917 848 918 849 // select peak in x and in y … … 921 852 double yMax = 0; 922 853 for (int i = 0; i < nBin; i++) { 923 if (xHist ->data.F32[i] > xMax) {854 if (xHistNew->data.F32[i] > xMax) { 924 855 xBin = i; 925 xMax = xHist ->data.F32[i];926 } 927 if (yHist ->data.F32[i] > yMax) {856 xMax = xHistNew->data.F32[i]; 857 } 858 if (yHistNew->data.F32[i] > yMax) { 928 859 yBin = i; 929 yMax = yHist ->data.F32[i];860 yMax = yHistNew->data.F32[i]; 930 861 } 931 862 } … … 940 871 tweak->offset.y += yPeak; 941 872 873 pmAstromVisualPlotTweak (xHistNew, yHistNew, xBin, yBin); 874 942 875 psFree (rot); 943 876 psFree (xHist); 944 877 psFree (yHist); 878 psFree (xHistNew); 879 psFree (yHistNew); 945 880 946 881 return tweak;
Note:
See TracChangeset
for help on using the changeset viewer.
