IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20269


Ignore:
Timestamp:
Oct 19, 2008, 1:53:16 PM (18 years ago)
Author:
eugene
Message:

do not overwrite results in header from earlier stages

Location:
trunk/psastro/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroChipAstrom.c

    r19514 r20269  
    44bool psastroChipAstrom (pmConfig *config) {
    55
     6    bool status;
    67    pmChip *chip = NULL;
    78    pmCell *cell = NULL;
     
    910
    1011    // select the current recipe
    11     psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSASTRO_RECIPE);
     12    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
    1213    if (!recipe) {
    1314        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe");
     
    1617
    1718    // select the input data sources
    18     pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     19    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT");
    1920    if (!input) {
    2021        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
     
    4344
    4445                // select the raw objects for this readout
    45                 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
     46                psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS");
    4647                if (rawstars == NULL) { continue; }
    4748
    4849                // select the raw objects for this readout
    49                 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");
     50                psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS");
    5051                if (refstars == NULL) { continue; }
    5152
     
    5960
    6061                // save WCS and analysis metadata in update header
    61                 psMetadata *updates = psMetadataAlloc();
     62                // (pull or create local view to entry on readout->analysis)
     63                psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER");
     64                if (!updates) {
     65                    updates = psMetadataAlloc ();
     66                    psMetadataAddMetadata (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
     67                    psFree (updates);
     68                }
    6269
    6370                // XXX update the header with info to reflect the failure
     
    6572                    readout->data_exists = false;
    6673                    psLogMsg ("psastro", 3, "failed to find a solution\n");
    67                     psFree (updates);
    6874                    continue;
    6975                }
     
    7278                    readout->data_exists = false;
    7379                    psLogMsg ("psastro", 3, "failed to find a solution\n");
    74                     psFree (updates);
    7580                    continue;
    7681                }
     
    8287
    8388                pmAstromWriteWCS (updates, fpa, chip, NONLIN_TOL);
    84                 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_DATA_METADATA, "psastro header stats", updates);
    85                 psFree (updates);
    8689
    8790                if (psTraceGetLevel("psastro.dump") > 0) {
    8891
    8992                    char *filename = NULL;
    90                     char *chipname = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME");
     93                    char *chipname = psMetadataLookupStr (&status, chip->concepts, "CHIP.NAME");
    9194
    9295                    psStringAppend (&filename, "rawstars.ch.%s.dat", chipname);
  • trunk/psastro/src/psastroMosaicAstrom.c

    r19518 r20269  
    6363
    6464    // save WCS and analysis metadata in update header.
    65     psMetadata *updates = psMetadataAlloc();
     65    // (pull or create local view to entry on readout->analysis)
     66    psMetadata *updates = psMetadataLookupMetadata (&status, fpa->analysis, "PSASTRO.HEADER");
     67    if (!updates) {
     68        updates = psMetadataAlloc ();
     69        psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
     70        psFree (updates);
     71    }
    6672    if (!pmAstromWriteBilevelMosaic (updates, fpa, NONLIN_TOL)) {
    6773        psAbort ("failed to save header terms");
     
    7076    // write the elapsed time here; this will be updated in psastroMosaicAstrometry, if called
    7177    psMetadataAddF32 (updates, PS_LIST_TAIL, "DT_ASTR", PS_META_REPLACE, "elapsed psastro time", psTimerMark ("psastroAnalysis"));
    72 
    73     psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
    74     psFree (updates);
    7578
    7679    // update the headers based on the results
  • trunk/psastro/src/psastroMosaicChipAstrom.c

    r17786 r20269  
    44bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, int iteration) {
    55
     6    bool status;
    67    pmChip *chip = NULL;
    78    pmCell *cell = NULL;
     
    2526
    2627                // save WCS and analysis metadata in update header
    27                 psMetadata *updates = psMetadataAlloc();
     28                // (pull or create local view to entry on readout->analysis)
     29                psMetadata *updates = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER");
     30                if (!updates) {
     31                    updates = psMetadataAlloc ();
     32                    psMetadataAddMetadata (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
     33                    psFree (updates);
     34                }
    2835
    2936                if (!psastroMosaicOneChip (chip, readout, recipe, updates, iteration)) {
     
    3138                    psError(PS_ERR_UNKNOWN, false, "failed to find a solution for %d,%d,%d\n",
    3239                            view->chip, view->cell, view->readout);
    33                     psFree(updates);
    3440                    psFree(view);
    3541                    return false;
     
    3844                // create the header keywords to descripe the results
    3945                pmAstromWriteBilevelChip (updates, chip, NONLIN_TOL);
    40                 psMetadataAddMetadata (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER",  PS_META_REPLACE, "psastro header stats", updates);
    41                 psFree (updates);
    4246            }
    4347        }
Note: See TracChangeset for help on using the changeset viewer.