Changeset 6079 for trunk/ppImage/src/ppImageLoop.c
- Timestamp:
- Jan 19, 2006, 11:44:37 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageLoop.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageLoop.c
r5976 r6079 1 1 # include "ppImage.h" 2 3 // Read the entire FPA 4 void readFPA(ppFile *file, // File to read 5 ppConfig *config // Configuration, containing the DB handle 6 ) 7 { 8 if (file->fpa && file->fits) { 9 if (! pmFPARead(file->fpa, file->fits, file->phu, config->database)) { 10 psErrorStackPrint(stderr, "Unable to populate camera from input FITS file\n"); 11 exit(EXIT_FAILURE); 12 } 13 } 14 } 15 16 // Read a specified chip only 17 void readChip(ppFile *file, // File to read 18 ppConfig *config, // Configuration 19 int chipNum // Chip number to read 20 ) 21 { 22 pmFPASelectChip(file->fpa, chipNum); 23 readFPA(file, config); 24 } 25 26 27 void readCell(ppFile *file, ppConfig *config, int chipNum, int cellNum) 28 { 29 pmChip *chip = file->fpa->chips->data[chipNum]; 30 pmChipSelectCell(chip, cellNum); 31 readFPA(file, config); 32 } 33 2 34 3 35 bool ppImageLoop(ppData *data, ppOptions *options, ppConfig *config) … … 5 37 ppDetrend detrend; 6 38 7 if (options->imageLoadDepth == PP_LOAD_FPA) { 39 int processChip = psMetadataLookupS32(NULL, config->arguments, "-chip"); // Chip number to process or -1 40 41 // Load at FPA level if requested 42 if (processChip < 0 && options->imageLoadDepth == PP_LOAD_FPA) { 8 43 psTrace(__func__, 1, "Loading pixels for FPA...\n"); 9 ppImageLoadPixels(data->input, config->database, -1, -1);10 ppImageLoadPixels(data->bias, config->database, -1, -1);11 ppImageLoadPixels(data->dark, config->database, -1, -1);12 ppImageLoadPixels(data->mask, config->database, -1, -1);13 ppImageLoadPixels(data->flat, config->database, -1, -1);44 readFPA(data->input, config); 45 readFPA(data->bias, config); 46 readFPA(data->dark, config); 47 readFPA(data->mask, config); 48 readFPA(data->flat, config); 14 49 } 15 50 16 for (int i = 0; i < data->input->fpa->chips->n; i++) { 17 pmChip *inputChip = data->input->fpa->chips->data[i]; // Chip of interest in input image 18 pmChip *biasChip = data->bias->fpa->chips->data[i]; // Chip of interest in bias image 19 pmChip *darkChip = data->dark->fpa->chips->data[i]; // Chip of interest in dark image 20 pmChip *maskChip = data->mask->fpa->chips->data[i]; // Chip of interest in mask image 21 pmChip *flatChip = data->flat->fpa->chips->data[i]; // Chip of interest in flat image 22 23 printf("Chip %d: %x %x\n", i, inputChip->exists, inputChip->process); 24 if (! inputChip->process) { continue; } 25 51 psArray *chips = data->input->fpa->chips; // Component chips 52 for (int i = 0; i < chips->n; i++) { 53 if (processChip >= 0 && i != processChip) { 54 continue; 55 } 26 56 if (options->imageLoadDepth == PP_LOAD_CHIP) { 27 57 psTrace(__func__, 1, "Loading pixels for chip %d...\n", i); 28 ppImageLoadPixels(data->input, config->database, i, -1);29 ppImageLoadPixels(data->bias, config->database, i, -1);30 ppImageLoadPixels(data->dark, config->database, i, -1);31 ppImageLoadPixels(data->mask, config->database, i, -1);32 ppImageLoadPixels(data->flat, config->database, i, -1);58 readChip(data->input, config, i); 59 readChip(data->bias, config, i); 60 readChip(data->dark, config, i); 61 readChip(data->mask, config, i); 62 readChip(data->flat, config, i); 33 63 } 34 64 35 for (int j = 0; j < inputChip->cells->n; j++) { 65 pmChip *inputChip = chips->data[i]; 66 pmChip *biasChip = data->bias->fpa->chips->data[i]; 67 pmChip *darkChip = data->dark->fpa->chips->data[i]; 68 pmChip *maskChip = data->mask->fpa->chips->data[i]; 69 pmChip *flatChip = data->flat->fpa->chips->data[i]; 70 71 psArray *cells = inputChip->cells; 72 for (int j = 0; j < cells->n; j++) { 36 73 detrend.input = inputChip->cells->data[j]; // Cell of interest in input image 37 74 detrend.bias = biasChip->cells->data[j]; // Cell of interest in bias image … … 40 77 detrend.flat = flatChip->cells->data[j]; // Cell of interest in flat image 41 78 42 printf ("\tCell %d: %x %x\n", j, detrend.input->exists, detrend.input->process);43 79 if (! detrend.input->process) { continue; } 44 80 45 81 if (options->imageLoadDepth == PP_LOAD_CELL) { 46 82 psTrace(__func__, 1, "Loading pixels for chip %d, cell %d...\n", i, j); 47 ppImageLoadPixels(data->input, config->database, i, j);48 ppImageLoadPixels(data->bias, config->database, i, j);49 ppImageLoadPixels(data->dark, config->database, i, j);50 ppImageLoadPixels(data->mask, config->database, i, j);51 ppImageLoadPixels(data->flat, config->database, i, j);83 readCell(data->input, config, i, j); 84 readCell(data->bias, config, i, j); 85 readCell(data->dark, config, i, j); 86 readCell(data->mask, config, i, j); 87 readCell(data->flat, config, i, j); 52 88 } 53 89 54 ppDetrendCell (&detrend, options, config);90 ppDetrendCell(&detrend, options, config); 55 91 } 56 92 }
Note:
See TracChangeset
for help on using the changeset viewer.
