IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2008, 3:32:28 PM (18 years ago)
Author:
Paul Price
Message:

I've implemented the chip-dependent concepts. It uses a generalised version of the dependent DEFAULT concepts, which can, unfortunately, make the camera format configuration a bit longer, but it consolidates code and keeps things simple both for the code and the configuration.

In the process, I took care of a couple of other concept bugs that have been sitting in my inbox for nearly a year:

  • FPA.NAME has been replaced with FPA.OBS, which is intended to be an observation identifier (bug 885). You're welcome to change the name, so long as you also volunteer to fix all the camera formats.
  • FPA.CAMERA is automatically set (on construction of the FPA) to the camera name as used by the configuration files (bug 931). I've changed the ppStats REGISTER recipe to use FPA.CAMERA instead of FPA.INSTRUMENT (which is retained in the concepts as the instrument's name according to the instrument, whereas FPA.CAMERA is the instrument's name according to our configuration).
File:
1 edited

Legend:

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

    r17832 r17911  
    263263            }
    264264
    265             pmFPA *nameSource = file->src; // Source of FPA.NAME
     265            pmFPA *nameSource = file->src; // Source of FPA.OBS
    266266            if (!nameSource) {
    267267                nameSource = file->fpa;
    268268            }
    269269            bool mdok;                  // Status of MD lookup
    270             const char *fpaname = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.NAME"); // Name of FPA
    271 
    272             pmFPAAddSourceFromView(file->fpa, fpaname, view, format);
    273             psTrace ("psModules.camera", 5, "created fpa data elements for %s (%s) (%d:%d:%d)\n", file->name, file->name, view->chip, view->cell, view->readout);
     270            const char *fpaObs = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.OBS"); // Obs. id
     271
     272            pmFPAAddSourceFromView(file->fpa, fpaObs, view, format);
     273            psTrace ("psModules.camera", 5, "created fpa data elements for %s (%s) (%d:%d:%d)\n",
     274                     file->name, file->name, view->chip, view->cell, view->readout);
    274275            break;
    275276    }
     
    349350    // (existing) fpa
    350351    if (file->type == PM_FPA_FILE_CMF) {
    351         if (!pmFPAviewCheckDataStatusForSources (view, file)) {
     352        if (!pmFPAviewCheckDataStatusForSources (view, file)) {
    352353        psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name);
    353354        return true;
     
    778779        file->fits->options = psMemIncrRefCounter(file->options);
    779780
    780         // in most cases, we have already open and read the phu and determined the format.
    781         // in some cases, (eg DetDB images), we have only just determined the filename.
    782         // we need to check the file format before we can work with the file
    783         if (!file->format) {
    784           psMetadata *phu = psFitsReadHeader (NULL, file->fits);
    785           if (!phu) {
    786             psError(PS_ERR_IO, false, "Failed to read file header %s\n", file->filename);
    787             return false;
    788           }
    789 
    790           // determine the current format from the header
    791           // determine camera if not specified already
    792           file->format = pmConfigCameraFormatFromHeader (config, phu, true);
    793           if (!file->format) {
    794             psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", file->filename);
    795             psFree(phu);
    796             return false;
    797           }
    798           psFree(phu);
    799         }
    800 
    801         // if needed, set the optional EXTWORD field based on the camera value
    802         psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE");
    803         if (!fileMenu) {
    804           psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n",
    805                    config->formatName);
    806           return false;
    807         }
    808         char *extword = psMetadataLookupStr (&status, fileMenu, "EXTWORD");
    809         if (status) {
    810           psFitsSetExtnameWord (file->fits, extword);
    811         }
     781        // in most cases, we have already open and read the phu and determined the format.
     782        // in some cases, (eg DetDB images), we have only just determined the filename.
     783        // we need to check the file format before we can work with the file
     784        if (!file->format) {
     785          psMetadata *phu = psFitsReadHeader (NULL, file->fits);
     786          if (!phu) {
     787            psError(PS_ERR_IO, false, "Failed to read file header %s\n", file->filename);
     788            return false;
     789          }
     790
     791          // determine the current format from the header
     792          // determine camera if not specified already
     793          file->format = pmConfigCameraFormatFromHeader (config, phu, true);
     794          if (!file->format) {
     795            psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", file->filename);
     796            psFree(phu);
     797            return false;
     798          }
     799          psFree(phu);
     800        }
     801
     802        // if needed, set the optional EXTWORD field based on the camera value
     803        psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE");
     804        if (!fileMenu) {
     805          psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n",
     806                   config->formatName);
     807          return false;
     808        }
     809        char *extword = psMetadataLookupStr (&status, fileMenu, "EXTWORD");
     810        if (status) {
     811          psFitsSetExtnameWord (file->fits, extword);
     812        }
    812813
    813814        // XXX these are probably only needed for WRITE files
Note: See TracChangeset for help on using the changeset viewer.