Changeset 14475 for trunk/psModules/src/config/pmConfigCamera.c
- Timestamp:
- Aug 13, 2007, 2:17:40 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfigCamera.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfigCamera.c
r14461 r14475 25 25 // Generate the skycell version of a named camera configuration 26 26 bool pmConfigCameraSkycellVersion(psMetadata *site, // The site configuration 27 const char *name // Name of the un-mosaicked camera28 )27 const char *name // Name of the un-mosaicked camera 28 ) 29 29 { 30 30 PS_ASSERT_METADATA_NON_NULL(site, false); … … 37 37 return false; 38 38 } 39 if (!pmConfigGenerateSkycellVersion(cameras, cameras, name )) {39 if (!pmConfigGenerateSkycellVersion(cameras, cameras, name, site)) { 40 40 psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n", name); 41 41 return false; … … 61 61 while ((camerasItem = psMetadataGetAndIncrement(camerasIter))) { 62 62 assert(camerasItem->type == PS_DATA_METADATA); // Only metadata are allowed here! 63 if (!pmConfigGenerateSkycellVersion(cameras, new, camerasItem->name )) {63 if (!pmConfigGenerateSkycellVersion(cameras, new, camerasItem->name, site)) { 64 64 psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n", 65 65 camerasItem->name); … … 86 86 const static char *skycellConceptsCell[] = { "CELL.BIASSEC", "CELL.TRIMSEC", "CELL.READDIR", "CELL.XPARITY", 87 87 "CELL.YPARITY", "CELL.XWINDOW", "CELL.YWINDOW", "CELL.X0", 88 "CELL.Y0", "CELL.XSIZE", "CELL.YSIZE", 0 }; 88 "CELL.Y0", "CELL.XSIZE", "CELL.YSIZE", "CELL.EXPOSURE", 89 "CELL.TIME", 0 }; 89 90 const static char *skycellConceptsChip[] = { "CHIP.XPARITY", "CHIP.YPARITY", "CHIP.XSIZE", "CHIP.YSIZE", 0 }; 90 91 // Do we update a particular concept? 91 const static char *skycellConceptsFPA[] = { "FPA.EXPOSURE", "FPA.TIME", 0 }; 92 93 // Do we update a particular concept for a skycell? 92 94 static bool updateConcept(const char *name, // Name of concept 93 95 const char **concepts // List of concepts NOT to update 94 )96 ) 95 97 { 96 98 for (int i = 0; concepts[i]; i++) { … … 102 104 } 103 105 106 // What do we call the skycell concept in the FITS header? 107 static const char* skycellConceptName(const char *name, // Name of concept 108 const psMetadata *site // Site configuration 109 ) 110 { 111 if (!site) { 112 return name; 113 } 114 bool mdok; // Status of MD lookup 115 psMetadata *skycells = psMetadataLookupMetadata(&mdok, site, "SKYCELLS"); // Skycell concept headers 116 if (!skycells) { 117 return name; 118 } 119 const char *keyword = psMetadataLookupStr(&mdok, skycells, name); // Keyword to use for this concept 120 if (!mdok || !keyword || strlen(keyword) == 0) { 121 return name; 122 } 123 return keyword; 124 } 125 126 104 127 // Generate a skycell version of a camera configuration 105 128 bool pmConfigGenerateSkycellVersion(psMetadata *oldCameras, // Old list of camera configurations 106 129 psMetadata *newCameras, // New list of camera configurations 107 const char *name // Name of original camera configuration 130 const char *name, // Name of original camera configuration 131 const psMetadata *site // Site configuration 108 132 ) 109 133 { … … 201 225 while ((name = psListGetAndIncrement(iter))) { 202 226 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, name); 227 if (updateConcept(name, skycellConceptsFPA)) { 228 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, skycellConceptName(name, site)); 229 } 203 230 } 204 231 psFree(iter); … … 209 236 while ((name = psListGetAndIncrement(iter))) { 210 237 if (updateConcept(name, skycellConceptsChip)) { 211 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, name);238 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, skycellConceptName(name, site)); 212 239 } 213 240 } … … 219 246 while ((name = psListGetAndIncrement(iter))) { 220 247 if (updateConcept(name, skycellConceptsCell)) { 221 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, name);248 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, skycellConceptName(name, site)); 222 249 } 223 250 }
Note:
See TracChangeset
for help on using the changeset viewer.
