- Timestamp:
- Jan 2, 2010, 6:13:37 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psModules/src/imcombine/pmSubtractionVisual.c
r26491 r26502 251 251 int yPix = ySub * (2*footprint + 1 + 3) + footprint; 252 252 253 double sum = 0.0; 253 254 for (int y = -footprint; y <= footprint; y++) { 254 255 for (int x = -footprint; x <= footprint; x++) { 255 256 output->data.F32[y + yPix][x + xPix] = kernel->kernel[y][x]; 257 sum += kernel->kernel[y][x]; 256 258 } 257 259 } 260 fprintf (stderr, "kernel %d, sum %f\n", i, sum); 258 261 } 259 262 … … 274 277 275 278 // choose the brightest stamp 276 pmSubtractionStamp *maxStamp = stamps->stamps->data[0];277 float maxFlux = maxStamp->flux;278 for (int i = 1; i < stamps->num; i++) {279 pmSubtractionStamp *maxStamp = NULL; 280 float maxFlux = NAN; 281 for (int i = 0; i < stamps->num; i++) { 279 282 pmSubtractionStamp *stamp = stamps->stamps->data[i]; 283 if (!isfinite(stamp->flux)) continue; 284 if (!stamp->convolutions1 && !stamp->convolutions2) continue; 285 if (!maxStamp) { 286 maxFlux = stamp->flux; 287 maxStamp = stamp; 288 continue; 289 } 280 290 if (stamp->flux > maxFlux) { 281 291 maxFlux = stamp->flux; 282 292 maxStamp = stamp; 283 293 } 294 } 295 296 if (!isfinite(maxStamp->flux)) { 297 fprintf (stderr, "no valid stamps?\n"); 284 298 } 285 299 … … 308 322 int yPix = ySub * (2*footprint + 1 + 3) + footprint; 309 323 324 double sum = 0.0; 310 325 for (int y = -footprint; y <= footprint; y++) { 311 326 for (int x = -footprint; x <= footprint; x++) { 312 327 output->data.F32[y + yPix][x + xPix] = kernel->kernel[y][x]; 328 sum += kernel->kernel[y][x]; 313 329 } 314 330 } 331 fprintf (stderr, "kernel %d, sum %f\n", i, sum); 315 332 } 316 333 pmVisualScaleImage(kapa2, output, "Image", 0, true); … … 339 356 int yPix = ySub * (2*footprint + 1 + 3) + footprint; 340 357 358 double sum = 0.0; 341 359 for (int y = -footprint; y <= footprint; y++) { 342 360 for (int x = -footprint; x <= footprint; x++) { 343 361 output->data.F32[y + yPix][x + xPix] = kernel->kernel[y][x]; 362 sum += kernel->kernel[y][x]; 344 363 } 345 364 } 365 fprintf (stderr, "kernel %d, sum %f\n", i, sum); 346 366 } 347 367 pmVisualScaleImage(kapa2, output, "Image", 1, true); … … 375 395 overlay[Noverlay].type = KII_OVERLAY_BOX; 376 396 if ((stamp->x < 1.0) && (stamp->y < 1.0)) { 377 fprintf (stderr, "stamp zero: %f %f\n", stamp->x, stamp->y);397 // fprintf (stderr, "stamp zero: %f %f\n", stamp->x, stamp->y); 378 398 continue; 379 399 } 380 400 if (!isfinite(stamp->x) && !isfinite(stamp->y)) { 381 fprintf (stderr, "stamp nan: %f %f\n", stamp->x, stamp->y);401 // fprintf (stderr, "stamp nan: %f %f\n", stamp->x, stamp->y); 382 402 continue; 383 403 } … … 409 429 bool pmSubtractionVisualShowFitInit(pmSubtractionStampList *stamps) { 410 430 411 if (!pmVisualIsVisual()) return true;431 // if (!pmVisualIsVisual()) return true; 412 432 413 433 // generate 4 storage images large enough to hold the N stamps: … … 446 466 bool pmSubtractionVisualShowFitAddStamp(psKernel *target, psKernel *source, psKernel *convolution, double background, double norm, int index) { 447 467 448 if (!pmVisualIsVisual()) return true;468 // if (!pmVisualIsVisual()) return true; 449 469 450 470 double sum; … … 517 537 bool pmSubtractionVisualShowFit() { 518 538 519 if (!pmVisualIsVisual()) return true;539 // if (!pmVisualIsVisual()) return true; 520 540 if (!pmVisualInitWindow(&kapa1, "ppSub:Images")) return false; 521 541 if (!pmVisualInitWindow(&kapa2, "ppSub:Misc")) return false;
Note:
See TracChangeset
for help on using the changeset viewer.
