Changeset 26899 for trunk/ppSub/src/ppSubCamera.c
- Timestamp:
- Feb 10, 2010, 7:42:02 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubCamera.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubCamera.c
r26571 r26899 23 23 24 24 // Define an input file 25 static pmFPAfile *defineInputFile(pmConfig *config,// Configuration 25 static pmFPAfile *defineInputFile(bool *success, 26 pmConfig *config,// Configuration 26 27 pmFPAfile *bind, // File to which to bind, or NULL 27 28 char *filerule, // Name of file rule … … 32 33 bool status; 33 34 35 *success = false; 36 34 37 pmFPAfile *file = NULL; 38 35 39 // look for the file on the argument list 36 40 if (bind) { … … 39 43 file = pmFPAfileDefineFromArgs(&status, config, filerule, argname); 40 44 } 45 41 46 if (!status) { 42 47 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule); … … 53 58 54 59 if (!file) { 60 // no file defined 61 *success = true; 55 62 return NULL; 56 63 } … … 61 68 } 62 69 70 *success = true; 63 71 return file; 64 72 } … … 137 145 bool ppSubCamera(ppSubData *data) 138 146 { 147 bool success = true; 148 139 149 psAssert(data, "Require processing data"); 140 150 pmConfig *config = data->config; … … 142 152 143 153 // Input image 144 pmFPAfile *input = defineInputFile( config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE);145 if (! input) {154 pmFPAfile *input = defineInputFile(&success, config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE); 155 if (!success) { 146 156 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT"); 147 157 return false; 148 158 } 149 defineInputFile(config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK); 150 pmFPAfile *inVar = defineInputFile(config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", 151 PM_FPA_FILE_VARIANCE); 152 defineInputFile(config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF); 159 160 defineInputFile(&success, config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK); 161 if (!success) { 162 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.MASK"); 163 return false; 164 } 165 166 pmFPAfile *inVar = defineInputFile(&success, config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", PM_FPA_FILE_VARIANCE); 167 if (!success) { 168 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.VARIANCE"); 169 return false; 170 } 171 172 defineInputFile(&success, config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF); 173 if (!success) { 174 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.SOURCES"); 175 return false; 176 } 153 177 154 178 // Reference image 155 pmFPAfile *ref = defineInputFile( config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);156 if (! ref) {179 pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE); 180 if (!success) { 157 181 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF"); 158 182 return false; 159 183 } 160 defineInputFile(config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK); 161 pmFPAfile *refVar = defineInputFile(config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", 162 PM_FPA_FILE_VARIANCE); 163 defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 164 184 185 defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK); 186 if (!success) { 187 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.MASK"); 188 return false; 189 } 190 191 pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE); 192 if (!success) { 193 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.VARIANCE"); 194 return false; 195 } 196 197 defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 198 if (!success) { 199 psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.SOURCES"); 200 return false; 201 } 165 202 166 203 // Now that the camera has been determined, we can read the recipe … … 298 335 jpeg2->save = true; 299 336 337 // Output residual JPEG 338 pmFPAfile *jpeg3 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.RESID.JPEG"); 339 if (!jpeg3) { 340 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.RESID.JPEG")); 341 return false; 342 } 343 if (jpeg3->type != PM_FPA_FILE_JPEG) { 344 psError(PS_ERR_IO, true, "PPSUB.OUTPUT.RESID.JPEG is not of type JPEG"); 345 return false; 346 } 347 jpeg3->save = true; 348 300 349 // Output subtraction kernel 301 350 pmFPAfile *kernel = defineCalcFile(config, NULL, "PPSUB.OUTPUT.KERNELS", PM_FPA_FILE_SUBKERNEL); … … 306 355 307 356 // psPhot input 308 if (data->photometry ) {357 if (data->photometry || 1) { 309 358 psphotModelClassInit(); // load implementation-specific models 310 359 … … 318 367 return false; 319 368 } 369 // specify the number of psphot input images 370 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1); 320 371 pmFPAfileActivate(config->files, false, "PSPHOT.INPUT"); 321 372 322 // Internal -ishfile for getting the PSF from the minuend323 pmFPAfile *psf = pmFPAfileDefine OutputFromFile(config, psphot, "PSPHOT.PSF.LOAD");373 // Internal file for getting the PSF from the minuend 374 pmFPAfile *psf = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.PSF.LOAD"); 324 375 if (!psf) { 325 376 psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
Note:
See TracChangeset
for help on using the changeset viewer.
