Changeset 31019
- Timestamp:
- Mar 23, 2011, 9:57:37 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psModules/src
- Files:
-
- 6 edited
-
astrom/pmAstrometryObjects.c (modified) (1 diff)
-
astrom/pmAstrometryVisual.c (modified) (70 diffs)
-
astrom/pmAstrometryVisual.h (modified) (1 diff)
-
extras/pmVisual.c (modified) (3 diffs)
-
extras/pmVisualUtils.c (modified) (3 diffs)
-
objects/pmSourceVisual.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psModules/src/astrom/pmAstrometryObjects.c
r27554 r31019 893 893 // XXX this function is crashing 894 894 pmAstromVisualPlotGridMatch(raw, ref, gridNP, stats->offset.x, stats->offset.y, maxOffpix, Scale, Offset); 895 pmAstromVisualPlotGridMatchOverlay(raw, ref );895 pmAstromVisualPlotGridMatchOverlay(raw, ref, stats->offset); 896 896 897 897 psFree (imStats); -
branches/eam_branches/ipp-20110213/psModules/src/astrom/pmAstrometryVisual.c
r26260 r31019 21 21 #include "pmKapaPlots.h" 22 22 #include "pmVisual.h" 23 24 //variables to determine when things are plotted 23 #include "pmVisualUtils.h" 24 25 // variables to determine when things are plotted 25 26 static bool plotGridMatch = true; 26 27 static bool plotTweak = true; … … 37 38 38 39 // variables to store plotting window indices 39 static int kapa = -1;40 static int kapa1 = -1; 40 41 static int kapa2 = -1; 41 42 //helper prototypes 42 static int kapa3 = -1; 43 44 // helper prototypes 43 45 bool residPlot (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe, 44 46 char *title); … … 49 51 bool pmAstromVisualClose(void) 50 52 { 51 if(kapa != -1) 52 KiiClose(kapa); 53 if(kapa2 != -1) 54 KiiClose(kapa2); 53 if (kapa1 != -1) KiiClose(kapa1); 54 if (kapa2 != -1) KiiClose(kapa2); 55 55 return true; 56 56 } … … 60 60 bool pmAstromVisualPlotRawStars (psArray *rawstars, pmFPA *fpa, pmChip *chip, psMetadata *recipe) 61 61 { 62 // make sure we want to plot this 63 if (!plotRawStars || !pmVisualIsVisual()) return true; 64 65 //set up plot region 66 if (!pmVisualInitWindow (&kapa, "psastro:plots")){ 67 return false; 68 } 62 if (!plotRawStars) return true; 63 if (!pmVisualTestLevel("psastro.plot1", 1)) return true; 64 if (!pmVisualInitWindow (&kapa1, "psastro:plots")) return false; 65 69 66 Graphdata graphdata; 70 67 KapaSection section; 71 68 72 69 KapaInitGraph (&graphdata); 73 KapaClearPlots (kapa); 70 KapaClearPlots (kapa1); 71 section.bg = KapaColorByName ("none"); // XXX probably should be 'none' 74 72 75 73 graphdata.color = KapaColorByName ("black"); … … 78 76 graphdata.style = 2; 79 77 80 section.dx = 0. 4;81 section.dy = 0. 4;82 83 // initialize and populate plotting vectors78 section.dx = 0.5; 79 section.dy = 0.5; 80 81 // initialize and populate plotting vectors 84 82 bool status = false; 85 83 float iMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.PLOT.INST.MAG.MIN"); … … 94 92 section.name = NULL; 95 93 psStringAppend (§ion.name, "a0"); 96 KapaSetSection (kapa , §ion);94 KapaSetSection (kapa1, §ion); 97 95 psFree (section.name); 98 96 99 // Chip coordinates97 // Chip coordinates 100 98 int n = 0; 101 99 for (int i = 0; i < rawstars->n; i++) { … … 112 110 xVec->n = yVec->n = zVec->n = n; 113 111 114 KapaSendLabel(kapa , "Chip", KAPA_LABEL_XP);115 KapaSendLabel(kapa , "X", KAPA_LABEL_XM);116 KapaSendLabel(kapa , "Y", KAPA_LABEL_YM);117 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);118 119 // Focal Plane Coordinates112 KapaSendLabel(kapa1, "Chip", KAPA_LABEL_XP); 113 KapaSendLabel(kapa1, "X", KAPA_LABEL_XM); 114 KapaSendLabel(kapa1, "Y", KAPA_LABEL_YM); 115 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 116 117 // Focal Plane Coordinates 120 118 section.x = 0.5; 121 119 section.y = 0.5; 122 120 section.name = NULL; 123 121 psStringAppend (§ion.name, "a1"); 124 KapaSetSection (kapa , §ion);122 KapaSetSection (kapa1, §ion); 125 123 psFree (section.name); 126 124 … … 139 137 xVec->n = yVec->n = zVec->n = n; 140 138 141 KapaSendLabel (kapa , "Focal Plane", KAPA_LABEL_XP);142 KapaSendLabel (kapa , "L", KAPA_LABEL_XM);143 KapaSendLabel (kapa , "M", KAPA_LABEL_YM);144 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);139 KapaSendLabel (kapa1, "Focal Plane", KAPA_LABEL_XP); 140 KapaSendLabel (kapa1, "L", KAPA_LABEL_XM); 141 KapaSendLabel (kapa1, "M", KAPA_LABEL_YM); 142 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 145 143 146 144 // Tangent Plane Coordinates … … 149 147 section.name = NULL; 150 148 psStringAppend (§ion.name, "a2"); 151 KapaSetSection (kapa , §ion);149 KapaSetSection (kapa1, §ion); 152 150 psFree (section.name); 153 151 … … 166 164 xVec->n = yVec->n = zVec->n = n; 167 165 168 KapaSendLabel (kapa , "Tangential Plane", KAPA_LABEL_XP);169 KapaSendLabel (kapa , "P", KAPA_LABEL_XM);170 KapaSendLabel (kapa , "Q", KAPA_LABEL_YM);171 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);172 173 // sky coordinates166 KapaSendLabel (kapa1, "Tangential Plane", KAPA_LABEL_XP); 167 KapaSendLabel (kapa1, "P", KAPA_LABEL_XM); 168 KapaSendLabel (kapa1, "Q", KAPA_LABEL_YM); 169 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 170 171 // sky coordinates 174 172 section.x = 0.5; 175 173 section.y = 0.0; 176 174 section.name = NULL; 177 175 psStringAppend (§ion.name, "a3"); 178 KapaSetSection (kapa , §ion);176 KapaSetSection (kapa1, §ion); 179 177 psFree (section.name); 180 178 … … 193 191 xVec->n = yVec->n = zVec->n = n; 194 192 195 KapaSendLabel (kapa , "Sky", KAPA_LABEL_XP);196 KapaSendLabel(kapa , "RA", KAPA_LABEL_XM);197 KapaSendLabel(kapa , "Dec", KAPA_LABEL_YM);198 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);193 KapaSendLabel (kapa1, "Sky", KAPA_LABEL_XP); 194 KapaSendLabel(kapa1, "RA", KAPA_LABEL_XM); 195 KapaSendLabel(kapa1, "Dec", KAPA_LABEL_YM); 196 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 199 197 200 198 // flip x (East increase to left) 201 199 SWAP (graphdata.xmin, graphdata.xmax); 202 KapaSetLimits (kapa , &graphdata);200 KapaSetLimits (kapa1, &graphdata); 203 201 204 202 // plot label 205 203 section.x = 0.0; 206 204 section.y = 0.0; 207 section.dx = .95;208 section.dy = .95;205 section.dx = 1.0; 206 section.dy = 1.0; 209 207 section.name = NULL; 210 208 psStringAppend (§ion.name, "a5"); 211 KapaSetSection (kapa , §ion);212 KapaSendLabel (kapa , "Raw Star Selection - Initial Astrometry", KAPA_LABEL_XP);209 KapaSetSection (kapa1, §ion); 210 KapaSendLabel (kapa1, "Raw Star Selection - Initial Astrometry", KAPA_LABEL_XP); 213 211 psFree (section.name); 214 212 … … 225 223 bool pmAstromVisualPlotRefStars (psArray *refstars, psMetadata *recipe) 226 224 { 227 //make sure we want to plot this 228 if (!pmVisualIsVisual() || !plotRefStars) return true; 229 230 //set up plotting variables 231 if (!pmVisualInitWindow (&kapa, "psastro:plots")) { 232 return false; 233 } 225 if (!plotRefStars) return true; 226 if (!pmVisualTestLevel("psastro.plot2", 1)) return true; 227 if (!pmVisualInitWindow (&kapa1, "psastro:plots")) return false; 234 228 235 229 Graphdata graphdata; 236 230 KapaInitGraph (&graphdata); 237 KapaClearSections (kapa );231 KapaClearSections (kapa1); 238 232 239 233 graphdata.color = KapaColorByName ("black"); … … 242 236 graphdata.style = 2; 243 237 244 // initialize and populate plot vectors238 // initialize and populate plot vectors 245 239 bool status = false; 246 240 float rMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.PLOT.REF.MAG.MIN"); … … 265 259 xVec->n = yVec->n = zVec->n = n; 266 260 267 KapaSendLabel (kapa , "RA", KAPA_LABEL_XM);268 KapaSendLabel (kapa , "Dec", KAPA_LABEL_YM);269 KapaSendLabel (kapa , "Reference Stars", KAPA_LABEL_XP);270 pmVisualTriplePlot(kapa , &graphdata, xVec, yVec, zVec, false);261 KapaSendLabel (kapa1, "RA", KAPA_LABEL_XM); 262 KapaSendLabel (kapa1, "Dec", KAPA_LABEL_YM); 263 KapaSendLabel (kapa1, "Reference Stars", KAPA_LABEL_XP); 264 pmVisualTriplePlot(kapa1, &graphdata, xVec, yVec, zVec, false); 271 265 272 266 // flip x (East increase to left) 273 267 SWAP (graphdata.xmin, graphdata.xmax); 274 KapaSetLimits (kapa , &graphdata);268 KapaSetLimits (kapa1, &graphdata); 275 269 276 270 // pause and wait for user input: … … 290 284 ) 291 285 { 292 293 // make sure we want to plot this 294 if ( !pmVisualIsVisual() || !plotLumFunc ) return true; 295 296 //set up plotting variables 297 if ( !pmVisualInitWindow (&kapa, "psastro:plots")){ 298 return false; 299 } 286 if (!plotLumFunc ) return true; 287 if (!pmVisualTestLevel("psastro.plot3", 1)) return true; 288 if (!pmVisualInitWindow (&kapa1, "psastro:plots")) return false; 289 290 int colorNone = KapaColorByName ("none"); // XXX probably should be 'none' 300 291 301 292 Graphdata graphdata; 302 KapaSection section1 = {"s1", .1, .1, .85, .35};303 KapaSection section2 = {"s2", .1, .5, .85, .35};293 KapaSection section1 = {"s1", 0.0, 0.0, 1.0, 0.5, colorNone}; 294 KapaSection section2 = {"s2", 0.0, 0.5, 1.0, 0.5, colorNone}; 304 295 KapaSection section; 305 if (rawFunc == NULL)296 if (rawFunc == NULL) { 306 297 section = section1; 307 else298 } else { 308 299 section = section2; 309 if (rawFunc == NULL) 310 KapaClearPlots(kapa); 300 } 301 302 if (rawFunc == NULL) KapaClearPlots(kapa1); 311 303 KapaInitGraph(&graphdata); 312 304 313 // Determine Plot Limits305 // Determine Plot Limits 314 306 pmVisualScaleGraphdata(&graphdata, Mag, lnMag, false); 315 307 316 // Make a line for the fit308 // Make a line for the fit 317 309 float x[2] = {graphdata.xmin, graphdata.xmax}; 318 310 float y[2] = {lumFunc->offset + x[0] * lumFunc->slope, 319 311 lumFunc->offset + x[1] * lumFunc->slope}; 320 312 321 // Plot Data322 KapaSetSection(kapa , §ion);323 KapaSetLimits(kapa , &graphdata);324 325 KapaSetFont (kapa , "helvetica", 14);326 KapaBox (kapa , &graphdata);327 KapaSendLabel (kapa , "Magnitude", KAPA_LABEL_XM);328 KapaSendLabel (kapa , "Log(N)", KAPA_LABEL_YM);313 // Plot Data 314 KapaSetSection(kapa1, §ion); 315 KapaSetLimits(kapa1, &graphdata); 316 317 KapaSetFont (kapa1, "helvetica", 14); 318 KapaBox (kapa1, &graphdata); 319 KapaSendLabel (kapa1, "Magnitude", KAPA_LABEL_XM); 320 KapaSendLabel (kapa1, "Log(N)", KAPA_LABEL_YM); 329 321 if (rawFunc == NULL) 330 KapaSendLabel (kapa , "Raw Star Luminosity Function", KAPA_LABEL_XP);322 KapaSendLabel (kapa1, "Raw Star Luminosity Function", KAPA_LABEL_XP); 331 323 else 332 KapaSendLabel (kapa ,324 KapaSendLabel (kapa1, 333 325 "Reference Star Luminosity Function, Shifted Raw Fit, and Cutoff", 334 326 KAPA_LABEL_XP); 335 327 graphdata.color=KapaColorByName("black"); 336 328 graphdata.style = 1; 337 KapaPrepPlot (kapa , lnMag->n, &graphdata);338 KapaPlotVector(kapa , lnMag->n, Mag->data.F32, "x");339 KapaPlotVector(kapa , lnMag->n, lnMag->data.F32, "y");340 341 // Overplot fit329 KapaPrepPlot (kapa1, lnMag->n, &graphdata); 330 KapaPlotVector(kapa1, lnMag->n, Mag->data.F32, "x"); 331 KapaPlotVector(kapa1, lnMag->n, lnMag->data.F32, "y"); 332 333 // Overplot fit 342 334 graphdata.style=0; 343 KapaPrepPlot(kapa ,2,&graphdata);344 KapaPlotVector(kapa , 2, x, "x");345 KapaPlotVector(kapa , 2, y, "y");346 347 // If rawFunc was supplied, overplot the raw star fit + cutoff335 KapaPrepPlot(kapa1,2,&graphdata); 336 KapaPlotVector(kapa1, 2, x, "x"); 337 KapaPlotVector(kapa1, 2, y, "y"); 338 339 // If rawFunc was supplied, overplot the raw star fit + cutoff 348 340 if( rawFunc != NULL) { 349 341 double mRef = 0.5*(lumFunc->mMin + lumFunc->mMax); … … 359 351 float y[2] = {graphdata.ymin, graphdata.ymax}; 360 352 graphdata.color= KapaColorByName("red"); 361 KapaPrepPlot(kapa , 2, &graphdata);362 KapaPlotVector(kapa , 2, x, "x");363 KapaPlotVector(kapa , 2, y, "y");364 KapaPrepPlot (kapa , 2, &graphdata);365 KapaPlotVector (kapa , 2, xraw, "x");366 KapaPlotVector (kapa , 2, yraw, "y");353 KapaPrepPlot(kapa1, 2, &graphdata); 354 KapaPlotVector(kapa1, 2, x, "x"); 355 KapaPlotVector(kapa1, 2, y, "y"); 356 KapaPrepPlot (kapa1, 2, &graphdata); 357 KapaPlotVector (kapa1, 2, xraw, "x"); 358 KapaPlotVector (kapa1, 2, yraw, "y"); 367 359 368 360 // pause and wait for user input: … … 379 371 ) 380 372 { 381 382 //make sure we want to plot this 383 if (!pmVisualIsVisual() || !plotRemoveClumps) return true; 384 385 //set up plot variables 386 if ( !pmVisualInitWindow (&kapa, "psastro:plots")) { 387 return false; 388 } 373 if (!plotRemoveClumps) return true; 374 if (!pmVisualTestLevel("psastro.plot4", 1)) return true; 375 if (!pmVisualInitWindow (&kapa1, "psastro:plots")) return false; 389 376 390 377 KapaSection section; 391 378 Graphdata graphdata; 392 section.x = 0; 393 section.dx = .9; 394 section.y = 0; 395 section.dy = .9; 379 380 KapaClearSections (kapa1); 381 KapaInitGraph(&graphdata); 382 section.bg = KapaColorByName ("none"); // XXX probably should be 'none' 383 384 section.x = 0.0; 385 section.dx = 1; 386 section.y = 0.0; 387 section.dy = 1.0; 396 388 section.name = NULL; 397 389 psStringAppend( §ion.name, "a0"); 398 KapaInitGraph(&graphdata); 399 KapaSetSection(kapa, §ion); 390 KapaSetSection(kapa1, §ion); 400 391 psFree(section.name); 401 392 … … 404 395 graphdata.style = 2; 405 396 graphdata.color = KapaColorByName ("black"); 406 KapaClearPlots(kapa );407 408 // set up plot vectors397 KapaClearPlots(kapa1); 398 399 // set up plot vectors 409 400 float Xmin = +FLT_MAX; 410 401 float Xmax = -FLT_MAX; … … 414 405 psVector *yVec = psVectorAlloc (input->n, PS_TYPE_F32); 415 406 416 // determine boundaries for histogram bin calculation407 // determine boundaries for histogram bin calculation 417 408 int n = 0; 418 409 for (int i=0; i< input->n; i++) { … … 430 421 xVec->n = yVec->n = n; 431 422 432 // plot stars423 // plot stars 433 424 graphdata.xmax = Xmax; 434 425 graphdata.xmin = Xmin; 435 426 graphdata.ymax = Ymax; 436 427 graphdata.ymin = Ymin; 437 KapaSetLimits (kapa , &graphdata);438 KapaSetFont (kapa , "helvetica", 14);439 440 KapaBox (kapa , &graphdata);441 442 KapaSendLabel (kapa , "L (pixels)", KAPA_LABEL_XM);443 KapaSendLabel (kapa , "M (pixels)", KAPA_LABEL_YM);444 KapaSendLabel (kapa , "Regions Flagged as Clumps (Red Boxes)",428 KapaSetLimits (kapa1, &graphdata); 429 KapaSetFont (kapa1, "helvetica", 14); 430 431 KapaBox (kapa1, &graphdata); 432 433 KapaSendLabel (kapa1, "L (pixels)", KAPA_LABEL_XM); 434 KapaSendLabel (kapa1, "M (pixels)", KAPA_LABEL_YM); 435 KapaSendLabel (kapa1, "Regions Flagged as Clumps (Red Boxes)", 445 436 KAPA_LABEL_XP); 446 437 447 KapaPrepPlot (kapa , xVec->n, &graphdata);448 KapaPlotVector (kapa , xVec->n, xVec->data.F32, "x");449 KapaPlotVector (kapa , yVec->n, yVec->data.F32, "y");438 KapaPrepPlot (kapa1, xVec->n, &graphdata); 439 KapaPlotVector (kapa1, xVec->n, xVec->data.F32, "x"); 440 KapaPlotVector (kapa1, yVec->n, yVec->data.F32, "y"); 450 441 451 442 graphdata.color = KapaColorByName ("red"); 452 443 graphdata.style = 0; 453 444 454 // overplot clumpy regions excluded from analysis455 for (int i = 0; i < count->numCols; i++) {445 // overplot clumpy regions excluded from analysis 446 for (int i = 0; i < count->numCols; i++) { 456 447 for (int j = 0; j < count->numRows; j++) { 457 if(count->data.U32[j][i] <= limit) continue; // not a clump448 if(count->data.U32[j][i] <= limit) continue; // not a clump 458 449 float Xbot = (i - 5) * scale + Xmin; 459 450 float Ybot = (j - 5) * scale + Ymin; … … 462 453 float x[5] = {Xbot, Xbot + scale, Xbot + scale, Xbot, Xbot}; 463 454 float y[5] = {Ybot, Ybot, Ybot + scale, Ybot + scale, Ybot}; 464 KapaPrepPlot (kapa , 5, &graphdata);465 KapaPlotVector (kapa , 5, x, "x");466 KapaPlotVector (kapa , 5, y, "y");455 KapaPrepPlot (kapa1, 5, &graphdata); 456 KapaPlotVector (kapa1, 5, x, "x"); 457 KapaPlotVector (kapa1, 5, y, "y"); 467 458 } 468 459 } 469 460 470 // ask for user input and finish461 // ask for user input and finish 471 462 pmVisualAskUser (&plotRemoveClumps); 472 463 psFree (xVec); … … 483 474 ) 484 475 { 485 486 //make sure we want to plot this 487 if (!pmVisualIsVisual() || !plotOneChipFit) 488 return true; 489 490 if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) { 491 return false; 492 } 493 494 //plot the residuals 476 if (!plotOneChipFit) return true; 477 if (!pmVisualTestLevel("psastro.plot5", 1)) return true; 478 if (!pmVisualInitWindow(&kapa1, "psastro:plot1")) return false; 479 if (!pmVisualInitWindow(&kapa2, "psastro:plot2")) return false; 480 if (!pmVisualInitWindow(&kapa3, "psastro:plot3")) return false; 481 482 // plot the residuals 495 483 if (!residPlot(rawstars, refstars, match, recipe, "Single Chip Fit Residuals (Chip Coordinates)")) { 496 484 plotOneChipFit = false; … … 498 486 } 499 487 500 // ask for user input and finish488 // ask for user input and finish 501 489 pmVisualAskUser(&plotOneChipFit); 502 490 return true; … … 509 497 ) 510 498 { 511 //make sure we want to plot this 512 if(!pmVisualIsVisual() || !plotFixChips) return true; 513 514 if(!pmVisualInitWindow(&kapa, "psastro:plots")) { 515 return false; 516 } 517 518 KapaSection section = {"s1", .05, .05, .9, .9}; 499 if (!plotFixChips) return true; 500 if (!pmVisualTestLevel("psastro.plot6", 1)) return true; 501 if (!pmVisualInitWindow(&kapa1, "psastro:plots")) return false; 502 503 int colorNone = KapaColorByName ("none"); // XXX probably should be 'none' 504 505 KapaSection section = {"s1", 0.0, 0.0, 1.0, 1.0, colorNone}; 519 506 Graphdata graphdata; 520 KapaInitGraph (&graphdata);521 KapaClearPlots (kapa );507 KapaInitGraph (&graphdata); 508 KapaClearPlots (kapa1); 522 509 graphdata.ptype = 2; 523 510 graphdata.style = 2; … … 559 546 } 560 547 561 // set up graph548 // set up graph 562 549 pmVisualScaleGraphdata(&graphdata, xOld, yOld, true); 563 pmVisualInitGraph(kapa , §ion, &graphdata);564 KapaSendLabel (kapa , "L (FP)", KAPA_LABEL_XM);565 KapaSendLabel (kapa , "M (FP)", KAPA_LABEL_YM);566 KapaSendLabel (kapa , "Chip corners before (black) and after (red) FixChips", KAPA_LABEL_XP);567 KapaPrepPlot (kapa , xOld->n, &graphdata);568 KapaPlotVector (kapa , xOld->n, xOld->data.F32, "x");569 KapaPlotVector (kapa , xOld->n, yOld->data.F32, "y");550 pmVisualInitGraph(kapa1, §ion, &graphdata); 551 KapaSendLabel (kapa1, "L (FP)", KAPA_LABEL_XM); 552 KapaSendLabel (kapa1, "M (FP)", KAPA_LABEL_YM); 553 KapaSendLabel (kapa1, "Chip corners before (black) and after (red) FixChips", KAPA_LABEL_XP); 554 KapaPrepPlot (kapa1, xOld->n, &graphdata); 555 KapaPlotVector (kapa1, xOld->n, xOld->data.F32, "x"); 556 KapaPlotVector (kapa1, xOld->n, yOld->data.F32, "y"); 570 557 571 558 graphdata.ptype = 1; 572 559 graphdata.color = KapaColorByName("red"); 573 KapaPrepPlot (kapa , xNew->n, &graphdata);574 KapaPlotVector (kapa , xNew->n, xNew->data.F32, "x");575 KapaPlotVector (kapa , xNew->n, yNew->data.F32, "y");560 KapaPrepPlot (kapa1, xNew->n, &graphdata); 561 KapaPlotVector (kapa1, xNew->n, xNew->data.F32, "x"); 562 KapaPlotVector (kapa1, xNew->n, yNew->data.F32, "y"); 576 563 577 564 pmVisualAskUser(&plotFixChips); … … 591 578 ) 592 579 { 593 594 //make sure we want to plot this 595 if (!pmVisualIsVisual() || !plotAstromGuessCheck) return true; 596 597 //set up graph window 598 if ( !pmVisualInitWindow (&kapa, "psastro:plots")) { 599 return false; 600 } 580 if (!plotAstromGuessCheck) return true; 581 if (!pmVisualTestLevel("psastro.plot7", 1)) return true; 582 if (!pmVisualInitWindow (&kapa1, "psastro:plots")) return false; 601 583 602 584 Graphdata graphdata; 603 585 KapaSection section; 604 KapaInitGraph(&graphdata); 605 KapaClearPlots (kapa); 586 KapaInitGraph (&graphdata); 587 KapaClearPlots (kapa1); 588 589 section.bg = KapaColorByName ("none"); // XXX probably should be 'none' 606 590 607 591 graphdata.color = KapaColorByName ("black"); … … 613 597 section.dy = 0.4; 614 598 615 // Old Corners599 // Old Corners 616 600 section.x = 0.30; 617 601 section.y = 0.50; 618 602 section.name = NULL; 619 603 psStringAppend (§ion.name, "a0"); 620 KapaSetSection (kapa , §ion);604 KapaSetSection (kapa1, §ion); 621 605 psFree(section.name); 622 606 623 607 pmVisualScaleGraphdata (&graphdata, cornerPo, cornerPo, true); 624 KapaSetLimits (kapa , &graphdata);625 KapaBox (kapa , &graphdata);626 KapaSendLabel (kapa , "P (Pixels)", KAPA_LABEL_XM);627 KapaSendLabel (kapa , "Q (Pixels)", KAPA_LABEL_YM);628 KapaSendLabel (kapa ,608 KapaSetLimits (kapa1, &graphdata); 609 KapaBox (kapa1, &graphdata); 610 KapaSendLabel (kapa1, "P (Pixels)", KAPA_LABEL_XM); 611 KapaSendLabel (kapa1, "Q (Pixels)", KAPA_LABEL_YM); 612 KapaSendLabel (kapa1, 629 613 "Fiducial Points in the Tangent Plane. Black: Initial Astrometry. Red: Final Astrometry", 630 614 KAPA_LABEL_XP); 631 KapaPrepPlot (kapa , cornerPo->n, &graphdata);632 KapaPlotVector (kapa , cornerPo->n, cornerPo->data.F32, "x");633 KapaPlotVector (kapa , cornerQo->n, cornerQo->data.F32, "y");615 KapaPrepPlot (kapa1, cornerPo->n, &graphdata); 616 KapaPlotVector (kapa1, cornerPo->n, cornerPo->data.F32, "x"); 617 KapaPlotVector (kapa1, cornerQo->n, cornerQo->data.F32, "y"); 634 618 635 619 // New Corners … … 637 621 graphdata.ptype = 7; 638 622 graphdata.size = 1.5; 639 KapaPrepPlot (kapa , cornerPn->n, &graphdata);640 KapaPlotVector (kapa , cornerPn->n, cornerPn->data.F32, "x");641 KapaPlotVector (kapa , cornerQn->n, cornerQn->data.F32, "y");623 KapaPrepPlot (kapa1, cornerPn->n, &graphdata); 624 KapaPlotVector (kapa1, cornerPn->n, cornerPn->data.F32, "x"); 625 KapaPlotVector (kapa1, cornerQn->n, cornerQn->data.F32, "y"); 642 626 643 627 // Residuals … … 655 639 section.name = NULL; 656 640 psStringAppend (§ion.name, "a1"); 657 KapaSetSection (kapa , §ion);641 KapaSetSection (kapa1, §ion); 658 642 psFree(section.name); 659 643 660 644 pmVisualScaleGraphdata (&graphdata, xResid, yResid, true); 661 KapaSetLimits (kapa , &graphdata);662 KapaBox (kapa , &graphdata);663 KapaSendLabel (kapa , "dP", KAPA_LABEL_XM);664 KapaSendLabel (kapa , "dQ", KAPA_LABEL_YM);665 KapaSendLabel (kapa ,645 KapaSetLimits (kapa1, &graphdata); 646 KapaBox (kapa1, &graphdata); 647 KapaSendLabel (kapa1, "dP", KAPA_LABEL_XM); 648 KapaSendLabel (kapa1, "dQ", KAPA_LABEL_YM); 649 KapaSendLabel (kapa1, 666 650 "Residual of the Fit from the Initial Astrometry to the Final Astrometry", 667 651 KAPA_LABEL_XP); 668 KapaPrepPlot (kapa , cornerPd->n, &graphdata);669 KapaPlotVector (kapa , cornerPd->n, xResid->data.F32, "x");670 KapaPlotVector (kapa , cornerQd->n, yResid->data.F32, "y");652 KapaPrepPlot (kapa1, cornerPd->n, &graphdata); 653 KapaPlotVector (kapa1, cornerPd->n, xResid->data.F32, "x"); 654 KapaPlotVector (kapa1, cornerQd->n, yResid->data.F32, "y"); 671 655 672 656 psFree(xResid); … … 681 665 ) 682 666 { 683 //make sure we want to plot this 684 if (!pmVisualIsVisual() || !plotCommonScale) return true; 685 686 if (!pmVisualInitWindow(&kapa, "psastro:plots")){ 687 return false; 688 } 689 690 KapaSection section = {"s1", .05, .05, .9, .9}; 667 if (!plotCommonScale) return true; 668 if (!pmVisualTestLevel("psastro.plot8", 1)) return true; 669 if (!pmVisualInitWindow(&kapa1, "psastro:plots")) return false; 670 671 int colorNone = KapaColorByName ("none"); 672 KapaSection section = {"s1", 0.0, 0.0, 1.0, 1.0, colorNone}; 691 673 Graphdata graphdata; 674 692 675 psPlane ptCH, ptFP; 693 676 ptCH.x = 0; … … 698 681 int nobj = 0; 699 682 700 // project each chip corner to the Focal Plane683 // project each chip corner to the Focal Plane 701 684 for(int i = 0; i < fpa->chips->n; i++) { 702 685 pmChip *chip = fpa->chips->data[i]; … … 711 694 } 712 695 713 // set up plot window696 // set up plot window 714 697 KapaInitGraph (&graphdata); 715 KapaClearPlots (kapa );716 KapaSetSection (kapa , §ion);717 KapaSetFont (kapa , "helvetica", 14);718 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, oldScale, false);719 KapaSendLabel (kapa , "L (FP)", KAPA_LABEL_XM);720 KapaSendLabel (kapa , "M (FP)", KAPA_LABEL_YM);721 KapaSendLabel (kapa , "Old Pixel Scale of FPA Chips (Not to Scale)", KAPA_LABEL_XP);698 KapaClearPlots (kapa1); 699 KapaSetSection (kapa1, §ion); 700 KapaSetFont (kapa1, "helvetica", 14); 701 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, oldScale, false); 702 KapaSendLabel (kapa1, "L (FP)", KAPA_LABEL_XM); 703 KapaSendLabel (kapa1, "M (FP)", KAPA_LABEL_YM); 704 KapaSendLabel (kapa1, "Old Pixel Scale of FPA Chips (Not to Scale)", KAPA_LABEL_XP); 722 705 723 706 pmVisualAskUser (&plotCommonScale); … … 733 716 psArray *match, psMetadata *recipe) 734 717 { 735 736 //make sure we want to plot this 737 if (!pmVisualIsVisual() || !plotMosaicOneChip) return true; 738 739 if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) { 740 return false; 741 } 742 743 //plot the residuals 718 if (!plotMosaicOneChip) return true; 719 if (!pmVisualTestLevel("psastro.plot9", 1)) return true; 720 if (!pmVisualInitWindow(&kapa1, "psastro:plot1")) return false; 721 if (!pmVisualInitWindow(&kapa2, "psastro:plot2")) return false; 722 if (!pmVisualInitWindow(&kapa3, "psastro:plot3")) return false; 723 724 // plot the residuals 744 725 if (!residPlot(rawstars, refstars, match, recipe, "Single Chip Fit Residuals - Mosaic Mode")) { 745 726 pmVisualSetVisual(false); … … 747 728 } 748 729 749 // ask for user input and finish730 // ask for user input and finish 750 731 pmVisualAskUser(&plotMosaicOneChip); 751 732 … … 758 739 psMetadata *recipe) 759 740 { 760 //make sure we want to plot this 761 if (!pmVisualIsVisual() || !plotMosaicMatches) return true; 741 if (!plotMosaicMatches) return true; 742 if (!pmVisualTestLevel("psastro.plot10", 1)) return true; 743 if (!pmVisualInitWindow(&kapa1, "psastro:plot1")) return false; 744 if (!pmVisualInitWindow(&kapa2, "psastro:plot2")) return false; 745 if (!pmVisualInitWindow(&kapa3, "psastro:plot3")) return false; 762 746 763 747 char title[60]; 764 748 sprintf(title, "Matches found during psastroMosaicSetMatch iteration %d", iteration); 765 766 767 if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {768 return false;769 }770 749 771 750 if (!residPlot(rawstars, refstars, match, recipe, title)){ … … 774 753 } 775 754 776 // ask for user input755 // ask for user input 777 756 pmVisualAskUser (&plotMosaicMatches); 778 757 return true; … … 789 768 double Offset) 790 769 { 791 //make sure we want to plot this 792 if (!pmVisualIsVisual() || !plotGridMatch) return true; 793 if (!pmVisualInitWindow(&kapa, "psastro:plots")){ 794 return false; 795 } 796 797 KapaSection section = {"s1", 0.05, 0.05, .75, .75}; 798 KapaSection sectionY = {"s2", 0.8, 0.05, .15, .75}; 799 KapaSection sectionX = {"s3", .05, .8, .75, .15}; 770 if (!plotGridMatch) return true; 771 if (!pmVisualTestLevel("psastro.plot11", 1)) return true; 772 if (!pmVisualInitWindow(&kapa1, "psastro:plots")) return false; 773 774 int colorNone = KapaColorByName ("none"); 775 KapaSection section = {"s1", 0.00, 0.00, 0.75, 0.75, colorNone}; 776 KapaSection sectionY = {"s2", 0.75, 0.00, 0.25, 0.75, colorNone}; 777 KapaSection sectionX = {"s3", 0.00, 0.75, 0.75, 0.25, colorNone}; 800 778 801 779 Graphdata graphdata; … … 818 796 819 797 // set up plot information 820 KapaClearPlots(kapa );798 KapaClearPlots(kapa1); 821 799 KapaInitGraph(&graphdata); 822 KapaSetSection(kapa , §ion);800 KapaSetSection(kapa1, §ion); 823 801 824 802 graphdata.xmin = -1.0 * maxOffpix; … … 826 804 graphdata.ymin = -1.0 * maxOffpix; 827 805 graphdata.ymax = 1.0 * maxOffpix; 828 KapaSetLimits(kapa , &graphdata);829 830 KapaSetFont(kapa , "helvetica", 14);831 KapaBox(kapa , &graphdata);832 KapaSendLabel (kapa , "X offset (FP)", KAPA_LABEL_XM);833 KapaSendLabel (kapa , "Y offset (FP)", KAPA_LABEL_YM);834 KapaSendLabel (kapa , "pmAstromGridAngle residuals. Box: Correlation Peak.",806 KapaSetLimits(kapa1, &graphdata); 807 808 KapaSetFont(kapa1, "helvetica", 14); 809 KapaBox(kapa1, &graphdata); 810 KapaSendLabel (kapa1, "X offset (FP)", KAPA_LABEL_XM); 811 KapaSendLabel (kapa1, "Y offset (FP)", KAPA_LABEL_YM); 812 KapaSendLabel (kapa1, "pmAstromGridAngle residuals. Box: Correlation Peak.", 835 813 KAPA_LABEL_XP); 836 814 graphdata.style = 2; … … 868 846 } 869 847 870 // Plot the offsets871 KapaPrepPlot(kapa , nplot, &graphdata);872 KapaPlotVector (kapa , nplot, dXplot->data.F32, "x");873 KapaPlotVector (kapa , nplot, dYplot->data.F32, "y");874 875 // Overplot bounding box, peak of distribution848 // Plot the offsets 849 KapaPrepPlot(kapa1, nplot, &graphdata); 850 KapaPlotVector (kapa1, nplot, dXplot->data.F32, "x"); 851 KapaPlotVector (kapa1, nplot, dYplot->data.F32, "y"); 852 853 // Overplot bounding box, peak of distribution 876 854 float xbound[5] = { -maxOffpix, maxOffpix, maxOffpix, -maxOffpix, -maxOffpix}; 877 855 float ybound[5] = { -maxOffpix, -maxOffpix, maxOffpix, maxOffpix, -maxOffpix}; … … 885 863 graphdata.style = 0; 886 864 graphdata.size = 1.0; 887 KapaPrepPlot(kapa , 5, &graphdata);888 KapaPlotVector (kapa , 5, xbound, "x");889 KapaPlotVector (kapa , 5, ybound, "y");890 KapaPrepPlot(kapa , 5, &graphdata);891 KapaPlotVector (kapa , 5, xbin, "x");892 KapaPlotVector (kapa , 5, ybin, "y");893 894 // plot X profile895 KapaSetSection(kapa , §ionX);865 KapaPrepPlot(kapa1, 5, &graphdata); 866 KapaPlotVector (kapa1, 5, xbound, "x"); 867 KapaPlotVector (kapa1, 5, ybound, "y"); 868 KapaPrepPlot(kapa1, 5, &graphdata); 869 KapaPlotVector (kapa1, 5, xbin, "x"); 870 KapaPlotVector (kapa1, 5, ybin, "y"); 871 872 // plot X profile 873 KapaSetSection(kapa1, §ionX); 896 874 graphdata.color = KapaColorByName("black"); 897 875 graphdata.ptype = 1; … … 899 877 graphdata.ymin = 0; 900 878 graphdata.ymax = maxHorizontalSlice + 0.5; 901 KapaSetLimits(kapa, &graphdata); 902 903 KapaBox(kapa, &graphdata); 904 KapaPrepPlot(kapa, gridNP->numCols, &graphdata); 905 KapaPlotVector (kapa, gridNP->numCols, horizontalIndices, "x"); 906 KapaPlotVector (kapa, gridNP->numCols, horizHistSlice, "y"); 879 strcpy (graphdata.labels, "0200"); 880 KapaSetLimits(kapa1, &graphdata); 881 882 KapaBox(kapa1, &graphdata); 883 KapaPrepPlot(kapa1, gridNP->numCols, &graphdata); 884 KapaPlotVector (kapa1, gridNP->numCols, horizontalIndices, "x"); 885 KapaPlotVector (kapa1, gridNP->numCols, horizHistSlice, "y"); 907 886 908 887 float xslice[2] = {offsetX - Scale / 2., offsetX - Scale / 2.}; … … 910 889 graphdata.style = 0; 911 890 graphdata.color = KapaColorByName("red"); 912 KapaPrepPlot(kapa , 2, &graphdata);913 KapaPlotVector (kapa , 2, xslice, "x");914 KapaPlotVector (kapa , 2, yslice, "y");915 916 // plot Y profile917 KapaSetSection(kapa , §ionY);891 KapaPrepPlot(kapa1, 2, &graphdata); 892 KapaPlotVector (kapa1, 2, xslice, "x"); 893 KapaPlotVector (kapa1, 2, yslice, "y"); 894 895 // plot Y profile 896 KapaSetSection(kapa1, §ionY); 918 897 graphdata.color = KapaColorByName("black"); 919 898 graphdata.ptype = 1; … … 923 902 graphdata.xmin = -1.0 ; 924 903 graphdata.xmax = maxVerticalSlice + 0.5; 925 KapaSetLimits(kapa, &graphdata); 926 927 KapaBox(kapa, &graphdata); 928 KapaPrepPlot(kapa, gridNP->numRows, &graphdata); 929 KapaPlotVector (kapa, gridNP->numRows, vertHistSlice, "x"); 930 KapaPlotVector (kapa, gridNP->numRows, verticalIndices, "y"); 904 strcpy (graphdata.labels, "2000"); 905 KapaSetLimits(kapa1, &graphdata); 906 907 KapaBox(kapa1, &graphdata); 908 KapaPrepPlot(kapa1, gridNP->numRows, &graphdata); 909 KapaPlotVector (kapa1, gridNP->numRows, vertHistSlice, "x"); 910 KapaPlotVector (kapa1, gridNP->numRows, verticalIndices, "y"); 931 911 932 912 yslice[0] = yslice[1] = offsetY - Scale / 2.; … … 934 914 graphdata.style = 0; 935 915 graphdata.color = KapaColorByName("red"); 936 KapaPrepPlot(kapa , 2, &graphdata);937 KapaPlotVector (kapa , 2, xslice, "x");938 KapaPlotVector (kapa , 2, yslice, "y");916 KapaPrepPlot(kapa1, 2, &graphdata); 917 KapaPlotVector (kapa1, 2, xslice, "x"); 918 KapaPlotVector (kapa1, 2, yslice, "y"); 939 919 940 920 pmVisualAskUser(&plotGridMatch); … … 946 926 947 927 bool pmAstromVisualPlotGridMatchOverlay (const psArray *raw, 948 const psArray *ref) 928 const psArray *ref, 929 const psPlane offset) 949 930 { 950 //make sure we want to plot this 951 if (!pmVisualIsVisual() || !plotGridMatch) return true; 952 if (!pmVisualInitWindow(&kapa2, "psastro:plots")){ 953 return false; 954 } 931 if (!plotGridMatch) return true; 932 if (!pmVisualTestLevel("psastro.plot12", 1)) return true; 933 if (!pmVisualInitWindow(&kapa2, "psastro:plots")) return false; 955 934 956 935 Graphdata graphdata; … … 980 959 graphdata.ymin = PS_MIN(graphdata.ymin, obj->FP->y); 981 960 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 ;961 xPlot->data.F32[i] = obj->FP->x + offset.x; 962 yPlot->data.F32[i] = obj->FP->y + offset.y; 984 963 zPlot->data.F32[i] = obj->Mag; 985 964 } … … 999 978 // the point size will be scaled from the z vector 1000 979 graphdata.style = 2; 1001 graphdata.ptype = 7;980 graphdata.ptype = 2; 1002 981 graphdata.size = -1; 1003 982 graphdata.color = KapaColorByName ("black"); … … 1052 1031 ) 1053 1032 { 1054 //make sure we want to plot this 1055 if (!pmVisualIsVisual() || !plotTweak) return true; 1056 if (!pmVisualInitWindow(&kapa, "psastro:plots")) { 1057 return false; 1058 } 1033 if (!plotTweak) return true; 1034 if (!pmVisualTestLevel("psastro.plot13", 1)) return true; 1035 if (!pmVisualInitWindow(&kapa1, "psastro:plots")) return false; 1059 1036 1060 1037 Graphdata graphdata; 1061 KapaSection section1 = {"s1", 0.05, 0.05, 0.90, 0.4}; 1062 KapaSection section2 = {"s2", 0.05, 0.5, 0.90, 0.4}; 1038 1039 int colorNone = KapaColorByName ("none"); // XXX probably should be 'none' 1040 KapaSection section1 = {"s1", 0.0, 0.0, 1.0, 0.5, colorNone}; 1041 KapaSection section2 = {"s2", 0.0, 0.5, 1.0, 0.5, colorNone}; 1042 KapaSection section3 = {"s3", 0.0, 0.0, 1.0, 1.0, colorNone}; 1063 1043 1064 1044 psVector *xIndices = psVectorAlloc (xHist->n, PS_TYPE_F32); 1065 1045 psVector *yIndices = psVectorAlloc (yHist->n, PS_TYPE_F32); 1066 1046 1067 // populate the Indices vectors1047 // populate the Indices vectors 1068 1048 for(int i = 0; i < xHist->n; i++) { 1069 1049 xIndices->data.F32[i] = i; … … 1074 1054 1075 1055 // set up plot information 1076 KapaClearPlots(kapa );1056 KapaClearPlots(kapa1); 1077 1057 KapaInitGraph(&graphdata); 1078 1058 1079 1059 // plot the X histogram 1080 1060 pmVisualScaleGraphdata(&graphdata, xIndices, xHist, false); 1081 KapaSetSection(kapa , §ion1);1082 KapaSetLimits (kapa , &graphdata);1083 KapaSetFont(kapa , "helvetica", 14);1084 KapaBox(kapa , &graphdata);1085 KapaSendLabel (kapa , "X offset Bin", KAPA_LABEL_XM);1086 KapaSendLabel (kapa , "Number of Sources", KAPA_LABEL_YM);1087 KapaSendLabel (kapa , "Horizontal Profile",1061 KapaSetSection(kapa1, §ion1); 1062 KapaSetLimits (kapa1, &graphdata); 1063 KapaSetFont(kapa1, "helvetica", 14); 1064 KapaBox(kapa1, &graphdata); 1065 KapaSendLabel (kapa1, "X offset Bin", KAPA_LABEL_XM); 1066 KapaSendLabel (kapa1, "Number of Sources", KAPA_LABEL_YM); 1067 KapaSendLabel (kapa1, "Horizontal Profile", 1088 1068 KAPA_LABEL_XP); 1089 1069 graphdata.style = 1; … … 1092 1072 graphdata.color = KapaColorByName ("black"); 1093 1073 1094 KapaPrepPlot (kapa , xHist->n, &graphdata);1095 KapaPlotVector (kapa , xHist->n, xIndices->data.F32, "x");1096 KapaPlotVector (kapa , xHist->n, xHist->data.F32, "y");1097 1098 // overplot the peak1074 KapaPrepPlot (kapa1, xHist->n, &graphdata); 1075 KapaPlotVector (kapa1, xHist->n, xIndices->data.F32, "x"); 1076 KapaPlotVector (kapa1, xHist->n, xHist->data.F32, "y"); 1077 1078 // overplot the peak 1099 1079 float x[2] = {xBin, xBin}; 1100 1080 float y[2] = {-500, 500}; 1101 1081 graphdata.color = KapaColorByName ("red"); 1102 KapaPrepPlot (kapa , 2, &graphdata);1103 KapaPlotVector (kapa , 2, x, "x");1104 KapaPlotVector (kapa , 2, y, "y");1105 1106 // plot the Y histogram1082 KapaPrepPlot (kapa1, 2, &graphdata); 1083 KapaPlotVector (kapa1, 2, x, "x"); 1084 KapaPlotVector (kapa1, 2, y, "y"); 1085 1086 // plot the Y histogram 1107 1087 pmVisualScaleGraphdata(&graphdata, yIndices, yHist, false); 1108 KapaSetSection(kapa , §ion2);1109 KapaSetLimits (kapa , &graphdata);1110 KapaSetFont(kapa , "helvetica", 14);1088 KapaSetSection(kapa1, §ion2); 1089 KapaSetLimits (kapa1, &graphdata); 1090 KapaSetFont(kapa1, "helvetica", 14); 1111 1091 graphdata.color = KapaColorByName ("black"); 1112 KapaBox(kapa , &graphdata);1113 KapaSendLabel (kapa , "Y offset Bin", KAPA_LABEL_XM);1114 KapaSendLabel (kapa , "Number of Sources", KAPA_LABEL_YM);1115 KapaSendLabel (kapa , "Vertical Profile",1092 KapaBox(kapa1, &graphdata); 1093 KapaSendLabel (kapa1, "Y offset Bin", KAPA_LABEL_XM); 1094 KapaSendLabel (kapa1, "Number of Sources", KAPA_LABEL_YM); 1095 KapaSendLabel (kapa1, "Vertical Profile", 1116 1096 KAPA_LABEL_XP); 1117 1097 graphdata.style = 1; … … 1119 1099 graphdata.size = 0.4; 1120 1100 1121 KapaPrepPlot (kapa , yHist->n, &graphdata);1122 KapaPlotVector (kapa , yHist->n, yIndices->data.F32, "x");1123 KapaPlotVector (kapa , yHist->n, yHist->data.F32, "y");1124 1125 // overplot the peak1101 KapaPrepPlot (kapa1, yHist->n, &graphdata); 1102 KapaPlotVector (kapa1, yHist->n, yIndices->data.F32, "x"); 1103 KapaPlotVector (kapa1, yHist->n, yHist->data.F32, "y"); 1104 1105 // overplot the peak 1126 1106 x[0] = x[1] = yBin; 1127 1107 graphdata.color = KapaColorByName ("red"); 1128 KapaPrepPlot (kapa , 2, &graphdata);1129 KapaPlotVector (kapa , 2, x, "x");1130 KapaPlotVector (kapa , 2, y, "y");1131 1132 // plot title1108 KapaPrepPlot (kapa1, 2, &graphdata); 1109 KapaPlotVector (kapa1, 2, x, "x"); 1110 KapaPlotVector (kapa1, 2, y, "y"); 1111 1112 // plot title 1133 1113 graphdata.color = KapaColorByName("black"); 1134 KapaSection section3 = {"s3", 0, 0, 1, 1}; 1135 KapaSetSection( kapa , §ion3);1136 KapaSendLabel (kapa , "Tweaking the Astrometry Grid Solution. Smoothed profiles + peak location",1114 1115 KapaSetSection( kapa1, §ion3); 1116 KapaSendLabel (kapa1, "Tweaking the Astrometry Grid Solution. Smoothed profiles + peak location", 1137 1117 KAPA_LABEL_XP); 1138 1118 … … 1142 1122 psFree(yIndices); 1143 1123 return true; 1144 } // end of pmAstromPlotTweak1124 } // end of pmAstromPlotTweak 1145 1125 1146 1126 … … 1149 1129 1150 1130 1151 // initialize graph information1131 // initialize graph information 1152 1132 Graphdata graphdata; 1153 1133 KapaSection section; 1134 section.bg = KapaColorByName ("none"); // XXX probably should be 'none' 1154 1135 1155 1136 KapaInitGraph (&graphdata); 1156 KapaClearPlots (kapa );1137 KapaClearPlots (kapa1); 1157 1138 1158 1139 graphdata.color = KapaColorByName ("black"); … … 1164 1145 section.dy = 0.4; 1165 1146 1166 // initialize and populate the plotting vectors1147 // initialize and populate the plotting vectors 1167 1148 bool status = false; 1168 1149 float iMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.PLOT.INST.MAG.MIN"); … … 1180 1161 section.name = NULL; 1181 1162 psStringAppend (§ion.name, "a0"); 1182 KapaSetSection (kapa , §ion);1163 KapaSetSection (kapa1, §ion); 1183 1164 psFree (section.name); 1184 1165 … … 1202 1183 xVec->n = yVec->n = zVec->n = n; 1203 1184 1204 KapaSendLabel (kapa , "X", KAPA_LABEL_XM);1205 KapaSendLabel (kapa , "dX", KAPA_LABEL_YM);1206 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);1185 KapaSendLabel (kapa1, "X", KAPA_LABEL_XM); 1186 KapaSendLabel (kapa1, "dX", KAPA_LABEL_YM); 1187 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 1207 1188 1208 1189 // X vs dY … … 1211 1192 section.name = NULL; 1212 1193 psStringAppend (§ion.name, "a1"); 1213 KapaSetSection (kapa , §ion);1194 KapaSetSection (kapa1, §ion); 1214 1195 psFree (section.name); 1215 1196 … … 1233 1214 xVec->n = yVec->n = zVec->n = n; 1234 1215 1235 KapaSendLabel (kapa , "X", KAPA_LABEL_XM);1236 KapaSendLabel (kapa , "dY", KAPA_LABEL_YM);1237 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);1216 KapaSendLabel (kapa1, "X", KAPA_LABEL_XM); 1217 KapaSendLabel (kapa1, "dY", KAPA_LABEL_YM); 1218 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 1238 1219 1239 1220 // Y vs dX … … 1242 1223 section.name = NULL; 1243 1224 psStringAppend (§ion.name, "a2"); 1244 KapaSetSection (kapa , §ion);1225 KapaSetSection (kapa1, §ion); 1245 1226 psFree (section.name); 1246 1227 … … 1264 1245 xVec->n = yVec->n = zVec->n = n; 1265 1246 1266 KapaSendLabel (kapa , "Y", KAPA_LABEL_XM);1267 KapaSendLabel (kapa , "dX", KAPA_LABEL_YM);1268 pmVisualTriplePlot (kapa , &graphdata, xVec, yVec, zVec, false);1247 KapaSendLabel (kapa1, "Y", KAPA_LABEL_XM); 1248 KapaSendLabel (kapa1, "dX", KAPA_LABEL_YM); 1249 pmVisualTriplePlot (kapa1, &graphdata, xVec, yVec, zVec, false); 1269 1250 1270 1251 // Y vs dY … … 1273 1254 section.name = NULL; 1274 1255 psStringAppend (§ion.name, "a3"); 1275 KapaSetSection (kapa , §ion);1256 KapaSetSection (kapa1, §ion); 1276 1257 psFree (section.name); 1277 1258 … … 1295 1276 xVec->n = yVec->n = zVec->n = n; 1296 1277 1297 KapaSendLabel (kapa, "Y", KAPA_LABEL_XM); 1298 KapaSendLabel (kapa, "dY", KAPA_LABEL_YM); 1299 pmKapaPlotVectorTriple_AutoLimits_OpenGraph (kapa, &graphdata, xVec, yVec, zVec, false); 1278 KapaSendLabel (kapa1, "Y", KAPA_LABEL_XM); 1279 KapaSendLabel (kapa1, "dY", KAPA_LABEL_YM); 1280 pmKapaPlotVectorTriple_AutoLimits_OpenGraph (kapa1, &graphdata, xVec, yVec, zVec, false); 1281 1282 psFree (xVec); 1283 psFree (yVec); 1284 psFree (zVec); 1300 1285 1301 1286 section.x = 0.0; … … 1305 1290 section.name = NULL; 1306 1291 psStringAppend (§ion.name, "a5"); 1307 KapaSetSection (kapa , §ion);1308 KapaSendLabel (kapa , title, KAPA_LABEL_XP);1292 KapaSetSection (kapa1, §ion); 1293 KapaSendLabel (kapa1, title, KAPA_LABEL_XP); 1309 1294 psFree (section.name); 1310 1295 1311 //second window 1296 // *************************************** 1297 // second window 1312 1298 1313 1299 KapaInitGraph (&graphdata); … … 1322 1308 graphdata.ptype = 7; 1323 1309 graphdata.style = 2; 1324 1325 psFree (xVec);1326 psFree (yVec);1327 psFree (zVec);1328 1310 1329 1311 xVec = psVectorAlloc (refstars->n, PS_TYPE_F32); … … 1346 1328 pmVisualTriplePlot (kapa2, &graphdata, xVec, yVec, zVec, false); 1347 1329 1348 // rescale the graph to include all points1330 // rescale the graph to include all points 1349 1331 float xmin = graphdata.xmin; 1350 1332 float ymin = graphdata.ymin; … … 1358 1340 KapaSetLimits (kapa2, &graphdata); 1359 1341 1360 bool plotTweak;1361 pmVisualAskUser(&plotTweak);1342 // bool plotTweak; 1343 // pmVisualAskUser(&plotTweak); 1362 1344 1363 1345 // X vs Y by mag (raw) 1364 1346 graphdata.color = KapaColorByName ("black"); 1365 graphdata.ptype = 2;1347 graphdata.ptype = 7; 1366 1348 graphdata.style = 2; 1367 1349 … … 1389 1371 pmVisualTripleOverplot (kapa2, &graphdata, xVec, yVec, zVec, false); 1390 1372 1391 // overplot matched stars in blue1373 // overplot matched stars in blue 1392 1374 psFree (xVec); 1393 1375 psFree (yVec); … … 1398 1380 zVec = psVectorAlloc (match->n, PS_TYPE_F32); 1399 1381 1382 graphdata.ptype = 2; 1400 1383 graphdata.color = KapaColorByName ("blue"); 1401 1384 n = 0; … … 1411 1394 xVec->data.F32[n] = raw->chip->x; 1412 1395 yVec->data.F32[n] = raw->chip->y; 1413 zVec->data.F32[n] = iMagMin;1396 zVec->data.F32[n] = raw->Mag; 1414 1397 n++; 1415 1398 } 1416 1399 xVec->n = yVec->n = zVec->n = n; 1400 fprintf (stderr, "plotting %d matched stars (raw = blue)\n", n); 1417 1401 pmVisualTripleOverplot (kapa2, &graphdata, xVec, yVec, zVec, false); 1402 1403 if (0) { 1404 graphdata.ptype = 3; 1405 graphdata.color = KapaColorByName ("green"); 1406 n = 0; 1407 for (int i = 0; i < match->n; i++) { 1408 pmAstromMatch *pair = match->data[i]; 1409 pmAstromObj *raw = rawstars->data[pair->raw]; 1410 pmAstromObj *ref = refstars->data[pair->ref]; 1411 if (raw->Mag < iMagMin) continue; 1412 if (raw->Mag > iMagMax) continue; 1413 if (ref->Mag < rMagMin) continue; 1414 if (ref->Mag > rMagMax) continue; 1415 1416 xVec->data.F32[n] = ref->chip->x; 1417 yVec->data.F32[n] = ref->chip->y; 1418 zVec->data.F32[n] = ref->Mag; 1419 n++; 1420 } 1421 xVec->n = yVec->n = zVec->n = n; 1422 fprintf (stderr, "plotting %d matched stars (ref = green)\n", n); 1423 pmVisualTripleOverplot (kapa2, &graphdata, xVec, yVec, zVec, false); 1424 } 1418 1425 1419 1426 psFree (xVec); 1420 1427 psFree (yVec); 1421 1428 psFree (zVec); 1429 1430 // *************************************** 1431 // third window, pt1 1432 1433 xVec = psVectorAlloc (match->n, PS_TYPE_F32); 1434 yVec = psVectorAlloc (match->n, PS_TYPE_F32); 1435 1436 KapaInitGraph (&graphdata); 1437 KapaClearPlots (kapa3); 1438 1439 // X vs Y by mag (ref) 1440 graphdata.color = KapaColorByName ("black"); 1441 graphdata.ptype = 2; 1442 graphdata.style = 2; 1443 graphdata.size = 1; 1444 1445 section.x = 0.0; 1446 section.y = 0.0; 1447 section.dx = 0.5; 1448 section.dy = 0.5; 1449 section.name = NULL; 1450 psStringAppend (§ion.name, "s1"); 1451 KapaSetSection (kapa3, §ion); 1452 psFree (section.name); 1453 1454 n = 0; 1455 for (int i = 0; i < match->n; i++) { 1456 pmAstromMatch *pair = match->data[i]; 1457 pmAstromObj *raw = rawstars->data[pair->raw]; 1458 pmAstromObj *ref = refstars->data[pair->ref]; 1459 if (raw->Mag < iMagMin) continue; 1460 if (raw->Mag > iMagMax) continue; 1461 if (ref->Mag < rMagMin) continue; 1462 if (ref->Mag > rMagMax) continue; 1463 1464 xVec->data.F32[n] = raw->Mag; 1465 yVec->data.F32[n] = raw->chip->y - ref->chip->y; 1466 n++; 1467 } 1468 xVec->n = yVec->n = n; 1469 1470 // rescale the graph to include all points 1471 pmVisualScaleGraphdata(&graphdata, xVec, yVec, true); 1472 KapaSetLimits (kapa3, &graphdata); 1473 KapaBox (kapa3, &graphdata); 1474 KapaSendLabel(kapa1, "raw mag", KAPA_LABEL_XM); 1475 KapaSendLabel(kapa1, "dY", KAPA_LABEL_YM); 1476 1477 KapaPrepPlot (kapa3, xVec->n, &graphdata); 1478 KapaPlotVector (kapa3, xVec->n, xVec->data.F32, "x"); 1479 KapaPlotVector (kapa3, yVec->n, yVec->data.F32, "y"); 1480 1481 // *************************************** 1482 // third window, pt2 1483 1484 section.x = 0.5; 1485 section.y = 0.0; 1486 section.dx = 0.5; 1487 section.dy = 0.5; 1488 section.name = NULL; 1489 psStringAppend (§ion.name, "s2"); 1490 KapaSetSection (kapa3, §ion); 1491 psFree (section.name); 1492 1493 n = 0; 1494 for (int i = 0; i < match->n; i++) { 1495 pmAstromMatch *pair = match->data[i]; 1496 pmAstromObj *raw = rawstars->data[pair->raw]; 1497 pmAstromObj *ref = refstars->data[pair->ref]; 1498 if (raw->Mag < iMagMin) continue; 1499 if (raw->Mag > iMagMax) continue; 1500 if (ref->Mag < rMagMin) continue; 1501 if (ref->Mag > rMagMax) continue; 1502 1503 xVec->data.F32[n] = ref->Mag; 1504 yVec->data.F32[n] = raw->chip->y - ref->chip->y; 1505 n++; 1506 } 1507 xVec->n = yVec->n = n; 1508 1509 // rescale the graph to include all points 1510 pmVisualScaleGraphdata(&graphdata, xVec, yVec, true); 1511 KapaSetLimits (kapa3, &graphdata); 1512 KapaBox (kapa3, &graphdata); 1513 KapaSendLabel(kapa1, "ref mag", KAPA_LABEL_XM); 1514 KapaSendLabel(kapa1, "dY", KAPA_LABEL_YM); 1515 1516 KapaPrepPlot (kapa3, xVec->n, &graphdata); 1517 KapaPlotVector (kapa3, xVec->n, xVec->data.F32, "x"); 1518 KapaPlotVector (kapa3, yVec->n, yVec->data.F32, "y"); 1519 1520 // *************************************** 1521 // third window, pt3 1522 1523 section.x = 0.0; 1524 section.y = 0.5; 1525 section.dx = 0.5; 1526 section.dy = 0.5; 1527 section.name = NULL; 1528 psStringAppend (§ion.name, "s3"); 1529 KapaSetSection (kapa3, §ion); 1530 psFree (section.name); 1531 1532 n = 0; 1533 for (int i = 0; i < match->n; i++) { 1534 pmAstromMatch *pair = match->data[i]; 1535 pmAstromObj *raw = rawstars->data[pair->raw]; 1536 pmAstromObj *ref = refstars->data[pair->ref]; 1537 if (raw->Mag < iMagMin) continue; 1538 if (raw->Mag > iMagMax) continue; 1539 if (ref->Mag < rMagMin) continue; 1540 if (ref->Mag > rMagMax) continue; 1541 1542 xVec->data.F32[n] = raw->Mag; 1543 yVec->data.F32[n] = raw->chip->x - ref->chip->x; 1544 n++; 1545 } 1546 xVec->n = yVec->n = n; 1547 1548 // rescale the graph to include all points 1549 pmVisualScaleGraphdata(&graphdata, xVec, yVec, true); 1550 KapaSetLimits (kapa3, &graphdata); 1551 KapaBox (kapa3, &graphdata); 1552 KapaSendLabel(kapa1, "raw mag", KAPA_LABEL_XM); 1553 KapaSendLabel(kapa1, "dX", KAPA_LABEL_YM); 1554 1555 KapaPrepPlot (kapa3, xVec->n, &graphdata); 1556 KapaPlotVector (kapa3, xVec->n, xVec->data.F32, "x"); 1557 KapaPlotVector (kapa3, yVec->n, yVec->data.F32, "y"); 1558 1559 // *************************************** 1560 // third window, pt4 1561 1562 section.x = 0.5; 1563 section.y = 0.5; 1564 section.dx = 0.5; 1565 section.dy = 0.5; 1566 section.name = NULL; 1567 psStringAppend (§ion.name, "s4"); 1568 KapaSetSection (kapa3, §ion); 1569 psFree (section.name); 1570 1571 n = 0; 1572 for (int i = 0; i < match->n; i++) { 1573 pmAstromMatch *pair = match->data[i]; 1574 pmAstromObj *raw = rawstars->data[pair->raw]; 1575 pmAstromObj *ref = refstars->data[pair->ref]; 1576 if (raw->Mag < iMagMin) continue; 1577 if (raw->Mag > iMagMax) continue; 1578 if (ref->Mag < rMagMin) continue; 1579 if (ref->Mag > rMagMax) continue; 1580 1581 xVec->data.F32[n] = ref->Mag; 1582 yVec->data.F32[n] = raw->chip->x - ref->chip->x; 1583 n++; 1584 } 1585 xVec->n = yVec->n = n; 1586 1587 // rescale the graph to include all points 1588 pmVisualScaleGraphdata(&graphdata, xVec, yVec, true); 1589 KapaSetLimits (kapa3, &graphdata); 1590 KapaBox (kapa3, &graphdata); 1591 KapaSendLabel(kapa1, "ref mag", KAPA_LABEL_XM); 1592 KapaSendLabel(kapa1, "dX", KAPA_LABEL_YM); 1593 1594 KapaPrepPlot (kapa3, xVec->n, &graphdata); 1595 KapaPlotVector (kapa3, xVec->n, xVec->data.F32, "x"); 1596 KapaPlotVector (kapa3, yVec->n, yVec->data.F32, "y"); 1597 1422 1598 return true; 1423 1599 } -
branches/eam_branches/ipp-20110213/psModules/src/astrom/pmAstrometryVisual.h
r26260 r31019 47 47 48 48 bool pmAstromVisualPlotGridMatchOverlay (const psArray *raw, 49 const psArray *ref); 49 const psArray *ref, 50 const psPlane offset); 50 51 51 52 /** -
branches/eam_branches/ipp-20110213/psModules/src/extras/pmVisual.c
r30623 r31019 1 /** The following are a collection of core procedures to aid the creation of vis aual diagnostics1 /** The following are a collection of core procedures to aid the creation of visual diagnostics 2 2 * @author Chris Beaumont, IfA 3 3 * @date January 23, 2008 … … 80 80 81 81 bool pmVisualInitWindow (int *kapid, char *name) { 82 82 83 if (*kapid == -1) { 83 84 *kapid = KapaOpenNamedSocket("kapa", name); 84 85 if (*kapid == -1) { 85 fprintf (stderr, "Failure to open kapa .\n");86 isVisual = false;86 fprintf (stderr, "Failure to open kapa; visual mode disabled.\n"); 87 pmVisualSetVisual(false); 87 88 return false; 88 89 } … … 255 256 } 256 257 258 if (increasing) { 259 fprintf (stderr, "plotting points scaled from %f to %f\n", zmin, zmax); 260 } else { 261 fprintf (stderr, "plotting points scaled from %f to %f\n", zmax, zmin); 262 } 263 257 264 float range = zmax - zmin; 258 265 if (range == 0.0) { -
branches/eam_branches/ipp-20110213/psModules/src/extras/pmVisualUtils.c
r29004 r31019 16 16 #include <pslib.h> 17 17 18 #include <pmVisual.h> 18 19 #include <pmVisualUtils.h> 19 20 … … 89 90 } 90 91 92 // turn on overall visualization 93 pmVisualSetVisual(true); 94 91 95 // If the component name has no leading dot, then supply it. 92 96 if (comp[0] != '.') { … … 145 149 PS_ASSERT_STRING_NON_EMPTY(func, false); 146 150 147 // return true if level is set to be shown 151 // if visualization is turned off, just skip 152 if (!pmVisualIsVisual()) return false; 153 154 // return true if level is set to be shown 148 155 FACILITY(facility, func, name); 156 149 157 bool valid = level <= getLevel(facility); 150 158 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceVisual.c
r29004 r31019 56 56 57 57 if (!pmVisualTestLevel("psphot.psf.metric", 2)) return true; 58 59 if (kapa1 == -1) { 60 kapa1 = KapaOpenNamedSocket ("kapa", "pmSource:plots"); 61 if (kapa1 == -1) { 62 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 63 pmVisualSetVisual(false); 64 return false; 65 } 66 } 58 if (!pmVisualInitWindow (&kapa1, "pmSource:plots")) return false; 67 59 68 60 KapaClearSections (kapa1); … … 140 132 141 133 if (!pmVisualTestLevel("psphot.psf.subpix", 3)) return true; 142 143 if (kapa1 == -1) { 144 kapa1 = KapaOpenNamedSocket ("kapa", "pmSource:plots"); 145 if (kapa1 == -1) { 146 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 147 pmVisualSetVisual(false); 148 return false; 149 } 150 } 134 if (!pmVisualInitWindow (&kapa1, "pmSource:plots")) return false; 151 135 152 136 KapaClearSections (kapa1); 153 137 KapaInitGraph (&graphdata); 138 section.bg = KapaColorByName ("none"); // XXX probably should be 'none' 154 139 155 140 int n; … … 302 287 303 288 if (!pmVisualTestLevel("psphot.psf.fits", 2)) return true; 304 305 if (kapa2 == -1) { 306 kapa2 = KapaOpenNamedSocket ("kapa", "pmSource:images"); 307 if (kapa2 == -1) { 308 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 309 pmVisualSetVisual(false); 310 return false; 311 } 312 } 289 if (!pmVisualInitWindow (&kapa2, "pmSource:images")) return false; 313 290 314 291 // create images 1/10 scale: … … 385 362 if (!source->pixels) return false; 386 363 if (!source->modelFlux) return false; 387 388 if (kapa2 == -1) { 389 kapa2 = KapaOpenNamedSocket ("kapa", "pmSource:images"); 390 if (kapa2 == -1) { 391 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 392 pmVisualSetVisual(false); 393 return false; 394 } 395 } 364 if (!pmVisualInitWindow (&kapa2, "pmSource:images")) return false; 396 365 397 366 // KapaClearSections (kapa2); … … 428 397 if (!plotPSF) return true; 429 398 if (!pmVisualTestLevel("psphot.psf.resid", 2)) return true; 430 431 if (kapa1 == -1) { 432 kapa1 = KapaOpenNamedSocket ("kapa", "pmSource:plots"); 433 if (kapa1 == -1) { 434 fprintf (stderr, "failure to open kapa; visual mode disabled\n"); 435 pmVisualSetVisual(false); 436 return false; 437 } 438 } 399 if (!pmVisualInitWindow (&kapa1, "pmSource:plots")) return false; 439 400 440 401 KapaClearPlots (kapa1); 441 402 KapaInitGraph (&graphdata); 403 section.bg = KapaColorByName ("none"); // XXX probably should be 'none' 442 404 443 405 float Xmin = +1e32;
Note:
See TracChangeset
for help on using the changeset viewer.
