IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27989 for trunk/psModules


Ignore:
Timestamp:
May 17, 2010, 5:49:51 PM (16 years ago)
Author:
Paul Price
Message:

Removing the 'FPA.OBS' concept (once called 'FPA.NAME'). The original idea was to provide a bit of protection against user error --- not reading a flat into an FPA containing an image, etc. However, that's not really necessary, and there's not always a nice keyword that we can use that is the exposure number or something like that, and so we end up with a lot of unneccessary warnings. Better to do away with it completely. It's not used for anything except that check.

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

Legend:

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

    r27762 r27989  
    100100
    101101    return num;
    102 }
    103 
    104 // Get the name of a PHU chip or cell from the header
    105 static psString phuNameFromHeader(const char *name, // The name to lookup: "CELL.NAME" or "CHIP.NAME"
    106                                   const psMetadata *fileInfo, // FILE within the camera format description
    107                                   const psMetadata *header // Primary header
    108                                  )
    109 {
    110     assert(name && strlen(name) > 0);
    111     assert(fileInfo);
    112     assert(header);
    113 
    114     bool mdok = true;                   // Result of MD lookup
    115     psString keyword = psMetadataLookupStr(&mdok, fileInfo, name);
    116     if (!mdok || strlen(keyword) == 0) {
    117         return false;
    118     }
    119     psMetadataItem *resultItem = psMetadataLookup(header, keyword);
    120     if (!resultItem) {
    121         psError(PS_ERR_IO, true, "Unable to find %s in primary header to identify %s.\n", keyword, name);
    122         return NULL;
    123     }
    124     return psMetadataItemParseString(resultItem);
    125102}
    126103
     
    11021079// It returns a view corresponding to the PHU
    11031080static pmFPAview *addSource(pmFPA *fpa,       // The FPA
    1104                             const char *fpaObs, // The desired FPA observation name
    11051081                            const pmFPAview *phuView, // The view corresponding to the PHU, or NULL
    11061082                            const psMetadata *header, // The PHU header, or NULL
     
    11141090
    11151091    bool mdok;                          // Status of MD lookup
    1116 
    1117     // If FPA.OBS is already defined, new name must match it; otherwise, warn the user that something
    1118     // potentially bad is happening.
    1119     if (fpaObs && install) {
    1120         const char *currentName = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.OBS"); // Current name
    1121         if (mdok && currentName && strlen(currentName) > 0 && strcmp(currentName, fpaObs) != 0) {
    1122             psWarning("FPA.OBS for new source (%s) doesn't match FPA.OBS for current fpa (%s).",
    1123                       fpaObs, currentName);
    1124         }
    1125         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.OBS", PS_META_REPLACE, "Observation identifier",
    1126                          fpaObs);
    1127     } else if (!psMetadataLookup(fpa->concepts, "FPA.OBS")) {
    1128         // Make sure there is an FPA.OBS
    1129         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.OBS", 0, "Observation identifier", "UNKNOWN");
    1130     }
    11311092
    11321093    psMetadata *fileInfo = psMetadataLookupMetadata(&mdok, format, "FILE"); // The file information
     
    13501311}
    13511312
    1352 bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaObs, const psMetadata *format)
     1313bool pmFPAAddSourceFromFormat(pmFPA *fpa, const psMetadata *format)
    13531314{
    13541315    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    13591320    pmFPAview *view = pmFPAviewAlloc(0);// View for current level
    13601321    if (phuLevel == PM_FPA_LEVEL_FPA) {
    1361         if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1322        if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13621323            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13631324            psFree(view);
     
    13681329        while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    13691330            if (phuLevel == PM_FPA_LEVEL_CHIP) {
    1370                 if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1331                if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13711332                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13721333                    psFree(view);
     
    13771338                while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    13781339                    if (phuLevel == PM_FPA_LEVEL_CELL) {
    1379                         if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1340                        if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13801341                            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13811342                            psFree(view);
     
    13921353}
    13931354
    1394 bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaObs, const pmFPAview *phuView,
     1355bool pmFPAAddSourceFromView(pmFPA *fpa, const pmFPAview *phuView,
    13951356                            const psMetadata *format)
    13961357{
     
    13991360    PS_ASSERT_PTR_NON_NULL(format, false);
    14001361
    1401     pmFPAview *view = addSource(fpa, fpaObs, phuView, NULL, format, true);
     1362    pmFPAview *view = addSource(fpa, phuView, NULL, format, true);
    14021363    bool status = (view != NULL);
    14031364    psFree(view);
     
    14181379    }
    14191380
    1420     // Check the name of the FPA
    1421     psString fpaObs = phuNameFromHeader("FPA.OBS", fileInfo, phu); // New observation name for the FPA
    1422     if (!fpaObs || strlen(fpaObs) == 0) {
    1423         psWarning("Unable to determine FPA.OBS: check for FPA.OBS in FILE in camera format");
    1424     }
    1425 
    1426     pmFPAview *view = addSource(fpa, fpaObs, NULL, phu, format, true); // View of PHU, to return
    1427     psFree(fpaObs);
     1381    pmFPAview *view = addSource(fpa, NULL, phu, format, true); // View of PHU, to return
    14281382
    14291383    return view;
     
    14371391    PS_ASSERT_PTR_NON_NULL(format, NULL);
    14381392
    1439     return addSource(fpa, NULL, NULL, phu, format, false);
     1393    return addSource(fpa, NULL, phu, format, false);
    14401394}
    14411395
  • trunk/psModules/src/camera/pmFPAConstruct.h

    r17911 r27989  
    2929/// This is suitable for generating an output FPA given the desired format.
    3030bool pmFPAAddSourceFromFormat(pmFPA *fpa, ///< The FPA
    31                               const char *fpaObs, ///< FPA.NAME for the source
    3231                              const psMetadata *format ///< Format of file
    3332    );
     
    3837/// configuration is required in order to describe how the FPA is laid out in terms of disk files.
    3938bool pmFPAAddSourceFromView(pmFPA *fpa,   ///< The FPA
    40                             const char *fpaObs, ///< FPA.NAME for the source
    4139                            const pmFPAview *phuView, ///< The view, corresponding to the PHU
    4240                            const psMetadata *format ///< Format of file
  • trunk/psModules/src/camera/pmFPAfileFitsIO.c

    r25878 r27989  
    7575    }
    7676
    77     pmFPA *nameSource = file->src; // Source of FPA.OBS
    78     if (!nameSource) {
    79         nameSource = file->fpa;
    80     }
    81     bool mdok;                  // Status of MD lookup
    82     const char *fpaObs = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.OBS"); // Observation id
    83 
    8477    pmFPA *copy = pmFPAConstruct(file->camera, file->cameraName);  // FPA to return
    85     if (!pmFPAAddSourceFromView(copy, fpaObs, phuView, file->format)) {
     78    if (!pmFPAAddSourceFromView(copy, phuView, file->format)) {
    8679        psError(PS_ERR_UNKNOWN, false, "Unable to insert HDU into FPA for writing.\n");
    8780        psFree(copy);
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r26893 r27989  
    286286            }
    287287
    288             pmFPA *nameSource = file->src; // Source of FPA.OBS
    289             if (!nameSource) {
    290                 nameSource = file->fpa;
    291             }
    292             bool mdok;                  // Status of MD lookup
    293             const char *fpaObs = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.OBS"); // Obs. id
    294 
    295             pmFPAAddSourceFromView(file->fpa, fpaObs, view, format);
     288            pmFPAAddSourceFromView(file->fpa, view, format);
    296289            psTrace ("psModules.camera", 5, "created fpa data elements for %s (%s) (%d:%d:%d)\n",
    297290                     file->name, file->name, view->chip, view->cell, view->readout);
Note: See TracChangeset for help on using the changeset viewer.