Changeset 2520 for trunk/archive/scripts/phase2.c
- Timestamp:
- Nov 29, 2004, 10:18:55 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/phase2.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/phase2.c
r2519 r2520 17 17 outroot = argv[2]; 18 18 19 // define command-line options 20 cameraname = NULL; 21 cameraname = getargs ("-camera"); // pseudo-code, not a valid API 22 recipefile = NULL; 23 recipefile = getargs ("-recipe"); // pseudo-code, not a valid API 24 25 // base file needs to be hardwired, from environment, or based on program name 26 base = psMetadataParseConfig (NULL, basefile, FALSE); 27 28 // load site-specific information (such as database servers, etc) 29 sitefile = psMetadataLookup (base, "SITE"); 30 site = psMetadataParseConfig (NULL, sitefile, FALSE); 31 32 // load only the headers from the given file input a list of headers 33 headers = psFITSReadHeaderSet (input); 19 fits = psFitsAlloc (input); 20 21 // load only the headers from the given file 22 headers = psFitsReadHeaderSet (fits); 34 23 35 24 // identify camera (may be specified on command line) 36 25 if (cameraname == NULL) { 37 cameraname = pmCameraFromHeader ( headers.data[0]);26 cameraname = pmCameraFromHeader (psListGet (headers->list, 0)); 38 27 } 39 28 camerafile = psMetadataLookup (site, "CAMERA.%s", cameraname); … … 63 52 // Is EXTNAME invarient? (probably not; does not always exist) 64 53 54 /* This will work, but it is not efficient: 55 we should work with the extensions in sequence */ 65 56 for (i = 0; i < FPA[0].chips.n; i++) { 66 57 chip = FPA[0].chips.data[i]; 67 58 59 if (Base == CELL) { 60 f = psFitsMoveExtName(f, extname); 61 } 62 68 63 for (j = 0; j < chip[0].cells.n; j++) { 69 64 cell = chip[0].cells.data[j]; 70 65 66 if (Base == CELL) { 67 f = psFitsMoveExtName(f, extname); 68 } 69 70 /* these need to work with the psFits pointer correctly 71 71 bias = load_bias_image (recipe, cell[0].metadata, cell[0].extname); 72 72 dark = load_dark_image (recipe, cell[0].metadata, cell[0].extname); … … 74 74 badpix = load_badpix_image (recipe, cell[0].metadata, cell[0].extname); 75 75 fringe = load_fringe_image (recipe, cell[0].metadata, cell[0].extname); 76 */ 76 77 77 78 for (k = 0; k < cell[0].readouts.n; k++) { … … 79 80 80 81 // load the specific readout pixels. put this in a function? 81 readout[0].image = psImageReadSection (NULL, 0, 0, 0, 0, 0, cell[0].extname, k, input);82 status = pmReadoutLoad (fits, cell, k); 82 83 83 84 kernel = make_kernel (); … … 299 300 } 300 301 302 303 bool pmConfigLoadBasic (psMetadata **site, psMetadata **base) { 304 305 // base file needs to be hardwired, from environment, or based on program name 306 base = psMetadataParseConfig (NULL, basefile, FALSE); 307 308 // load site-specific information (such as database servers, etc) 309 sitefile = psMetadataLookup (base, "SITE"); 310 site = psMetadataParseConfig (NULL, sitefile, FALSE); 311 312 } 313 314 bool pmConfigLoadCamera (psMetadata **camera, psMetadata *site, psMetadata *header) { 315 316 if (site == NULL) return (FALSE); 317 318 // identify camera (may be specified on command line) 319 cameraname = getargs ("-camera"); // pseudo-code, not a valid API 320 321 // if there is no source for camera info, fail 322 if ((cameraname == NULL) && (header == NULL)) { 323 return (FALSE); 324 } 325 326 // try to determine camera from header 327 if (cameraname == NULL) { 328 cameraname = pmCameraFromHeader (header); 329 } 330 331 // find appropriate camera definition file 332 camerafile = psMetadataLookup (site, "CAMERA.%s", cameraname); 333 334 // load the camera details for the specific camera 335 *camera = psMetadataParseConfig (NULL, camerafile, FALSE); 336 337 return (TRUE); 338 } 339 340 bool pmConfigLoadRecipe (psMetadata **recipe, psMetadata *camera, char *script) { 341 342 char recipename[64]; 343 344 if (site == NULL) return (FALSE); 345 if (camera == NULL) return (FALSE); 346 347 // define command-line options 348 recipefile = getargs ("-recipe"); // pseudo-code, not a valid API 349 350 // recipefile is defined in the camera metadata, if not specified on command line 351 if (recipefile == NULL) { 352 sprintf (recipename, "RECIPE.%s", script); 353 354 // option 1: recipe is in the camera definition 355 recipefile = psMetadataLookup (camera, recipename); 356 357 // option 2: recipe is in the metadata database (equiv to a detrend file) 358 // this option requires a different API (header data, etc) 359 recipefile = DetrendDatabaseLookup (recipename, site, camera, header); 360 } 361 362 *recipe = psMetadataParseConfig (NULL, recipefile, FALSE); 363 return (TRUE); 364 }
Note:
See TracChangeset
for help on using the changeset viewer.
