Changeset 6580
- Timestamp:
- Mar 13, 2006, 6:40:37 PM (20 years ago)
- Location:
- branches/rel10_ifa/psModules/src
- Files:
-
- 7 edited
-
astrom/pmConcepts.c (modified) (15 diffs)
-
astrom/pmConceptsRead.c (modified) (6 diffs)
-
astrom/pmFPAConstruct.c (modified) (7 diffs)
-
astrom/pmFPAConstruct.h (modified) (1 diff)
-
astrom/pmFPAfile.h (modified) (2 diffs)
-
astrom/pmFPAview.h (modified) (2 diffs)
-
config/pmConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmConcepts.c
r6575 r6580 76 76 77 77 // Set all registered concepts to blank value for the specified level 78 static bool conceptsBlank(psMetadata * specs, // One of the concepts specifications78 static bool conceptsBlank(psMetadata **specs, // One of the concepts specifications 79 79 psMetadata *target // Place to install the concepts 80 80 ) … … 83 83 pmConceptsInit(); 84 84 } 85 psMetadataIterator *specsIter = psMetadataIteratorAlloc( specs, PS_LIST_HEAD, NULL); // Iterator on specs85 psMetadataIterator *specsIter = psMetadataIteratorAlloc(*specs, PS_LIST_HEAD, NULL); // Iterator on specs 86 86 psMetadataItem *specItem = NULL; // Item from the specs metadata 87 87 while ((specItem = psMetadataGetAndIncrement(specsIter))) { … … 99 99 100 100 // Read all registered concepts for the specified level 101 static bool conceptsRead(psMetadata * specs, // One of the concepts specifications101 static bool conceptsRead(psMetadata **specs, // One of the concepts specifications 102 102 pmFPA *fpa, // The FPA 103 103 pmChip *chip, // The chip … … 113 113 114 114 if (source & PM_CONCEPT_SOURCE_CAMERA || source == PM_CONCEPT_SOURCE_ALL) { 115 pmConceptsReadFromCamera( specs, cell, target);115 pmConceptsReadFromCamera(*specs, cell, target); 116 116 } 117 117 if (source & PM_CONCEPT_SOURCE_DEFAULTS || source == PM_CONCEPT_SOURCE_ALL) { 118 pmConceptsReadFromDefaults( specs, fpa, chip, cell, target);118 pmConceptsReadFromDefaults(*specs, fpa, chip, cell, target); 119 119 } 120 120 if (source & PM_CONCEPT_SOURCE_HEADER || source == PM_CONCEPT_SOURCE_ALL) { 121 pmConceptsReadFromHeader( specs, fpa, chip, cell, target);121 pmConceptsReadFromHeader(*specs, fpa, chip, cell, target); 122 122 } 123 123 if (source & PM_CONCEPT_SOURCE_DATABASE || source == PM_CONCEPT_SOURCE_ALL) { 124 pmConceptsReadFromDatabase( specs, fpa, chip, cell, db, target);124 pmConceptsReadFromDatabase(*specs, fpa, chip, cell, db, target); 125 125 } 126 126 … … 129 129 130 130 // Write all registered concepts for the specified level 131 static bool conceptsWrite(psMetadata * specs, // One of the concepts specifications131 static bool conceptsWrite(psMetadata **specs, // One of the concepts specifications 132 132 pmFPA *fpa, // The FPA 133 133 pmChip *chip, // The chip … … 143 143 144 144 if (source & PM_CONCEPT_SOURCE_CAMERA || source == PM_CONCEPT_SOURCE_ALL) { 145 pmConceptsWriteToCamera( specs, cell, concepts);145 pmConceptsWriteToCamera(*specs, cell, concepts); 146 146 } 147 147 if (source & PM_CONCEPT_SOURCE_DEFAULTS || source == PM_CONCEPT_SOURCE_ALL) { 148 pmConceptsWriteToDefaults( specs, fpa, chip, cell, concepts);148 pmConceptsWriteToDefaults(*specs, fpa, chip, cell, concepts); 149 149 } 150 150 if (source & PM_CONCEPT_SOURCE_HEADER || source == PM_CONCEPT_SOURCE_ALL) { 151 pmConceptsWriteToHeader( specs, fpa, chip, cell, concepts);151 pmConceptsWriteToHeader(*specs, fpa, chip, cell, concepts); 152 152 } 153 153 if (source & PM_CONCEPT_SOURCE_DATABASE || source == PM_CONCEPT_SOURCE_ALL) { 154 pmConceptsWriteToDatabase( specs, fpa, chip, cell, db, concepts);154 pmConceptsWriteToDatabase(*specs, fpa, chip, cell, db, concepts); 155 155 } 156 156 … … 164 164 { 165 165 psTrace("psModule.concepts", 5, "Blanking FPA concepts: %x %x\n", conceptsFPA, fpa->concepts); 166 return conceptsBlank( conceptsFPA, fpa->concepts);166 return conceptsBlank(&conceptsFPA, fpa->concepts); 167 167 } 168 168 … … 174 174 { 175 175 psTrace("psModule.concepts", 5, "Reading FPA concepts: %x %x\n", conceptsFPA, fpa->concepts); 176 return conceptsRead( conceptsFPA, fpa, NULL, NULL, source, db, fpa->concepts);176 return conceptsRead(&conceptsFPA, fpa, NULL, NULL, source, db, fpa->concepts); 177 177 } 178 178 … … 184 184 { 185 185 psTrace("psModule.concepts", 5, "Writing FPA concepts: %x %x\n", conceptsFPA, fpa->concepts); 186 return conceptsWrite( conceptsFPA, fpa, NULL, NULL, source, db, fpa->concepts);186 return conceptsWrite(&conceptsFPA, fpa, NULL, NULL, source, db, fpa->concepts); 187 187 } 188 188 … … 192 192 { 193 193 psTrace("psModule.concepts", 5, "Blanking chip concepts: %x %x\n", conceptsChip, chip->concepts); 194 return conceptsBlank( conceptsChip, chip->concepts);194 return conceptsBlank(&conceptsChip, chip->concepts); 195 195 } 196 196 … … 203 203 psTrace("psModule.concepts", 5, "Reading chip concepts: %x %x\n", conceptsChip, chip->concepts); 204 204 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 205 return conceptsRead( conceptsChip, fpa, chip, NULL, source, db, chip->concepts);205 return conceptsRead(&conceptsChip, fpa, chip, NULL, source, db, chip->concepts); 206 206 } 207 207 … … 214 214 psTrace("psModule.concepts", 5, "Writing chip concepts: %x %x\n", conceptsChip, chip->concepts); 215 215 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 216 return conceptsWrite( conceptsChip, fpa, chip, NULL, source, db, chip->concepts);216 return conceptsWrite(&conceptsChip, fpa, chip, NULL, source, db, chip->concepts); 217 217 } 218 218 … … 222 222 { 223 223 psTrace("psModule.concepts", 5, "Blanking cell concepts: %x %x\n", conceptsCell, cell->concepts); 224 return conceptsBlank( conceptsCell, cell->concepts);224 return conceptsBlank(&conceptsCell, cell->concepts); 225 225 } 226 226 … … 234 234 pmChip *chip = cell->parent; // Chip to which the cell belongs 235 235 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 236 return conceptsRead( conceptsCell, fpa, chip, cell, source, db, cell->concepts);236 return conceptsRead(&conceptsCell, fpa, chip, cell, source, db, cell->concepts); 237 237 } 238 238 … … 246 246 pmChip *chip = cell->parent; // Chip to which the cell belongs 247 247 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 248 return conceptsWrite( conceptsCell, fpa, chip, cell, source, db, cell->concepts);248 return conceptsWrite(&conceptsCell, fpa, chip, cell, source, db, cell->concepts); 249 249 } 250 250 -
branches/rel10_ifa/psModules/src/astrom/pmConceptsRead.c
r6575 r6580 175 175 } 176 176 177 177 178 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 178 179 // Public functions … … 201 202 bool mdok = true; // Status of MD lookup 202 203 psString source = psMetadataLookupStr(&mdok, cell->config, nameSource); // The source 203 if (mdok && strlen(source)) { 204 if (strcasecmp(source, "HEADER") == 0 && conceptItem->type == PS_DATA_STRING) { 205 value = psMetadataLookup(hdu->header, conceptItem->data.V); 206 } else if (strcasecmp(source, "VALUE") == 0) { 207 value = psMemIncrRefCounter(conceptItem); 208 } else { 209 psError(PS_ERR_IO, true, "%s isn't HEADER or VALUE --- can't read %s\n", source, 210 name); 211 continue; 212 } 213 } else { 214 // Assume it's specified by value 204 if (mdok && strlen(source) > 0 && strcasecmp(source, "VALUE") == 0) { 215 205 value = psMemIncrRefCounter(conceptItem); 206 conceptParse(spec, value, cameraFormat, target, NULL, NULL, cell); 207 } else if (source && (strlen(source) == 0 || strcasecmp(source, "HEADER") != 0)) { 208 // We leave "HEADER" to pmConceptsReadFromHeader 209 psError(PS_ERR_IO, true, "%s isn't HEADER or VALUE --- can't read %s\n", source, name); 210 continue; 216 211 } 217 conceptParse(spec, value, cameraFormat, target, NULL, NULL, cell);218 212 } 219 213 } … … 253 247 } 254 248 249 255 250 bool pmConceptsReadFromHeader(psMetadata *specs, // The concept specifications 256 251 pmFPA *fpa, // The FPA … … 265 260 psMetadata *transSpec = psMetadataLookupMD(&mdok, cameraFormat, "TRANSLATION"); // The TRANSLATION spec 266 261 if (mdok && transSpec) { 267 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level268 psMetadata *cameraFormat = hdu->format; // The camera format269 262 psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator 270 263 psMetadataItem *specItem = NULL; // Item from the specs metadata … … 272 265 pmConceptSpec *spec = specItem->data.V; // The specification 273 266 psString name = specItem->name; // The concept name 274 psString keywords = psMetadataLookupStr(&mdok, transSpec, name); // The FITS keywords 275 if (mdok && strlen(keywords) > 0) { 276 // In case there are multiple headers 277 psList *keys = psStringSplit(keywords, " ,;"); // List of keywords 278 psMetadataItem *headerItem = NULL; // The item, to be returned 279 if (keys->n == 1) { 280 // Only one key --- proceed as usual 281 headerItem = psMetadataLookup(hdu->header, keywords); 282 } else { 283 psListIterator *keysIter = psListIteratorAlloc(keys, PS_LIST_HEAD, false); // Iterator 284 psString key = NULL; // Item from iteration 285 psList *values = psListAlloc(NULL); // List containing the values 286 while ((key = psListGetAndIncrement(keysIter))) { 287 psMetadataItem *value = psMetadataLookup(hdu->header, key); 288 psListAdd(values, PS_LIST_TAIL, value); 267 psMetadataItem *headerItem = NULL; // The value of the concept from the header 268 // First check the cell configuration 269 if (cell && cell->config) { 270 psMetadataItem *conceptItem = psMetadataLookup(cell->config, name); // The concept, or NULL 271 if (conceptItem) { 272 // Check the SOURCE 273 psString nameSource = NULL; // String with the concept name and ".SOURCE" added 274 psStringAppend(&nameSource, "%s.SOURCE", name); 275 psString source = psMetadataLookupStr(&mdok, cell->config, nameSource); // The source 276 if (mdok && strlen(source) && strcasecmp(source, "HEADER") == 0) { 277 headerItem = psMetadataLookup(hdu->header, conceptItem->data.V); 289 278 } 290 psFree(keysIter); 291 headerItem = psMetadataItemAlloc(name, PS_DATA_LIST, specItem->comment, values); 292 psFree(values); 279 // Leave the error handling to pmConceptsFromCamera, which should already have been called 293 280 } 294 psFree(keys); 295 296 // This will also clean up the name 297 conceptParse(spec, headerItem, cameraFormat, target, fpa, chip, cell); 298 } 281 } 282 if (! headerItem) { 283 psString keywords = psMetadataLookupStr(&mdok, transSpec, name); // The FITS keywords 284 if (mdok && strlen(keywords) > 0) { 285 // In case there are multiple headers 286 psList *keys = psStringSplit(keywords, " ,;"); // List of keywords 287 if (keys->n == 1) { 288 // Only one key --- proceed as usual 289 headerItem = psMetadataLookup(hdu->header, keywords); 290 } else { 291 psListIterator *keysIter = psListIteratorAlloc(keys, PS_LIST_HEAD, false); // Iterator 292 psString key = NULL; // Item from iteration 293 psList *values = psListAlloc(NULL); // List containing the values 294 while ((key = psListGetAndIncrement(keysIter))) { 295 psMetadataItem *value = psMetadataLookup(hdu->header, key); 296 psListAdd(values, PS_LIST_TAIL, value); 297 } 298 psFree(keysIter); 299 headerItem = psMetadataItemAlloc(name, PS_DATA_LIST, specItem->comment, values); 300 psFree(values); 301 } 302 psFree(keys); 303 } 304 } 305 306 // This will also clean up the name 307 conceptParse(spec, headerItem, cameraFormat, target, fpa, chip, cell); 299 308 } 300 309 psFree(specsIter); … … 303 312 return false; 304 313 } 314 305 315 306 316 // XXX --- the below code has NOT been tested! -
branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c
r6575 r6580 147 147 while ((cellName = psListGetAndIncrement(cellNamesIter))) { 148 148 pmCell *cell = pmCellAlloc(chip, cellName); // New cell 149 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_DEFAULTS, NULL);150 149 psFree(cell); // Drop reference 151 150 } 152 pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_DEFAULTS, NULL);153 151 psFree(chip); // Drop reference 154 152 psFree(cellNamesIter); 155 153 } 156 154 psFree(componentsIter); 157 pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_DEFAULTS, NULL);158 155 159 156 return fpa; … … 166 163 pmCell *cell, // Cell to which to add, or NULL 167 164 psMetadata *phu, // Primary header of file 168 constpsMetadata *format // Format of file165 psMetadata *format // Format of file 169 166 ) 170 167 { … … 192 189 pmHDU *phdu = pmHDUAlloc("PHU"); // The primary header data unit 193 190 phdu->header = psMemIncrRefCounter(phu); 191 phdu->format = psMemIncrRefCounter(format); 194 192 if (fpa && !fpa->hdu && strcasecmp(phuType, "FPA") == 0) { 195 193 fpa->hdu = phdu; 194 pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL); 196 195 } else if (chip && !chip->hdu && strcasecmp(phuType, "CHIP") == 0) { 197 196 chip->hdu = phdu; 197 pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, NULL); 198 198 } else if (cell && !cell->hdu && strcasecmp(phuType, "CELL") == 0) { 199 199 // cell->hdu = phdu; … … 244 244 } 245 245 cell->config = psMemIncrRefCounter(cellData); 246 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA , NULL);246 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS, NULL); 247 247 } 248 248 } … … 295 295 } 296 296 cell->config = psMemIncrRefCounter(cellData); 297 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA , NULL);297 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS, NULL); 298 298 } 299 299 … … 337 337 } 338 338 cell->config = psMemIncrRefCounter(cellData); 339 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA , NULL);339 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS, NULL); 340 340 } 341 341 … … 346 346 } 347 347 psFree(contentsIter); 348 349 pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_DEFAULTS, NULL); 348 350 349 351 return true; -
branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.h
r6552 r6580 14 14 pmCell *cell, // Cell to which to add, or NULL 15 15 psMetadata *phu, // Primary header of file 16 const psMetadata *format// Format of file16 psMetadata *format // Format of file 17 17 ); 18 18 -
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h
r6573 r6580 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2. 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-03-14 0 2:21:07 $9 * @version $Revision: 1.1.2.6 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-03-14 04:40:37 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 15 15 #ifndef PM_FPA_FILE_H 16 16 #define PM_FPA_FILE_H 17 18 #include "pslib.h" 19 #include "pmFPA.h" 20 #include "pmFPAview.h" 17 21 18 22 typedef enum { -
branches/rel10_ifa/psModules/src/astrom/pmFPAview.h
r6573 r6580 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2. 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-03-14 0 2:21:07 $9 * @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-03-14 04:40:37 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 15 15 #ifndef PM_FPA_VIEW_H 16 16 #define PM_FPA_VIEW_H 17 18 #include "pmFPA.h" 17 19 18 20 /// @addtogroup AstroImage -
branches/rel10_ifa/psModules/src/config/pmConfig.c
r6569 r6580 3 3 * @author PAP, IfA 4 4 * 5 * @version $Revision: 1.7.4. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03-1 0 02:05:06$5 * @version $Revision: 1.7.4.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-14 04:40:37 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 477 477 PS_ASSERT_PTR_NON_NULL(config->camera, false); 478 478 479 if (!config->recipes) { 480 config->recipes = psMetadataAlloc(); 481 } 482 479 483 bool mdok = true; // Status of MD lookup 480 484 psMetadata *recipes = psMetadataLookupMD(&mdok, config->camera, "RECIPES"); // The list of recipes
Note:
See TracChangeset
for help on using the changeset viewer.
