Changeset 5773 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Dec 13, 2005, 10:03:27 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r5772 r5773 367 367 } 368 368 369 // dump thesources to an output file369 // write the PSF sources to an output file 370 370 bool pmModelWritePSFs (psArray *sources, psMetadata *config, char *filename, pmPSF *psf) { 371 371 … … 389 389 pmSource *source = (pmSource *) sources->data[i]; 390 390 391 // write out sources fitted as PSFs392 391 if (source->type != PM_SOURCE_STAR) continue; 393 if (source->mode & PM_SOURCE_FAIL) continue;394 if (source->mode & PM_SOURCE_POOR) continue;395 396 model = pmSourceMagnitudes (source, psf, RADIUS );392 // if (source->mode & PM_SOURCE_FAIL) continue; 393 // if (source->mode & PM_SOURCE_POOR) continue; 394 395 model = pmSourceMagnitudes (source, psf, RADIUS, true); 397 396 if (model == NULL) continue; 398 397 … … 400 399 dPAR = model->dparams->data.F32; 401 400 401 // dP is positional error 402 402 dP = 0; 403 403 dP += PS_SQR(dPAR[2]); … … 410 410 PAR[2], PAR[3], PAR[0], source->fitMag, dmag, dP); 411 411 412 for (j = 0; j < model->params->n - 4; j++) {413 fprintf (f, "%9.6f ", PAR[j +4]);412 for (j = 4; j < model->params->n; j++) { 413 fprintf (f, "%9.6f ", PAR[j]); 414 414 } 415 415 fprintf (f, " : "); 416 for (j = 0; j < model->params->n - 4; j++) {417 fprintf (f, "%9.6f ", dPAR[j +4]);416 for (j = 4; j < model->params->n; j++) { 417 fprintf (f, "%9.6f ", dPAR[j]); 418 418 } 419 fprintf (f, ": %2d % 7.3f %7.3f %7.2f %4d %2d\n",420 source[0].type, 419 fprintf (f, ": %2d %2d %7.3f %7.3f %7.2f %4d %2d\n", 420 source[0].type, source[0].mode, 421 421 log10(model[0].chisq/model[0].nDOF), 422 422 source[0].moments->SN, … … 448 448 for (i = 0; i < sources->n; i++) { 449 449 pmSource *source = (pmSource *) sources->data[i]; 450 model = (pmModel *) source->modelFLT; 450 451 if (source->type != PM_SOURCE_GALAXY) continue; 452 // if (source->mode & PM_SOURCE_FAIL) continue; 453 // if (source->mode & PM_SOURCE_POOR) continue; 454 455 model = pmSourceMagnitudes (source->modelFLT, NULL, model->radius); 451 456 if (model == NULL) continue; 452 if (source->type != PM_SOURCE_GALAXY) continue; 453 if (source->mode & PM_SOURCE_FAIL) continue;454 if (source->mode & PM_SOURCE_POOR) continue;457 458 PAR = model->params->data.F32; 459 dPAR = model->dparams->data.F32; 455 460 456 params = model->params; 457 dparams = model->dparams; 458 459 // XXX these are hardwired for SGAUSS : this should be pushed into the 460 // model functions as an abstract function 461 // dP is shape error 462 // XXX these are hardwired for SGAUSS 461 463 dP = 0; 462 dP += PS_SQR(d params[0].data.F32[4] / params[0].data.F32[4]);463 dP += PS_SQR(d params[0].data.F32[5] / params[0].data.F32[5]);464 dP += PS_SQR(d params[0].data.F32[7] / params[0].data.F32[7]);464 dP += PS_SQR(dPAR[4] / PAR[4]); 465 dP += PS_SQR(dPAR[5] / PAR[5]); 466 dP += PS_SQR(dPAR[7] / PAR[7]); 465 467 dP = sqrt (dP); 466 468 469 dmag = dPAR[1] / PAR[1]; 470 467 471 fprintf (f, "%7.1f %7.1f %5.1f %7.3f %7.4f %7.4f ", 468 params[0].data.F32[2], 469 params[0].data.F32[3], 470 params[0].data.F32[0], 471 -2.5*log10(params[0].data.F32[1]), 472 (dparams[0].data.F32[1]/params[0].data.F32[1]), 473 dP); 472 PAR[2], PAR[3], PAR[0], source->fitMag, dmag, dP); 474 473 475 474 for (j = 4; j < model->params->n; j++) { 476 fprintf (f, "%9.6f ", params[0].data.F32[j]);475 fprintf (f, "%9.6f ", PAR[j]); 477 476 } 478 477 fprintf (f, " : "); 479 478 for (j = 4; j < model->params->n; j++) { 480 fprintf (f, "%9.6f ", d params[0].data.F32[j]);479 fprintf (f, "%9.6f ", dPAR[j]); 481 480 } 482 fprintf (f, ": %2d %7.3f %7.3f %7.2f %4d %2d\n", 483 source[0].type, log10(model[0].chisq/model[0].nDOF), 481 fprintf (f, ": %2d %2d %7.3f %7.3f %7.2f %4d %2d\n", 482 source[0].type, source[0].mode, 483 log10(model[0].chisq/model[0].nDOF), 484 484 source[0].moments->SN, 485 485 model[0].radius, … … 497 497 int i; 498 498 FILE *f; 499 pmMoments *moment = NULL; 500 pmSource *source = NULL; 499 501 500 502 f = fopen (filename, "w"); … … 508 510 // write sources with models first 509 511 for (i = 0; i < sources->n; i++) { 510 pmSource *source = (pmSource *)sources->data[i];512 source = sources->data[i]; 511 513 512 514 // skip these sources (in PSF or FLT) 513 if (source->type == PM_SOURCE_STAR) { 514 if (source->mode & PM_SOURCE_FAIL) goto isNULL; 515 if (source->mode & PM_SOURCE_POOR) goto isNULL; 516 continue; 515 if (source->type == PM_SOURCE_STAR) continue; 516 if (source->type == PM_SOURCE_GALAXY) continue; 517 518 if (source->moments == NULL) { 519 moment = empty; 520 } else { 521 moment = source->moments; 517 522 } 518 if (source->type == PM_SOURCE_GALAXY) { 519 if (source->mode & PM_SOURCE_FAIL) goto isNULL; 520 if (source->mode & PM_SOURCE_POOR) goto isNULL; 521 continue; 522 } 523 524 isNULL: 525 526 if (source->moments == NULL) { 527 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", 528 source->peak->x, source->peak->y, source->peak->counts, 529 empty->x, empty->y, 530 empty->Sx, empty->Sy, 531 empty->Sum, empty->Peak, 532 empty->Sky, empty->SN, 533 empty->nPixels, source->type); 534 } else { 535 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", 536 source->peak->x, source->peak->y, source->peak->counts, 537 source->moments->x, source->moments->y, 538 source->moments->Sx, source->moments->Sy, 539 source->moments->Sum, source->moments->Peak, 540 source->moments->Sky, source->moments->SN, 541 source->moments->nPixels, source->type); 542 } 523 524 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", 525 source->peak->x, source->peak->y, source->peak->counts, 526 source->moments->x, source->moments->y, 527 source->moments->Sx, source->moments->Sy, 528 source->moments->Sum, source->moments->Peak, 529 source->moments->Sky, source->moments->SN, 530 source->moments->nPixels, source->type); 543 531 } 544 532 fclose (f); … … 552 540 int i; 553 541 FILE *f; 554 pmSource *source ;542 pmSource *source = NULL; 555 543 556 544 f = fopen (filename, "w"); … … 561 549 562 550 for (i = 0; i < sources->n; i++) { 563 source = (pmSource *)sources->data[i];551 source = sources->data[i]; 564 552 if (source->moments == NULL) 565 553 continue;
Note:
See TracChangeset
for help on using the changeset viewer.
