Changeset 26129
- Timestamp:
- Nov 13, 2009, 4:58:22 AM (16 years ago)
- Location:
- branches/eam_branches/20091113/psModules/src/astrom
- Files:
-
- 3 edited
-
pmAstrometryObjects.c (modified) (2 diffs)
-
pmAstrometryVisual.c (modified) (4 diffs)
-
pmAstrometryVisual.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091113/psModules/src/astrom/pmAstrometryObjects.c
r24034 r26129 634 634 } 635 635 636 # if 0 637 char line[16];638 psFits *fits = psFitsOpen ("grid.image.fits", "w");639 psFitsWriteImage (fits, NULL, gridNP, 0, NULL);640 psFitsClose (fits);641 fprintf (stderr, "wrote grid image, press return to continue\n");642 fgets (line, 15, stdin);643 # endif 636 if (psTraceGetLevel("psModules.astrom") >= 5) { 637 char line[16]; 638 psFits *fits = psFitsOpen ("grid.image.fits", "w"); 639 psFitsWriteImage (fits, NULL, gridNP, 0, NULL); 640 psFitsClose (fits); 641 fprintf (stderr, "wrote grid image, press return to continue\n"); 642 fgets (line, 15, stdin); 643 } 644 644 645 645 // only check bins with at least 1/2 of max bin 646 646 // XXX requiring at least 3 matches in bin 647 647 int minNpts = PS_MAX (0.5*imStats->max, 5); 648 psTrace("psModule.astrom", 5, "minNpts: %d, min: %d, max: %d, median: %f, stdev: %f", minNpts, (int)(imStats->min), (int)(imStats->max), imStats->sampleMedian, imStats->sampleStdev);648 psTrace("psModule.astrom", 4, "minNpts: %d, min: %d, max: %d, median: %f, stdev: %f", minNpts, (int)(imStats->min), (int)(imStats->max), imStats->sampleMedian, imStats->sampleStdev); 649 649 650 650 // find the 'best' bin … … 687 687 688 688 // XXX this function is crashing 689 // pmAstromVisualPlotGridMatch(raw, ref, gridNP, stats->offset.x, stats->offset.y, maxOffpix, Scale, Offset); 689 pmAstromVisualPlotGridMatch(raw, ref, gridNP, stats->offset.x, stats->offset.y, maxOffpix, Scale, Offset); 690 pmAstromVisualPlotGridMatchOverlay(raw, ref); 690 691 691 692 psFree (imStats); -
branches/eam_branches/20091113/psModules/src/astrom/pmAstrometryVisual.c
r25729 r26129 450 450 451 451 graphdata.color = KapaColorByName ("red"); 452 graphdata.style = 1;452 graphdata.style = 0; 453 453 454 454 //overplot clumpy regions excluded from analysis … … 905 905 KapaPlotVector (kapa, gridNP->numCols, horizontalIndices, "x"); 906 906 KapaPlotVector (kapa, gridNP->numCols, horizHistSlice, "y"); 907 907 908 float xslice[2] = {offsetX - Scale / 2., offsetX - Scale / 2.}; 908 909 float yslice[2] = {-5, 100}; 910 graphdata.style = 0; 909 911 graphdata.color = KapaColorByName("red"); 910 912 KapaPrepPlot(kapa, 2, &graphdata); … … 927 929 KapaPlotVector (kapa, gridNP->numRows, vertHistSlice, "x"); 928 930 KapaPlotVector (kapa, gridNP->numRows, verticalIndices, "y"); 931 929 932 yslice[0] = yslice[1] = offsetY - Scale / 2.; 930 933 xslice[0] = -5; xslice[1] = 100; 934 graphdata.style = 0; 931 935 graphdata.color = KapaColorByName("red"); 932 936 KapaPrepPlot(kapa, 2, &graphdata); … … 940 944 } // end of pmAstromVisualPlotGridMatch 941 945 946 947 bool 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 } 942 1047 943 1048 bool pmAstromVisualPlotTweak (psVector *xHist, // Smoothed Horizontal cut through the histogram -
branches/eam_branches/20091113/psModules/src/astrom/pmAstrometryVisual.h
r23487 r26129 45 45 ); 46 46 47 48 bool pmAstromVisualPlotGridMatchOverlay (const psArray *raw, 49 const psArray *ref); 47 50 48 51 /**
Note:
See TracChangeset
for help on using the changeset viewer.
