Changeset 26260 for trunk/psModules/src/objects
- Timestamp:
- Nov 22, 2009, 3:00:47 PM (16 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
pmPSFtryMetric.c (modified) (1 diff)
-
pmPSFtryModel.c (modified) (2 diffs)
-
pmSourceIO.c (modified) (1 diff)
-
pmSourceIO_MatchedRefs.c (modified) (1 diff)
-
pmSourceVisual.c (modified) (1 diff)
-
pmSourceVisual.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects
- Property svn:mergeinfo deleted
-
trunk/psModules/src/objects/pmPSFtryMetric.c
r25754 r26260 76 76 77 77 pmSourceVisualPlotPSFMetric (psfTry); 78 pmSourceVisualPlotPSFMetricSubpix (psfTry); 78 79 79 80 psFree (stats); -
trunk/psModules/src/objects/pmPSFtryModel.c
r25819 r26260 72 72 } 73 73 74 // XXX set the min number of needed source more carefully (depends on psfTrendMode?) 75 int orderMax = PS_MAX (options->psfTrendNx, options->psfTrendNy); 76 if ((sources->n < 15) && (orderMax >= 3)) orderMax = 2; 77 if ((sources->n < 11) && (orderMax >= 2)) orderMax = 1; 78 if ((sources->n < 8) && (orderMax >= 1)) orderMax = 0; 74 // hard limit on minimum number of stars 79 75 if ((sources->n < 3)) { 80 76 psError (PS_ERR_UNKNOWN, true, "failed to determine PSF parameters"); … … 82 78 } 83 79 84 int orderMin; 80 // this is a bit tricky, because we have two cases (MAP vs POLY), and they have a different 81 // definition for 'order' (order_MAP = order_POLY + 1). in addition, we have a 82 // user-specified MAX order, which we should respect, regardless of the mode 83 84 // set the max order (0 = constant) which the number of psf stars can support: 85 // rule of thumb: require 3 stars per 'cell' (order+1)^2 86 int MaxOrderForStars = 0; 87 if (sources->n >= 12) MaxOrderForStars = 1; // 4 cells 88 if (sources->n >= 27) MaxOrderForStars = 2; // 9 cells 89 if (sources->n >= 48) MaxOrderForStars = 3; // 16 cells 90 if (sources->n > 75) MaxOrderForStars = 4; // 25 cells 91 92 int orderMax = PS_MAX (options->psfTrendNx, options->psfTrendNy); 93 int orderMin = 0; 85 94 if (options->psfTrendMode == PM_TREND_MAP) { 86 orderMin = 1; 87 orderMax = PS_MAX(orderMax, 1); 88 } else { 89 orderMin = 0; 90 } 95 MaxOrderForStars ++; 96 orderMin ++; 97 } 98 orderMax = PS_MIN (orderMax, MaxOrderForStars); 91 99 92 100 // save the raw source mask (generated by pmPSFtryFitEXT) -
trunk/psModules/src/objects/pmSourceIO.c
r25907 r26260 980 980 if (!tableHeader) psAbort("cannot read table header"); 981 981 982 char *xtension = psMetadataLookupStr (NULL, tableHeader, "XTENSION"); 983 if (!xtension) psAbort("cannot read table type"); 984 if (strcmp (xtension, "BINTABLE")) { 985 psWarning ("no binary table in extension %s, skipping\n", dataname); 986 return false; 987 } 988 982 989 char *exttype = psMetadataLookupStr (NULL, tableHeader, "EXTTYPE"); 983 990 if (!exttype) psAbort("cannot read table type"); -
trunk/psModules/src/objects/pmSourceIO_MatchedRefs.c
r24801 r26260 120 120 psMetadataAdd (row, PS_LIST_TAIL, "X_CHIP", PS_DATA_F32, "x coord on chip", raw->chip->x); 121 121 psMetadataAdd (row, PS_LIST_TAIL, "Y_CHIP", PS_DATA_F32, "y coord on chip", raw->chip->y); 122 psMetadataAdd (row, PS_LIST_TAIL, "X_CHIP_FIT",PS_DATA_F32, "x fitted coord on chip", ref->chip->x); 123 psMetadataAdd (row, PS_LIST_TAIL, "Y_CHIP_FIT",PS_DATA_F32, "y fitted coord on chip", ref->chip->y); 122 124 psMetadataAdd (row, PS_LIST_TAIL, "X_FPA", PS_DATA_F32, "x coord on focal plane", raw->FP->x); 123 125 psMetadataAdd (row, PS_LIST_TAIL, "Y_FPA", PS_DATA_F32, "y coord on focal plane", raw->FP->y); -
trunk/psModules/src/objects/pmSourceVisual.c
r25979 r26260 73 73 74 74 float range; 75 range = graphdata.xmax - graphdata.xmin; 76 graphdata.xmax += 0.05*range; 77 graphdata.xmin -= 0.05*range; 78 range = graphdata.ymax - graphdata.ymin; 79 graphdata.ymax += 0.05*range; 80 graphdata.ymin -= 0.05*range; 81 82 // better choice for range? 83 // graphdata.xmin = -17.0; 84 // graphdata.xmax = -9.0; 85 graphdata.ymin = -0.51; 86 graphdata.ymax = +0.51; 87 88 KapaSetLimits (kapa1, &graphdata); 89 90 KapaSetFont (kapa1, "helvetica", 14); 91 KapaBox (kapa1, &graphdata); 92 KapaSendLabel (kapa1, "PSF Mag", KAPA_LABEL_XM); 93 KapaSendLabel (kapa1, "Ap Mag - PSF Mag", KAPA_LABEL_YM); 94 95 graphdata.color = KapaColorByName ("black"); 96 graphdata.ptype = 2; 97 graphdata.size = 0.5; 98 graphdata.style = 2; 99 graphdata.etype |= 0x01; 100 101 KapaPrepPlot (kapa1, n, &graphdata); 102 KapaPlotVector (kapa1, n, x->data.F32, "x"); 103 KapaPlotVector (kapa1, n, y->data.F32, "y"); 104 KapaPlotVector (kapa1, n, dy->data.F32, "dym"); 105 KapaPlotVector (kapa1, n, dy->data.F32, "dyp"); 106 107 psFree (x); 108 psFree (y); 109 psFree (dy); 110 111 pmVisualAskUser(NULL); 112 return true; 113 } 114 115 bool pmSourceVisualPlotPSFMetricSubpix (pmPSFtry *psfTry) { 116 117 KapaSection section; // put the positive profile in one and the residuals in another? 118 Graphdata graphdata; 119 120 if (!pmVisualIsVisual()) return true; 121 122 if (kapa1 == -1) { 123 kapa1 = KapaOpenNamedSocket ("kapa", "pmSource:plots"); 124 if (kapa1 == -1) { 125 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 126 pmVisualSetVisual(false); 127 return false; 128 } 129 } 130 131 KapaClearSections (kapa1); 132 KapaInitGraph (&graphdata); 133 134 int n; 135 float range; 136 psVector *x = psVectorAllocEmpty (psfTry->sources->n, PS_TYPE_F32); 137 psVector *y = psVectorAllocEmpty (psfTry->sources->n, PS_TYPE_F32); 138 psVector *dy = psVectorAllocEmpty(psfTry->sources->n, PS_TYPE_F32); 139 140 // section a: fractional-x pixel 141 section.dx = 1.0; 142 section.dy = 0.5; 143 section.x = 0.0; 144 section.y = 0.0; 145 section.name = NULL; 146 psStringAppend (§ion.name, "a1"); 147 KapaSetSection (kapa1, §ion); 148 psFree (section.name); 149 150 graphdata.xmin = +32.0; 151 graphdata.xmax = -32.0; 152 graphdata.ymin = +32.0; 153 graphdata.ymax = -32.0; 154 155 // construct the plot vectors 156 n = 0; 157 for (int i = 0; i < psfTry->sources->n; i++) { 158 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue; 159 160 pmSource *source = psfTry->sources->data[i]; 161 x->data.F32[n] = source->modelEXT->params->data.F32[PM_PAR_XPOS] - (int)source->modelEXT->params->data.F32[PM_PAR_XPOS]; 162 163 y->data.F32[n] = psfTry->metric->data.F32[i]; 164 dy->data.F32[n] = psfTry->metricErr->data.F32[i]; 165 graphdata.xmin = PS_MIN(graphdata.xmin, x->data.F32[n]); 166 graphdata.xmax = PS_MAX(graphdata.xmax, x->data.F32[n]); 167 graphdata.ymin = PS_MIN(graphdata.ymin, y->data.F32[n]); 168 graphdata.ymax = PS_MAX(graphdata.ymax, y->data.F32[n]); 169 n++; 170 } 171 x->n = y->n = dy->n = n; 172 173 range = graphdata.xmax - graphdata.xmin; 174 graphdata.xmax += 0.05*range; 175 graphdata.xmin -= 0.05*range; 176 range = graphdata.ymax - graphdata.ymin; 177 graphdata.ymax += 0.05*range; 178 graphdata.ymin -= 0.05*range; 179 180 // better choice for range? 181 // graphdata.xmin = -17.0; 182 // graphdata.xmax = -9.0; 183 graphdata.ymin = -0.51; 184 graphdata.ymax = +0.51; 185 186 KapaSetLimits (kapa1, &graphdata); 187 188 KapaSetFont (kapa1, "helvetica", 14); 189 KapaBox (kapa1, &graphdata); 190 KapaSendLabel (kapa1, "PSF Mag", KAPA_LABEL_XM); 191 KapaSendLabel (kapa1, "Ap Mag - PSF Mag", KAPA_LABEL_YM); 192 193 graphdata.color = KapaColorByName ("black"); 194 graphdata.ptype = 2; 195 graphdata.size = 0.5; 196 graphdata.style = 2; 197 graphdata.etype |= 0x01; 198 199 KapaPrepPlot (kapa1, n, &graphdata); 200 KapaPlotVector (kapa1, n, x->data.F32, "x"); 201 KapaPlotVector (kapa1, n, y->data.F32, "y"); 202 KapaPlotVector (kapa1, n, dy->data.F32, "dym"); 203 KapaPlotVector (kapa1, n, dy->data.F32, "dyp"); 204 205 // *** section b: fractional-x pixel 206 section.dx = 1.0; 207 section.dy = 0.5; 208 section.x = 0.0; 209 section.y = 0.5; 210 section.name = NULL; 211 psStringAppend (§ion.name, "a2"); 212 KapaSetSection (kapa1, §ion); 213 psFree (section.name); 214 215 graphdata.xmin = +32.0; 216 graphdata.xmax = -32.0; 217 graphdata.ymin = +32.0; 218 graphdata.ymax = -32.0; 219 220 // construct the plot vectors 221 n = 0; 222 for (int i = 0; i < psfTry->sources->n; i++) { 223 if (psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue; 224 225 pmSource *source = psfTry->sources->data[i]; 226 x->data.F32[n] = source->modelEXT->params->data.F32[PM_PAR_YPOS] - (int)source->modelEXT->params->data.F32[PM_PAR_YPOS]; 227 228 y->data.F32[n] = psfTry->metric->data.F32[i]; 229 dy->data.F32[n] = psfTry->metricErr->data.F32[i]; 230 graphdata.xmin = PS_MIN(graphdata.xmin, x->data.F32[n]); 231 graphdata.xmax = PS_MAX(graphdata.xmax, x->data.F32[n]); 232 graphdata.ymin = PS_MIN(graphdata.ymin, y->data.F32[n]); 233 graphdata.ymax = PS_MAX(graphdata.ymax, y->data.F32[n]); 234 n++; 235 } 236 x->n = y->n = dy->n = n; 237 75 238 range = graphdata.xmax - graphdata.xmin; 76 239 graphdata.xmax += 0.05*range; -
trunk/psModules/src/objects/pmSourceVisual.h
r25754 r26260 19 19 bool pmSourceVisualPSFModelResid (pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask); 20 20 bool pmSourceVisualPlotPSFMetric (pmPSFtry *try); 21 bool pmSourceVisualPlotPSFMetricSubpix (pmPSFtry *try); 22 21 23 bool pmSourceVisualShowModelFit (pmSource *source); 22 24 bool pmSourceVisualShowModelFits (pmPSF *psf, psArray *sources, psImageMaskType maskVal);
Note:
See TracChangeset
for help on using the changeset viewer.
