IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 12, 2007, 12:22:15 PM (19 years ago)
Author:
Paul Price
Message:

Adding fix to bug 853: when CELL.BIASSEC or CELL.TRIMSEC are specified by value in the CELLS part of the camera format, then they need to be updated by the binning. Added pmConceptsUpdate, which is run after concepts are read, and seaches for concepts to update (e.g., dependent on other concepts, which may not be available at read time --- just like CELL.TRIMSEC and CELL.XBIN/CELL.YBIN). To use this, changed the functions that parse/format standard concepts to receive the source of the concept. CELL.TRIMSEC and CELL.BIASSEC are updated for the binning if CELL.TRIMSEC.UPDATE or CELL.BIASSEC.UPDATE are set. Tested this quickly, and it seems to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsWrite.c

    r11257 r11749  
    106106static psMetadataItem *conceptFormat(const pmConceptSpec *spec, // The concept specification
    107107                                     const psMetadataItem *concept, // The concept to parse
     108                                     pmConceptSource source, // The concept source
    108109                                     const psMetadata *cameraFormat, // The camera format
    109110                                     const pmFPA *fpa, // The FPA
     
    118119        psMetadataItem *formatted = NULL;  // The formatted concept
    119120        if (spec->format) {
    120             formatted = spec->format(concept, cameraFormat, fpa, chip, cell);
     121            formatted = spec->format(concept, source, cameraFormat, fpa, chip, cell);
    121122        } else if (strcmp(concept->name, spec->blank->name) != 0) {
    122123            // Adjust so that the name is correct
     
    251252            // Grab the concept
    252253            psMetadataItem *conceptItem = psMetadataLookup(concepts, name); // The concept
    253             // Formatted version
    254             psMetadataItem *formatted = conceptFormat(spec, conceptItem, cameraFormat, NULL, NULL, cell);
    255             if (!formatted) {
    256                 continue;
    257             }
     254
    258255            psString nameSource = NULL; // String with the concept name and ".SOURCE" added
    259256            psStringAppend(&nameSource, "%s.SOURCE", name);
     
    268265                        continue;
    269266                    }
     267
     268                    // Formatted version
     269                    psMetadataItem *formatted = conceptFormat(spec, conceptItem, PM_CONCEPT_SOURCE_HEADER,
     270                                                              cameraFormat, NULL, NULL, cell);
     271                    if (!formatted) {
     272                        continue;
     273                    }
     274
    270275                    psTrace("psModules.concepts", 8, "Writing %s to header %s\n", name, cameraItem->data.str);
    271276                    writeHeader(hdu, cameraItem->data.V, formatted);
     277                    psFree(formatted);
    272278                } else if (strcasecmp(source, "VALUE") == 0) {
     279                    // Formatted version
     280                    psMetadataItem *formatted = conceptFormat(spec, conceptItem, PM_CONCEPT_SOURCE_CELLS,
     281                                                              cameraFormat, NULL, NULL, cell);
     282                    if (!formatted) {
     283                        continue;
     284                    }
     285
    273286                    psTrace("psModules.concepts", 8, "Checking %s against camera format.\n", name);
    274287                    if (! compareConcepts(formatted, cameraItem)) {
     
    276289                                 "format, but the values don't match.\n", name);
    277290                    }
     291                    psFree(formatted);
    278292                } else {
    279293                    psLogMsg(__func__, PS_LOG_WARN, "Concept source %s isn't HEADER or VALUE --- can't "
    280294                             "write\n", nameSource);
    281295                }
    282             } else if (! compareConcepts(formatted, cameraItem)) {
     296            } else {
    283297                // Assume it's specified by value
    284                 psLogMsg(__func__, PS_LOG_WARN, "Concept %s is specified by value in the camera "
    285                          "format, but the values don't match.\n", name);
    286             }
    287             psFree(formatted);
     298                psMetadataItem *formatted = conceptFormat(spec, conceptItem, PM_CONCEPT_SOURCE_CELLS,
     299                                                          cameraFormat, NULL, NULL, cell);
     300                if (!formatted) {
     301                    continue;
     302                }
     303
     304                if (! compareConcepts(formatted, cameraItem)) {
     305                    psLogMsg(__func__, PS_LOG_WARN, "Concept %s is specified by value in the camera "
     306                             "format, but the values don't match.\n", name);
     307                }
     308                psFree(formatted);
     309            }
    288310            psFree(nameSource);
    289311        }
     
    346368            }
    347369            conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
    348             psMetadataItem *formatted = conceptFormat(spec, conceptItem, cameraFormat, fpa, chip, cell);
     370            psMetadataItem *formatted = conceptFormat(spec, conceptItem, PM_CONCEPT_SOURCE_DEFAULTS,
     371                                                      cameraFormat, fpa, chip, cell);
    349372            if (!formatted) {
    350373                continue;
     
    394417            psTrace("psModules.concepts", 3, "Writing %s to header %s\n", name, headerItem->data.str);
    395418            psMetadataItem *conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
    396             psMetadataItem *formatted = conceptFormat(spec, conceptItem, cameraFormat, fpa, chip, cell);
     419            psMetadataItem *formatted = conceptFormat(spec, conceptItem, PM_CONCEPT_SOURCE_HEADER,
     420                                                      cameraFormat, fpa, chip, cell);
    397421            if (!formatted) {
    398422                continue;
     
    446470
    447471            psMetadataItem *conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
    448             psMetadataItem *formatted = conceptFormat(spec, conceptItem, cameraFormat, fpa, chip, cell);
     472            psMetadataItem *formatted = conceptFormat(spec, conceptItem, PM_CONCEPT_SOURCE_DATABASE,
     473                                                      cameraFormat, fpa, chip, cell);
    449474            if (!formatted) {
    450475                continue;
Note: See TracChangeset for help on using the changeset viewer.