IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38384


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

Code to implement update mode in psphotStack

Location:
trunk/psphot/src
Files:
3 edited

Legend:

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

    r34282 r38384  
    3131    // these options override the PSPHOT recipe values loaded from recipe files
    3232    psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE);
     33
     34    bool updateMode = false;
     35    if ((N = psArgumentGet (argc, argv, "-updatemode"))) {
     36        psArgumentRemove (N, &argc, argv);
     37        updateMode = true;
     38    }
     39    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSPHOT.STACK.UPDATEMODE", 0, "update mode flag", updateMode);
    3340
    3441    // visual : interactive display mode
  • trunk/psphot/src/psphotStackImageLoop.c

    r36839 r38384  
    3030
    3131    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
     32    bool updateMode = psMetadataLookupBool(&status, config->arguments, "PSPHOT.STACK.UPDATEMODE");
    3233
    3334    // just load the full set of images up front except for EXPNUM which we defer
     
    6162
    6263                // XXX for now, we assume there is only a single chip in the PHU:
    63                 if (!psphotStackReadout (config, view)) {
    64                     psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
    65                     psFree (view);
    66                     return false;
    67                 }
     64                if (!updateMode) {
     65                    if (!psphotStackReadout (config, view)) {
     66                        psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
     67                        psFree (view);
     68                        return false;
     69                    }
     70                } else {
     71                    if (!psphotStackUpdateReadout (config, view)) {
     72                        psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
     73                        psFree (view);
     74                        return false;
     75                    }
     76                }
    6877
    6978                UpdateHeadersForReadout(config, view);
  • 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.