Changeset 25504
- Timestamp:
- Sep 23, 2009, 12:35:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotVisual.c
r25452 r25504 821 821 bool psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf) { 822 822 823 if (!pmVisualIsVisual()) return true;823 // if (!pmVisualIsVisual()) return true; 824 824 825 825 int myKapa = psphotKapaChannel (3); … … 2209 2209 psFree (vY); 2210 2210 2211 2212 bool psphotVisualShowSourceSize_old (pmReadout *readout, psArray *sources) {2213 2214 int Noverlay, NOVERLAY;2215 KiiOverlay *overlay;2216 2217 if (!pmVisualIsVisual()) return true;2218 2219 if (kapa == -1) {2220 fprintf (stderr, "kapa not opened, skipping\n");2221 return false;2222 }2223 2224 // note: this uses the Ohana allocation tools:2225 Noverlay = 0;2226 NOVERLAY = 100;2227 ALLOCATE (overlay, KiiOverlay, sources->n);2228 2229 // mark CRs with red boxes2230 for (int i = 0; i < sources->n; i++) {2231 2232 pmSource *source = sources->data[i];2233 if (source == NULL) continue;2234 2235 if (!(source->mode & PM_SOURCE_MODE_CR_LIMIT)) continue;2236 2237 overlay[Noverlay].type = KII_OVERLAY_BOX;2238 overlay[Noverlay].x = source->peak->xf;2239 overlay[Noverlay].y = source->peak->yf;2240 2241 overlay[Noverlay].dx = 4;2242 overlay[Noverlay].dy = 4;2243 overlay[Noverlay].angle = 0;2244 overlay[Noverlay].text = NULL;2245 Noverlay ++;2246 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);2247 }2248 KiiLoadOverlay (kapa, overlay, Noverlay, "red");2249 2250 2251 Noverlay = 0;2252 for (int i = 0; i < sources->n; i++) {2253 2254 pmSource *source = sources->data[i];2255 if (source == NULL) continue;2256 2257 // mark EXTs with yellow circles2258 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;2259 2260 overlay[Noverlay].type = KII_OVERLAY_CIRCLE;2261 overlay[Noverlay].x = source->peak->xf;2262 overlay[Noverlay].y = source->peak->yf;2263 2264 overlay[Noverlay].dx = 10;2265 overlay[Noverlay].dy = 10;2266 overlay[Noverlay].angle = 0;2267 overlay[Noverlay].text = NULL;2268 Noverlay ++;2269 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);2270 }2271 2272 KiiLoadOverlay (kapa, overlay, Noverlay, "blue");2273 FREE (overlay);2274 2275 psphotVisualShowMask (kapa, readout->mask, "mask", 2);2276 2277 // pause and wait for user input:2278 // continue, save (provide name), ??2279 char key[10];2280 fprintf (stdout, "CR: 4pix red BOX; EXT: 10pix blue circle\n");2281 fprintf (stdout, "[c]ontinue? ");2282 if (!fgets(key, 8, stdin)) {2283 psWarning("Unable to read option");2284 }2285 2286 return true;2287 }2288 2289 bool psphotVisualPlotSourceSize_old (psArray *sources) {2290 2291 Graphdata graphdata;2292 KapaSection section;2293 2294 if (!pmVisualIsVisual()) return true;2295 2296 int kapa = psphotKapaChannel (2);2297 if (kapa == -1) return false;2298 2299 KapaClearPlots (kapa3);2300 KapaInitGraph (&graphdata);2301 2302 // first section : mag vs CR nSigma2303 section.dx = 1.0;2304 section.dy = 0.5;2305 section.x = 0.0;2306 section.y = 0.0;2307 section.name = NULL;2308 psStringAppend (§ion.name, "a1");2309 KapaSetSection (kapa3, §ion);2310 psFree (section.name);2311 2312 psVector *x = psVectorAllocEmpty (sources->n, PS_TYPE_F32);2313 psVector *y = psVectorAllocEmpty (sources->n, PS_TYPE_F32);2314 2315 graphdata.xmin = +32.0;2316 graphdata.xmax = -32.0;2317 graphdata.ymin = +32.0;2318 graphdata.ymax = -32.0;2319 2320 // construct the plot vectors2321 int n = 0;2322 for (int i = 0; i < sources->n; i++) {2323 pmSource *source = sources->data[i];2324 if (!source) continue;2325 if (source->type != PM_SOURCE_TYPE_STAR) continue;2326 if (!isfinite (source->crNsigma)) continue;2327 if (!isfinite (source->peak->flux)) continue;2328 if (source->peak->flux < 0) continue;2329 2330 x->data.F32[n] = -2.5*log10(source->peak->flux);2331 y->data.F32[n] = source->crNsigma;2332 graphdata.xmin = PS_MIN(graphdata.xmin, x->data.F32[n]);2333 graphdata.xmax = PS_MAX(graphdata.xmax, x->data.F32[n]);2334 graphdata.ymin = -0.5;2335 graphdata.ymax = 10.0;2336 2337 n++;2338 }2339 x->n = y->n = n;2340 2341 float range;2342 range = graphdata.xmax - graphdata.xmin;2343 graphdata.xmax += 0.05*range;2344 graphdata.xmin -= 0.05*range;2345 2346 // XXX set the plot range to match the image2347 KapaSetLimits (kapa3, &graphdata);2348 2349 KapaSetFont (kapa3, "helvetica", 14);2350 KapaBox (kapa3, &graphdata);2351 KapaSendLabel (kapa3, "Peak as Mag", KAPA_LABEL_XM);2352 KapaSendLabel (kapa3, "CR N Sigma", KAPA_LABEL_YM);2353 2354 graphdata.color = KapaColorByName ("black");2355 graphdata.ptype = 2;2356 graphdata.size = 0.5;2357 graphdata.style = 2;2358 KapaPrepPlot (kapa3, n, &graphdata);2359 KapaPlotVector (kapa3, n, x->data.F32, "x");2360 KapaPlotVector (kapa3, n, y->data.F32, "y");2361 2362 // second section : mag vs EXT nSigma2363 section.dx = 1.0;2364 section.dy = 0.5;2365 section.x = 0.0;2366 section.y = 0.5;2367 section.name = NULL;2368 psStringAppend (§ion.name, "a2");2369 KapaSetSection (kapa3, §ion);2370 psFree (section.name);2371 2372 graphdata.xmin = +32.0;2373 graphdata.xmax = -32.0;2374 graphdata.ymin = +32.0;2375 graphdata.ymax = -32.0;2376 2377 // construct the plot vectors2378 n = 0;2379 for (int i = 0; i < sources->n; i++) {2380 pmSource *source = sources->data[i];2381 if (!source) continue;2382 if (source->type != PM_SOURCE_TYPE_STAR) continue;2383 if (!isfinite (source->extNsigma)) continue;2384 if (!isfinite (source->peak->flux)) continue;2385 if (source->peak->flux < 0) continue;2386 2387 x->data.F32[n] = -2.5*log10(source->peak->flux);2388 y->data.F32[n] = source->extNsigma;2389 graphdata.xmin = PS_MIN(graphdata.xmin, x->data.F32[n]);2390 graphdata.xmax = PS_MAX(graphdata.xmax, x->data.F32[n]);2391 graphdata.ymin = -0.5;2392 graphdata.ymax = 10.0;2393 2394 n++;2395 }2396 x->n = y->n = n;2397 2398 range = graphdata.xmax - graphdata.xmin;2399 graphdata.xmax += 0.05*range;2400 graphdata.xmin -= 0.05*range;2401 2402 // XXX set the plot range to match the image2403 KapaSetLimits (kapa3, &graphdata);2404 2405 KapaSetFont (kapa3, "helvetica", 14);2406 KapaBox (kapa3, &graphdata);2407 KapaSendLabel (kapa3, "EXT N Sigma", KAPA_LABEL_YM);2408 2409 graphdata.color = KapaColorByName ("black");2410 graphdata.ptype = 2;2411 graphdata.size = 0.5;2412 graphdata.style = 2;2413 KapaPrepPlot (kapa3, n, &graphdata);2414 KapaPlotVector (kapa3, n, x->data.F32, "x");2415 KapaPlotVector (kapa3, n, y->data.F32, "y");2416 2417 psFree (x);2418 psFree (y);2419 2420 // pause and wait for user input:2421 // continue, save (provide name), ??2422 char key[10];2423 fprintf (stdout, "[c]ontinue? ");2424 if (!fgets(key, 8, stdin)) {2425 psWarning("Unable to read option");2426 }2427 return true;2428 }2429 2430 2211 # endif 2431 2212
Note:
See TracChangeset
for help on using the changeset viewer.
