- Timestamp:
- Sep 21, 2009, 8:37:01 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psModules/src/objects/pmSourceVisual.c
r25268 r25476 5 5 #include <pslib.h> 6 6 #include "pmTrend2D.h" 7 #include "pmPSF.h" 8 #include "pmPSFtry.h" 7 9 #include "pmSourceVisual.h" 8 10 … … 27 29 bool pmSourcePlotPoints3D (int myKapa, Graphdata *graphdata, psVector *xn, psVector *yn, psVector *zn, float theta, float phi); 28 30 31 bool pmSourceVisualPlotPSFMetric (pmPSFtry *psfTry) { 32 33 Graphdata graphdata; 34 35 if (!pmVisualIsVisual()) return true; 36 37 if (kapa1 == -1) { 38 kapa1 = KapaOpenNamedSocket ("kapa", "pmSource:plots"); 39 if (kapa1 == -1) { 40 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 41 pmVisualSetVisual(false); 42 return false; 43 } 44 } 45 46 KapaClearPlots (kapa1); 47 KapaInitGraph (&graphdata); 48 49 psVector *x = psVectorAllocEmpty (psfTry->sources->n, PS_TYPE_F32); 50 psVector *y = psVectorAllocEmpty (psfTry->sources->n, PS_TYPE_F32); 51 psVector *dy = psVectorAllocEmpty(psfTry->sources->n, PS_TYPE_F32); 52 53 graphdata.xmin = +32.0; 54 graphdata.xmax = -32.0; 55 graphdata.ymin = +32.0; 56 graphdata.ymax = -32.0; 57 58 // construct the plot vectors 59 int n = 0; 60 for (int i = 0; i < psfTry->sources->n; i++) { 61 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue; 62 x->data.F32[n] = psfTry->fitMag->data.F32[i]; 63 y->data.F32[n] = psfTry->metric->data.F32[i]; 64 dy->data.F32[n] = psfTry->metricErr->data.F32[i]; 65 graphdata.xmin = PS_MIN(graphdata.xmin, x->data.F32[n]); 66 graphdata.xmax = PS_MAX(graphdata.xmax, x->data.F32[n]); 67 graphdata.ymin = PS_MIN(graphdata.ymin, y->data.F32[n]); 68 graphdata.ymax = PS_MAX(graphdata.ymax, y->data.F32[n]); 69 n++; 70 } 71 x->n = y->n = dy->n = n; 72 73 float range; 74 range = graphdata.xmax - graphdata.xmin; 75 graphdata.xmax += 0.05*range; 76 graphdata.xmin -= 0.05*range; 77 range = graphdata.ymax - graphdata.ymin; 78 graphdata.ymax += 0.05*range; 79 graphdata.ymin -= 0.05*range; 80 81 KapaSetLimits (kapa1, &graphdata); 82 83 KapaSetFont (kapa1, "helvetica", 14); 84 KapaBox (kapa1, &graphdata); 85 KapaSendLabel (kapa1, "PSF Mag", KAPA_LABEL_XM); 86 KapaSendLabel (kapa1, "Ap Mag - PSF Mag", KAPA_LABEL_YM); 87 88 graphdata.color = KapaColorByName ("black"); 89 graphdata.ptype = 2; 90 graphdata.size = 0.5; 91 graphdata.style = 2; 92 graphdata.etype |= 0x01; 93 94 KapaPrepPlot (kapa1, n, &graphdata); 95 KapaPlotVector (kapa1, n, x->data.F32, "x"); 96 KapaPlotVector (kapa1, n, y->data.F32, "y"); 97 KapaPlotVector (kapa1, n, dy->data.F32, "dym"); 98 KapaPlotVector (kapa1, n, dy->data.F32, "dyp"); 99 100 psFree (x); 101 psFree (y); 102 psFree (dy); 103 104 // pause and wait for user input: 105 // continue, save (provide name), ?? 106 char key[10]; 107 fprintf (stdout, "[c]ontinue? "); 108 if (!fgets(key, 8, stdin)) { 109 psWarning("Unable to read option"); 110 } 111 return true; 112 } 29 113 30 114 bool pmSourceVisualPSFModelResid (pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask) {
Note:
See TracChangeset
for help on using the changeset viewer.
