IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27657 for trunk/psModules


Ignore:
Timestamp:
Apr 11, 2010, 5:08:29 PM (16 years ago)
Author:
eugene
Message:

updates to support psphotStack

Location:
trunk/psModules
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

  • trunk/psModules/src/camera/pmFPAfile.c

    r27134 r27657  
    111111    file->save = false;
    112112
    113     file->index = fileNum++;
     113    file->fileIndex = fileNum++;
     114    file->fileID = 0;
    114115
    115116    file->imageId = 0;
     
    372373        // Number of the file in list
    373374        psString num = NULL;            // Number to use
    374         psStringAppend(&num, "%d", file->index);
     375        psStringAppend(&num, "%d", file->fileIndex);
    375376        psStringSubstitute(&newRule, num, "{FILE.INDEX}");
     377        psFree(num);
     378    }
     379
     380    if (strstr(newRule, "{FILE.ID}")) {
     381        // Number of the file in list
     382        psString num = NULL;            // Number to use
     383        psStringAppend(&num, "%03d", file->fileID);
     384        psStringSubstitute(&newRule, num, "{FILE.ID}");
    376385        psFree(num);
    377386    }
     
    638647    psFree(iter);
    639648
    640     psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unable to find instance %d of file %s", num, name);
     649    psLogMsg("psModules.camera", PS_LOG_MINUTIA, "Unable to find instance %d of file %s", num, name);
    641650    return NULL;
    642651}
  • trunk/psModules/src/camera/pmFPAfile.h

    r27134 r27657  
    111111    psString formatName;                // name of the camera format
    112112
    113     int index;                          // Index of file
     113    int fileIndex;                      // Index of file
     114    int fileID;                         // internal sequence number
    114115
    115116    psS64 imageId, sourceId;            // Image and source identifiers
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r27417 r27657  
    12711271    file->name = psStringCopy (name);
    12721272
     1273    // free a previously existing readout
     1274    psFree(file->readout);
    12731275    file->readout = readout;
    1274     psMetadataAddPtr(files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file);
     1276
     1277    // allow for multiple entries
     1278    // XXX handle replace vs multiple?
     1279    psMetadataAddPtr(files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", file);
    12751280    psFree(file);
    12761281    // we free this copy of file, but 'files' still has a copy
     
    13131318                                const char *name, // name of internal/external file
    13141319                                const pmFPA *fpa, // use this fpa to generate
    1315                                 const psImageBinning *binning) {
     1320                                const psImageBinning *binning,
     1321                                int index) {
    13161322  pmReadout *readout = NULL;
    13171323
    1318   bool status = true;
    1319   pmFPAfile *file = psMetadataLookupPtr(&status, config->files, name);
     1324  pmFPAfile *file = pmFPAfileSelectSingle(config->files, name, index);
    13201325
    13211326  // if the file does not exist, it is not being used as an I/O file: define an internal version
    13221327  if (file == NULL) {
    1323     readout = pmFPAfileDefineInternal (config->files, name, binning->nXruff, binning->nYruff, PS_TYPE_F32);
    1324     return readout;
     1328      // XXX currently, we do not guarantee that the defined file lands on entry 'index'
     1329      psAssert (binning, "internal files must be supplied a psImageBinning for the output images size");
     1330      readout = pmFPAfileDefineInternal (config->files, name, binning->nXruff, binning->nYruff, PS_TYPE_F32);
     1331      return readout;
    13251332  }
    13261333
  • trunk/psModules/src/camera/pmFPAfileDefine.h

    r23354 r27657  
    172172                                const char *name, // name of internal/external file
    173173                                const pmFPA *fpa, // use this fpa to generate
    174                                 const psImageBinning *binning);
     174                                const psImageBinning *binning,
     175                                int index
     176    );
    175177
    176178/// @}
  • trunk/psModules/src/objects/Makefile.am

    r27531 r27657  
    2020        pmModelUtils.c \
    2121        pmSource.c \
     22        pmPhotObj.c \
    2223        pmSourceMasks.c \
    2324        pmSourceMoments.c \
     
    8081        pmModelUtils.h \
    8182        pmSource.h \
     83        pmPhotObj.h \
    8284        pmSourceMasks.h \
    8385        pmSourceDiffStats.h \
  • trunk/psModules/src/objects/pmPeaks.h

    r20945 r27657  
    6363    bool assigned;                      ///< is peak assigned to a source?
    6464    pmPeakType type;                    ///< Description of peak.
    65     pmFootprint *footprint;     ///< reference to containing footprint
     65    pmFootprint *footprint;             ///< reference to containing footprint
    6666}
    6767pmPeak;
  • trunk/psModules/src/objects/pmPhotObj.c

    r26893 r27657  
    1717#include <pslib.h>
    1818#include "pmPhotObj.h"
     19#include "pmSource.h"
    1920
    2021static void pmPhotObjFree (pmPhotObj *tmp)
     
    3839}
    3940
     41bool pmPhotObjAddSource(pmPhotObj *object, pmSource *source) {
     42
     43    psAssert (source, "programming error: NULL source");
     44    if (!source->peak) {
     45        psError(PS_ERR_UNKNOWN, true, "source missing peak");
     46        return false;
     47    }
     48    if (!finite(source->peak->xf)) {
     49        psError(PS_ERR_UNKNOWN, true, "NAN peak coordinate");
     50        return false;
     51    }
     52    if (!finite(source->peak->yf)) {
     53        psError(PS_ERR_UNKNOWN, true, "NAN peak coordinate");
     54        return false;
     55    }
     56
     57    // XXX we should probably use the fitted position if it exists
     58    if (!object->sources) {
     59        object->sources = psArrayAllocEmpty(1);
     60        object->x = source->peak->xf;
     61        object->y = source->peak->yf;
     62    }
     63    psArrayAdd (object->sources, 1, source);
     64    return true;
     65}
  • trunk/psModules/src/objects/pmPhotObj.h

    r26893 r27657  
    3434 */
    3535typedef struct {
    36   int seq;                            ///< ID for output (generated on write OR set on read)
    37   psArray *sources;
     36    int id;                            ///< ID for output (generated on write OR set on read)
     37    psArray *sources;
     38    int flags;
     39    float x;
     40    float y;
    3841} pmPhotObj;
     42
     43bool pmPhotObjAddSource(pmPhotObj *object, pmSource *source);
     44pmPhotObj *pmPhotObjAlloc(void);
    3945
    4046/// @}
    4147# endif /* PM_PHOT_OBJ_H */
     48
  • trunk/psModules/src/objects/pmSource.c

    r27531 r27657  
    180180    source->type = in->type;
    181181    source->mode = in->mode;
     182    source->imageID = in->imageID;
    182183
    183184    return(source);
     
    10581059    psF32 fA = (A->peak == NULL) ? 0 : A->peak->y;
    10591060    psF32 fB = (B->peak == NULL) ? 0 : B->peak->y;
     1061
     1062    psF32 diff = fA - fB;
     1063    if (diff > FLT_EPSILON) return (+1);
     1064    if (diff < FLT_EPSILON) return (-1);
     1065    return (0);
     1066}
     1067
     1068// sort by X (ascending)
     1069int pmSourceSortByX (const void **a, const void **b)
     1070{
     1071    pmSource *A = *(pmSource **)a;
     1072    pmSource *B = *(pmSource **)b;
     1073
     1074    psF32 fA = (A->peak == NULL) ? 0 : A->peak->x;
     1075    psF32 fB = (B->peak == NULL) ? 0 : B->peak->x;
    10601076
    10611077    psF32 diff = fA - fB;
  • trunk/psModules/src/objects/pmSource.h

    r27531 r27657  
    4343    PM_SOURCE_TMPF_SIZE_MEASURED     = 0x0004,
    4444    PM_SOURCE_TMPF_SIZE_CR_CANDIDATE = 0x0008,
     45    PM_SOURCE_TMPF_MOMENTS_MEASURED  = 0x0010,
    4546} pmSourceTmpF;
    4647
     
    9091    pmSourceExtendedPars *extpars;      ///< extended source parameters
    9192    pmSourceDiffStats *diffStats;       ///< extra parameters for difference detections
     93    int imageID;
    9294};
    9395
     
    245247int  pmSourceSortBySN (const void **a, const void **b);
    246248int  pmSourceSortByY (const void **a, const void **b);
     249int  pmSourceSortByX (const void **a, const void **b);
    247250int  pmSourceSortBySeq (const void **a, const void **b);
    248251
  • trunk/psModules/src/psmodules.h

    r27531 r27657  
    124124#include <pmSourceMasks.h>
    125125#include <pmSource.h>
     126#include <pmPhotObj.h>
    126127#include <pmSourceUtils.h>
    127128#include <pmSourceIO.h>
Note: See TracChangeset for help on using the changeset viewer.