Changeset 6747 for trunk/ppImage/src/ppImageParseCamera.c
- Timestamp:
- Mar 31, 2006, 3:24:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageParseCamera.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageParseCamera.c
r6260 r6747 1 1 #include <stdio.h> 2 2 #include "pslib.h" 3 #include "pmFPA.h" 4 #include "pmFPAConstruct.h" 5 #include "pmConfig.h" 3 #include "psmodules.h" 6 4 #include "ppImage.h" 7 5 8 bool ppImageParseCamera(ppImageData *data, p pConfig *config)6 bool ppImageParseCamera(ppImageData *data, pmConfig *config) 9 7 { 10 8 // Initialise the containers where the files will go … … 22 20 data->input->fits = psFitsOpen(data->input->filename, "r"); // File handle for FITS file 23 21 if (! data->input->fits) { 24 // There's no point in continuing if we can't open the input22 // We can't open the input 25 23 psErrorStackPrint(stderr, "Can't open input image: %s\n", data->input->filename); 26 24 exit(EXIT_FAILURE); … … 29 27 30 28 // Get camera configuration from header if not already defined 29 psMetadata *cameraFormat = NULL; // Camera format description 31 30 if (! config->camera) { 32 c onfig->camera = pmConfigCameraFromHeader(config->site, data->input->phu);31 cameraFormat = pmConfigCameraFormatFromHeader(config, data->input->phu); 33 32 if (! config->camera) { 34 33 // There's no point in continuing if we can't recognise what we've got … … 36 35 exit(EXIT_FAILURE); 37 36 } 38 } else if (! pmConfigValidateCamera(config->camera, data->input->phu)) {39 // There's no point in continuing if what we've got doesn't match what we've been told37 } else if (! pmConfigValidateCameraFormat(config->camera, data->input->phu)) { 38 // What we've got doesn't match what we've been told 40 39 psError(PS_ERR_IO, true, "%s does not seem to be from the specified camera.\n", 41 40 data->input->filename); … … 43 42 } 44 43 45 // Determine the correct recipe to use 46 if (! config->recipe && !(config->recipe = pmConfigRecipeFromCamera(config->camera, RECIPE))) { 47 // There's no point in continuing if we can't work out what recipe to use 48 psErrorStackPrint(stderr, "Can't find recipe configuration!\n"); 49 exit(EXIT_FAILURE); 50 } 44 // Construct cameras in preparation for reading 45 data->input->fpa = pmFPAConstruct(config->camera); 46 data->input->view = pmFPAAddSource(data->input->fpa, data->input->phu, cameraFormat); 51 47 52 // Construct cameras in preparation for reading53 data->input->fpa = pmFPAConstruct(config->camera);54 data->mask->fpa = pmFPAConstruct(config->camera);55 data->bias->fpa = pmFPAConstruct(config->camera);56 data->dark->fpa = pmFPAConstruct(config->camera);57 data->flat->fpa = pmFPAConstruct(config->camera); 58 data->fringe->fpa = pmFPAConstruct(config->camera);48 ppFileOpen(data->mask, "-mask", config, config->camera, cameraFormat); 49 ppFileOpen(data->bias, "-bias", config, config->camera, cameraFormat); 50 ppFileOpen(data->dark, "-dark", config, config->camera, cameraFormat); 51 ppFileOpen(data->flat, "-flat", config, config->camera, cameraFormat); 52 ppFileOpen(data->fringe, "-fringe", config, config->camera, cameraFormat); 53 54 psFree(cameraFormat); 59 55 60 56 // Open output file … … 66 62 } 67 63 68 // XXX EAM : extend this to allow an array of selected chips by name69 // Chip selection: if we are using a single chip, select it for each FPA70 int chipNum = psMetadataLookupS32(NULL, config->arguments, "-chip"); // Chip number to work on71 if (chipNum >= 0) {72 if (! pmFPASelectChip(data->input->fpa, chipNum)) {73 psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);74 exit(EXIT_FAILURE);75 }76 psLogMsg("ppImage", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);77 }78 64 return true; 79 65 } 80 66 81 // XXX EAM : I dropped the pre-open of the output files; replace with a stats test of output permissions82 83 // XXX : for split data (data spread across multiple files), this step is only operating on a component84 // of the FPA. the other components should be set to 'invalid' in this case?
Note:
See TracChangeset
for help on using the changeset viewer.
