- Timestamp:
- Mar 13, 2006, 4:23:40 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c
r6570 r6575 1 1 #include <stdio.h> 2 #include <assert.h> 2 3 3 4 #include "pslib.h" 4 5 6 #include "pmFPA.h" 5 7 #include "pmConceptsRead.h" 6 8 #include "pmConceptsWrite.h" 7 #include "pmFPA.h"8 9 #include "pmConceptsStandard.h" 9 #include "psAdditionals.h"10 10 11 11 … … 21 21 psLogMsg(__func__, PS_LOG_WARN, "Assuming format for %s is HOURS.\n", pattern->name); 22 22 return M_PI / 12.0; 23 } else if (strcmp(pattern->name, "FPA.DEC") == 0) { 23 } 24 if (strcmp(pattern->name, "FPA.DEC") == 0) { 24 25 psLogMsg(__func__, PS_LOG_WARN, "Assuming format for %s is DEGREES.\n", pattern->name); 25 26 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; 29 30 } 30 31 … … 73 74 psMetadata *formats = psMetadataLookupMD(&mdok, cameraFormat, "FORMATS"); 74 75 if (mdok && formats) { 75 psString format = psMetadataLookupStr(&mdok, formats, blank->name);76 psString format = psMetadataLookupStr(&mdok, formats, pattern->name); 76 77 if (mdok && strlen(format) > 0) { 77 78 if (strcasecmp(format, "HOURS") == 0) { … … 95 96 96 97 // FPA.RA and FPA.DEC 97 psMetadataItem *pmConceptFormat_FPA_Coords(psMetadataItem *concept, psMetadataItem *pattern, p mConceptSpec *spec, psMetadata *cameraFormat)98 psMetadataItem *pmConceptFormat_FPA_Coords(psMetadataItem *concept, psMetadataItem *pattern, psMetadata *cameraFormat) 98 99 { 99 100 assert(concept); … … 128 129 int big, medium; 129 130 float small; 130 big = (int) ra;131 big = (int)coords; 131 132 medium = (int)(60.0*(coords - (double)big)); 132 133 small = 3600.0*(coords - (double)big - 60.0 * (double)medium); … … 146 147 assert(pattern); 147 148 148 psMetadata *cellConfig = cell->config; // The cell configuration149 149 psRegion *trimsec = psAlloc(sizeof(psRegion)); // Make space for a psRegion (usually passed by value) 150 150 … … 166 166 assert(cell); 167 167 assert(pattern); 168 psMetadata *cellConfig = cell->config; // The cell configuration169 168 170 169 psList *biassecs = psListAlloc(NULL); // List of bias sections 171 psMetadataItem *item = psMetadataItemAlloc("CELL.BIASSEC", PS_DATA_LIST, "Bias sections", biassecs);172 170 psFree(biassecs); // Drop reference 173 171 … … 215 213 216 214 // CELL.XBIN and CELL.YBIN 217 psMetadataItem *pmConceptParse_CELL_B INNING(psMetadataItem *concept, psMetadataItem *pattern, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell)215 psMetadataItem *pmConceptParse_CELL_Binning(psMetadataItem *concept, psMetadataItem *pattern, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell) 218 216 { 219 217 assert(concept); … … 226 224 sscanf(binString, "%d,%*d", &binning) != 1) || 227 225 (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); 240 237 } 241 238 … … 247 244 248 245 psTimeType timeSys = PS_TIME_UTC; // The time system 246 psString sys = concept->data.V; // The time system string 249 247 if (concept->type != PS_DATA_STRING || strlen(sys) <= 0) { 250 248 psError(PS_ERR_IO, true, "Can't interpret CELL.TIMESYS --- assuming UTC.\n"); … … 273 271 274 272 // Need CELL.TIMESYS first 275 bool mdok = false; // Result of MD lookup273 bool mdok = true; // Result of MD lookup 276 274 psTimeType timeSys = psMetadataLookupS32(&mdok, cell->concepts, "CELL.TIMESYS"); // The time system 277 275 if (!mdok) { … … 281 279 282 280 // Get format 283 bool mdok = true; // Status of MD lookup284 281 psMetadata *formats = psMetadataLookupMD(&mdok, cameraFormat, "FORMATS"); 285 282 if (!mdok || !formats) { … … 446 443 psRegion *trimsec = concept->data.V; // The trimsec region 447 444 psString trimsecString = psRegionToString(*trimsec); 448 psMetadataItem *formatted = psMetadataItemAllocStr( trimsecItem->name, trimsecItem->comment,445 psMetadataItem *formatted = psMetadataItemAllocStr(concept->name, concept->comment, 449 446 trimsecString); 450 447 psFree(trimsecString); … … 543 540 psFree(sys); 544 541 545 return success;542 return newItem; 546 543 } 547 544 … … 602 599 } 603 600 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"); 605 602 return NULL; 606 603 } 607 604 608 psMetadataItem *pmConceptFormat_CELL_Positions(psMetadataItem *concept, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell *db)605 psMetadataItem *pmConceptFormat_CELL_Positions(psMetadataItem *concept, psMetadata *cameraFormat, pmFPA *fpa, pmChip *chip, pmCell *cell) 609 606 { 610 607 assert(concept); … … 612 609 613 610 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); 615 612 return NULL; 616 613 }
Note:
See TracChangeset
for help on using the changeset viewer.
