IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2015, 12:36:49 PM (11 years ago)
Author:
bills
Message:

Code to implement update mode in psphotStack

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotStackParseCamera.c

    r37608 r38384  
    1818    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    1919    bool savePSF = psMetadataLookupBool(&status, recipe, "SAVE.PSF");
     20    // XXX: bills: I don't think psphotStack will work if SAVE.BACKMDL is false
    2021    bool saveBackgroundModel = psMetadataLookupBool(&status, recipe, "SAVE.BACKMDL");
    2122    bool saveBackground = psMetadataLookupBool(&status, recipe, "SAVE.BACKGND");
     
    2627    bool saveChisq = psMetadataLookupBool(&status, recipe, "SAVE.CHISQ");
    2728    bool useRaw = psMetadataLookupBool(&status, recipe, "PSPHOT.STACK.USE.RAW");
     29
     30    bool updateMode = psMetadataLookupBool(&status, config->arguments, "PSPHOT.STACK.UPDATEMODE");
     31    if (updateMode) {
     32        // Tell the sources reader to save a copy of the header from the input sources file on
     33        // readout->analysis so that we can copy some metadata from measurements that are skipped
     34        // in update mode from there to the analysis structure.
     35        psMetadataAddBool(recipe, PS_LIST_TAIL, "SAVE.INPUT.SOURCES.HEADER", PS_META_REPLACE, "", true);
     36    }
    2837
    2938
     
    6574                }
    6675            }
    67             psString psf = psMetadataLookupStr(&status, input, "RAW:PSF"); // Name of mask
     76            psString psf = psMetadataLookupStr(&status, input, "RAW:PSF"); // Name of psf
    6877            if (psf && strlen(psf) > 0) {
    69                 if (!defineFile(config, rawInputFile, "PSPHOT.STACK.PSF.RAW", psf, PM_FPA_FILE_PSF)) {
     78                // if (!defineFile(config, rawInputFile, "PSPHOT.STACK.PSF.RAW", psf, PM_FPA_FILE_PSF)) {
     79                if (!defineFile(config, rawInputFile, "PSPHOT.PSF.LOAD", psf, PM_FPA_FILE_PSF)) {
    7080                    psError(PS_ERR_UNKNOWN, false, "Unable to define file from psf %d (%s)", i, psf);
     81                    return false;
     82                }
     83            }
     84            psString backmdl = psMetadataLookupStr(&status, input, "RAW:BACKMDL"); // Name of background model
     85            if (backmdl && strlen(backmdl) > 0) {
     86                if (!defineFile(config, NULL, "PSPHOT.STACK.BACKMDL.RAW", backmdl, PM_FPA_FILE_IMAGE)) {
     87                    psError(PS_ERR_UNKNOWN, false, "Unable to define file from backmdl %d (%s)", i, backmdl);
    7188                    return false;
    7289                }
     
    144161        }
    145162
    146         psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of mask
    147         if (sources && strlen(sources) > 0) {
    148             if (!defineFile(config, NULL, "PSPHOT.STACK.SOURCES", sources, PM_FPA_FILE_CMF)) {
    149                 psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)", i, sources);
    150                 return false;
    151             }
    152         }
     163        psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of sources
     164        if (sources && strlen(sources) > 0) {
     165            // input sources are not bound to fpa.
     166            // XXX: bills: I believe that they are only required in -updatemode now.
     167            if (!defineFile(config, NULL, "PSPHOT.STACK.SOURCES", sources, PM_FPA_FILE_CMF)) {
     168                psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)", i, sources);
     169                return false;
     170            }
     171        }
    153172
    154173        psS64 stack_id = psMetadataLookupS64(&status, input, "STACK_ID");
     
    207226                    return false;
    208227                }
    209                 output->save = true;
     228                // don't save psf in update mode?
     229                output->save = !updateMode;
    210230                output->fileID = stack_id;
    211231            }
     
    219239                }
    220240
    221                 output->save = true;
     241                // do not save the background model file when in update mode. We need to create the file above
     242                // but we don't need save it.
     243                output->save = !updateMode;
    222244                output->fileID = stack_id;
    223245            }
Note: See TracChangeset for help on using the changeset viewer.