IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 19, 2008, 3:26:07 PM (17 years ago)
Author:
eugene
Message:

importing astrometry visualizations from cmb_branch_20081011

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmAstrometryObjects.c

    r20039 r20801  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2008-10-10 02:33:35 $
     10*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2008-11-20 01:26:07 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929#include <unistd.h>   // for unlink
    3030#include <pslib.h>
    31 #include <kapa.h> // cnb: do I need an IFDEF?
    3231
    3332#include "pmHDU.h"
     
    3534#include "pmAstrometryObjects.h"
    3635#include "pmKapaPlots.h"
     36#include "pmAstrometryVisual.h"
    3737
    3838#define PM_ASTROMETRYOBJECTS_DEBUG 1
     
    120120        i++;
    121121    }
    122 
    123122    return (matches);
    124123}
     
    564563    psF32 **D2 = gridD2->data.F32;
    565564
    566 #ifdef PLOTS
    567     // vectors to hold dX and dY
    568     int nplot = raw->n * ref->n;
    569     float dXplot[nplot];
    570     float dYplot[nplot];
    571 #endif
    572565
    573566    // accumulate grids for focal plane (L,M) matches
     
    579572            dY = ob1->FP->y - ob2->FP->y;
    580573
    581 #ifdef PLOTS
    582             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 #endif
    586574            // find bin coordinates for this delta-delta
    587575            if (!AstromGridBin (&iX, &iY, dX, dY)) {
     
    618606        }
    619607
    620         # if 0
     608# if 0
    621609        char line[16];
    622610        psFits *fits = psFitsOpen ("grid.image.fits", "w");
     
    625613        fprintf (stderr, "wrote grid image, press return to continue\n");
    626614        fgets (line, 15, stdin);
    627         # endif
     615# endif
    628616
    629617        // only check bins with at least 1/2 of max bin
     
    670658        }
    671659
     660        pmAstromVisualPlotGridMatch(raw, ref, gridNP, stats->offset.x, stats->offset.y,
     661                                    maxOffpix, Scale, Offset);
     662
    672663        psFree (imStats);
    673664        // XXX EAM : This routine, and pmAstromGridMatch, need to handle failure cases better
     
    689680    // fprintf (stderr, "sigma: nMatch: %d, nTest: %d, nTen: %d\n", stats->nMatch, stats->nTest, sort->data.U32[sort->n - 10]);
    690681
    691 #ifdef PLOTS
    692     /*** 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, &section);
    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 distribution
    725     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 #endif
    746682
    747683  psFree (sort);
     
    767703    PS_ASSERT_PTR_NON_NULL(ref, NULL);
    768704    PS_ASSERT_PTR_NON_NULL(config, NULL);
    769 
    770705    bool status;
    771706    double xMin, xMax, yMin, yMax;
     
    911846    psVector *xHistNew = psVectorSmooth(NULL, xHist, tweakSmooth, tweakNsigma);
    912847    psVector *yHistNew = psVectorSmooth(NULL, yHist, tweakSmooth, tweakNsigma);
    913     psFree(xHist);
    914     psFree(yHist);
    915     xHist = xHistNew;
    916     yHist = yHistNew;
    917848
    918849    // select peak in x and in y
     
    921852    double yMax = 0;
    922853    for (int i = 0; i < nBin; i++) {
    923         if (xHist->data.F32[i] > xMax) {
     854        if (xHistNew->data.F32[i] > xMax) {
    924855            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) {
    928859            yBin = i;
    929             yMax = yHist->data.F32[i];
     860            yMax = yHistNew->data.F32[i];
    930861        }
    931862    }
     
    940871    tweak->offset.y += yPeak;
    941872
     873    pmAstromVisualPlotTweak (xHistNew, yHistNew, xBin, yBin);
     874
    942875    psFree (rot);
    943876    psFree (xHist);
    944877    psFree (yHist);
     878    psFree (xHistNew);
     879    psFree (yHistNew);
    945880
    946881    return tweak;
Note: See TracChangeset for help on using the changeset viewer.