Changeset 6624 for trunk/ppImage/src/ppTest.c
- Timestamp:
- Mar 16, 2006, 5:16:20 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppTest.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppTest.c
r6566 r6624 3 3 #include "pslib.h" 4 4 #include "psmodules.h" 5 6 #define RECIPE "PHASE2"7 5 8 6 int main(int argc, char *argv[]) … … 12 10 // ppImageConfig.c 13 11 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 14 pmConfig *config = pmConfigRead(&argc, argv , RECIPE);12 pmConfig *config = pmConfigRead(&argc, argv); 15 13 if (! config) { 16 14 psErrorStackPrint(stderr, "Can't find site configuration!\n"); … … 49 47 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 50 48 51 const char * filename = psMetadataLookupStr(NULL, config->arguments, "-input");52 psLogMsg("ppImage", PS_LOG_INFO, "Opening input image: %s\n", filename);53 psFits * fits = psFitsOpen(filename, "r"); // File handle for FITS file54 if (! fits) {49 const char *inName = psMetadataLookupStr(NULL, config->arguments, "-input"); 50 psLogMsg("ppImage", PS_LOG_INFO, "Opening input image: %s\n", inName); 51 psFits *inFile = psFitsOpen(inName, "r"); // File handle for FITS file 52 if (! inFile) { 55 53 // There's no point in continuing if we can't open the input 56 psErrorStackPrint(stderr, "Can't open input image: %s\n", filename);54 psErrorStackPrint(stderr, "Can't open input image: %s\n", inName); 57 55 exit(EXIT_FAILURE); 58 56 } 59 psMetadata *phu = psFitsReadHeader(NULL, fits); // FITS primary header57 psMetadata *phu = psFitsReadHeader(NULL, inFile); // FITS primary header 60 58 61 59 psMetadata *cameraFormat = pmConfigCameraFormatFromHeader(config, phu); … … 69 67 } 70 68 // Determine the correct recipe to use 71 if (! config->recipe && !pmConfigRecipeFromCamera(config, RECIPE)) {72 // There's no point in continuing if we can't work out what recipe to use69 if (! config->recipes && !pmConfigReadRecipes(config)) { 70 // There's no point in continuing if we can't work out what recipes to use 73 71 psErrorStackPrint(stderr, "Can't find recipe configuration!\n"); 72 exit(EXIT_FAILURE); 73 } 74 75 const char *outName = psMetadataLookupStr(NULL, config->arguments, "-output"); 76 psLogMsg("ppImage", PS_LOG_INFO, "Opening output image: %s\n", outName); 77 psFits *outFile = psFitsOpen(outName, "w"); 78 if (!outFile) { 79 // There's no point in continuing if we can't open the output 80 psErrorStackPrint(stderr, "Can't open output image: %s\n", outName); 74 81 exit(EXIT_FAILURE); 75 82 } … … 83 90 84 91 // Add in a source file 85 pmFPAAddSource(fpa, NULL, NULL, phu, cameraFormat); 92 pmFPAview *view = pmFPAAddSource(fpa, phu, cameraFormat); 93 printf("View chip: %d\n", view->chip); 94 printf("View cell: %d\n", view->cell); 86 95 87 96 // Read the FPA 88 // pmFPARead(fpa, fits, NULL);97 pmFPARead(fpa, inFile, NULL); 89 98 90 99 // How'd we do? 91 pmFPAPrint(fpa, false); 100 pmFPAPrint(fpa, true); 101 #if 1 102 pmChip *chip = fpa->chips->data[13]; 103 psString chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 104 printf("CELL.NAME for chip 13: %s\n", chipName); 105 pmCell *cell = chip->cells->data[0]; 106 psMetadataPrint(cell->concepts, 10); 107 #endif 92 108 93 psFitsClose(fits); 109 110 pmFPAWrite(fpa, outFile, NULL); 111 112 psFitsClose(inFile); 113 psFitsClose(outFile); 94 114 psFree(phu); 95 115 psFree(cameraFormat);
Note:
See TracChangeset
for help on using the changeset viewer.
