IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 13, 2007, 2:17:40 PM (19 years ago)
Author:
Paul Price
Message:

Adding option to output concepts for skycells in ordinary header keywords (as opposed to, e.g., 'HIERARCH FPA.AIRMASS'). This is necessary in order for DVO to read the photometry files generated from skycells.

File:
1 edited

Legend:

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

    r14461 r14475  
    2525// Generate the skycell version of a named camera configuration
    2626bool pmConfigCameraSkycellVersion(psMetadata *site, // The site configuration
    27                            const char *name // Name of the un-mosaicked camera
    28                            )
     27                                  const char *name // Name of the un-mosaicked camera
     28                                  )
    2929{
    3030    PS_ASSERT_METADATA_NON_NULL(site, false);
     
    3737        return false;
    3838    }
    39     if (!pmConfigGenerateSkycellVersion(cameras, cameras, name)) {
     39    if (!pmConfigGenerateSkycellVersion(cameras, cameras, name, site)) {
    4040        psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n", name);
    4141        return false;
     
    6161    while ((camerasItem = psMetadataGetAndIncrement(camerasIter))) {
    6262        assert(camerasItem->type == PS_DATA_METADATA); // Only metadata are allowed here!
    63         if (!pmConfigGenerateSkycellVersion(cameras, new, camerasItem->name)) {
     63        if (!pmConfigGenerateSkycellVersion(cameras, new, camerasItem->name, site)) {
    6464            psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n",
    6565                    camerasItem->name);
     
    8686const static char *skycellConceptsCell[] = { "CELL.BIASSEC", "CELL.TRIMSEC", "CELL.READDIR", "CELL.XPARITY",
    8787                                             "CELL.YPARITY", "CELL.XWINDOW", "CELL.YWINDOW", "CELL.X0",
    88                                              "CELL.Y0", "CELL.XSIZE", "CELL.YSIZE", 0 };
     88                                             "CELL.Y0", "CELL.XSIZE", "CELL.YSIZE", "CELL.EXPOSURE",
     89                                             "CELL.TIME", 0 };
    8990const static char *skycellConceptsChip[] = { "CHIP.XPARITY", "CHIP.YPARITY", "CHIP.XSIZE", "CHIP.YSIZE", 0 };
    90 
    91 // Do we update a particular concept?
     91const static char *skycellConceptsFPA[] = { "FPA.EXPOSURE", "FPA.TIME", 0 };
     92
     93// Do we update a particular concept for a skycell?
    9294static bool updateConcept(const char *name, // Name of concept
    9395                          const char **concepts // List of concepts NOT to update
    94     )
     96                          )
    9597{
    9698    for (int i = 0; concepts[i]; i++) {
     
    102104}
    103105
     106// What do we call the skycell concept in the FITS header?
     107static const char* skycellConceptName(const char *name, // Name of concept
     108                                      const psMetadata *site // Site configuration
     109                                      )
     110{
     111    if (!site) {
     112        return name;
     113    }
     114    bool mdok;                          // Status of MD lookup
     115    psMetadata *skycells = psMetadataLookupMetadata(&mdok, site, "SKYCELLS"); // Skycell concept headers
     116    if (!skycells) {
     117        return name;
     118    }
     119    const char *keyword = psMetadataLookupStr(&mdok, skycells, name); // Keyword to use for this concept
     120    if (!mdok || !keyword || strlen(keyword) == 0) {
     121        return name;
     122    }
     123    return keyword;
     124}
     125
     126
    104127// Generate a skycell version of a camera configuration
    105128bool pmConfigGenerateSkycellVersion(psMetadata *oldCameras, // Old list of camera configurations
    106129                                    psMetadata *newCameras, // New list of camera configurations
    107                                     const char *name // Name of original camera configuration
     130                                    const char *name, // Name of original camera configuration
     131                                    const psMetadata *site // Site configuration
    108132                                    )
    109133{
     
    201225        while ((name = psListGetAndIncrement(iter))) {
    202226            psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, name);
     227            if (updateConcept(name, skycellConceptsFPA)) {
     228                psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, skycellConceptName(name, site));
     229            }
    203230        }
    204231        psFree(iter);
     
    209236        while ((name = psListGetAndIncrement(iter))) {
    210237            if (updateConcept(name, skycellConceptsChip)) {
    211                 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, name);
     238                psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, skycellConceptName(name, site));
    212239            }
    213240        }
     
    219246        while ((name = psListGetAndIncrement(iter))) {
    220247            if (updateConcept(name, skycellConceptsCell)) {
    221                 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, name);
     248                psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, skycellConceptName(name, site));
    222249            }
    223250        }
Note: See TracChangeset for help on using the changeset viewer.