IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 29, 2007, 11:46:38 AM (19 years ago)
Author:
Paul Price
Message:

Used to have every concept being written to the header. Now just inherit the parent's sources for concepts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfigCamera.c

    r11370 r11375  
    88
    99
    10 // Update the sources of the concepts, so that they all come from the headers.
    11 static void updateConceptsSources(psList *concepts, // List of concepts
    12                                   psMetadata *translation, // Header concepts
    13                                   psMetadata *database, // Database concepts
    14                                   psMetadata *defaults, // Defaults concepts
    15                                   psMetadata *formats, // Concepts formats
    16                                   pmFPALevel level // Mosaic level
     10// Remove a concept from the list of sources.  Need to check to see if it exists first, to avoid a warning.
     11static void removeConcept(psMetadata *source, // Source from which to remove concept
     12                          const char *concept // Concept name to remove
     13                         )
     14{
     15    assert(source);
     16    assert(concept && strlen(concept) > 0);
     17
     18    if (psMetadataLookup(source, concept)) {
     19        psMetadataRemoveKey(source, concept);
     20    }
     21
     22    return;
     23}
     24
     25// Remove certain concepts from the list of sources.  These concepts are important in the mosaicking process,
     26// and are added explicitly to the defaults (elsewhere) so that the user can't get them wrong.
     27static void removeConceptsSources(psMetadata *source // Source for concepts
    1728                                 )
    1829{
    19     assert(concepts);
    20     assert(translation);
    21     assert(level == PM_FPA_LEVEL_CHIP || level == PM_FPA_LEVEL_FPA);
    22     return;
    23 
    24     psListIterator *iter = psListIteratorAlloc(concepts, PS_LIST_HEAD, false); // Iterator
    25     psString concept;                   // Concept, from iteration
    26     while ((concept = psListGetAndIncrement(iter))) {
    27         // skip concepts added explicitly
    28         if (!strcmp(concept, "CELL.BIASSEC"))
    29             goto skip;
    30         if (!strcmp(concept, "CELL.TRIMSEC"))
    31             goto skip;
    32         if (!strcmp(concept, "CELL.XPARITY"))
    33             goto skip;
    34         if (!strcmp(concept, "CELL.YPARITY"))
    35             goto skip;
    36         if (!strcmp(concept, "CELL.X0"))
    37             goto skip;
    38         if (!strcmp(concept, "CELL.Y0"))
    39             goto skip;
    40         if ((level == PM_FPA_LEVEL_FPA) && !strcmp(concept, "CHIP.XPARITY"))
    41             goto skip;
    42         if ((level == PM_FPA_LEVEL_FPA) && !strcmp(concept, "CHIP.YPARITY"))
    43             goto skip;
    44         if ((level == PM_FPA_LEVEL_FPA) && !strcmp(concept, "CHIP.X0"))
    45             goto skip;
    46         if ((level == PM_FPA_LEVEL_FPA) && !strcmp(concept, "CHIP.Y0"))
    47             goto skip;
    48         psMetadataAddStr(translation, PS_LIST_TAIL, concept, PS_META_REPLACE, NULL, concept);
    49 skip:
    50         if (database && psMetadataLookup(database, concept)) {
    51             psMetadataRemoveKey(database, concept);
    52         }
    53         if (defaults && psMetadataLookup(defaults, concept)) {
    54             psMetadataRemoveKey(defaults, concept);
    55         }
    56     }
    57     psFree(iter);
     30    if (!source) {
     31        return;
     32    }
     33
     34    removeConcept(source, "CELL.BIASSEC");
     35    removeConcept(source, "CELL.TRIMSEC");
     36    removeConcept(source, "CELL.XPARITY");
     37    removeConcept(source, "CELL.YPARITY");
     38    removeConcept(source, "CELL.X0");
     39    removeConcept(source, "CELL.Y0");
     40    removeConcept(source, "CHIP.XPARITY");
     41    removeConcept(source, "CHIP.YPARITY");
     42    removeConcept(source, "CHIP.X0");
     43    removeConcept(source, "CHIP.Y0");
    5844
    5945    return;
     
    281267        // Update the concepts, so that they are all stored in the FITS headers, under headers of the same
    282268        // name as the concept
    283         psMetadata *conceptsFormats = psMetadataLookupMetadata(&mdok, format, "FORMATS"); // Concepts FORMATS
    284269        psMetadata *database = psMetadataLookupMetadata(&mdok, format, "DATABASE"); // DATABASE concepts
    285270        psMetadata *defaults = psMetadataLookupMetadata(&mdok, format, "DEFAULTS"); // DEFAULTS concepts
     
    295280            continue;
    296281        }
    297         psList *concepts = pmConceptsList(PM_FPA_LEVEL_CELL); // List of concepts
    298         updateConceptsSources(concepts, translation, database, defaults, conceptsFormats, level);
    299         psFree(concepts);
    300         concepts = pmConceptsList(PM_FPA_LEVEL_CHIP);
    301         updateConceptsSources(concepts, translation, database, defaults, conceptsFormats, level);
    302         psFree(concepts);
    303         concepts = pmConceptsList(PM_FPA_LEVEL_FPA);
    304         updateConceptsSources(concepts, translation, database, defaults, conceptsFormats, level);
    305         psFree(concepts);
     282
     283        removeConceptsSources(translation);
     284        removeConceptsSources(database);
     285        removeConceptsSources(defaults);
    306286
    307287        // Add in the positioning concepts
    308         psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.XPARITY", PS_META_REPLACE, NULL, 1);
    309         psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.YPARITY", PS_META_REPLACE, NULL, 1);
    310         psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, NULL, 1);
    311         psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, NULL, 1);
    312         psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.X0",      PS_META_REPLACE, NULL, 0);
    313         psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.Y0",      PS_META_REPLACE, NULL, 0);
     288        psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.XPARITY", 0, NULL, 1);
     289        psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.YPARITY", 0, NULL, 1);
     290        psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.XPARITY", 0, NULL, 1);
     291        psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.YPARITY", 0, NULL, 1);
     292        psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.X0",      0, NULL, 0);
     293        psMetadataAddS32(defaults, PS_LIST_TAIL, "CELL.Y0",      0, NULL, 0);
    314294        if (formats) {
    315295            if (psMetadataLookup(formats, "CELL.X0")) {
     
    322302
    323303        if (level == PM_FPA_LEVEL_FPA) {
    324             psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.X0", PS_META_REPLACE, NULL, 0);
    325             psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.Y0", PS_META_REPLACE, NULL, 0);
     304            psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.X0", 0, NULL, 0);
     305            psMetadataAddS32(defaults, PS_LIST_TAIL, "CHIP.Y0", 0, NULL, 0);
    326306            if (formats) {
    327307                if (psMetadataLookup(formats, "CHIP.X0")) {
Note: See TracChangeset for help on using the changeset viewer.