Changeset 23293
- Timestamp:
- Mar 12, 2009, 10:42:30 AM (17 years ago)
- Location:
- trunk/pswarp/src
- Files:
-
- 3 edited
-
pswarpArguments.c (modified) (2 diffs)
-
pswarpLoop.c (modified) (1 diff)
-
pswarpParseCamera.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpArguments.c
r23242 r23293 87 87 88 88 89 if (!pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list")) { 90 psError(PSWARP_ERR_ARGUMENTS, true, "Missing -file (input) or -list (input)"); 91 return NULL; 92 } 93 94 // the mask and variance entries are optional (build from gain?) 95 pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist"); 89 pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list"); 90 pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist"); 96 91 pmConfigFileSetsMD (config->arguments, &argc, argv, "VARIANCE", "-variance", "-variancelist"); 97 92 … … 105 100 106 101 // output position is fixed 107 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);102 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]); 108 103 109 104 // skycell position is fixed 110 105 array = psArrayAlloc(1); 111 array->data[0] = psStringCopy (argv[2]);112 status = psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array);113 psFree (array);106 array->data[0] = psStringCopy(argv[2]); 107 status = psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array); 108 psFree(array); 114 109 115 110 psTrace("pswarp", 1, "Done with pswarpArguments...\n"); 116 return (config);111 return config; 117 112 } 118 113 -
trunk/pswarp/src/pswarpLoop.c
r23170 r23293 83 83 } 84 84 85 if (!pswarpSetMaskBits(config)) { 86 psError(PS_ERR_IO, false, "failed to set mask bits"); 87 return NULL; 88 } 89 85 90 // output mask bits 86 91 psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT"); -
trunk/pswarp/src/pswarpParseCamera.c
r21368 r23293 11 11 */ 12 12 13 # include "pswarp.h" 13 #include "pswarp.h" 14 15 // Define an input file 16 static pmFPAfile *defineInputFile(pmConfig *config,// Configuration 17 pmFPAfile *bind, // File to which to bind, or NULL 18 char *filerule, // Name of file rule 19 char *argname, // Argument name 20 pmFPAfileType fileType // Type of file 21 ) 22 { 23 bool status; 24 25 // look for the file on the RUN metadata 26 pmFPAfile *file = pmFPAfileDefineFromRun(&status, config, filerule); // File to return 27 if (!status) { 28 psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition"); 29 return NULL; 30 } 31 if (!file) { 32 // look for the file on the argument list 33 if (bind) { 34 file = pmFPAfileBindFromArgs(&status, bind, config, filerule, argname); 35 } else { 36 file = pmFPAfileDefineFromArgs(&status, config, filerule, argname); 37 } 38 if (!status) { 39 psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition"); 40 return false; 41 } 42 } 43 44 if (!file) { 45 return NULL; 46 } 47 48 if (file->type != fileType) { 49 psError(PSWARP_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 50 return NULL; 51 } 52 53 return file; 54 } 55 56 57 14 58 15 59 bool pswarpParseCamera(pmConfig *config) 16 60 { 17 bool status; 18 bool mdok; ///< Status of MD lookup 19 pmFPAfile *skycell = NULL; 20 pmConfig *skyConfig = NULL; 61 psAssert(config, "Require configuration"); 21 62 22 // the input image(s) are required arguments; they define the camera 23 status = false; 24 pmFPAfile *input = pmFPAfileDefineFromArgs(&status, config, "PSWARP.INPUT", "INPUT"); 25 if (!input || !status) { 63 // The input image(s) is required: it defines the camera 64 pmFPAfile *input = defineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE); 65 if (!input) { 26 66 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT"); 27 67 return false; 28 68 } 29 69 30 // the input image(s) are required arguments; they define the camera 31 status = false; 32 pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM"); 33 if (!status) { 34 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 35 return NULL; 36 } 37 if (astrom) { 38 psLogMsg ("pswarp", 3, "using supplied astrometry\n"); 39 } else { 40 psLogMsg ("pswarp", 3, "using header astrometry\n"); 70 pmFPAfile *astrom = defineInputFile(config, NULL, "PSWARP.ASTROM", "ASTROM", PM_FPA_FILE_CMF); 71 psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header"); 72 73 pmFPAfile *inMask = defineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK); 74 if (!inMask) { 75 psLogMsg("pswarp", PS_LOG_INFO, "No mask supplied"); 41 76 } 42 77 43 // the mask is not required - but must conform to input camera 44 pmFPAfile *inMask = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.MASK", "MASK"); 45 if (!status) { 46 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 47 return NULL; 48 } 49 if (!inMask) { 50 psLogMsg ("pswarp", 3, "no mask supplied\n"); 78 pmFPAfile *inVariance = defineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE", 79 PM_FPA_FILE_VARIANCE); 80 if (!inVariance) { 81 psLogMsg("pswarp", PS_LOG_INFO, "No variance supplied"); 51 82 } 52 83 53 // loading the mask here should have invoked pmConfigMaskReadHeader() 54 if (!pswarpSetMaskBits (config)) { 55 psError(PS_ERR_IO, false, "failed to set mask bits"); 56 return NULL; 57 } 58 59 pmFPAfile *inVariance = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.VARIANCE", "VARIANCE"); 60 if (!status) { 61 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 62 return NULL; 63 } 64 if (!inVariance) { 65 psLogMsg ("pswarp", 3, "no variance supplied\n"); 66 } 67 68 // the input skycell is a required argument: it defines the output image 84 // The input skycell is a required argument: it defines the output image 69 85 // XXX we may need a different skycell structure here 70 status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 86 pmFPAfile *skycell = NULL; 87 pmConfig *skyConfig = NULL; 88 bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 71 89 if (!status) { 72 90 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL"); … … 81 99 return false; 82 100 } 101 output->save = true; 102 83 103 pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK"); 84 104 if (!outMask) { … … 86 106 return false; 87 107 } 88 89 output->save = true;90 108 outMask->save = true; 91 109 … … 108 126 } 109 127 128 bool mdok; // Status of MD lookup 110 129 if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) { 111 130 // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by … … 160 179 } 161 180 } 162 psFree (chips);181 psFree(chips); 163 182 } 164 183
Note:
See TracChangeset
for help on using the changeset viewer.
