Changeset 13810 for trunk/psModules/src/camera
- Timestamp:
- Jun 13, 2007, 4:03:29 PM (19 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 2 added
- 3 edited
-
Makefile.am (modified) (2 diffs)
-
pmFPACalibration.c (added)
-
pmFPACalibration.h (added)
-
pmFPAfile.c (modified) (13 diffs)
-
pmFPAfile.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/Makefile.am
r12454 r13810 5 5 libpsmodulescamera_la_SOURCES = \ 6 6 pmFPA.c \ 7 pmFPACalibration.c \ 7 8 pmFPAConstruct.c \ 8 9 pmFPACopy.c \ … … 29 30 pkginclude_HEADERS = \ 30 31 pmFPA.h \ 32 pmFPACalibration.h \ 31 33 pmFPAConstruct.h \ 32 34 pmFPACopy.h \ -
trunk/psModules/src/camera/pmFPAfile.c
r13523 r13810 5 5 #include <stdio.h> 6 6 #include <string.h> 7 #include <strings.h> /* for strn?casecmp */7 #include <strings.h> /* for strn?casecmp */ 8 8 #include <pslib.h> 9 9 … … 164 164 } 165 165 166 // select the rule from the camera configuration, perform substitutions as needed 167 psString pmFPAfileNameFromRule(const char *rule, const pmFPAfile *file, const pmFPAview *view) 168 { 169 PS_ASSERT_PTR_NON_NULL(rule, NULL); 170 PS_ASSERT_INT_POSITIVE(strlen(rule), NULL); 171 PS_ASSERT_PTR_NON_NULL(file, NULL); 166 psString pmFPANameFromRule(const char *rule, const pmFPA *fpa, const pmFPAview *view) 167 { 168 PS_ASSERT_STRING_NON_EMPTY(rule, NULL); 172 169 PS_ASSERT_PTR_NON_NULL(view, NULL); 173 170 174 char *newName = NULL; // destination for resulting name 175 176 newName = psStringCopy (rule); 177 178 if (strstr (newName, "{OUTPUT}") != NULL) { 179 char *name = psMetadataLookupStr (NULL, file->names, "OUTPUT"); 180 if (name != NULL) { 181 psStringSubstitute(&newName, name, "{OUTPUT}"); 182 } 183 } 171 psString newName = NULL; // New name, to be returned 172 newName = psStringCopy(rule); 173 184 174 if (strstr (newName, "{CHIP.NAME}") != NULL) { 185 pmChip *chip = pmFPAviewThisChip (view, f ile->fpa);175 pmChip *chip = pmFPAviewThisChip (view, fpa); 186 176 if (chip != NULL) { 187 177 char *name = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME"); … … 202 192 } 203 193 if (strstr (newName, "{CELL.NAME}") != NULL) { 204 pmCell *cell = pmFPAviewThisCell (view, f ile->fpa);194 pmCell *cell = pmFPAviewThisCell (view, fpa); 205 195 if (cell != NULL) { 206 196 char *name = psMetadataLookupStr (NULL, cell->concepts, "CELL.NAME"); … … 220 210 } 221 211 if (strstr (newName, "{EXTNAME}") != NULL) { 222 pmHDU *hdu = pmFPAviewThisHDU (view, f ile->fpa);212 pmHDU *hdu = pmFPAviewThisHDU (view, fpa); 223 213 if (hdu->extname && *hdu->extname) { 224 214 psStringSubstitute(&newName, hdu->extname, "{EXTNAME}"); … … 226 216 } 227 217 if (strstr (newName, "{FILTER}") != NULL) { 228 if (f ile->fpa != NULL) {229 char *name = psMetadataLookupStr (NULL, f ile->fpa->concepts, "FPA.FILTER");218 if (fpa != NULL) { 219 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.FILTER"); 230 220 if (name && *name) { 231 221 psStringSubstitute(&newName, name, "{FILTER}"); … … 234 224 } 235 225 if (strstr (newName, "{FILTER.ID}") != NULL) { 236 if (f ile->fpa != NULL) {237 char *name = psMetadataLookupStr (NULL, f ile->fpa->concepts, "FPA.FILTERID");226 if (fpa != NULL) { 227 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.FILTERID"); 238 228 if (name && *name) { 239 229 psStringSubstitute(&newName, name, "{FILTER.ID}"); … … 242 232 } 243 233 if (strstr (newName, "{CAMERA}") != NULL) { 244 if (f ile->fpa != NULL) {245 char *name = psMetadataLookupStr (NULL, f ile->fpa->concepts, "FPA.INSTRUMENT");234 if (fpa != NULL) { 235 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.INSTRUMENT"); 246 236 if (name && *name) { 247 237 psStringSubstitute(&newName, name, "{CAMERA}"); … … 250 240 } 251 241 if (strstr (newName, "{INSTRUMENT}") != NULL) { 252 if (f ile->fpa != NULL) {253 char *name = psMetadataLookupStr (NULL, f ile->fpa->concepts, "FPA.INSTRUMENT");242 if (fpa != NULL) { 243 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.INSTRUMENT"); 254 244 if (name && *name) { 255 245 psStringSubstitute(&newName, name, "{INSTRUMENT}"); … … 258 248 } 259 249 if (strstr (newName, "{DETECTOR}") != NULL) { 260 if (f ile->fpa != NULL) {261 char *name = psMetadataLookupStr (NULL, f ile->fpa->concepts, "FPA.DETECTOR");250 if (fpa != NULL) { 251 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.DETECTOR"); 262 252 if (name && *name) { 263 253 psStringSubstitute(&newName, name, "{DETECTOR}"); … … 266 256 } 267 257 if (strstr (newName, "{TELESCOPE}") != NULL) { 268 if (f ile->fpa != NULL) {269 char *name = psMetadataLookupStr (NULL, f ile->fpa->concepts, "FPA.TELESCOPE");258 if (fpa != NULL) { 259 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.TELESCOPE"); 270 260 if (name && *name) { 271 261 psStringSubstitute(&newName, name, "{TELESCOPE}"); … … 273 263 } 274 264 } 265 return newName; 266 } 267 268 // select the rule from the camera configuration, perform substitutions as needed 269 psString pmFPAfileNameFromRule(const char *rule, const pmFPAfile *file, const pmFPAview *view) 270 { 271 PS_ASSERT_PTR_NON_NULL(rule, NULL); 272 PS_ASSERT_INT_POSITIVE(strlen(rule), NULL); 273 PS_ASSERT_PTR_NON_NULL(file, NULL); 274 PS_ASSERT_PTR_NON_NULL(view, NULL); 275 276 psString newRule = NULL; // Rule to pass on to pmFPANameFromRule 277 newRule = psStringCopy(rule); 278 279 if (strstr(newRule, "{OUTPUT}") != NULL) { 280 char *name = psMetadataLookupStr(NULL, file->names, "OUTPUT"); 281 if (name) { 282 psStringSubstitute(&newRule, name, "{OUTPUT}"); 283 } 284 } 285 286 psString newName = pmFPANameFromRule(newRule, file->fpa, view); // New name, to be returned 287 psFree(newRule); 288 275 289 return newName; 276 290 } … … 346 360 status = pmChipCopyStructure (outChip, inChip, xBin, yBin); 347 361 return status; 348 } 362 } 349 363 if (view->cell >= inChip->cells->n) { 350 364 psError(PS_ERR_IO, true, "Requested cell == %d>= inChip->cells->n == %ld", … … 410 424 switch (type) { 411 425 case PM_FPA_FILE_SX: 412 return ("SX");426 return ("SX"); 413 427 case PM_FPA_FILE_OBJ: 414 return ("OBJ");428 return ("OBJ"); 415 429 case PM_FPA_FILE_CMP: 416 return ("CMP");430 return ("CMP"); 417 431 case PM_FPA_FILE_CMF: 418 return ("CMF");432 return ("CMF"); 419 433 case PM_FPA_FILE_RAW: 420 return ("RAW");434 return ("RAW"); 421 435 case PM_FPA_FILE_IMAGE: 422 return ("IMAGE");436 return ("IMAGE"); 423 437 case PM_FPA_FILE_PSF: 424 return ("PSF");438 return ("PSF"); 425 439 case PM_FPA_FILE_JPEG: 426 return ("JPEG");440 return ("JPEG"); 427 441 case PM_FPA_FILE_KAPA: 428 return ("KAPA");442 return ("KAPA"); 429 443 case PM_FPA_FILE_MASK: 430 return ("MASK");444 return ("MASK"); 431 445 case PM_FPA_FILE_WEIGHT: 432 return ("WEIGHT");446 return ("WEIGHT"); 433 447 case PM_FPA_FILE_FRINGE: 434 return ("FRINGE");448 return ("FRINGE"); 435 449 case PM_FPA_FILE_HEADER: 436 return ("HEADER");450 return ("HEADER"); 437 451 default: 438 return ("NONE");452 return ("NONE"); 439 453 } 440 454 return ("NONE"); -
trunk/psModules/src/camera/pmFPAfile.h
r13523 r13810 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-0 5-26 02:50:36$6 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-06-14 02:03:29 $ 8 8 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 9 9 */ … … 53 53 typedef struct 54 54 { 55 pmFPAfileMode mode; // is this file read, written, or only used internally?56 pmFPAfileType type; // what type of data is read from / written to disk?57 pmFPAfileState state; // have we opened the file, etc?55 pmFPAfileMode mode; // is this file read, written, or only used internally? 56 pmFPAfileType type; // what type of data is read from / written to disk? 57 pmFPAfileState state; // have we opened the file, etc? 58 58 59 pmFPALevel fileLevel; // what level in the FPA hierarchy represents a unique file?60 pmFPALevel dataLevel; // at what level do we read/write the data segment? (request by user)61 pmFPALevel freeLevel; // at what level do we free the data segment? (set by program)59 pmFPALevel fileLevel; // what level in the FPA hierarchy represents a unique file? 60 pmFPALevel dataLevel; // at what level do we read/write the data segment? (request by user) 61 pmFPALevel freeLevel; // at what level do we free the data segment? (set by program) 62 62 pmFPALevel mosaicLevel; // at what level is the mosaic? 63 63 64 pmFPA *fpa; // for I/O files, we carry a pointer to the complete fpa65 psFits *fits; // for I/O files of fits type (IMAGE, CMP, CMF), we carry a file handle64 pmFPA *fpa; // for I/O files, we carry a pointer to the complete fpa 65 psFits *fits; // for I/O files of fits type (IMAGE, CMP, CMF), we carry a file handle 66 66 67 bool phu; // have we written a PHU for this file?68 psMetadata *header; // pointer (view) to the current hdu header67 bool phu; // have we written a PHU for this file? 68 psMetadata *header; // pointer (view) to the current hdu header 69 69 70 pmReadout *readout; // for internal files, we only carry a single readout70 pmReadout *readout; // for internal files, we only carry a single readout 71 71 72 psMetadata *names; // filenames supplied by the cmdline or detdb are saved here72 psMetadata *names; // filenames supplied by the cmdline or detdb are saved here 73 73 74 char *filerule; // rule for constructing a filename when needed75 char *filesrc; // rule to find file in pmFPAfile->names list74 char *filerule; // rule for constructing a filename when needed 75 char *filesrc; // rule to find file in pmFPAfile->names list 76 76 77 char *name; // the name of the rule (useful for debugging / tracing)78 char *filename; // the current name of an active file79 char *extname; // the current name of an active file extension77 char *name; // the name of the rule (useful for debugging / tracing) 78 char *filename; // the current name of an active file 79 char *extname; // the current name of an active file extension 80 80 81 81 pmDetrendSelectResults *detrend; // Detrend information, from pmDetrendSelect … … 110 110 111 111 // convert the rule to a name based on the current view 112 psString pmFPANameFromRule(const char *rule, const pmFPA *fpa, const pmFPAview *view); 113 114 // convert the rule to a name based on the current view 112 115 psString pmFPAfileNameFromRule(const char *rule, const pmFPAfile *file, const pmFPAview *view); 113 116
Note:
See TracChangeset
for help on using the changeset viewer.
