IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16819


Ignore:
Timestamp:
Mar 4, 2008, 3:08:08 PM (18 years ago)
Author:
eugene
Message:

merge changes from eam_branch_20080225 (better flag definitions)

Location:
trunk/psModules/src/objects
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSource.c

    r16066 r16819  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-01-15 02:48:10 $
     8 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-03-05 01:08:08 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    513513        if (!source->moments) {
    514514            source->type = PM_SOURCE_TYPE_STAR;
    515             source->mode |= PM_SOURCE_MODE_DEFAULT;
    516515            Nstar++;
    517516            continue;
     
    542541        if (Nsatpix > 1) {
    543542            source->type = PM_SOURCE_TYPE_SATURATED;
    544             source->mode |= PM_SOURCE_MODE_DEFAULT;
     543            source->mode |= PM_SOURCE_MODE_SATURATED;
    545544            Nsat ++;
    546545            continue;
     
    553552        if ((sigX < 0.05) || (sigY < 0.05)) {
    554553            source->type = PM_SOURCE_TYPE_DEFECT;
    555             source->mode |= PM_SOURCE_MODE_DEFAULT;
     554            source->mode |= PM_SOURCE_MODE_DEFECT;
    556555            Ncr ++;
    557556            continue;
     
    561560        if ((sigX > (clump.X + 3*clump.dX)) || (sigY > (clump.Y + 3*clump.dY))) {
    562561            source->type = PM_SOURCE_TYPE_EXTENDED;
    563             source->mode |= PM_SOURCE_MODE_DEFAULT;
    564562            Next ++;
    565563            continue;
     
    584582        // random type of star
    585583        source->type = PM_SOURCE_TYPE_STAR;
    586         source->mode |= PM_SOURCE_MODE_DEFAULT;
    587584    }
    588585
     
    10061003  if (!strcasecmp (name, "PSFMODEL"  )) return PM_SOURCE_MODE_PSFMODEL;
    10071004  if (!strcasecmp (name, "EXTMODEL"  )) return PM_SOURCE_MODE_EXTMODEL;
    1008   if (!strcasecmp (name, "SUBTRACTED")) return PM_SOURCE_MODE_SUBTRACTED;
    10091005  if (!strcasecmp (name, "FITTED"    )) return PM_SOURCE_MODE_FITTED;
    10101006  if (!strcasecmp (name, "FAIL"      )) return PM_SOURCE_MODE_FAIL;
     
    10141010  if (!strcasecmp (name, "SATSTAR"   )) return PM_SOURCE_MODE_SATSTAR;
    10151011  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;
    10181012  if (!strcasecmp (name, "EXTERNAL"  )) return PM_SOURCE_MODE_EXTERNAL;
    10191013  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;
    10201018  return PM_SOURCE_MODE_DEFAULT;
    10211019}
     
    10261024    case PM_SOURCE_MODE_PSFMODEL   : return psStringCopy ("PSFMODEL"  );
    10271025    case PM_SOURCE_MODE_EXTMODEL   : return psStringCopy ("EXTMODEL"  );
    1028     case PM_SOURCE_MODE_SUBTRACTED : return psStringCopy ("SUBTRACTED");
    10291026    case PM_SOURCE_MODE_FITTED     : return psStringCopy ("FITTED"    );
    10301027    case PM_SOURCE_MODE_FAIL       : return psStringCopy ("FAIL"      );
     
    10341031    case PM_SOURCE_MODE_SATSTAR    : return psStringCopy ("SATSTAR"   );
    10351032    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"   );
    10381033    case PM_SOURCE_MODE_EXTERNAL   : return psStringCopy ("EXTERNAL"  );
    10391034    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");
    10401039    default:
    10411040      return NULL;
  • trunk/psModules/src/objects/pmSource.h

    r16066 r16819  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2008-01-15 02:48:28 $
     5 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2008-03-05 01:08:08 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    3636typedef enum {
    3737    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)
    5253} pmSourceMode;
    5354
     
    5758 *  simplest measurement of a source is the location and flux of the peak pixel
    5859 *  associated with the source:
     60 *
     61 *  XXX do I have to re-organize this (again!) to allow an arbitrary set of extended model fits??
    5962 *
    6063 */
  • trunk/psModules/src/objects/pmSourceIO.c

    r15562 r16819  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-11-10 01:09:20 $
     5 *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-03-05 01:08:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    254254    char *dataname = NULL;
    255255    char *xsrcname = NULL;
     256    char *xfitname = NULL;
    256257    char *headname = NULL;
    257258
     
    319320        // if this is not TRUE, the output files only contain the psf measurements.
    320321        bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XSRC");
     322        bool XFIT_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XFIT");
    321323
    322324        // define the EXTNAME values for the different data segments:
     
    356358              }
    357359              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);
    358369            }
    359370        }
     
    405416            psFree (exttype);
    406417
     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
    407426            // XXX these are case-sensitive since the EXTYPE is case-sensitive
    408427            status = false;
     
    416435                status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname, xsrcname);
    417436            }
     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            }
    418447            if (!status) {
    419448                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  
    44 * @author EAM, IfA; GLG, MHPCC
    55 *
    6  * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-11-10 01:09:20 $
     6 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2008-03-05 01:08:08 $
    88 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    99 *
     
    2828bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname);
    2929bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname);
     30bool pmSourcesWrite_PS1_DEV_1_XFIT (psFits *fits, psArray *sources, char *extname);
    3031
    3132bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
  • trunk/psModules/src/objects/pmSourceIO_PS1_DEV_1.c

    r16294 r16819  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-02-03 22:04:47 $
     5 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-03-05 01:08:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6161    psF32 xPos, yPos;
    6262    psF32 xErr, yErr;
    63 
    64     // if we request XSRC output, add the XSRC name to this header
    65     if (xsrcname) {
    66       psMetadataAddStr (tableHeader, PS_LIST_TAIL, "XSRCNAME", PS_META_REPLACE, "name of XSRC table extension", xsrcname);
    67     }
    6863
    6964    // let's write these out in S/N order
     
    155150    psFree (table);
    156151
    157     if (xsrcname) {
    158       pmSourcesWrite_PS1_DEV_1_XSRC (fits, sources, xsrcname);
    159     }
    160 
    161152    return true;
    162153}
     
    284275    // we write out all sources, regardless of quality.  the source flags tell us the state
    285276    for (i = 0; i < sources->n; i++) {
    286         // source->seq is set during the PSF output step, which must be called
    287         // XXX test here if seq is set?
    288 
    289277        // skip source if it is not a ext sourc
    290278        // XXX we have two places that extended source parameters are measured:
     
    305293        if (source->extpars == NULL) continue;
    306294
     295        // XXX I need to split the extended models from the extended aperture measurements
    307296        PAR = model->params->data.F32;
    308297        dPAR = model->dparams->data.F32;
     
    312301        yErr = dPAR[PM_PAR_YPOS];
    313302
     303        // XXX for the aperture values, I probably can / should just refer to the psf position and not write any of this
    314304        axes = pmPSF_ModelToAxes (PAR, 20.0);
    315305
     
    329319        psMetadataAdd (row, PS_LIST_TAIL, "EXT_THETA",        PS_DATA_F32, "EXT orientation angle",                      axes.theta);
    330320
    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?
    332322
    333323        // other values that I need to report:
     
    401391    return true;
    402392}
     393
     394bool 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.