Changeset 27517 for branches/eam_branches/20100225/ppSub/src
- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 9 edited
- 2 copied
-
. (modified) (1 prop)
-
ppSub/src (modified) (1 prop)
-
ppSub/src/Makefile.am (modified) (3 diffs)
-
ppSub/src/ppSub.c (modified) (2 diffs)
-
ppSub/src/ppSub.h (modified) (1 diff)
-
ppSub/src/ppSubArguments.c (modified) (1 diff)
-
ppSub/src/ppSubConvolve.c (copied) (copied from trunk/ppSub/src/ppSubConvolve.c )
-
ppSub/src/ppSubExit.c (copied) (copied from trunk/ppSub/src/ppSubExit.c )
-
ppSub/src/ppSubFiles.c (modified) (1 diff)
-
ppSub/src/ppSubMatchPSFs.c (modified) (4 diffs)
-
ppSub/src/ppSubVarianceRescale.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ppSub/src
- Property svn:ignore
-
old new 13 13 ppSubErrorCodes.c 14 14 ppSubVersionDefinitions.h 15 ppSubConvolve
-
- Property svn:ignore
-
branches/eam_branches/20100225/ppSub/src/Makefile.am
r24862 r27517 1 bin_PROGRAMS = ppSub ppSubKernel 1 bin_PROGRAMS = ppSub ppSubKernel ppSubConvolve 2 2 3 3 if HAVE_SVNVERSION … … 34 34 ppSubData.c \ 35 35 ppSubErrorCodes.c \ 36 ppSubExit.c \ 36 37 ppSubFiles.c \ 37 38 ppSubLoop.c \ … … 53 54 ppSubKernel_SOURCES = \ 54 55 ppSubKernel.c 56 57 ppSubConvolve_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPSUB_CFLAGS) 58 ppSubConvolve_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PPSUB_LIBS) 59 60 ppSubConvolve_SOURCES = \ 61 ppSubConvolve.c \ 62 ppSubExit.c \ 63 ppSubVersion.c 55 64 56 65 noinst_HEADERS = \ -
branches/eam_branches/20100225/ppSub/src/ppSub.c
r27078 r27517 26 26 psLibInit(NULL); 27 27 psTimerStart("ppSub"); 28 29 pmErrorRegister(); 30 ppSubErrorRegister(); 31 psphotErrorRegister(); 28 32 29 33 ppSubData *data = NULL; // Processing data … … 63 67 64 68 die: 65 if (data && data->stats && data->statsFile) { 66 psString stats = psMetadataConfigFormat(data->stats); // Statistics to output 67 if (!stats || strlen(stats) == 0) { 68 psError(PPSUB_ERR_IO, false, "Unable to format statistics file"); 69 } else if (fprintf(data->statsFile, "%s", stats) != strlen(stats)) { 70 psError(PPSUB_ERR_IO, true, "Unable to write statistics file"); 69 { 70 psExit exitValue = ppSubExitCode(PS_EXIT_SUCCESS); // Exit code 71 72 if (data && data->stats && data->statsFile) { 73 psString stats = psMetadataConfigFormat(data->stats); // Statistics to output 74 if (!stats || strlen(stats) == 0) { 75 psError(PPSUB_ERR_IO, false, "Unable to format statistics file"); 76 } else if (fprintf(data->statsFile, "%s", stats) != strlen(stats)) { 77 psError(PPSUB_ERR_IO, true, "Unable to write statistics file"); 78 } 79 psFree(stats); 80 if (fclose(data->statsFile) == EOF) { 81 psError(PPSUB_ERR_IO, true, "Unable to close statistics file"); 82 } 83 data->statsFile = NULL; 84 pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName); 85 exitValue = ppSubExitCode(exitValue); 71 86 } 72 psFree(stats); 73 if (fclose(data->statsFile) == EOF) { 74 psError(PPSUB_ERR_IO, true, "Unable to close statistics file"); 87 88 if (config && !ppSubFilesIterateUp(config, PPSUB_FILES_ALL)) { 89 psError(psErrorCodeLast(), false, "Unable to close files."); 90 exitValue = ppSubExitCode(exitValue); 91 pmFPAfileFreeSetStrict(false); 75 92 } 76 data->statsFile = NULL; 77 pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName); 93 94 if (data) { 95 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig"); 96 if (dump_file) { 97 if (!pmConfigDump(data->config, dump_file)) { 98 psError(PPSUB_ERR_IO, false, "Unable to dump configuration."); 99 exitValue = ppSubExitCode(exitValue); 100 } 101 } 102 psFree(data); 103 } 104 105 psTrace("ppSub", 1, "Finished at %f sec\n", psTimerMark("ppSub")); 106 psTimerStop(); 107 108 pmVisualClose(); //close plot windows, if -visual is set 109 pmModelClassCleanup(); 110 pmConfigDone(); 111 psLibFinalize(); 112 113 exitValue = ppSubExitCode(exitValue); 114 exit(exitValue); 78 115 } 79 80 if (data) {81 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig");82 if (dump_file) {83 if (!pmConfigDump(data->config, dump_file)) {84 psError(PPSUB_ERR_IO, false, "Unable to dump configuration.");85 }86 }87 psFree(data);88 }89 90 psExit exitValue = PS_EXIT_SUCCESS; // Exit value for program91 psErrorCode errorCode = psErrorCodeLast(); // Error code92 if (errorCode != PS_ERR_NONE) {93 psErrorStackPrint(stderr, "Unable to perform subtraction.");94 switch (errorCode) {95 case PPSUB_ERR_UNKNOWN:96 case PS_ERR_UNKNOWN:97 exitValue = PS_EXIT_UNKNOWN_ERROR;98 break;99 case PS_ERR_IO:100 case PS_ERR_DB_CLIENT:101 case PS_ERR_DB_SERVER:102 case PS_ERR_BAD_FITS:103 case PS_ERR_OS_CALL_FAILED:104 case PPSUB_ERR_IO:105 exitValue = PS_EXIT_SYS_ERROR;106 break;107 case PS_ERR_BAD_PARAMETER_VALUE:108 case PS_ERR_BAD_PARAMETER_TYPE:109 case PS_ERR_BAD_PARAMETER_NULL:110 case PS_ERR_BAD_PARAMETER_SIZE:111 case PPSUB_ERR_ARGUMENTS:112 case PPSUB_ERR_CONFIG:113 exitValue = PS_EXIT_CONFIG_ERROR;114 break;115 case PPSUB_ERR_DATA:116 case PPSUB_ERR_NO_OVERLAP:117 exitValue = PS_EXIT_DATA_ERROR;118 break;119 case PS_ERR_UNEXPECTED_NULL:120 case PS_ERR_PROGRAMMING:121 case PPSUB_ERR_NOT_IMPLEMENTED:122 case PPSUB_ERR_PROG:123 default:124 // It's a programming error if we're not dealing with the error correctly125 exitValue = PS_EXIT_PROG_ERROR;126 break;127 }128 }129 130 if (config && !ppSubFilesIterateUp(config, PPSUB_FILES_ALL)) {131 psErrorStackPrint(stderr, "Unable to close files.");132 }133 134 psTrace("ppSub", 1, "Finished at %f sec\n", psTimerMark("ppSub"));135 psTimerStop();136 137 pmVisualClose(); //close plot windows, if -visual is set138 pmModelClassCleanup();139 pmConfigDone();140 psLibFinalize();141 142 exit(exitValue);143 116 } -
branches/eam_branches/20100225/ppSub/src/ppSub.h
r26899 r27517 165 165 bool ppSubCopyPSF (pmFPAfile *output, pmFPAfile *input, pmFPAview *view); 166 166 167 /// Return appropriate exit code 168 psExit ppSubExitCode(psExit exitValue // Current exit value 169 ); 170 167 171 ///@} 168 172 #endif -
branches/eam_branches/20100225/ppSub/src/ppSubArguments.c
r27080 r27517 141 141 if (data->statsName && strlen(data->statsName) > 0) { 142 142 psString resolved = pmConfigConvertFilename(data->statsName, config, true, true); // Resolved filename 143 if (!resolved) { 144 psError(psErrorCodeLast(), false, "Unable to resolve statistics file: %s", data->statsName); 145 return false; 146 } 143 147 data->statsFile = fopen(resolved, "w"); 144 148 if (!data->statsFile) { -
branches/eam_branches/20100225/ppSub/src/ppSubFiles.c
r26899 r27517 183 183 } 184 184 185 psFree(view); 186 187 // Disable writing of data now that we've written things out 188 if (files & PPSUB_FILES_CONV) { 189 pmFPAview *view = ppSubViewReadout(); // View to readout 190 { 191 pmReadout *ro = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); 192 if (ro) { 193 ro->data_exists = ro->parent->data_exists = ro->parent->parent->data_exists = false; 194 } 195 } 196 { 197 pmReadout *ro = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); 198 if (ro) { 199 ro->data_exists = ro->parent->data_exists = ro->parent->parent->data_exists = false; 200 } 201 } 202 psFree(view); 203 } 204 if (files & PPSUB_FILES_SUB) { 205 pmFPAview *view = ppSubViewReadout(); // View to readout 206 pmReadout *ro = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); 207 if (ro) { 208 ro->data_exists = ro->parent->data_exists = ro->parent->parent->data_exists = false; 209 } 210 psFree(view); 211 } 212 // Disable writing of data now that we've written things out 213 if (files & PPSUB_FILES_INV) { 214 pmFPAview *view = ppSubViewReadout(); // View to readout 215 pmReadout *ro = pmFPAfileThisReadout(config->files, view, "PPSUB.INVERSE"); 216 if (ro) { 217 ro->data_exists = ro->parent->data_exists = ro->parent->parent->data_exists = false; 218 } 219 psFree(view); 220 } 221 185 222 ppSubFilesActivate(config, PPSUB_FILES_ALL, false); 186 223 -
branches/eam_branches/20100225/ppSub/src/ppSubMatchPSFs.c
r26982 r27517 331 331 int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads 332 332 if (threads > 0) { 333 pmSubtractionThreadsInit( inRO, refRO);333 pmSubtractionThreadsInit(); 334 334 } 335 335 … … 340 340 psImageCovarianceTruncate(refRO->covariance, COVAR_FRAC); 341 341 } 342 343 // Data doesn't exist until it's created in pmSubtraction... 344 inConv->data_exists = inConv->parent->data_exists = inConv->parent->parent->data_exists = false; 345 refConv->data_exists = refConv->parent->data_exists = refConv->parent->parent->data_exists = false; 342 346 343 347 // Match the PSFs … … 349 353 } else { 350 354 success = pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize, 351 spacing, threshold, detections ->allSources, data->stamps, type, size, order,352 widths, orders, inner, ringsOrder, binning, penalty, optimum,353 optWidths, optOrder, optThresh, iter, rej, normFrac,354 sysErr, skyErr, kernelErr, covarFrac, maskVal, maskBad, maskPoor,355 poorFrac, badFrac, subMode);355 spacing, threshold, detections ? detections->allSources : NULL, 356 data->stamps, type, size, order, widths, orders, inner, ringsOrder, 357 binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, 358 normFrac, sysErr, skyErr, kernelErr, covarFrac, 359 maskVal, maskBad, maskPoor, poorFrac, badFrac, subMode); 356 360 } 357 361 … … 376 380 377 381 psFree(optWidths); 378 pmSubtractionThreadsFinalize( inRO, refRO);382 pmSubtractionThreadsFinalize(); 379 383 380 384 if (!success) { -
branches/eam_branches/20100225/ppSub/src/ppSubVarianceRescale.c
r26982 r27517 54 54 pmReadout *readout = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); // Output image 55 55 56 if (!readout->variance) { 57 // Nothing to renormalise 58 psWarning("Renormalisation of the variance requested, but no variance provided."); 59 return true; 60 } 61 56 62 return pmReadoutVarianceRenormalise(readout, maskBad, num, minValid, maxValid); 57 63 }
Note:
See TracChangeset
for help on using the changeset viewer.
