Changeset 5802 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Dec 17, 2005, 10:26:59 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r5773 r5802 370 370 bool pmModelWritePSFs (psArray *sources, psMetadata *config, char *filename, pmPSF *psf) { 371 371 372 double dP , dmag;372 double dPos, dMag; 373 373 int i, j; 374 374 FILE *f; … … 393 393 // if (source->mode & PM_SOURCE_POOR) continue; 394 394 395 model = pmSourceMagnitudes (source, psf, RADIUS , true);395 model = pmSourceMagnitudes (source, psf, RADIUS); 396 396 if (model == NULL) continue; 397 397 … … 399 399 dPAR = model->dparams->data.F32; 400 400 401 // dP is positional error 402 dP = 0; 403 dP += PS_SQR(dPAR[2]); 404 dP += PS_SQR(dPAR[3]); 405 dP = sqrt (dP); 406 407 dmag = dPAR[1] / PAR[1]; 408 409 fprintf (f, "%7.1f %7.1f %5.1f %7.4f %7.4f %7.4f ", 410 PAR[2], PAR[3], PAR[0], source->fitMag, dmag, dP); 401 // dPos is positional error, dMag is mag error 402 dPos = hypot (dPAR[2], dPAR[3]); 403 dMag = dPAR[1] / PAR[1]; 404 405 fprintf (f, "%7.1f %7.1f %5.1f %8.4f %7.4f %7.4f ", 406 PAR[2], PAR[3], PAR[0], source->fitMag, dMag, dPos); 411 407 412 408 for (j = 4; j < model->params->n; j++) { … … 417 413 fprintf (f, "%9.6f ", dPAR[j]); 418 414 } 419 fprintf (f, ": %2d % 2d %7.3f %7.3f %7.2f %4d %2d\n",415 fprintf (f, ": %2d %#5x %7.3f %7.1f %7.2f %4d %2d\n", 420 416 source[0].type, source[0].mode, 421 417 log10(model[0].chisq/model[0].nDOF), … … 432 428 bool pmModelWriteFLTs (psArray *sources, char *filename) { 433 429 434 double dP ;430 double dPos, dMag; 435 431 int i, j; 436 432 FILE *f; 437 psVector *params; 438 psVector *dparams; 433 psF32 *PAR, *dPAR; 439 434 pmModel *model; 440 435 … … 450 445 451 446 if (source->type != PM_SOURCE_GALAXY) continue; 452 // if (source->mode & PM_SOURCE_FAIL) continue;453 // if (source->mode & PM_SOURCE_POOR) continue;454 447 455 model = pmSourceMagnitudes (source->modelFLT, NULL, model->radius);456 if (model == NULL) continue;448 if (source->modelFLT == NULL) continue; 449 model = pmSourceMagnitudes (source, NULL, source->modelFLT->radius); 457 450 458 451 PAR = model->params->data.F32; 459 452 dPAR = model->dparams->data.F32; 460 453 461 // dP is shape error454 // dPos is shape error 462 455 // XXX these are hardwired for SGAUSS 463 dP = 0; 464 dP += PS_SQR(dPAR[4] / PAR[4]); 465 dP += PS_SQR(dPAR[5] / PAR[5]); 466 dP += PS_SQR(dPAR[7] / PAR[7]); 467 dP = sqrt (dP); 468 469 dmag = dPAR[1] / PAR[1]; 470 471 fprintf (f, "%7.1f %7.1f %5.1f %7.3f %7.4f %7.4f ", 472 PAR[2], PAR[3], PAR[0], source->fitMag, dmag, dP); 456 dPos = 0; 457 dPos += PS_SQR(dPAR[4] / PAR[4]); 458 dPos += PS_SQR(dPAR[5] / PAR[5]); 459 // dPos += PS_SQR(dPAR[7] / PAR[7]); 460 dPos = sqrt (dPos); 461 dMag = dPAR[1] / PAR[1]; 462 463 fprintf (f, "%7.1f %7.1f %7.1f %7.3f %7.4f %7.4f ", 464 PAR[2], PAR[3], PAR[0], source->fitMag, dMag, dPos); 473 465 474 466 for (j = 4; j < model->params->n; j++) { … … 479 471 fprintf (f, "%9.6f ", dPAR[j]); 480 472 } 481 fprintf (f, ": %2d % 2d %7.3f %7.3f %7.2f %4d %2d\n",473 fprintf (f, ": %2d %#5x %7.3f %7.1f %7.2f %4d %2d\n", 482 474 source[0].type, source[0].mode, 483 475 log10(model[0].chisq/model[0].nDOF), … … 548 540 } 549 541 542 fprintf (stderr, "writing out moments\n"); 550 543 for (i = 0; i < sources->n; i++) { 551 544 source = sources->data[i]; 552 545 if (source->moments == NULL) 553 546 continue; 554 fprintf (f, "%5d %5d %7.1f %7.1f %7.1f %6.3f %6.3f % 8.1f %7.1f %7.1f %7.1f %4d %2d\n",547 fprintf (f, "%5d %5d %7.1f %7.1f %7.1f %6.3f %6.3f %10.1f %7.1f %7.1f %7.1f %4d %2d %#5x\n", 555 548 source->peak->x, source->peak->y, source->peak->counts, 556 549 source->moments->x, source->moments->y, … … 558 551 source->moments->Sum, source->moments->Peak, 559 552 source->moments->Sky, source->moments->SN, 560 source->moments->nPixels, source->type );553 source->moments->nPixels, source->type, source->mode); 561 554 } 562 555 fclose (f); … … 599 592 600 593 psRegion region = {x - dx, x + dx, y - dy, y + dy}; 601 psImage *sample = psImageSubset (image, region); 594 psImage *view = psImageSubset (image, region); 595 psImage *sample = psImageCopy (NULL, view, PS_TYPE_F32); 602 596 psImageInit (sample, 0); 603 597 modelFLT->params->data.F32[2] = x; … … 635 629 return (TRUE); 636 630 } 631 632 bool psphotDumpMoments (psMetadata *config, psArray *sources) { 633 634 bool status; 635 636 // optional dump of all rough source data 637 char *output = psMetadataLookupPtr (&status, config, "MOMENTS_OUTPUT_FILE"); 638 if (!status) return false; 639 if (output == NULL) return false; 640 if (output[0] == 0) return false; 641 642 pmMomentsWriteText (sources, output); 643 psFree (output); 644 return true; 645 }
Note:
See TracChangeset
for help on using the changeset viewer.
