IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10512


Ignore:
Timestamp:
Dec 6, 2006, 2:46:09 PM (19 years ago)
Author:
Paul Price
Message:

Additions to ensure concepts/headers are propagated

Location:
trunk/psModules/src/camera
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPACopy.c

    r9589 r10512  
    333333    // Update the concepts
    334334    psMetadataCopy(target->concepts, source->concepts);
     335    psMetadataCopy(target->parent->concepts, source->parent->concepts);
    335336
    336337    target->data_exists = true;
  • trunk/psModules/src/camera/pmFPAMosaic.c

    r9945 r10512  
    10331033    // Currently, there's nothing interesting in the chip concepts that needs to be updated.
    10341034
     1035    // Copy the concepts for the target FPA
     1036    target->parent->concepts = psMetadataCopy(target->parent->concepts, source->parent->concepts);
     1037
    10351038    // Now make a new readout to go in the target cell
    10361039    pmReadout *newReadout = pmReadoutAlloc(targetCell); // New readout
  • trunk/psModules/src/camera/pmFPAWrite.c

    r10081 r10512  
    2929// File-static (private) functions
    3030//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     31
     32
     33// Update the FPA.NAME, CHIP.NAME and CELL.NAME in the FITS header, if required
     34static bool updateNames(pmFPA *fpa, pmChip *chip, pmCell *cell)
     35{
     36    pmHDU *hdu = pmHDUGetHighest(fpa, chip, cell); // Highest HDU, i.e., the PHU
     37    if (!hdu) {
     38        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find HDU.\n");
     39        return false;
     40    }
     41    bool mdok;                          // Status of MD lookup
     42    psMetadata *fileData = psMetadataLookupMetadata(&mdok, hdu->format, "FILE"); // File information
     43    if (!mdok || !fileData) {
     44        psError(PS_ERR_UNKNOWN, true, "Unable to find FILE information in camera format.\n");
     45        return false;
     46    }
     47    if (fpa) {
     48        const char *fpaNameHdr = psMetadataLookupStr(&mdok, fileData, "FPA.NAME");
     49        if (mdok && fpaNameHdr && strlen(fpaNameHdr) > 0) {
     50            const char *fpaName = psMetadataLookupStr(NULL, fpa->concepts, "FPA.NAME");
     51            psMetadataAddStr(hdu->header, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName);
     52        }
     53    }
     54    if (chip) {
     55        const char *chipNameHdr = psMetadataLookupStr(&mdok, fileData, "CHIP.NAME");
     56        if (mdok && chipNameHdr && strlen(chipNameHdr) > 0) {
     57            const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
     58            psMetadataAddStr(hdu->header, PS_LIST_TAIL, chipNameHdr, PS_META_REPLACE, "Chip name", chipName);
     59        }
     60    }
     61    if (cell) {
     62        const char *cellNameHdr = psMetadataLookupStr(&mdok, fileData, "CELL.NAME");
     63        if (mdok && cellNameHdr && strlen(cellNameHdr) > 0) {
     64            const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME");
     65            psMetadataAddStr(hdu->header, PS_LIST_TAIL, cellNameHdr, PS_META_REPLACE, "Cell name", cellName);
     66        }
     67    }
     68    return true;
     69}
    3170
    3271// Return the appropriate image array for the given type
     
    66105    return false;
    67106}
    68 
    69107// Write a cell image/mask/weight
    70108static bool cellWrite(pmCell *cell,     // Cell to write
     
    99137
    100138    if (writeBlank || writeImage) {
     139        updateNames(cell->parent->parent, cell->parent, cell);
    101140        pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS |
    102141                                 PM_CONCEPT_SOURCE_DEFAULTS;
     
    147186
    148187        if (writeBlank || writeImage) {
     188            updateNames(chip->parent, chip, NULL);
    149189            pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS |
    150190                                     PM_CONCEPT_SOURCE_DEFAULTS;
     
    176216}
    177217
     218
    178219// Write an FPA image/mask/weight
    179220static bool fpaWrite(pmFPA *fpa,        // FPA to write
     
    208249
    209250        if (writeBlank || writeImage) {
     251            updateNames(fpa, NULL, NULL);
    210252            pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS |
    211253                                     PM_CONCEPT_SOURCE_DEFAULTS;
Note: See TracChangeset for help on using the changeset viewer.