IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 22, 2009, 3:00:47 PM (16 years ago)
Author:
eugene
Message:

various updates from eam_branches/20091113

1) psf model order limits now consistent in poly and map modes
2) added subpix visualization
3) added model fit in MATCHED_REFS
4) handle input smf files with empty extensions (earlier failure)
5) function for generating unique reference matches

File:
1 edited

Legend:

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

    r25729 r26260  
    450450
    451451    graphdata.color = KapaColorByName ("red");
    452     graphdata.style = 1;
     452    graphdata.style = 0;
    453453
    454454    //overplot clumpy regions excluded from analysis
     
    905905    KapaPlotVector (kapa, gridNP->numCols, horizontalIndices, "x");
    906906    KapaPlotVector (kapa, gridNP->numCols, horizHistSlice, "y");
     907
    907908    float xslice[2] = {offsetX - Scale / 2., offsetX - Scale / 2.};
    908909    float yslice[2] = {-5, 100};
     910    graphdata.style = 0;
    909911    graphdata.color = KapaColorByName("red");
    910912    KapaPrepPlot(kapa, 2, &graphdata);
     
    927929    KapaPlotVector (kapa, gridNP->numRows, vertHistSlice, "x");
    928930    KapaPlotVector (kapa, gridNP->numRows, verticalIndices, "y");
     931
    929932    yslice[0] = yslice[1] = offsetY - Scale / 2.;
    930933    xslice[0] = -5; xslice[1] = 100;
     934    graphdata.style = 0;
    931935    graphdata.color = KapaColorByName("red");
    932936    KapaPrepPlot(kapa, 2, &graphdata);
     
    940944} // end of pmAstromVisualPlotGridMatch
    941945
     946
     947bool pmAstromVisualPlotGridMatchOverlay (const psArray *raw,
     948                                         const psArray *ref)
     949{
     950    //make sure we want to plot this
     951    if (!pmVisualIsVisual() || !plotGridMatch) return true;
     952    if (!pmVisualInitWindow(&kapa2, "psastro:plots")){
     953        return false;
     954    }
     955
     956    Graphdata graphdata;
     957    psVector *xPlot = psVectorAlloc (PS_MAX(raw->n, ref->n), PS_TYPE_F32); // x data points
     958    psVector *yPlot = psVectorAlloc (PS_MAX(raw->n, ref->n), PS_TYPE_F32); // y data points
     959    psVector *zPlot = psVectorAlloc (PS_MAX(raw->n, ref->n), PS_TYPE_F32); // y data points
     960
     961    // set up plot information
     962    KapaClearPlots(kapa2);
     963    KapaInitGraph(&graphdata);
     964
     965    KapaSetFont(kapa2, "helvetica", 14);
     966    KapaBox(kapa2, &graphdata);
     967    KapaSendLabel (kapa2, "X (FP)", KAPA_LABEL_XM);
     968    KapaSendLabel (kapa2, "Y (FP)", KAPA_LABEL_YM);
     969    KapaSendLabel (kapa2, "pmAstromGridAngle residuals. Box: Correlation Peak.", KAPA_LABEL_XP);
     970
     971    // plot the REF data.  (also calculate the plot ranges, accumulate the plot vectors)
     972    graphdata.xmin = +INT_MAX;
     973    graphdata.xmax = -INT_MAX;
     974    graphdata.ymin = +INT_MAX;
     975    graphdata.ymax = -INT_MAX;
     976    for (int i = 0; i < ref->n; i++) {
     977        pmAstromObj *obj = ref->data[i];
     978        graphdata.xmin = PS_MIN(graphdata.xmin, obj->FP->x);
     979        graphdata.xmax = PS_MAX(graphdata.xmax, obj->FP->x);
     980        graphdata.ymin = PS_MIN(graphdata.ymin, obj->FP->y);
     981        graphdata.ymax = PS_MAX(graphdata.ymax, obj->FP->y);
     982        xPlot->data.F32[i] = obj->FP->x;
     983        yPlot->data.F32[i] = obj->FP->y;
     984        zPlot->data.F32[i] = obj->Mag;
     985    }
     986    xPlot->n = yPlot->n = zPlot->n = ref->n;
     987    KapaSetLimits(kapa2, &graphdata);
     988
     989    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
     990    psVectorStats (stats, zPlot, NULL, NULL, 0);
     991    float zero = stats->sampleMedian + 3.0;
     992    float range = 6.0;
     993
     994    for (int i = 0; i < zPlot->n; i++) {
     995        float value = (zero - zPlot->data.F32[i]) / range;
     996        zPlot->data.F32[i] = PS_MAX(0.0, PS_MIN(1.0, value));
     997    }
     998
     999    // the point size will be scaled from the z vector
     1000    graphdata.style = 2;
     1001    graphdata.ptype = 7;
     1002    graphdata.size = -1;
     1003    graphdata.color = KapaColorByName ("black");
     1004
     1005    KapaPrepPlot   (kapa2, xPlot->n, &graphdata);
     1006    KapaPlotVector (kapa2, xPlot->n, xPlot->data.F32, "x");
     1007    KapaPlotVector (kapa2, yPlot->n, yPlot->data.F32, "y");
     1008    KapaPlotVector (kapa2, zPlot->n, zPlot->data.F32, "z");
     1009
     1010    // plot the RAW data (keep previous limits)
     1011    for (int i = 0; i < raw->n; i++) {
     1012        pmAstromObj *obj = raw->data[i];
     1013        xPlot->data.F32[i] = obj->FP->x;
     1014        yPlot->data.F32[i] = obj->FP->y;
     1015        zPlot->data.F32[i] = obj->Mag;
     1016    }
     1017    xPlot->n = yPlot->n = zPlot->n = raw->n;
     1018
     1019    psStatsInit(stats);
     1020    psVectorStats (stats, zPlot, NULL, NULL, 0);
     1021    zero = stats->sampleMedian + 3.0;
     1022    range = 6.0;
     1023
     1024    for (int i = 0; i < zPlot->n; i++) {
     1025        float value = (zero - zPlot->data.F32[i]) / range;
     1026        zPlot->data.F32[i] = PS_MAX(0.0, PS_MIN(1.0, value));
     1027    }
     1028
     1029    // the point size will be scaled from the z vector
     1030    graphdata.style = 2;
     1031    graphdata.ptype = 7;
     1032    graphdata.size = -1;
     1033    graphdata.color = KapaColorByName ("red");
     1034
     1035    KapaPrepPlot   (kapa2, xPlot->n, &graphdata);
     1036    KapaPlotVector (kapa2, xPlot->n, xPlot->data.F32, "x");
     1037    KapaPlotVector (kapa2, yPlot->n, yPlot->data.F32, "y");
     1038    KapaPlotVector (kapa2, zPlot->n, zPlot->data.F32, "z");
     1039
     1040    pmVisualAskUser(&plotGridMatch);
     1041    psFree(xPlot);
     1042    psFree(yPlot);
     1043    psFree(zPlot);
     1044    psFree(stats);
     1045    return true;
     1046}
    9421047
    9431048bool pmAstromVisualPlotTweak (psVector *xHist, // Smoothed Horizontal cut through the histogram
Note: See TracChangeset for help on using the changeset viewer.