IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6895


Ignore:
Timestamp:
Apr 18, 2006, 2:54:44 PM (20 years ago)
Author:
Paul Price
Message:

Removing pmConceptLevel in favour of pmFPALevel

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

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmConcepts.c

    r6872 r6895  
    4141                       pmConceptParseFunc parse, // Function to call to parse the concept
    4242                       pmConceptFormatFunc format, // Function to call to format the concept
    43                        pmConceptLevel level // Level at which to store concept in the FPA hierarchy
     43                       pmFPALevel level // Level at which to store concept in the FPA hierarchy
    4444                      )
    4545{
     
    5252    psMetadata **target = NULL;         // The metadata of known concepts to write to
    5353    switch (level) {
    54     case PM_CONCEPT_LEVEL_FPA:
     54    case PM_FPA_LEVEL_FPA:
    5555        target = &conceptsFPA;
    5656        break;
    57     case PM_CONCEPT_LEVEL_CHIP:
     57    case PM_FPA_LEVEL_CHIP:
    5858        target = &conceptsChip;
    5959        break;
    60     case PM_CONCEPT_LEVEL_CELL:
     60    case PM_FPA_LEVEL_CELL:
    6161        target = &conceptsCell;
    6262        break;
    6363    default:
    64         psError(PS_ERR_IO, true, "Unknown concept level provided: %d\n", level);
     64        psError(PS_ERR_IO, true, "Invalid concept level provided: %d\n", level);
    6565        psFree(spec);
    6666        return false;
     
    285285        {
    286286            psMetadataItem *fpaName = psMetadataItemAllocStr("FPA.NAME", "Name of FPA", "");
    287             pmConceptRegister(fpaName, NULL, NULL, PM_CONCEPT_LEVEL_FPA);
     287            pmConceptRegister(fpaName, NULL, NULL, PM_FPA_LEVEL_FPA);
    288288            psFree(fpaName);
    289289        }
     
    293293        {
    294294            psMetadataItem *fpaAirmass = psMetadataItemAllocF32("FPA.AIRMASS", "Airmass at boresight", 0.0);
    295             pmConceptRegister(fpaAirmass, NULL, NULL, PM_CONCEPT_LEVEL_FPA);
     295            pmConceptRegister(fpaAirmass, NULL, NULL, PM_FPA_LEVEL_FPA);
    296296            psFree(fpaAirmass);
    297297        }
     
    300300        {
    301301            psMetadataItem *fpaFilter = psMetadataItemAllocStr("FPA.FILTER", "Filter used", "");
    302             pmConceptRegister(fpaFilter, NULL, NULL, PM_CONCEPT_LEVEL_FPA);
     302            pmConceptRegister(fpaFilter, NULL, NULL, PM_FPA_LEVEL_FPA);
    303303            psFree(fpaFilter);
    304304        }
     
    308308            psMetadataItem *fpaPosangle = psMetadataItemAllocF32("FPA.POSANGLE",
    309309                                          "Position angle of instrument", 0.0);
    310             pmConceptRegister(fpaPosangle, NULL, NULL, PM_CONCEPT_LEVEL_FPA);
     310            pmConceptRegister(fpaPosangle, NULL, NULL, PM_FPA_LEVEL_FPA);
    311311            psFree(fpaPosangle);
    312312        }
     
    316316            psMetadataItem *fpaRadecsys = psMetadataItemAllocStr("FPA.RADECSYS",
    317317                                          "Celestial coordinate system", "");
    318             pmConceptRegister(fpaRadecsys, NULL, NULL, PM_CONCEPT_LEVEL_FPA);
     318            pmConceptRegister(fpaRadecsys, NULL, NULL, PM_FPA_LEVEL_FPA);
    319319            psFree(fpaRadecsys);
    320320        }
     
    324324            psMetadataItem *fpaRa = psMetadataItemAllocF64("FPA.RA", "Right Ascension of boresight", NAN);
    325325            pmConceptRegister(fpaRa, (pmConceptParseFunc)pmConceptParse_FPA_Coords,
    326                               (pmConceptFormatFunc)pmConceptFormat_FPA_Coords, PM_CONCEPT_LEVEL_FPA);
     326                              (pmConceptFormatFunc)pmConceptFormat_FPA_Coords, PM_FPA_LEVEL_FPA);
    327327            psFree(fpaRa);
    328328        }
     
    332332            psMetadataItem *fpaDec = psMetadataItemAllocF64("FPA.DEC", "Declination of boresight", NAN);
    333333            pmConceptRegister(fpaDec, (pmConceptParseFunc)pmConceptParse_FPA_Coords,
    334                               (pmConceptFormatFunc)pmConceptFormat_FPA_Coords, PM_CONCEPT_LEVEL_FPA);
     334                              (pmConceptFormatFunc)pmConceptFormat_FPA_Coords, PM_FPA_LEVEL_FPA);
    335335            psFree(fpaDec);
    336336        }
     
    352352        {
    353353            psMetadataItem *cellGain = psMetadataItemAllocF32("CELL.GAIN", "CCD gain (e/count)", NAN);
    354             pmConceptRegister(cellGain, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     354            pmConceptRegister(cellGain, NULL, NULL, PM_FPA_LEVEL_CELL);
    355355            psFree(cellGain);
    356356        }
     
    360360            psMetadataItem *cellReadnoise = psMetadataItemAllocF32("CELL.READNOISE",
    361361                                            "CCD read noise (e)", NAN);
    362             pmConceptRegister(cellReadnoise, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     362            pmConceptRegister(cellReadnoise, NULL, NULL, PM_FPA_LEVEL_CELL);
    363363            psFree(cellReadnoise);
    364364        }
     
    368368            psMetadataItem *cellSaturation = psMetadataItemAllocF32("CELL.SATURATION",
    369369                                             "Saturation level (counts)", NAN);
    370             pmConceptRegister(cellSaturation, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     370            pmConceptRegister(cellSaturation, NULL, NULL, PM_FPA_LEVEL_CELL);
    371371            psFree(cellSaturation);
    372372        }
     
    375375        {
    376376            psMetadataItem *cellBad = psMetadataItemAllocF32("CELL.BAD", "Bad level (counts)", NAN);
    377             pmConceptRegister(cellBad, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     377            pmConceptRegister(cellBad, NULL, NULL, PM_FPA_LEVEL_CELL);
    378378            psFree(cellBad);
    379379        }
     
    383383            psMetadataItem *cellXparity = psMetadataItemAllocS32("CELL.XPARITY",
    384384                                          "Orientation in x compared to the rest of the FPA", 0);
    385             pmConceptRegister(cellXparity, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     385            pmConceptRegister(cellXparity, NULL, NULL, PM_FPA_LEVEL_CELL);
    386386            psFree(cellXparity);
    387387        }
     
    391391            psMetadataItem *cellYparity = psMetadataItemAllocS32("CELL.YPARITY",
    392392                                          "Orientation in x compared to the rest of the FPA", 0);
    393             pmConceptRegister(cellYparity, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     393            pmConceptRegister(cellYparity, NULL, NULL, PM_FPA_LEVEL_CELL);
    394394            psFree(cellYparity);
    395395        }
     
    399399            psMetadataItem *cellReaddir = psMetadataItemAllocS32("CELL.READDIR",
    400400                                          "Read direction, rows=1, cols=2", 0);
    401             pmConceptRegister(cellReaddir, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     401            pmConceptRegister(cellReaddir, NULL, NULL, PM_FPA_LEVEL_CELL);
    402402            psFree(cellReaddir);
    403403        }
     
    414414            psMetadataItem *cellExposure = psMetadataItemAllocF32("CELL.EXPOSURE",
    415415                                           "Exposure time (sec)", NAN);
    416             pmConceptRegister(cellExposure, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     416            pmConceptRegister(cellExposure, NULL, NULL, PM_FPA_LEVEL_CELL);
    417417            psFree(cellExposure);
    418418        }
     
    422422            psMetadataItem *cellDarktime = psMetadataItemAllocF32("CELL.DARKTIME",
    423423                                           "Time since flush (sec)", NAN);
    424             pmConceptRegister(cellDarktime, NULL, NULL, PM_CONCEPT_LEVEL_CELL);
     424            pmConceptRegister(cellDarktime, NULL, NULL, PM_FPA_LEVEL_CELL);
    425425            psFree(cellDarktime);
    426426        }
     
    434434            psFree(trimsec);
    435435            pmConceptRegister(cellTrimsec, (pmConceptParseFunc)pmConceptParse_CELL_TRIMSEC,
    436                               (pmConceptFormatFunc)pmConceptFormat_CELL_TRIMSEC, PM_CONCEPT_LEVEL_CELL);
     436                              (pmConceptFormatFunc)pmConceptFormat_CELL_TRIMSEC, PM_FPA_LEVEL_CELL);
    437437            psFree(cellTrimsec);
    438438        }
     
    445445            psFree(biassecs);
    446446            pmConceptRegister(cellBiassec, (pmConceptParseFunc)pmConceptParse_CELL_BIASSEC,
    447                               (pmConceptFormatFunc)pmConceptFormat_CELL_BIASSEC, PM_CONCEPT_LEVEL_CELL);
     447                              (pmConceptFormatFunc)pmConceptFormat_CELL_BIASSEC, PM_FPA_LEVEL_CELL);
    448448            psFree(cellBiassec);
    449449        }
     
    453453            psMetadataItem *cellXbin = psMetadataItemAllocS32("CELL.XBIN", "Binning in x", 0);
    454454            pmConceptRegister(cellXbin, (pmConceptParseFunc)pmConceptParse_CELL_Binning,
    455                               (pmConceptFormatFunc)pmConceptFormat_CELL_XBIN, PM_CONCEPT_LEVEL_CELL);
     455                              (pmConceptFormatFunc)pmConceptFormat_CELL_XBIN, PM_FPA_LEVEL_CELL);
    456456            psFree(cellXbin);
    457457        }
     
    461461            psMetadataItem *cellYbin = psMetadataItemAllocS32("CELL.YBIN", "Binning in y", 0);
    462462            pmConceptRegister(cellYbin, (pmConceptParseFunc)pmConceptParse_CELL_Binning,
    463                               (pmConceptFormatFunc)pmConceptFormat_CELL_YBIN, PM_CONCEPT_LEVEL_CELL);
     463                              (pmConceptFormatFunc)pmConceptFormat_CELL_YBIN, PM_FPA_LEVEL_CELL);
    464464            psFree(cellYbin);
    465465        }
     
    469469            psMetadataItem *cellTimesys = psMetadataItemAllocS32("CELL.TIMESYS", "Time system", -1);
    470470            pmConceptRegister(cellTimesys, (pmConceptParseFunc)pmConceptParse_CELL_TIMESYS,
    471                               (pmConceptFormatFunc)pmConceptFormat_CELL_TIMESYS, PM_CONCEPT_LEVEL_CELL);
     471                              (pmConceptFormatFunc)pmConceptFormat_CELL_TIMESYS, PM_FPA_LEVEL_CELL);
    472472            psFree(cellTimesys);
    473473        }
     
    483483            psFree(time);
    484484            pmConceptRegister(cellTime, (pmConceptParseFunc)pmConceptParse_CELL_TIME,
    485                               (pmConceptFormatFunc)pmConceptFormat_CELL_TIME, PM_CONCEPT_LEVEL_CELL);
     485                              (pmConceptFormatFunc)pmConceptFormat_CELL_TIME, PM_FPA_LEVEL_CELL);
    486486            psFree(cellTime);
    487487        }
     
    491491            psMetadataItem *cellX0 = psMetadataItemAllocS32("CELL.X0", "Position of (0,0) on the chip", 0);
    492492            pmConceptRegister(cellX0, (pmConceptParseFunc)pmConceptParse_CELL_Positions,
    493                               (pmConceptFormatFunc)pmConceptFormat_CELL_Positions, PM_CONCEPT_LEVEL_CELL);
     493                              (pmConceptFormatFunc)pmConceptFormat_CELL_Positions, PM_FPA_LEVEL_CELL);
    494494            psFree(cellX0);
    495495        }
     
    499499            psMetadataItem *cellY0 = psMetadataItemAllocS32("CELL.Y0", "Position of (0,0) on the chip", 0);
    500500            pmConceptRegister(cellY0, (pmConceptParseFunc)pmConceptParse_CELL_Positions,
    501                               (pmConceptFormatFunc)pmConceptFormat_CELL_Positions, PM_CONCEPT_LEVEL_CELL);
     501                              (pmConceptFormatFunc)pmConceptFormat_CELL_Positions, PM_FPA_LEVEL_CELL);
    502502            psFree(cellY0);
    503503        }
  • trunk/psModules/src/astrom/pmConcepts.h

    r6872 r6895  
    2727                                 );
    2828
    29 // Level at which to store a concept in the FPA hierarchy
    30 typedef enum {
    31     PM_CONCEPT_LEVEL_FPA,               // Store in the FPA
    32     PM_CONCEPT_LEVEL_CHIP,              // Store in the chip
    33     PM_CONCEPT_LEVEL_CELL               // Store in the cell
    34 } pmConceptLevel;
    35 
    3629// Register a new concept
    3730bool pmConceptRegister(psMetadataItem *blank, // Blank value; contains the name
    3831                       pmConceptParseFunc parse, // Function to call to parse the concept
    3932                       pmConceptFormatFunc format, // Function to call to format the concept
    40                        pmConceptLevel level // Level at which to store concept in the FPA hierarchy
     33                       pmFPALevel level // Level at which to store concept in the FPA hierarchy
    4134                      );
    4235
  • trunk/psModules/src/astrom/pmConceptsStandard.c

    r6872 r6895  
    1414                               (a)->y0 == (b)->y0 && \
    1515                               (a)->y1 == (b)->y1) ? true : false)
     16
     17#define TYPE_CASE(assign, item, TYPE) \
     18case PS_TYPE_##TYPE: \
     19assign = item->data.TYPE; \
     20break;
     21
    1622
    1723
     
    218224
    219225    int binning = 1;                    // Binning factor in x
    220     if (concept->type == PS_DATA_STRING) {
    221         psString binString = concept->data.V; // The string containing the binning
    222         if ((strcmp(pattern->name, "CELL.XBIN") == 0 && sscanf(binString, "%d %*d", &binning) != 1 &&
    223                 sscanf(binString, "%d,%*d", &binning) != 1) ||
    224                 (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 &&
    225                  sscanf(binString, "%*d,%d", &binning) != 1)) {
    226             psError(PS_ERR_IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString);
    227         }
    228     } else if (concept->type == PS_TYPE_S32) {
    229         binning = concept->data.S32;
    230     } else {
     226    switch (concept->type) {
     227    case PS_DATA_STRING: {
     228            psString binString = concept->data.V; // The string containing the binning
     229            if ((strcmp(pattern->name, "CELL.XBIN") == 0 && sscanf(binString, "%d %*d", &binning) != 1 &&
     230                    sscanf(binString, "%d,%*d", &binning) != 1) ||
     231                    (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 &&
     232                     sscanf(binString, "%*d,%d", &binning) != 1)) {
     233                psError(PS_ERR_IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString);
     234            }
     235        }
     236        TYPE_CASE(binning, concept, U8);
     237        TYPE_CASE(binning, concept, U16);
     238        TYPE_CASE(binning, concept, U32);
     239        TYPE_CASE(binning, concept, S8);
     240        TYPE_CASE(binning, concept, S16);
     241        TYPE_CASE(binning, concept, S32);
     242    default:
    231243        psError(PS_ERR_IO, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name,
    232244                concept->type);
     
    324336                double seconds = NAN;
    325337                switch (timeItem->type) {
    326                 case PS_TYPE_S32:
    327                     seconds = timeItem->data.S32;
    328                     break;
    329                 case PS_TYPE_F32:
    330                     seconds = timeItem->data.F32;
    331                     break;
    332                 case PS_TYPE_F64:
    333                     seconds = timeItem->data.F64;
    334                     break;
     338                    TYPE_CASE(seconds, timeItem, U8);
     339                    TYPE_CASE(seconds, timeItem, U16);
     340                    TYPE_CASE(seconds, timeItem, U32);
     341                    TYPE_CASE(seconds, timeItem, S8);
     342                    TYPE_CASE(seconds, timeItem, S16);
     343                    TYPE_CASE(seconds, timeItem, S32);
     344                    TYPE_CASE(seconds, timeItem, F32);
     345                    TYPE_CASE(seconds, timeItem, F64);
    335346                default:
    336347                    psError(PS_ERR_IO, true, "Time is not of an expected type: %x\n", timeItem->type);
     
    424435    assert(cameraFormat);
    425436
    426     if (concept->type != PS_TYPE_S32) {
    427         psError(PS_ERR_IO, true, "Concept %s is not of type S32, as expected.\n", pattern->name);
     437    int offset = 0;                     // Offset of cell (0,0) corner from the chip (0,0) corner
     438
     439    switch (concept->type) {
     440        TYPE_CASE(offset, concept, U8);
     441        TYPE_CASE(offset, concept, U16);
     442        TYPE_CASE(offset, concept, U32);
     443        TYPE_CASE(offset, concept, S8);
     444        TYPE_CASE(offset, concept, S16);
     445        TYPE_CASE(offset, concept, S32);
     446    default:
     447        psError(PS_ERR_IO, true, "Concept %s is not of integer type, as expected.\n", pattern->name);
    428448        return NULL;
    429449    }
    430     int offset = concept->data.S32;
    431450    offset -= fortranCorr(cameraFormat, pattern->name);
    432451    return psMetadataItemAllocS32(pattern->name, pattern->comment, offset);
Note: See TracChangeset for help on using the changeset viewer.