Changeset 16819
- Timestamp:
- Mar 4, 2008, 3:08:08 PM (18 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 5 edited
-
pmSource.c (modified) (10 diffs)
-
pmSource.h (modified) (3 diffs)
-
pmSourceIO.c (modified) (6 diffs)
-
pmSourceIO.h (modified) (2 diffs)
-
pmSourceIO_PS1_DEV_1.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSource.c
r16066 r16819 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1. 49$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-15 02:48:10$8 * @version $Revision: 1.50 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-03-05 01:08:08 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 513 513 if (!source->moments) { 514 514 source->type = PM_SOURCE_TYPE_STAR; 515 source->mode |= PM_SOURCE_MODE_DEFAULT;516 515 Nstar++; 517 516 continue; … … 542 541 if (Nsatpix > 1) { 543 542 source->type = PM_SOURCE_TYPE_SATURATED; 544 source->mode |= PM_SOURCE_MODE_ DEFAULT;543 source->mode |= PM_SOURCE_MODE_SATURATED; 545 544 Nsat ++; 546 545 continue; … … 553 552 if ((sigX < 0.05) || (sigY < 0.05)) { 554 553 source->type = PM_SOURCE_TYPE_DEFECT; 555 source->mode |= PM_SOURCE_MODE_DEF AULT;554 source->mode |= PM_SOURCE_MODE_DEFECT; 556 555 Ncr ++; 557 556 continue; … … 561 560 if ((sigX > (clump.X + 3*clump.dX)) || (sigY > (clump.Y + 3*clump.dY))) { 562 561 source->type = PM_SOURCE_TYPE_EXTENDED; 563 source->mode |= PM_SOURCE_MODE_DEFAULT;564 562 Next ++; 565 563 continue; … … 584 582 // random type of star 585 583 source->type = PM_SOURCE_TYPE_STAR; 586 source->mode |= PM_SOURCE_MODE_DEFAULT;587 584 } 588 585 … … 1006 1003 if (!strcasecmp (name, "PSFMODEL" )) return PM_SOURCE_MODE_PSFMODEL; 1007 1004 if (!strcasecmp (name, "EXTMODEL" )) return PM_SOURCE_MODE_EXTMODEL; 1008 if (!strcasecmp (name, "SUBTRACTED")) return PM_SOURCE_MODE_SUBTRACTED;1009 1005 if (!strcasecmp (name, "FITTED" )) return PM_SOURCE_MODE_FITTED; 1010 1006 if (!strcasecmp (name, "FAIL" )) return PM_SOURCE_MODE_FAIL; … … 1014 1010 if (!strcasecmp (name, "SATSTAR" )) return PM_SOURCE_MODE_SATSTAR; 1015 1011 if (!strcasecmp (name, "BLEND" )) return PM_SOURCE_MODE_BLEND; 1016 if (!strcasecmp (name, "LINEAR" )) return PM_SOURCE_MODE_LINEAR;1017 if (!strcasecmp (name, "TEMPSUB" )) return PM_SOURCE_MODE_TEMPSUB;1018 1012 if (!strcasecmp (name, "EXTERNAL" )) return PM_SOURCE_MODE_EXTERNAL; 1019 1013 if (!strcasecmp (name, "BADPSF" )) return PM_SOURCE_MODE_BADPSF; 1014 if (!strcasecmp (name, "DEFECT" )) return PM_SOURCE_MODE_DEFECT; 1015 if (!strcasecmp (name, "SATURATED" )) return PM_SOURCE_MODE_SATURATED; 1016 if (!strcasecmp (name, "CRLIMIT" )) return PM_SOURCE_MODE_CRLIMIT; 1017 if (!strcasecmp (name, "SUBTRACTED")) return PM_SOURCE_MODE_SUBTRACTED; 1020 1018 return PM_SOURCE_MODE_DEFAULT; 1021 1019 } … … 1026 1024 case PM_SOURCE_MODE_PSFMODEL : return psStringCopy ("PSFMODEL" ); 1027 1025 case PM_SOURCE_MODE_EXTMODEL : return psStringCopy ("EXTMODEL" ); 1028 case PM_SOURCE_MODE_SUBTRACTED : return psStringCopy ("SUBTRACTED");1029 1026 case PM_SOURCE_MODE_FITTED : return psStringCopy ("FITTED" ); 1030 1027 case PM_SOURCE_MODE_FAIL : return psStringCopy ("FAIL" ); … … 1034 1031 case PM_SOURCE_MODE_SATSTAR : return psStringCopy ("SATSTAR" ); 1035 1032 case PM_SOURCE_MODE_BLEND : return psStringCopy ("BLEND" ); 1036 case PM_SOURCE_MODE_LINEAR : return psStringCopy ("LINEAR" );1037 case PM_SOURCE_MODE_TEMPSUB : return psStringCopy ("TEMPSUB" );1038 1033 case PM_SOURCE_MODE_EXTERNAL : return psStringCopy ("EXTERNAL" ); 1039 1034 case PM_SOURCE_MODE_BADPSF : return psStringCopy ("BADPSF" ); 1035 case PM_SOURCE_MODE_DEFECT : return psStringCopy ("DEFECT" ); 1036 case PM_SOURCE_MODE_SATURATED : return psStringCopy ("SATURATED" ); 1037 case PM_SOURCE_MODE_CRLIMIT : return psStringCopy ("CRLIMIT"); 1038 case PM_SOURCE_MODE_SUBTRACTED : return psStringCopy ("SUBTRACTED"); 1040 1039 default: 1041 1040 return NULL; -
trunk/psModules/src/objects/pmSource.h
r16066 r16819 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2008-0 1-15 02:48:28 $5 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-03-05 01:08:08 $ 7 7 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 8 8 */ … … 36 36 typedef enum { 37 37 PM_SOURCE_MODE_DEFAULT = 0x0000, ///< 38 PM_SOURCE_MODE_PSFMODEL = 0x0001, ///< 39 PM_SOURCE_MODE_EXTMODEL = 0x0002, ///< 40 PM_SOURCE_MODE_SUBTRACTED = 0x0004, ///< 41 PM_SOURCE_MODE_FITTED = 0x0008, ///< 42 PM_SOURCE_MODE_FAIL = 0x0010, ///< 43 PM_SOURCE_MODE_POOR = 0x0020, ///< 44 PM_SOURCE_MODE_PAIR = 0x0040, ///< 45 PM_SOURCE_MODE_PSFSTAR = 0x0080, ///< 46 PM_SOURCE_MODE_SATSTAR = 0x0100, ///< 47 PM_SOURCE_MODE_BLEND = 0x0200, ///< 48 PM_SOURCE_MODE_LINEAR = 0x0400, ///< 49 PM_SOURCE_MODE_TEMPSUB = 0x0800, ///< XXX get me a better name! 50 PM_SOURCE_MODE_EXTERNAL = 0x1000, ///< XXX get me a better name! 51 PM_SOURCE_MODE_BADPSF = 0x2000, ///< Failed to get good estimate of object's PSF 38 PM_SOURCE_MODE_PSFMODEL = 0x0001, ///< Source fitted with a psf model (linear or non-linear) 39 PM_SOURCE_MODE_EXTMODEL = 0x0002, ///< Source fitted with an extended-source model 40 PM_SOURCE_MODE_FITTED = 0x0004, ///< Source fitted with non-linear model (PSF or EXT; good or bad) 41 PM_SOURCE_MODE_FAIL = 0x0008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero) 42 PM_SOURCE_MODE_POOR = 0x0010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?) 43 PM_SOURCE_MODE_PAIR = 0x0020, ///< Source fitted with a double psf 44 PM_SOURCE_MODE_PSFSTAR = 0x0040, ///< Source used to define PSF model 45 PM_SOURCE_MODE_SATSTAR = 0x0080, ///< Source model peak is above saturation 46 PM_SOURCE_MODE_BLEND = 0x0100, ///< Source is a blend with other sourcers 47 PM_SOURCE_MODE_EXTERNAL = 0x0200, ///< Source based on supplied input position 48 PM_SOURCE_MODE_BADPSF = 0x0400, ///< Failed to get good estimate of object's PSF 49 PM_SOURCE_MODE_DEFECT = 0x0800, ///< Source is thought to be a defect 50 PM_SOURCE_MODE_SATURATED = 0x1000, ///< Source is thought to be saturation 51 PM_SOURCE_MODE_CRLIMIT = 0x2000, ///< Source has crNsigma above limit 52 PM_SOURCE_MODE_SUBTRACTED = 0x4000, ///< XXX this flag is actually only used internally (move) 52 53 } pmSourceMode; 53 54 … … 57 58 * simplest measurement of a source is the location and flux of the peak pixel 58 59 * associated with the source: 60 * 61 * XXX do I have to re-organize this (again!) to allow an arbitrary set of extended model fits?? 59 62 * 60 63 */ -
trunk/psModules/src/objects/pmSourceIO.c
r15562 r16819 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.5 3$ $Name: not supported by cvs2svn $6 * @date $Date: 200 7-11-10 01:09:20$5 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-03-05 01:08:08 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 254 254 char *dataname = NULL; 255 255 char *xsrcname = NULL; 256 char *xfitname = NULL; 256 257 char *headname = NULL; 257 258 … … 319 320 // if this is not TRUE, the output files only contain the psf measurements. 320 321 bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XSRC"); 322 bool XFIT_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XFIT"); 321 323 322 324 // define the EXTNAME values for the different data segments: … … 356 358 } 357 359 xsrcname = pmFPAfileNameFromRule (rule, file, view); 360 } 361 if (XFIT_OUTPUT) { 362 // EXTNAME for extended source data table 363 rule = psMetadataLookupStr(&status, menu, "CMF.XFIT"); 364 if (!rule) { 365 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XFIT in EXTNAME.RULES in camera.config"); 366 return false; 367 } 368 xfitname = pmFPAfileNameFromRule (rule, file, view); 358 369 } 359 370 } … … 405 416 psFree (exttype); 406 417 418 // if we request XSRC output, add the XSRC name to this header 419 if (xsrcname) { 420 psMetadataAddStr (outhead, PS_LIST_TAIL, "XSRCNAME", PS_META_REPLACE, "name of XSRC table extension", xsrcname); 421 } 422 if (xfitname) { 423 psMetadataAddStr (outhead, PS_LIST_TAIL, "XFITNAME", PS_META_REPLACE, "name of XFIT table extension", xfitname); 424 } 425 407 426 // XXX these are case-sensitive since the EXTYPE is case-sensitive 408 427 status = false; … … 416 435 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname, xsrcname); 417 436 } 437 if (xsrcname) { 438 if (!strcmp (exttype, "PS1_DEV_1")) { 439 status = pmSourcesWrite_PS1_DEV_1_XSRC (file->fits, sources, xsrcname); 440 } 441 } 442 if (xfitname) { 443 if (!strcmp (exttype, "PS1_DEV_1")) { 444 status = pmSourcesWrite_PS1_DEV_1_XFIT (file->fits, sources, xfitname); 445 } 446 } 418 447 if (!status) { 419 448 psError(PS_ERR_IO, false, "writing CMF data to %s with format %s\n", file->filename, exttype); -
trunk/psModules/src/objects/pmSourceIO.h
r15562 r16819 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-11-10 01:09:20$6 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-03-05 01:08:08 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 * … … 28 28 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname); 29 29 bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname); 30 bool pmSourcesWrite_PS1_DEV_1_XFIT (psFits *fits, psArray *sources, char *extname); 30 31 31 32 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config); -
trunk/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
r16294 r16819 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $6 * @date $Date: 2008-0 2-03 22:04:47$5 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-03-05 01:08:08 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 61 61 psF32 xPos, yPos; 62 62 psF32 xErr, yErr; 63 64 // if we request XSRC output, add the XSRC name to this header65 if (xsrcname) {66 psMetadataAddStr (tableHeader, PS_LIST_TAIL, "XSRCNAME", PS_META_REPLACE, "name of XSRC table extension", xsrcname);67 }68 63 69 64 // let's write these out in S/N order … … 155 150 psFree (table); 156 151 157 if (xsrcname) {158 pmSourcesWrite_PS1_DEV_1_XSRC (fits, sources, xsrcname);159 }160 161 152 return true; 162 153 } … … 284 275 // we write out all sources, regardless of quality. the source flags tell us the state 285 276 for (i = 0; i < sources->n; i++) { 286 // source->seq is set during the PSF output step, which must be called287 // XXX test here if seq is set?288 289 277 // skip source if it is not a ext sourc 290 278 // XXX we have two places that extended source parameters are measured: … … 305 293 if (source->extpars == NULL) continue; 306 294 295 // XXX I need to split the extended models from the extended aperture measurements 307 296 PAR = model->params->data.F32; 308 297 dPAR = model->dparams->data.F32; … … 312 301 yErr = dPAR[PM_PAR_YPOS]; 313 302 303 // XXX for the aperture values, I probably can / should just refer to the psf position and not write any of this 314 304 axes = pmPSF_ModelToAxes (PAR, 20.0); 315 305 … … 329 319 psMetadataAdd (row, PS_LIST_TAIL, "EXT_THETA", PS_DATA_F32, "EXT orientation angle", axes.theta); 330 320 331 // XXX at the moment, this will be a fixed size table, but perhaps have multiple output formats depending on what is measured?321 // XXX at the moment, this will be a fixed sized table, but perhaps have multiple output formats depending on what is measured? 332 322 333 323 // other values that I need to report: … … 401 391 return true; 402 392 } 393 394 bool pmSourcesWrite_PS1_DEV_1_XFIT (psFits *fits, psArray *sources, char *extname) 395 { 396 397 psArray *table; 398 psMetadata *row; 399 int i; 400 psF32 *PAR, *dPAR; 401 psEllipseAxes axes; 402 psF32 xPos, yPos; 403 psF32 xErr, yErr; 404 405 // create a header to hold the output data 406 psMetadata *outhead = psMetadataAlloc (); 407 408 // write the links to the image header 409 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "xsrc table extension", extname); 410 411 // let's write these out in S/N order 412 sources = psArraySort (sources, pmSourceSortBySN); 413 414 table = psArrayAllocEmpty (sources->n); 415 416 // we write out all sources, regardless of quality. the source flags tell us the state 417 for (i = 0; i < sources->n; i++) { 418 // skip source if it is not a ext sourc 419 // XXX we have two places that extended source parameters are measured: 420 // psphotExtendedSources, which measures the aperture-like parameters and (potentially) the psf-convolved extended source models, 421 // psphotFitEXT, which does the simple extended source model fit (not psf-convolved) 422 // should we require both? 423 424 pmSource *source = sources->data[i]; 425 426 // XXX need to have an array of model fits; loop over the array and write out all 427 // which we calculated 428 429 // choose the convolved EXT model, if available, otherwise the simple one 430 // XXX should not need to choose: write both out 431 pmModel *model = source->modelConv; 432 if (model == NULL) { 433 model = source->modelEXT; 434 } 435 if (model == NULL) continue; 436 437 PAR = model->params->data.F32; 438 dPAR = model->dparams->data.F32; 439 xPos = PAR[PM_PAR_XPOS]; 440 yPos = PAR[PM_PAR_YPOS]; 441 xErr = dPAR[PM_PAR_XPOS]; 442 yErr = dPAR[PM_PAR_YPOS]; 443 444 axes = pmPSF_ModelToAxes (PAR, 20.0); 445 446 row = psMetadataAlloc (); 447 // XXX we are not writing out the mode (flags) or the type (psf, ext, etc) 448 psMetadataAdd (row, PS_LIST_TAIL, "IPP_IDET", PS_DATA_U32, "IPP detection identifier index", source->seq); 449 psMetadataAdd (row, PS_LIST_TAIL, "X_EXT", PS_DATA_F32, "EXT model x coordinate", xPos); 450 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT", PS_DATA_F32, "EXT model y coordinate", yPos); 451 psMetadataAdd (row, PS_LIST_TAIL, "X_EXT_SIG", PS_DATA_F32, "Sigma in EXT x coordinate", xErr); 452 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG", PS_DATA_F32, "Sigma in EXT y coordinate", yErr); 453 psMetadataAdd (row, PS_LIST_TAIL, "EXT_INST_MAG", PS_DATA_F32, "EXT fit instrumental magnitude", source->extMag); 454 psMetadataAdd (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->errMag); 455 456 // XXX these should be major and minor, not 'x' and 'y' 457 psMetadataAdd (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ", PS_DATA_F32, "EXT width in x coordinate", axes.major); 458 psMetadataAdd (row, PS_LIST_TAIL, "EXT_WIDTH_MIN", PS_DATA_F32, "EXT width in y coordinate", axes.minor); 459 psMetadataAdd (row, PS_LIST_TAIL, "EXT_THETA", PS_DATA_F32, "EXT orientation angle", axes.theta); 460 461 // XXX other parameters which may be set. 462 // XXX flag / value to define the model 463 464 psArrayAdd (table, 100, row); 465 psFree (row); 466 } 467 468 if (table->n == 0) { 469 psFitsWriteBlank (fits, outhead, extname); 470 psFree (table); 471 return true; 472 } 473 474 psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname); 475 if (!psFitsWriteTable (fits, outhead, table, extname)) { 476 psError(PS_ERR_IO, false, "writing ext data %s\n", extname); 477 psFree(table); 478 return false; 479 } 480 psFree (table); 481 482 return true; 483 }
Note:
See TracChangeset
for help on using the changeset viewer.
