Changeset 27004 for trunk/ppStack/src/ppStackCamera.c
- Timestamp:
- Feb 18, 2010, 6:42:01 PM (16 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStackCamera.c (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppStackVersionDefinitions.h 12 ppStackErrorCodes.c 13 ppStackErrorCodes.h
-
- Property svn:ignore
-
trunk/ppStack/src/ppStackCamera.c
r26898 r27004 30 30 pmFPAfileDefineFromArgs(&found, config, name, "FILENAMES"); 31 31 if (!file || !found) { 32 psError( PS_ERR_UNKNOWN, false, "Unable to define file %s from %s", name, filename);32 psError(psErrorCodeLast(), false, "Unable to define file %s from %s", name, filename); 33 33 return NULL; 34 34 } 35 35 if (file->type != type) { 36 psError(PS_ERR_IO, true, "%s is not of type %s", name, pmFPAfileStringFromType(type));36 psError(PS_ERR_IO, PPSTACK_ERR_CONFIG, "%s is not of type %s", name, pmFPAfileStringFromType(type)); 37 37 return NULL; 38 38 } … … 53 53 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // Recipe for ppSim 54 54 if (!recipe) { 55 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSTACK_RECIPE);55 psError(PPSTACK_ERR_CONFIG, false, "Unable to find recipe %s", PPSTACK_RECIPE); 56 56 return false; 57 57 } … … 67 67 "PPSTACK.INPUT.MASK"); // Input masks 68 68 if (!status) { 69 psError( PS_ERR_UNKNOWN, false, "Unable to define input masks from RUN metadata.");69 psError(psErrorCodeLast(), false, "Unable to define input masks from RUN metadata."); 70 70 psFree(runImages); 71 71 return false; … … 76 76 "PPSTACK.INPUT.VARIANCE"); // Input variances 77 77 if (!status) { 78 psError( PS_ERR_UNKNOWN, false, "Unable to define input variances from RUN metadata.");78 psError(psErrorCodeLast(), false, "Unable to define input variances from RUN metadata."); 79 79 psFree(runImages); 80 80 return false; … … 88 88 "PPSTACK.INPUT.SOURCES"); // Input sources 89 89 if (!status) { 90 psError( PS_ERR_UNKNOWN, false, "Unable to define input sources from RUN metadata.");90 psError(psErrorCodeLast(), false, "Unable to define input sources from RUN metadata."); 91 91 psFree(runImages); 92 92 return false; 93 93 } 94 94 if (!runSrc) { 95 psError(P S_ERR_UNEXPECTED_NULL, true, "Unable to define input sources from RUN metadata.");95 psError(PPSTACK_ERR_CONFIG, true, "Unable to define input sources from RUN metadata."); 96 96 psFree(runImages); 97 97 return false; … … 104 104 "PPSTACK.INPUT.PSF"); // Input PSFs 105 105 if (!status) { 106 psError( PS_ERR_UNKNOWN, false, "Unable to define input PSFs from RUN metadata.");106 psError(psErrorCodeLast(), false, "Unable to define input PSFs from RUN metadata."); 107 107 psFree(runImages); 108 108 return false; … … 118 118 "PPSTACK.CONV.KERNEL"); // Conv'n kernels 119 119 if (!status) { 120 psError(PS_ERR_UNKNOWN, false, "Unable to define convolution kernels from RUN metadata."); 120 psError(psErrorCodeLast(), false, 121 "Unable to define convolution kernels from RUN metadata."); 121 122 psFree(runImages); 122 123 return false; 123 124 } 124 125 if (!runKernel) { 125 psError(P S_ERR_UNEXPECTED_NULL, true,126 psError(PPSTACK_ERR_CONFIG, true, 126 127 "Unable to define convolution kernels from RUN metadata."); 127 128 psFree(runImages); … … 137 138 psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); // The inputs info 138 139 if (!inputs) { 139 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to find inputs.");140 psError(PPSTACK_ERR_ARGUMENTS, false, "Unable to find inputs."); 140 141 return false; 141 142 } … … 145 146 while ((item = psMetadataGetAndIncrement(iter))) { 146 147 if (item->type != PS_DATA_METADATA) { 147 psError(P S_ERR_BAD_PARAMETER_TYPE, true,148 psError(PPSTACK_ERR_ARGUMENTS, true, 148 149 "Component %s of the input metadata is not of type METADATA", item->name); 149 150 psFree(iter); … … 155 156 psString image = psMetadataLookupStr(NULL, input, "IMAGE"); // Name of image 156 157 if (!image || strlen(image) == 0) { 157 psError(P S_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks IMAGE of type STR", item->name);158 psError(PPSTACK_ERR_ARGUMENTS, true, "Component %s lacks IMAGE of type STR", item->name); 158 159 psFree(iter); 159 160 return false; … … 169 170 image, PM_FPA_FILE_IMAGE); // File for image 170 171 if (!imageFile) { 171 psError( PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, image);172 psError(psErrorCodeLast(), false, "Unable to define file from image %d (%s)", i, image); 172 173 return false; 173 174 } … … 175 176 if (mask && strlen(mask) > 0 && 176 177 !defineFile(config, imageFile, "PPSTACK.INPUT.MASK", mask, PM_FPA_FILE_MASK)) { 177 psError( PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask);178 psError(psErrorCodeLast(), false, "Unable to define file from mask %d (%s)", i, mask); 178 179 return false; 179 180 } … … 183 184 if (!defineFile(config, imageFile, "PPSTACK.INPUT.VARIANCE", variance, 184 185 PM_FPA_FILE_VARIANCE)) { 185 psError( PS_ERR_UNKNOWN, false,186 psError(psErrorCodeLast(), false, 186 187 "Unable to define file from variance %d (%s)", i, variance); 187 188 return false; … … 195 196 havePSFs = true; 196 197 if (!defineFile(config, imageFile, "PPSTACK.INPUT.PSF", psf, PM_FPA_FILE_PSF)) { 197 psError( PS_ERR_UNKNOWN, false, "Unable to define file from psf %d (%s)", i, psf);198 psError(psErrorCodeLast(), false, "Unable to define file from psf %d (%s)", i, psf); 198 199 return false; 199 200 } 200 201 } 201 202 } else if (havePSFs) { 202 psError(P S_ERR_UNEXPECTED_NULL, true, "Unable to find PSF %d", i);203 psError(PPSTACK_ERR_CONFIG, true, "Unable to find PSF %d", i); 203 204 return false; 204 205 } 205 206 206 207 if (!sources || strlen(sources) == 0) { 207 psError(P S_ERR_UNEXPECTED_NULL, true, "SOURCES not provided for file %d", i);208 psError(PPSTACK_ERR_CONFIG, true, "SOURCES not provided for file %d", i); 208 209 return false; 209 210 } 210 211 if (!defineFile(config, imageFile, "PPSTACK.INPUT.SOURCES", sources, PM_FPA_FILE_CMF)) { 211 psError( PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)",212 psError(psErrorCodeLast(), false, "Unable to define file from sources %d (%s)", 212 213 i, sources); 213 214 return false; … … 217 218 pmFPAfile *kernel = pmFPAfileDefineOutput(config, imageFile->fpa, "PPSTACK.CONV.KERNEL"); 218 219 if (!kernel) { 219 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.CONV.KERNEL")); 220 psError(psErrorCodeLast(), false, 221 "Unable to generate output file from PPSTACK.CONV.KERNEL"); 220 222 return false; 221 223 } … … 235 237 pmFPA *outFPA = pmFPAConstruct(config->camera, config->cameraName); // FPA to contain the output 236 238 if (!outFPA) { 237 psError( PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration.");239 psError(psErrorCodeLast(), false, "Unable to construct an FPA from camera configuration."); 238 240 return false; 239 241 } … … 241 243 psFree(outFPA); // Drop reference 242 244 if (!output) { 243 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.OUTPUT"));245 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.OUTPUT")); 244 246 return false; 245 247 } 246 248 if (output->type != PM_FPA_FILE_IMAGE) { 247 psError(P S_ERR_IO, true, "PPSTACK.OUTPUT is not of type IMAGE");249 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.OUTPUT is not of type IMAGE"); 248 250 return false; 249 251 } … … 251 253 252 254 if (!pmFPAAddSourceFromFormat(outFPA, "Stack", output->format)) { 253 psError( PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");255 psError(psErrorCodeLast(), false, "Unable to generate output FPA."); 254 256 return false; 255 257 } … … 258 260 pmFPAfile *outMask = pmFPAfileDefineOutput(config, output->fpa, "PPSTACK.OUTPUT.MASK"); 259 261 if (!outMask) { 260 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.OUTPUT.MASK"));262 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.OUTPUT.MASK")); 261 263 return false; 262 264 } 263 265 if (outMask->type != PM_FPA_FILE_MASK) { 264 psError(P S_ERR_IO, true, "PPSTACK.OUTPUT.MASK is not of type MASK");266 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.OUTPUT.MASK is not of type MASK"); 265 267 return false; 266 268 } … … 271 273 pmFPAfile *outVariance = pmFPAfileDefineOutput(config, output->fpa, "PPSTACK.OUTPUT.VARIANCE"); 272 274 if (!outVariance) { 273 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.OUTPUT.VARIANCE"));275 psError(psErrorCodeLast(), false, "Unable to generate output file from PPSTACK.OUTPUT.VARIANCE"); 274 276 return false; 275 277 } 276 278 if (outVariance->type != PM_FPA_FILE_VARIANCE) { 277 psError(P S_ERR_IO, true, "PPSTACK.OUTPUT.VARIANCE is not of type VARIANCE");279 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.OUTPUT.VARIANCE is not of type VARIANCE"); 278 280 return false; 279 281 } … … 284 286 pmFPAfile *targetPSF = pmFPAfileDefineOutput(config, output->fpa, "PPSTACK.TARGET.PSF"); 285 287 if (!targetPSF) { 286 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.TARGET.PSF"));288 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.TARGET.PSF")); 287 289 return false; 288 290 } 289 291 if (targetPSF->type != PM_FPA_FILE_PSF) { 290 psError(P S_ERR_IO, true, "PPSTACK.TARGET.PSF is not of type PSF");292 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.TARGET.PSF is not of type PSF"); 291 293 return false; 292 294 } … … 298 300 pmFPA *unconvFPA = pmFPAConstruct(config->camera, config->cameraName); // FPA to contain unconvolved output 299 301 if (!unconvFPA) { 300 psError( PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration.");302 psError(psErrorCodeLast(), false, "Unable to construct an FPA from camera configuration."); 301 303 return false; 302 304 } … … 304 306 psFree(unconvFPA); // Drop reference 305 307 if (!unConv) { 306 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.UNCONV"));308 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.UNCONV")); 307 309 return false; 308 310 } 309 311 if (unConv->type != PM_FPA_FILE_IMAGE) { 310 psError(P S_ERR_IO, true, "PPSTACK.UNCONV is not of type IMAGE");312 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.UNCONV is not of type IMAGE"); 311 313 return false; 312 314 } … … 314 316 315 317 if (!pmFPAAddSourceFromFormat(unconvFPA, "Stack", unConv->format)) { 316 psError( PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");318 psError(psErrorCodeLast(), false, "Unable to generate output FPA."); 317 319 return false; 318 320 } … … 321 323 pmFPAfile *unconvMask = pmFPAfileDefineOutput(config, unconvFPA, "PPSTACK.UNCONV.MASK"); 322 324 if (!unconvMask) { 323 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.UNCONV.MASK"));325 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.UNCONV.MASK")); 324 326 return false; 325 327 } 326 328 if (unconvMask->type != PM_FPA_FILE_MASK) { 327 psError(P S_ERR_IO, true, "PPSTACK.UNCONV.MASK is not of type MASK");329 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.UNCONV.MASK is not of type MASK"); 328 330 return false; 329 331 } … … 334 336 pmFPAfile *unconvVariance = pmFPAfileDefineOutput(config, unconvFPA, "PPSTACK.UNCONV.VARIANCE"); 335 337 if (!unconvVariance) { 336 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.UNCONV.VARIANCE"));338 psError(psErrorCodeLast(), false, "Unable to generate output file from PPSTACK.UNCONV.VARIANCE"); 337 339 return false; 338 340 } 339 341 if (unconvVariance->type != PM_FPA_FILE_VARIANCE) { 340 psError(P S_ERR_IO, true, "PPSTACK.UNCONV.VARIANCE is not of type VARIANCE");342 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.UNCONV.VARIANCE is not of type VARIANCE"); 341 343 return false; 342 344 } … … 348 350 pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSTACK.OUTPUT.JPEG1"); 349 351 if (!jpeg1) { 350 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.OUTPUT.JPEG1"));352 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.OUTPUT.JPEG1")); 351 353 return false; 352 354 } 353 355 if (jpeg1->type != PM_FPA_FILE_JPEG) { 354 psError(P S_ERR_IO, true, "PPSTACK.OUTPUT.JPEG1 is not of type JPEG");356 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.OUTPUT.JPEG1 is not of type JPEG"); 355 357 return false; 356 358 } … … 358 360 pmFPAfile *jpeg2 = pmFPAfileDefineOutput(config, NULL, "PPSTACK.OUTPUT.JPEG2"); 359 361 if (!jpeg2) { 360 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.OUTPUT.JPEG2"));362 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSTACK.OUTPUT.JPEG2")); 361 363 return false; 362 364 } 363 365 if (jpeg2->type != PM_FPA_FILE_JPEG) { 364 psError(P S_ERR_IO, true, "PPSTACK.OUTPUT.JPEG2 is not of type JPEG");366 psError(PPSTACK_ERR_CONFIG, true, "PPSTACK.OUTPUT.JPEG2 is not of type JPEG"); 365 367 return false; 366 368 } … … 377 379 pmFPAfile *psphotInput = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT"); 378 380 if (!psphotInput) { 379 psError( PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT"));380 return false; 381 } 382 // specify the number of psphot input images383 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);381 psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT")); 382 return false; 383 } 384 // specify the number of psphot input images 385 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1); 384 386 385 387 // Define associated psphot input/output files 386 388 if (!psphotDefineFiles(config, psphotInput)) { 387 psError( PSPHOT_ERR_CONFIG, false,389 psError(psErrorCodeLast(), false, 388 390 "Trouble defining the additional input/output files for psphot"); 389 391 return false; … … 393 395 pmFPAfile *outPSF = pmFPAfileDefineOutputFromFile(config, output, "PSPHOT.PSF.SAVE"); 394 396 if (!outPSF) { 395 psError( PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.PSF.SAVE"));397 psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.PSF.SAVE")); 396 398 return false; 397 399 } 398 400 if (outPSF->type != PM_FPA_FILE_PSF) { 399 psError(P S_ERR_IO, true, "PSPHOT.PSF.SAVE is not of type PSF");401 psError(PPSTACK_ERR_CONFIG, true, "PSPHOT.PSF.SAVE is not of type PSF"); 400 402 return false; 401 403 }
Note:
See TracChangeset
for help on using the changeset viewer.
