Changeset 26982
- Timestamp:
- Feb 17, 2010, 5:36:13 PM (16 years ago)
- Location:
- trunk/ppSub/src
- Files:
-
- 16 edited
-
ppSub.c (modified) (6 diffs)
-
ppSubBackground.c (modified) (2 diffs)
-
ppSubCamera.c (modified) (32 diffs)
-
ppSubDefineOutput.c (modified) (1 diff)
-
ppSubErrorCodes.dat (modified) (1 diff)
-
ppSubLoop.c (modified) (11 diffs)
-
ppSubMakePSF.c (modified) (1 diff)
-
ppSubMatchPSFs.c (modified) (7 diffs)
-
ppSubReadoutInverse.c (modified) (1 diff)
-
ppSubReadoutJpeg.c (modified) (2 diffs)
-
ppSubReadoutPhotometry.c (modified) (2 diffs)
-
ppSubReadoutStats.c (modified) (1 diff)
-
ppSubReadoutSubtract.c (modified) (2 diffs)
-
ppSubSetMasks.c (modified) (4 diffs)
-
ppSubThreshold.c (modified) (4 diffs)
-
ppSubVarianceRescale.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSub.c
r26899 r26982 24 24 int main(int argc, char *argv[]) 25 25 { 26 27 # if 028 26 psLibInit(NULL); 29 pmVisualSetVisual(true);30 for (int order = 2; order < 11; order ++) {31 pmSubtractionDeconvolutionTest (order);32 }33 psLibFinalize();34 exit (1);35 # endif36 37 psExit exitValue = PS_EXIT_SUCCESS; // Exit value38 27 psTimerStart("ppSub"); 39 psLibInit(NULL);40 28 41 29 ppSubData *data = NULL; // Processing data 42 30 pmConfig *config = pmConfigRead(&argc, argv, PPSUB_RECIPE); // Configuration 43 31 if (!config) { 44 psErrorStackPrint(stderr, "Error reading configuration.");45 exitValue = PS_EXIT_CONFIG_ERROR;46 32 goto die; 47 33 } … … 50 36 51 37 if (!pmModelClassInit()) { 52 psErrorStackPrint(stderr, "Error initialising model classes.\n"); 53 exitValue = PS_EXIT_PROG_ERROR; 38 psError(PPSUB_ERR_PROG, false, "Unable to initialise model classes."); 54 39 psFree(config); 55 40 goto die; … … 57 42 58 43 if (!psphotInit()) { 59 psErrorStackPrint(stderr, "Error initialising psphot.\n"); 60 exitValue = PS_EXIT_PROG_ERROR; 44 psError(PPSUB_ERR_PROG, false, "Error initialising psphot."); 61 45 psFree(config); 62 46 goto die; … … 66 50 67 51 if (!ppSubArguments(argc, argv, data)) { 68 psErrorStackPrint(stderr, "Error reading arguments.\n"); 69 exitValue = PS_EXIT_CONFIG_ERROR; 52 psError(PPSUB_ERR_ARGUMENTS, false, "Error reading arguments."); 70 53 goto die; 71 54 } 72 55 73 56 if (!ppSubCamera(data)) { 74 psErrorStackPrint(stderr, "Error setting up camera.\n");75 exitValue = PS_EXIT_CONFIG_ERROR;76 57 goto die; 77 58 } 78 59 79 60 if (!ppSubLoop(data)) { 80 psErrorStackPrint(stderr, "Error performing subtraction.\n");81 exitValue = PS_EXIT_SYS_ERROR;82 61 goto die; 83 62 } … … 87 66 psTimerStop(); 88 67 89 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig"); 90 if (dump_file) { 91 if (!pmConfigDump(data->config, dump_file)) { 92 psErrorStackPrint(stderr, "Unable to dump configuration.\n"); 93 exitValue = PS_EXIT_SYS_ERROR; 68 if (data) { 69 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig"); 70 if (dump_file) { 71 if (!pmConfigDump(data->config, dump_file)) { 72 psError(PPSUB_ERR_IO, false, "Unable to dump configuration."); 73 } 94 74 } 75 psFree(data); 95 76 } 96 psFree(data);97 77 98 78 pmVisualClose(); //close plot windows, if -visual is set … … 101 81 psLibFinalize(); 102 82 83 psExit exitValue = PS_EXIT_SUCCESS; // Exit value for program 84 psErrorCode errorCode = psErrorCodeLast(); // Error code 85 if (errorCode != PS_ERR_NONE) { 86 psErrorStackPrint(stderr, "Unable to perform subtraction."); 87 switch (errorCode) { 88 case PPSUB_ERR_UNKNOWN: 89 case PS_ERR_UNKNOWN: 90 exitValue = PS_EXIT_UNKNOWN_ERROR; 91 break; 92 case PS_ERR_IO: 93 case PS_ERR_DB_CLIENT: 94 case PS_ERR_DB_SERVER: 95 case PS_ERR_BAD_FITS: 96 case PS_ERR_OS_CALL_FAILED: 97 case PPSUB_ERR_IO: 98 exitValue = PS_EXIT_SYS_ERROR; 99 break; 100 case PS_ERR_BAD_PARAMETER_VALUE: 101 case PS_ERR_BAD_PARAMETER_TYPE: 102 case PS_ERR_BAD_PARAMETER_NULL: 103 case PS_ERR_BAD_PARAMETER_SIZE: 104 case PPSUB_ERR_ARGUMENTS: 105 case PPSUB_ERR_CONFIG: 106 exitValue = PS_EXIT_CONFIG_ERROR; 107 break; 108 case PPSUB_ERR_DATA: 109 case PPSUB_ERR_NO_OVERLAP: 110 exitValue = PS_EXIT_DATA_ERROR; 111 break; 112 case PS_ERR_UNEXPECTED_NULL: 113 case PS_ERR_PROGRAMMING: 114 case PPSUB_ERR_NOT_IMPLEMENTED: 115 case PPSUB_ERR_PROG: 116 default: 117 // It's a programming error if we're not dealing with the error correctly 118 exitValue = PS_EXIT_PROG_ERROR; 119 break; 120 } 121 } 122 103 123 exit(exitValue); 104 124 } -
trunk/ppSub/src/ppSubBackground.c
r26899 r26982 43 43 // Create the background model 44 44 if (!psphotModelBackgroundReadoutFileIndex(config, view, "PPSUB.OUTPUT", 0)) { 45 psError( PS_ERR_UNKNOWN, false, "Unable to model background");45 psError(psErrorCodeLast(), false, "Unable to model background"); 46 46 psFree(view); 47 47 return false; … … 50 50 modelRO = pmFPAfileThisReadout(config->files, view, "PSPHOT.BACKMDL"); 51 51 if (!modelRO) { 52 psError( PS_ERR_UNEXPECTED_NULL, true, "Unable to find background model");52 psError(psErrorCodeLast(), false, "Unable to find background model"); 53 53 psFree(view); 54 54 return false; -
trunk/ppSub/src/ppSubCamera.c
r26899 r26982 45 45 46 46 if (!status) { 47 psError( PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);47 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 48 48 return false; 49 49 } … … 52 52 file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return 53 53 if (!status) { 54 psError( PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);54 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 55 55 return NULL; 56 56 } … … 64 64 65 65 if (file->type != fileType) { 66 psError(P S_ERR_UNKNOWN, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));66 psError(PPSUB_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 67 67 return NULL; 68 68 } … … 84 84 pmFPAfileDefineOutput(config, template->fpa, filerule); 85 85 if (!file) { 86 psError( PS_ERR_IO, false, _("Unable to generate output file from %s"), filerule);86 psError(psErrorCodeLast(), false, _("Unable to generate output file from %s"), filerule); 87 87 return NULL; 88 88 } 89 89 if (file->type != fileType) { 90 psError(P S_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));90 psError(PPSUB_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 91 91 return NULL; 92 92 } … … 109 109 pmFPAfile *file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return 110 110 if (!status) { 111 psError( PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);111 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 112 112 return NULL; 113 113 } … … 121 121 file = pmFPAfileDefineOutput(config, bind ? bind->fpa : NULL, filerule); 122 122 if (!status) { 123 psError( PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);123 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 124 124 return false; 125 125 } … … 135 135 136 136 if (file->type != fileType) { 137 psError(P S_ERR_UNKNOWN, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));137 psError(PPSUB_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 138 138 return NULL; 139 139 } … … 154 154 pmFPAfile *input = defineInputFile(&success, config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE); 155 155 if (!success) { 156 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT");156 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT"); 157 157 return false; 158 158 } … … 160 160 defineInputFile(&success, config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK); 161 161 if (!success) { 162 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.MASK");162 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT.MASK"); 163 163 return false; 164 164 } … … 166 166 pmFPAfile *inVar = defineInputFile(&success, config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", PM_FPA_FILE_VARIANCE); 167 167 if (!success) { 168 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.VARIANCE");168 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT.VARIANCE"); 169 169 return false; 170 170 } … … 172 172 defineInputFile(&success, config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF); 173 173 if (!success) { 174 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.SOURCES");174 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT.SOURCES"); 175 175 return false; 176 176 } … … 179 179 pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE); 180 180 if (!success) { 181 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF");181 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF"); 182 182 return false; 183 183 } … … 185 185 defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK); 186 186 if (!success) { 187 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.MASK");187 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.MASK"); 188 188 return false; 189 189 } … … 191 191 pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE); 192 192 if (!success) { 193 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.VARIANCE");193 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.VARIANCE"); 194 194 return false; 195 195 } … … 197 197 defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 198 198 if (!success) { 199 psError( PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.SOURCES");199 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES"); 200 200 return false; 201 201 } … … 204 204 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 205 205 if (!recipe) { 206 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE);206 psError(PPSUB_ERR_CONFIG, false, "Unable to find recipe %s", PPSUB_RECIPE); 207 207 return false; 208 208 } … … 227 227 PM_FPA_FILE_MASK); 228 228 if (!inConvImage || !inConvMask) { 229 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");229 psError(psErrorCodeLast(), false, "Unable to define output files"); 230 230 return false; 231 231 } … … 238 238 PM_FPA_FILE_VARIANCE); 239 239 if (!inConvVar) { 240 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");240 psError(psErrorCodeLast(), false, "Unable to define output files"); 241 241 return false; 242 242 } … … 251 251 PM_FPA_FILE_MASK); 252 252 if (!refConvImage || !refConvMask) { 253 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");253 psError(psErrorCodeLast(), false, "Unable to define output files"); 254 254 return false; 255 255 } … … 262 262 PM_FPA_FILE_VARIANCE); 263 263 if (!refConvVar) { 264 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");264 psError(psErrorCodeLast(), false, "Unable to define output files"); 265 265 return false; 266 266 } … … 274 274 pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK); 275 275 if (!output || !outMask) { 276 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");276 psError(psErrorCodeLast(), false, "Unable to define output files"); 277 277 return false; 278 278 } … … 283 283 PM_FPA_FILE_VARIANCE); 284 284 if (!outVar) { 285 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");285 psError(psErrorCodeLast(), false, "Unable to define output files"); 286 286 return false; 287 287 } … … 296 296 PM_FPA_FILE_MASK); 297 297 if (!inverse || !invMask) { 298 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");298 psError(psErrorCodeLast(), false, "Unable to define output files"); 299 299 return false; 300 300 } … … 305 305 PM_FPA_FILE_VARIANCE); 306 306 if (!invVar) { 307 psError( PS_ERR_UNKNOWN, false, "Unable to define output files");307 psError(psErrorCodeLast(), false, "Unable to define output files"); 308 308 return false; 309 309 } … … 316 316 pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG1"); 317 317 if (!jpeg1) { 318 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG1"));318 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG1")); 319 319 return false; 320 320 } 321 321 if (jpeg1->type != PM_FPA_FILE_JPEG) { 322 psError( PS_ERR_IO, true, "PPSUB.OUTPUT.JPEG1 is not of type JPEG");322 psError(psErrorCodeLast(), true, "PPSUB.OUTPUT.JPEG1 is not of type JPEG"); 323 323 return false; 324 324 } … … 326 326 pmFPAfile *jpeg2 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG2"); 327 327 if (!jpeg2) { 328 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG2"));328 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG2")); 329 329 return false; 330 330 } 331 331 if (jpeg2->type != PM_FPA_FILE_JPEG) { 332 psError( PS_ERR_IO, true, "PPSUB.OUTPUT.JPEG2 is not of type JPEG");332 psError(psErrorCodeLast(), true, "PPSUB.OUTPUT.JPEG2 is not of type JPEG"); 333 333 return false; 334 334 } … … 338 338 pmFPAfile *jpeg3 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.RESID.JPEG"); 339 339 if (!jpeg3) { 340 psError( PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.RESID.JPEG"));340 psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSUB.OUTPUT.RESID.JPEG")); 341 341 return false; 342 342 } 343 343 if (jpeg3->type != PM_FPA_FILE_JPEG) { 344 psError( PS_ERR_IO, true, "PPSUB.OUTPUT.RESID.JPEG is not of type JPEG");344 psError(psErrorCodeLast(), true, "PPSUB.OUTPUT.RESID.JPEG is not of type JPEG"); 345 345 return false; 346 346 } … … 360 360 pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT"); 361 361 if (!psphot) { 362 psError( PS_ERR_IO, false, "Failed to build FPA from PSPHOT.INPUT");362 psError(psErrorCodeLast(), false, "Failed to build FPA from PSPHOT.INPUT"); 363 363 return false; 364 364 } 365 365 if (psphot->type != PM_FPA_FILE_IMAGE) { 366 psError( PS_ERR_IO, true, "PSPHOT.INPUT is not of type IMAGE");366 psError(psErrorCodeLast(), true, "PSPHOT.INPUT is not of type IMAGE"); 367 367 return false; 368 368 } … … 374 374 pmFPAfile *psf = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.PSF.LOAD"); 375 375 if (!psf) { 376 psError( PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");376 psError(psErrorCodeLast(), false, "Failed to build FPA from PSPHOT.PSF.LOAD"); 377 377 return false; 378 378 } 379 379 if (psf->type != PM_FPA_FILE_PSF) { 380 psError( PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");380 psError(psErrorCodeLast(), true, "PSPHOT.PSF.LOAD is not of type PSF"); 381 381 return false; 382 382 } … … 384 384 385 385 if (!psphotDefineFiles(config, psphot)) { 386 psError( PS_ERR_UNKNOWN, false, "Unable to set up psphot files.");386 psError(psErrorCodeLast(), false, "Unable to set up psphot files."); 387 387 return false; 388 388 } … … 395 395 PM_FPA_FILE_CMF); 396 396 if (!outSources) { 397 psError( PS_ERR_UNKNOWN, false, "Unable to set up output source file.");397 psError(psErrorCodeLast(), false, "Unable to set up output source file."); 398 398 return false; 399 399 } … … 404 404 PM_FPA_FILE_CMF); 405 405 if (!invSources) { 406 psError( PS_ERR_UNKNOWN, false, "Unable to set up inverse source file.");406 psError(psErrorCodeLast(), false, "Unable to set up inverse source file."); 407 407 return false; 408 408 } -
trunk/ppSub/src/ppSubDefineOutput.c
r26899 r26982 55 55 56 56 if (!kernels) { 57 hdu = pmHDUFromCell(refConv->parent);57 hdu = pmHDUFromCell(refConv->parent); 58 58 analysis = refConv->analysis; 59 59 kernels = psMetadataLookupPtr(&mdok, analysis, PM_SUBTRACTION_ANALYSIS_KERNEL); 60 60 } 61 61 if (!kernels) { 62 psError(P S_ERR_UNEXPECTED_NULL, true, "Unable to find SUBTRACTION.KERNEL");62 psError(PPSUB_ERR_UNKNOWN, true, "Unable to find SUBTRACTION.KERNEL"); 63 63 psFree(outRO); 64 64 return false; -
trunk/ppSub/src/ppSubErrorCodes.dat
r23740 r26982 10 10 DATA Problem in data values 11 11 NO_OVERLAP No overlap between input and skycell 12 PROG Programming error -
trunk/ppSub/src/ppSubLoop.c
r26899 r26982 43 43 44 44 if (!ppSubSetMasks(config)) { 45 psError( PS_ERR_UNKNOWN, false, "Unable to set masks.");45 psError(psErrorCodeLast(), false, "Unable to set masks."); 46 46 return false; 47 47 } 48 48 49 49 if (!ppSubMatchPSFs(data)) { 50 psError( PS_ERR_UNKNOWN, false, "Unable to match PSFs.");50 psError(psErrorCodeLast(), false, "Unable to match PSFs."); 51 51 return false; 52 52 } … … 57 57 // generate the residual stamp grid for visualization 58 58 if (!ppSubResidualSampleJpeg(config)) { 59 psError( PS_ERR_UNKNOWN, false, "Unable to update.");59 psError(psErrorCodeLast(), false, "Unable to update."); 60 60 return false; 61 61 } … … 71 71 72 72 if (!ppSubLowThreshold(data)) { 73 psError( PS_ERR_UNKNOWN, false, "Unable to threshold images.");73 psError(psErrorCodeLast(), false, "Unable to threshold images."); 74 74 return false; 75 75 } … … 82 82 83 83 if (!ppSubDefineOutput("PPSUB.OUTPUT", config)) { 84 psError( PS_ERR_UNKNOWN, false, "Unable to define output.");84 psError(psErrorCodeLast(), false, "Unable to define output."); 85 85 return false; 86 86 } 87 87 88 88 if (!data->quality && !ppSubMakePSF(data)) { 89 psError( PS_ERR_UNKNOWN, false, "Unable to generate PSF.");89 psError(psErrorCodeLast(), false, "Unable to generate PSF."); 90 90 return false; 91 91 } 92 92 93 93 if (!ppSubReadoutSubtract(config)) { 94 psError( PS_ERR_UNKNOWN, false, "Unable to subtract images.");94 psError(psErrorCodeLast(), false, "Unable to subtract images."); 95 95 return false; 96 96 } … … 104 104 // Higher order background subtraction using psphot 105 105 if (!ppSubBackground(config)) { 106 psError( PS_ERR_UNKNOWN, false, "Unable to subtract background.");106 psError(psErrorCodeLast(), false, "Unable to subtract background."); 107 107 return false; 108 108 } … … 110 110 // Perform Variance correction (rescale within a modest range) 111 111 if (!ppSubVarianceRescale(config)) { 112 psError( PS_ERR_UNKNOWN, false, "Unable to rescale variance.");112 psError(psErrorCodeLast(), false, "Unable to rescale variance."); 113 113 return false; 114 114 } … … 120 120 121 121 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.OUTPUT", data)) { 122 psError( PS_ERR_UNKNOWN, false, "Unable to perform photometry.");122 psError(psErrorCodeLast(), false, "Unable to perform photometry."); 123 123 return false; 124 124 } … … 131 131 // Perform statistics on the cell 132 132 if (!ppSubReadoutStats(data)) { 133 psError( PS_ERR_UNKNOWN, false, "Unable to collect statistics");133 psError(psErrorCodeLast(), false, "Unable to collect statistics"); 134 134 return false; 135 135 } … … 137 137 // generate the binned image used to write the jpeg 138 138 if (!ppSubReadoutJpeg(config)) { 139 psError( PS_ERR_UNKNOWN, false, "Unable to update.");139 psError(psErrorCodeLast(), false, "Unable to update."); 140 140 return false; 141 141 } … … 149 149 150 150 if (data->inverse && !ppSubDefineOutput("PPSUB.INVERSE", config)) { 151 psError( PS_ERR_UNKNOWN, false, "Unable to define inverse.");151 psError(psErrorCodeLast(), false, "Unable to define inverse."); 152 152 return false; 153 153 } 154 154 155 155 if (!ppSubReadoutInverse(config)) { 156 psError( PS_ERR_UNKNOWN, false, "Unable to invert images.");156 psError(psErrorCodeLast(), false, "Unable to invert images."); 157 157 return false; 158 158 } … … 170 170 171 171 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.INVERSE", data)) { 172 psError( PS_ERR_UNKNOWN, false, "Unable to perform photometry.");172 psError(psErrorCodeLast(), false, "Unable to perform photometry."); 173 173 return false; 174 174 } -
trunk/ppSub/src/ppSubMakePSF.c
r26899 r26982 59 59 pmFPAfile *photFile = psMetadataLookupPtr(&mdok, config->files, "PSPHOT.INPUT"); // Photometry file 60 60 if (!pmFPACopy(photFile->fpa, minuendFile->fpa)) { 61 psError(P S_ERR_UNKNOWN, false, "Unable to copy FPA for photometry");61 psError(PPSUB_ERR_CONFIG, false, "Unable to copy FPA for photometry"); 62 62 psFree(view); 63 63 return false; -
trunk/ppSub/src/ppSubMatchPSFs.c
r26974 r26982 56 56 psAssert(photFile, "Need photometry file."); 57 57 if (!pmFPACopy(photFile->fpa, ro->parent->parent->parent)) { 58 psError(P S_ERR_UNKNOWN, false, "Unable to copy FPA for photometry");58 psError(PPSUB_ERR_CONFIG, false, "Unable to copy FPA for photometry"); 59 59 return false; 60 60 } … … 170 170 if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths, inFWHM, refFWHM, 171 171 scaleRef, scaleMin, scaleMax)) { 172 psError(P S_ERR_UNKNOWN, false, "Unable to scale parameters.");172 psError(PPSUB_ERR_DATA, false, "Unable to scale parameters."); 173 173 return false; 174 174 } … … 236 236 psFree(lists); 237 237 if (!detections->allSources) { 238 psError(P S_ERR_UNKNOWN, false, "Unable to merge source lists");238 psError(PPSUB_ERR_DATA, false, "Unable to merge source lists"); 239 239 psFree(detections); 240 240 return false; … … 262 262 pmSubtractionKernelsType type = pmSubtractionKernelsTypeFromString(typeStr); // Type of kernel 263 263 if (type == PM_SUBTRACTION_KERNEL_NONE) { 264 psError(P S_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised kernel type: %s", typeStr);264 psError(PPSUB_ERR_ARGUMENTS, true, "Unrecognised kernel type: %s", typeStr); 265 265 return false; 266 266 } … … 319 319 break; 320 320 default: 321 psError(P S_ERR_BAD_PARAMETER_VALUE, false, "Invalid value for -convolve");321 psError(PPSUB_ERR_ARGUMENTS, false, "Invalid value for -convolve"); 322 322 return false; 323 323 } … … 325 325 326 326 if (!subScaleKernel(data, widths, &size, &footprint)) { 327 psError(P S_ERR_UNKNOWN, false, "Unable to scale kernel parameters");327 psError(PPSUB_ERR_DATA, false, "Unable to scale kernel parameters"); 328 328 return false; 329 329 } … … 391 391 return true; 392 392 } else { 393 psError(P S_ERR_UNKNOWN, false, "Unable to match images.");393 psError(PPSUB_ERR_DATA, false, "Unable to match images."); 394 394 return false; 395 395 } -
trunk/ppSub/src/ppSubReadoutInverse.c
r24255 r26982 34 34 pmHDU *invHDU = invFPA->hdu; // Inverse HDU 35 35 if (!pmAstromWriteWCS(invHDU->header, outFPA, outChip, WCS_TOLERANCE)) { 36 psError( PS_ERR_UNKNOWN, false, "Unable to write WCS astrometry to PPSUB.INVERSE.");36 psError(psErrorCodeLast(), false, "Unable to write WCS astrometry to PPSUB.INVERSE."); 37 37 return false; 38 38 } 39 39 // Read from newly written astrometry so that it exists in the "inverse" FPA (for sources) 40 40 if (!pmAstromReadWCS(invFPA, invChip, invHDU->header, 1.0)) { 41 psError( PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry.");41 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry."); 42 42 return false; 43 43 } -
trunk/ppSub/src/ppSubReadoutJpeg.c
r26899 r26982 33 33 pmReadout *ro1 = pmReadoutAlloc(cell1), *ro2 = pmReadoutAlloc(cell2); // Binned readouts 34 34 if (!pmReadoutRebin(ro1, outRO, maskBad, bin1, bin1)) { 35 psError(P S_ERR_UNKNOWN, false, "Unable to bin output (1st binning)");35 psError(PPSUB_ERR_DATA, false, "Unable to bin output (1st binning)"); 36 36 psFree(ro1); 37 37 psFree(ro2); … … 39 39 } 40 40 if (!pmReadoutRebin(ro2, ro1, 0, bin2, bin2)) { 41 psError(P S_ERR_UNKNOWN, false, "Unable to bin output (2nd binning)");41 psError(PPSUB_ERR_DATA, false, "Unable to bin output (2nd binning)"); 42 42 psFree(ro1); 43 43 psFree(ro2); -
trunk/ppSub/src/ppSubReadoutPhotometry.c
r26899 r26982 53 53 pmFPAfile *inFile = psMetadataLookupPtr(&mdok, config->files, name); // Input file 54 54 if (!pmFPACopy(photFile->fpa, inFile->fpa)) { 55 psError(P S_ERR_UNKNOWN, false, "Unable to copy FPA for photometry");55 psError(PPSUB_ERR_CONFIG, false, "Unable to copy FPA for photometry"); 56 56 psFree(view); 57 57 return false; … … 111 111 if (!data->quality) { 112 112 if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, "PSPHOT.DETECTIONS")) { 113 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to copy PSPHOT.DETECTIONS");113 psError(PPSUB_ERR_PROG, false, "Unable to copy PSPHOT.DETECTIONS"); 114 114 return false; 115 115 } 116 116 if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, "PSPHOT.HEADER")) { 117 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to copy PSPHOT.HEADER");117 psError(PPSUB_ERR_PROG, false, "Unable to copy PSPHOT.HEADER"); 118 118 return false; 119 119 } 120 120 if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, PM_DETEFF_ANALYSIS)) { 121 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to copy Detection Efficiency");121 psError(PPSUB_ERR_PROG, false, "Unable to copy Detection Efficiency"); 122 122 return false; 123 123 } -
trunk/ppSub/src/ppSubReadoutStats.c
r23939 r26982 23 23 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PPSUB.OUTPUT"); // Output file 24 24 if (!output) { 25 psError(P S_ERR_UNEXPECTED_NULL, true, "Unable to find file PPSUB.OUTPUT.\n");25 psError(PPSUB_ERR_PROG, true, "Unable to find file PPSUB.OUTPUT.\n"); 26 26 return false; 27 27 } -
trunk/ppSub/src/ppSubReadoutSubtract.c
r24862 r26982 71 71 pmFPA *outFPA = outFile->fpa; // Output FPA 72 72 if (!pmConceptsCopyFPA(outFPA, inFPA, true, true)) { 73 psError(P S_ERR_UNKNOWN, false, "Unable to copy concepts from input to output.");73 psError(PPSUB_ERR_CONFIG, false, "Unable to copy concepts from input to output."); 74 74 psFree(outRO); 75 75 psFree(view); … … 84 84 psFree(view); 85 85 if (!outHDU || !inHDU) { 86 psError(P S_ERR_UNKNOWN, false, "Unable to find HDU at FPA level to copy astrometry.");86 psError(PPSUB_ERR_PROG, true, "Unable to find HDU at FPA level to copy astrometry."); 87 87 return false; 88 88 } 89 89 if (!pmAstromReadWCS(outFPA, outChip, inHDU->header, 1.0)) { 90 psError( PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry from input FPA.");90 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry from input FPA."); 91 91 return false; 92 92 } 93 93 if (!pmAstromWriteWCS(outHDU->header, outFPA, outChip, WCS_TOLERANCE)) { 94 psError( PS_ERR_UNKNOWN, false, "Unable to write WCS astrometry to output FPA.");94 psError(psErrorCodeLast(), false, "Unable to write WCS astrometry to output FPA."); 95 95 return false; 96 96 } -
trunk/ppSub/src/ppSubSetMasks.c
r23740 r26982 28 28 psImageMaskType maskValue, markValue; // Mask values 29 29 if (!pmConfigMaskSetBits(&maskValue, &markValue, config)) { 30 psError(P S_ERR_UNKNOWN, false, "Unable to determine mask value.");30 psError(PPSUB_ERR_CONFIG, false, "Unable to determine mask value."); 31 31 return false; 32 32 } 33 33 34 34 // Set the mask bits needed by psphot (in psphot recipe) 35 psphotSetMaskRecipe (config, maskValue, markValue);35 psphotSetMaskRecipe(config, maskValue, markValue); 36 36 37 37 // Look up recipe values … … 79 79 // Mask the NAN values 80 80 if (!pmReadoutMaskNonfinite(inRO, satValue)) { 81 psError(P S_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in input.");81 psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in input."); 82 82 return false; 83 83 } 84 84 if (!pmReadoutMaskNonfinite(refRO, satValue)) { 85 psError(P S_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in reference.");85 psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in reference."); 86 86 return false; 87 87 } … … 94 94 psImageInterpolateMode interpMode = psImageInterpolateModeFromString(interpModeStr); // Interp 95 95 if (interpMode == PS_INTERPOLATE_NONE) { 96 psError(P S_ERR_BAD_PARAMETER_VALUE, false, "Unknown interpolation mode: %s", interpModeStr);96 psError(PPSUB_ERR_CONFIG, false, "Unknown interpolation mode: %s", interpModeStr); 97 97 return false; 98 98 } … … 104 104 // Interpolate over bad pixels, so the bad pixels don't explode 105 105 if (!pmReadoutInterpolateBadPixels(inRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) { 106 psError(P S_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for input image.");106 psError(PPSUB_ERR_DATA, false, "Unable to interpolate bad pixels for input image."); 107 107 return false; 108 108 } 109 109 if (!pmReadoutInterpolateBadPixels(refRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) { 110 psError(P S_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for reference image.");110 psError(PPSUB_ERR_DATA, false, "Unable to interpolate bad pixels for reference image."); 111 111 return false; 112 112 } -
trunk/ppSub/src/ppSubThreshold.c
r26899 r26982 45 45 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator 46 46 if (!psImageBackground(stats, NULL, subImage, subMask, maskIgnore, rng)) { 47 psError(P S_ERR_UNKNOWN, false, "Unable to determine threshold.");47 psError(PPSUB_ERR_DATA, false, "Unable to determine threshold."); 48 48 psFree(rng); 49 49 psFree(stats); … … 97 97 pmReadout *in = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); // Input image 98 98 if (!in) { 99 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to find readout.");99 psError(PPSUB_ERR_UNKNOWN, false, "Unable to find readout."); 100 100 return false; 101 101 } … … 103 103 pmReadout *ref = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); // Reference image 104 104 if (!ref) { 105 psError(P S_ERR_UNEXPECTED_NULL, false, "Unable to find readout.");105 psError(PPSUB_ERR_UNKNOWN, false, "Unable to find readout."); 106 106 return false; 107 107 } … … 114 114 psRegion *region = regItem->data.V; // Region of interest 115 115 if (!lowThreshold(in, thresh, maskVal, maskThresh, region, "input convolved image")) { 116 psError( PS_ERR_UNKNOWN, false, "Unable to threshold input image.");116 psError(psErrorCodeLast(), false, "Unable to threshold input image."); 117 117 return false; 118 118 } 119 119 if (!lowThreshold(ref, thresh, maskVal, maskThresh, region, "reference convolved image")) { 120 psError( PS_ERR_UNKNOWN, false, "Unable to threshold input image.");120 psError(psErrorCodeLast(), false, "Unable to threshold input image."); 121 121 return false; 122 122 } -
trunk/ppSub/src/ppSubVarianceRescale.c
r25374 r26982 35 35 int num = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); 36 36 if (!mdok) { 37 psError(P S_ERR_BAD_PARAMETER_VALUE, true, "RENORM.NUM is not set in the recipe");37 psError(PPSUB_ERR_ARGUMENTS, true, "RENORM.NUM is not set in the recipe"); 38 38 return false; 39 39 } 40 40 float minValid = psMetadataLookupF32(&mdok, recipe, "RENORM.MIN"); 41 41 if (!mdok) { 42 psError(P S_ERR_BAD_PARAMETER_VALUE, true, "RENORM.MIN is not set in the recipe");42 psError(PPSUB_ERR_ARGUMENTS, true, "RENORM.MIN is not set in the recipe"); 43 43 return false; 44 44 } 45 45 float maxValid = psMetadataLookupF32(&mdok, recipe, "RENORM.MAX"); 46 46 if (!mdok) { 47 psError(P S_ERR_BAD_PARAMETER_VALUE, true, "RENORM.MAX is not set in the recipe");47 psError(PPSUB_ERR_ARGUMENTS, true, "RENORM.MAX is not set in the recipe"); 48 48 return false; 49 49 }
Note:
See TracChangeset
for help on using the changeset viewer.
