IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27648


Ignore:
Timestamp:
Apr 9, 2010, 4:40:56 PM (16 years ago)
Author:
eugene
Message:

adding features to support psphotStack

Location:
branches/eam_branches/stackphot.20100406/psModules/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/stackphot.20100406/psModules/src/camera/pmFPAfile.c

    r27134 r27648  
    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}
  • branches/eam_branches/stackphot.20100406/psModules/src/camera/pmFPAfile.h

    r27134 r27648  
    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
  • branches/eam_branches/stackphot.20100406/psModules/src/camera/pmFPAfileDefine.c

    r27417 r27648  
    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
  • branches/eam_branches/stackphot.20100406/psModules/src/camera/pmFPAfileDefine.h

    r23354 r27648  
    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/// @}
  • branches/eam_branches/stackphot.20100406/psModules/src/objects/Makefile.am

    r27531 r27648  
    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 \
  • branches/eam_branches/stackphot.20100406/psModules/src/objects/pmPhotObj.c

    r26893 r27648  
    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}
  • branches/eam_branches/stackphot.20100406/psModules/src/objects/pmPhotObj.h

    r27626 r27648  
    3434 */
    3535typedef struct {
    36   int seq;                            ///< ID for output (generated on write OR set on read)
    37   psArray *sources;
    38   int flags;
     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;
    3941} pmPhotObj;
     42
     43bool pmPhotObjAddSource(pmPhotObj *object, pmSource *source);
     44pmPhotObj *pmPhotObjAlloc(void);
    4045
    4146/// @}
    4247# endif /* PM_PHOT_OBJ_H */
     48
  • branches/eam_branches/stackphot.20100406/psModules/src/objects/pmSource.c

    r27531 r27648  
    10651065}
    10661066
     1067// sort by X (ascending)
     1068int pmSourceSortByX (const void **a, const void **b)
     1069{
     1070    pmSource *A = *(pmSource **)a;
     1071    pmSource *B = *(pmSource **)b;
     1072
     1073    psF32 fA = (A->peak == NULL) ? 0 : A->peak->x;
     1074    psF32 fB = (B->peak == NULL) ? 0 : B->peak->x;
     1075
     1076    psF32 diff = fA - fB;
     1077    if (diff > FLT_EPSILON) return (+1);
     1078    if (diff < FLT_EPSILON) return (-1);
     1079    return (0);
     1080}
     1081
    10671082// sort by Seq (ascending)
    10681083int pmSourceSortBySeq (const void **a, const void **b)
  • branches/eam_branches/stackphot.20100406/psModules/src/objects/pmSource.h

    r27626 r27648  
    246246int  pmSourceSortBySN (const void **a, const void **b);
    247247int  pmSourceSortByY (const void **a, const void **b);
     248int  pmSourceSortByX (const void **a, const void **b);
    248249int  pmSourceSortBySeq (const void **a, const void **b);
    249250
  • branches/eam_branches/stackphot.20100406/psModules/src/psmodules.h

    r27531 r27648  
    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.