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/pmFPAConstruct.c

    r16912 r17911  
    11021102// It returns a view corresponding to the PHU
    11031103static pmFPAview *addSource(pmFPA *fpa,       // The FPA
    1104                             const char *fpaname, // The desired FPA name
     1104                            const char *fpaObs, // The desired FPA observation name
    11051105                            const pmFPAview *phuView, // The view corresponding to the PHU, or NULL
    11061106                            const psMetadata *header, // The PHU header, or NULL
     
    11151115    bool mdok;                          // Status of MD lookup
    11161116
    1117     // If FPA.NAME is already defined, new name must match it; otherwise, warn the user that something
     1117    // If FPA.OBS is already defined, new name must match it; otherwise, warn the user that something
    11181118    // potentially bad is happening.
    1119     if (fpaname && install) {
    1120         const char *currentName = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.NAME"); // Current name
    1121         if (mdok && currentName && strlen(currentName) > 0 && strcmp(currentName, fpaname) != 0) {
    1122             psWarning("FPA.NAME for new source (%s) doesn't match FPA.NAME for current "
    1123                      "fpa (%s).\n", fpaname, currentName);
    1124         }
    1125         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.NAME", PS_META_REPLACE, "Name of FPA", fpaname);
    1126     } else if (!psMetadataLookup(fpa->concepts, "FPA.NAME")) {
    1127         // Make sure there is an FPA.NAME
    1128         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.NAME", 0, "Name of FPA", "UNKNOWN");
     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");
    11291130    }
    11301131
     
    13081309//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    13091310
    1310 pmFPA *pmFPAConstruct(const psMetadata *camera)
     1311pmFPA *pmFPAConstruct(const psMetadata *camera, const char *cameraName)
    13111312{
    13121313    PS_ASSERT_PTR_NON_NULL(camera, NULL);
    13131314
    1314     pmFPA *fpa = pmFPAAlloc(camera);    // The FPA to fill out
     1315    pmFPA *fpa = pmFPAAlloc(camera, cameraName);    // The FPA to fill out
    13151316
    13161317    bool mdok = true;                   // Status from MD lookups
     
    13491350}
    13501351
    1351 bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaname, const psMetadata *format)
     1352bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaObs, const psMetadata *format)
    13521353{
    13531354    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    13581359    pmFPAview *view = pmFPAviewAlloc(0);// View for current level
    13591360    if (phuLevel == PM_FPA_LEVEL_FPA) {
    1360         if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) {
     1361        if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
    13611362            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13621363            psFree(view);
     
    13671368        while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    13681369            if (phuLevel == PM_FPA_LEVEL_CHIP) {
    1369                 if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) {
     1370                if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
    13701371                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13711372                    psFree(view);
     
    13761377                while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    13771378                    if (phuLevel == PM_FPA_LEVEL_CELL) {
    1378                         if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) {
     1379                        if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
    13791380                            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13801381                            psFree(view);
     
    13911392}
    13921393
    1393 bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaname, const pmFPAview *phuView,
     1394bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaObs, const pmFPAview *phuView,
    13941395                            const psMetadata *format)
    13951396{
     
    13981399    PS_ASSERT_PTR_NON_NULL(format, false);
    13991400
    1400     pmFPAview *view = addSource(fpa, fpaname, phuView, NULL, format, true);
     1401    pmFPAview *view = addSource(fpa, fpaObs, phuView, NULL, format, true);
    14011402    bool status = (view != NULL);
    14021403    psFree(view);
     
    14181419
    14191420    // Check the name of the FPA
    1420     psString fpaname = phuNameFromHeader("FPA.NAME", fileInfo, phu); // New name for the FPA
    1421     if (!fpaname || strlen(fpaname) == 0) {
    1422         psWarning("Unable to determine FPA.NAME: check for FPA.NAME in FILE in camera format");
    1423     }
    1424 
    1425     pmFPAview *view = addSource(fpa, fpaname, NULL, phu, format, true); // View of PHU, to return
    1426     psFree(fpaname);
     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);
    14271428
    14281429    return view;
Note: See TracChangeset for help on using the changeset viewer.