IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2006, 4:23:40 PM (20 years ago)
Author:
Paul Price
Message:

Getting code to compile; adding concept read to fpa construction and reading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c

    r6570 r6575  
    11#include <stdio.h>
     2#include <assert.h>
    23
    34#include "pslib.h"
    45
     6#include "pmFPA.h"
    57#include "pmConceptsRead.h"
    68#include "pmConceptsWrite.h"
    7 #include "pmFPA.h"
    89#include "pmConceptsStandard.h"
    9 #include "psAdditionals.h"
    1010
    1111
     
    2121        psLogMsg(__func__, PS_LOG_WARN, "Assuming format for %s is HOURS.\n", pattern->name);
    2222        return M_PI / 12.0;
    23     } else if (strcmp(pattern->name, "FPA.DEC") == 0) {
     23    }
     24    if (strcmp(pattern->name, "FPA.DEC") == 0) {
    2425        psLogMsg(__func__, PS_LOG_WARN, "Assuming format for %s is DEGREES.\n", pattern->name);
    2526        return M_PI / 180.0;
    26     } else {
    27         psAbort("Should never ever get here.\n");
    28     }
     27    }
     28    psAbort(__func__, "Should never ever get here.\n");
     29    return NAN;
    2930}
    3031
     
    7374    psMetadata *formats = psMetadataLookupMD(&mdok, cameraFormat, "FORMATS");
    7475    if (mdok && formats) {
    75         psString format = psMetadataLookupStr(&mdok, formats, blank->name);
     76        psString format = psMetadataLookupStr(&mdok, formats, pattern->name);
    7677        if (mdok && strlen(format) > 0) {
    7778            if (strcasecmp(format, "HOURS") == 0) {
     
    9596
    9697// FPA.RA and FPA.DEC
    97 psMetadataItem *pmConceptFormat_FPA_Coords(psMetadataItem *concept, psMetadataItem *pattern, pmConceptSpec *spec, psMetadata *cameraFormat)
     98psMetadataItem *pmConceptFormat_FPA_Coords(psMetadataItem *concept, psMetadataItem *pattern, psMetadata *cameraFormat)
    9899{
    99100    assert(concept);
     
    128129    int big, medium;
    129130    float small;
    130     big = (int)ra;
     131    big = (int)coords;
    131132    medium = (int)(60.0*(coords - (double)big));
    132133    small = 3600.0*(coords - (double)big - 60.0 * (double)medium);
     
    146147    assert(pattern);
    147148
    148     psMetadata *cellConfig = cell->config; // The cell configuration
    149149    psRegion *trimsec = psAlloc(sizeof(psRegion)); // Make space for a psRegion (usually passed by value)
    150150
     
    166166    assert(cell);
    167167    assert(pattern);
    168     psMetadata *cellConfig = cell->config; // The cell configuration
    169168
    170169    psList *biassecs = psListAlloc(NULL); // List of bias sections
    171     psMetadataItem *item = psMetadataItemAlloc("CELL.BIASSEC", PS_DATA_LIST, "Bias sections", biassecs);
    172170    psFree(biassecs);               // Drop reference
    173171
     
    215213
    216214// CELL.XBIN and CELL.YBIN
    217 psMetadataItem *pmConceptParse_CELL_BINNING(psMetadataItem *concept, psMetadataItem *pattern, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell)
     215psMetadataItem *pmConceptParse_CELL_Binning(psMetadataItem *concept, psMetadataItem *pattern, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell)
    218216{
    219217    assert(concept);
     
    226224                sscanf(binString, "%d,%*d", &binning) != 1) ||
    227225                (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 &&
    228                  sscanf(binString, "%*d,%d", &binning) != 1) {
    229                 psError(PS_ERR_IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString)
    230                     ;
    231                 }
    232             } else if (concept->type == PS_TYPE_S32) {
    233                 binning = concept->data.S32;
    234             } else {
    235                 psError(PS_ERR_IO, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name,
    236                         binItem->type);
    237             }
    238 
    239             return psMetadataItemAllocS32(pattern->name, pattern->comment, binning);
     226                 sscanf(binString, "%*d,%d", &binning) != 1)) {
     227            psError(PS_ERR_IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString);
     228        }
     229    } else if (concept->type == PS_TYPE_S32) {
     230        binning = concept->data.S32;
     231    } else {
     232        psError(PS_ERR_IO, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name,
     233                concept->type);
     234    }
     235
     236    return psMetadataItemAllocS32(pattern->name, pattern->comment, binning);
    240237}
    241238
     
    247244
    248245    psTimeType timeSys = PS_TIME_UTC;   // The time system
     246    psString sys = concept->data.V;     // The time system string
    249247    if (concept->type != PS_DATA_STRING || strlen(sys) <= 0) {
    250248        psError(PS_ERR_IO, true, "Can't interpret CELL.TIMESYS --- assuming UTC.\n");
     
    273271
    274272    // Need CELL.TIMESYS first
    275     bool mdok = false;                  // Result of MD lookup
     273    bool mdok = true;                  // Result of MD lookup
    276274    psTimeType timeSys = psMetadataLookupS32(&mdok, cell->concepts, "CELL.TIMESYS"); // The time system
    277275    if (!mdok) {
     
    281279
    282280    // Get format
    283     bool mdok = true;               // Status of MD lookup
    284281    psMetadata *formats = psMetadataLookupMD(&mdok, cameraFormat, "FORMATS");
    285282    if (!mdok || !formats) {
     
    446443    psRegion *trimsec = concept->data.V; // The trimsec region
    447444    psString trimsecString = psRegionToString(*trimsec);
    448     psMetadataItem *formatted = psMetadataItemAllocStr(trimsecItem->name, trimsecItem->comment,
     445    psMetadataItem *formatted = psMetadataItemAllocStr(concept->name, concept->comment,
    449446                                trimsecString);
    450447    psFree(trimsecString);
     
    543540    psFree(sys);
    544541
    545     return success;
     542    return newItem;
    546543}
    547544
     
    602599    }
    603600
    604     psError(PS_ERR_IO, true, "Not sure how to format concept CELL.TIME (%s)\n", dateTimeString);
     601    psError(PS_ERR_IO, true, "Not sure how to format concept CELL.TIME\n");
    605602    return NULL;
    606603}
    607604
    608 psMetadataItem *pmConceptFormat_CELL_Positions(psMetadataItem *concept, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell *db)
     605psMetadataItem *pmConceptFormat_CELL_Positions(psMetadataItem *concept, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell)
    609606{
    610607    assert(concept);
     
    612609
    613610    if (concept->type != PS_TYPE_S32) {
    614         psError(PS_ERR_IO, true, "Concept %s is not of type S32, as expected.\n", pattern->name);
     611        psError(PS_ERR_IO, true, "Concept %s is not of type S32, as expected.\n", concept->name);
    615612        return NULL;
    616613    }
Note: See TracChangeset for help on using the changeset viewer.