IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 5, 2010, 9:42:25 PM (16 years ago)
Author:
eugene
Message:

psphotReadout* API modification to accept a filerule name; wrap lookup of filerule.NUM values in a function (missing = 1); drop deprecated psphotDetect and related; add function to cleanup input pmFPAfile; use psMetadataAddF32 instead of psMetadataAdd (... PS_DATA_F32); add psphotReadoutForcedKnownSources.c; add psphotAddKnownSources

Location:
trunk/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphotOutput.c

    r29902 r29936  
    11# include "psphotInternal.h"
     2
     3// convert filerule to filerule.NUM and look up in the config->arguments metadata
     4int psphotFileruleCount(const pmConfig *config, const char *filerule) {
     5
     6    bool status = false;
     7
     8    psString name = NULL;
     9    psStringAppend(&name, "%s.NUM", filerule);
     10    int num = psMetadataLookupS32 (&status, config->arguments, name);
     11    if (!status) {
     12      // we only explicitly define (filerule.NUM) if we have more than 1
     13      num = 1;
     14    }
     15    psFree (name);
     16    return num;
     17}
    218
    319pmReadout *psphotSelectBackground (pmConfig *config,
     
    6379    fclose (f);
    6480    return true;
    65 }
    66 
    67 // XXX replace this with a call to a pmConfig function (pmConfigDump...)
    68 bool psphotDumpConfig (pmConfig *config) {
    69 
    70   psMetadataConfigWrite (config->user, "user.md");
    71   psMetadataConfigWrite (config->camera, "camera.md");
    72   psMetadataConfigWrite (config->recipes, "recipes.md");
    73   psMetadataConfigWrite (config->arguments, "arguments.md");
    74   psMetadataConfigWrite (config->files, "files.md");
    75   return true;
    7681}
    7782
     
    126131}
    127132
     133bool psphotCleanInputsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     134bool psphotCleanInputs (pmConfig *config, const pmFPAview *view, const char *filerule) {
     135
     136    int num = psphotFileruleCount(config, filerule);
     137
     138    // loop over the available readouts
     139    for (int i = 0; i < num; i++) {
     140        if (!psphotCleanInputsReadout (config, view, filerule, i)) {
     141          psError (PSPHOT_ERR_CONFIG, false, "failed to clean inputs for %s entry %d", filerule, i);
     142            return false;
     143        }
     144    }
     145    return true;
     146}
     147
     148bool psphotCleanInputsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
     149
     150    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
     151    PS_ASSERT (file, false);
     152
     153    pmReadout  *readout = pmFPAviewThisReadout (view, file->fpa);
     154
     155    // XXX anything else to remove?
     156    if (psMetadataLookup(readout->analysis, "PSPHOT.DETECTIONS")) {
     157        psMetadataRemoveKey(readout->analysis, "PSPHOT.DETECTIONS");
     158    }
     159
     160    return true;
     161}
     162
    128163bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule) {
    129164
    130     bool status = false;
    131 
    132     int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
    133     psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     165    int num = psphotFileruleCount(config, filerule);
    134166
    135167    // loop over the available readouts
    136168    for (int i = 0; i < num; i++) {
    137169        if (!psphotAddPhotcodeReadout (config, view, filerule, i)) {
    138             psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to PSPHOT.INPUT entry %d", i);
     170          psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to %s entry %d", filerule, i);
    139171            return false;
    140172        }
     
    357389    // XXX need alternative output function
    358390    // psMetadata *psfData = pmPSFtoMetadata (NULL, try->psf);
    359     // psMetadataConfigWrite (psfData, "psfmodel.dat");
     391    // psMetadataConfigWrite (psfData, "psfmodel.dat", NULL);
    360392    psLogMsg ("psphot.choosePSF", PS_LOG_INFO, "wrote out psf-subtracted image, psf data, exiting\n");
    361393
Note: See TracChangeset for help on using the changeset viewer.