IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 27, 2008, 12:05:30 PM (18 years ago)
Author:
Paul Price
Message:

Instead of being dependent upon a single list of sources, want to be able to use all the available information. So One common failure mode in the MOPS processing was that the source list didn't cover the entire skycell, so convolutions didn't succeed. Now we get a source list for each input image and merge these. Still retains (or at least, supposed to) the old way of inputting a single source list on the command line.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackCamera.c

    r17916 r18346  
    7272{
    7373    bool haveWeights = false;           // Do we have weight maps?
    74     bool havePSFs = false;               // Do we have PSFs?
     74    bool havePSFs = false;              // Do we have PSFs?
     75    bool haveSources = (bool)psMetadataLookup(config->arguments, "PPSTACK.SOURCES"); // Have global sources?
    7576
    7677    psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); // The inputs info
     
    99100        psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); // Name of weight map
    100101        psString psf = psMetadataLookupStr(&mdok, input, "PSF"); // Name of PSF
     102        psString sources = psMetadataLookupStr(&mdok, input, "SOURCES"); // Name of sources
    101103
    102104        float weighting = psMetadataLookupF32(&mdok, input, "WEIGHTING"); // Relative weighting
     
    198200        }
    199201
     202        // Add the sources file
     203        if (!haveSources) {
     204            if (!sources || strlen(sources) == 0) {
     205                if (havePSFs) {
     206                    psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find SOURCES %d", i);
     207                    return false;
     208                }
     209            } else {
     210                if (!havePSFs) {
     211                    psWarning("SOURCES provided without PSF --- ignoring.");
     212                } else {
     213                    psArray *sourcesFiles = psArrayAlloc(1); // Array of filenames for this FPA
     214                    sourcesFiles->data[0] = psMemIncrRefCounter(sources);
     215                    psMetadataAddArray(config->arguments, PS_LIST_TAIL, "SOURCES.FILENAMES", PS_META_REPLACE,
     216                                       "Filenames of SOURCES files", sourcesFiles);
     217                    psFree(sourcesFiles);
     218
     219                    bool status;
     220                    pmFPAfile *sourcesFile = pmFPAfileBindFromArgs(&status, imageFile, config,
     221                                                                   "PPSTACK.INPUT.SOURCES",
     222                                                                   "SOURCES.FILENAMES");
     223                    if (!status) {
     224                        psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)",
     225                                i, sources);
     226                        return false;
     227                    }
     228                    if (sourcesFile->type != PM_FPA_FILE_CMF) {
     229                        psError(PS_ERR_IO, true, "PPSTACK.INPUT.SOURCES is not of type CMF");
     230                        return false;
     231                    }
     232                }
     233            }
     234        }
     235
    200236#if 0
    201237        // Output convolved files
     
    238274        psMetadataRemoveKey(config->arguments, "PSF.FILENAMES");
    239275    }
     276    if (psMetadataLookup(config->arguments, "SOURCES.FILENAMES")) {
     277        psMetadataRemoveKey(config->arguments, "SOURCES.FILENAMES");
     278    }
     279
     280    if (haveSources) {
     281        // Global list of sources for use as stamps
     282        bool status = false;            // Found the file?
     283        if (havePSFs) {
     284            pmFPAfile *sources = pmFPAfileDefineFromArgs(&status, config, "PPSTACK.INPUT.SOURCES",
     285                                                         "PPSTACK.SOURCES");
     286            if (!status) {
     287                psError(PS_ERR_IO, false, "Failed to load file definition PPSTACK.INPUT.SOURCES");
     288                return false;
     289            }
     290            if (sources && sources->type != PM_FPA_FILE_CMF) {
     291                psError(PS_ERR_IO, true, "PPSTACK.SOURCES is not of type CMF");
     292                return false;
     293            }
     294        }
     295    }
    240296
    241297    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INPUTS.NUM", 0, "Number of input files", i);
    242298    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "HAVE.PSF", 0, "Have PSFs available?", havePSFs);
     299    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "HAVE.SOURCES", 0, "Have global sources?",
     300                      haveSources);
    243301
    244302    // Output image
     
    326384    }
    327385
    328     // Sources for use as stamps
    329     bool status = false;                // Found the file?
    330     if (havePSFs) {
    331         pmFPAfile *sources = pmFPAfileDefineFromArgs(&status, config, "PPSTACK.SOURCES", "PPSTACK.SOURCES");
    332         if (!status) {
    333             psError(PS_ERR_IO, false, "Failed to load file definition PPSTACK.SOURCES");
    334             return false;
    335         }
    336         if (sources && sources->type != PM_FPA_FILE_CMF) {
    337             psError(PS_ERR_IO, true, "PPSTACK.SOURCES is not of type CMF");
    338             return false;
    339         }
    340     }
    341 
    342386    return true;
    343387}
Note: See TracChangeset for help on using the changeset viewer.