Changeset 23753 for trunk/ppSub/src
- Timestamp:
- Apr 8, 2009, 2:33:59 PM (17 years ago)
- Location:
- trunk/ppSub/src
- Files:
-
- 3 deleted
- 12 edited
-
Makefile.am (modified) (1 diff)
-
ppSub.c (modified) (5 diffs)
-
ppSub.h (modified) (8 diffs)
-
ppSubArguments.c (modified) (2 diffs)
-
ppSubCamera.c (modified) (1 diff)
-
ppSubData.c (modified) (4 diffs)
-
ppSubLoop.c (modified) (7 diffs)
-
ppSubMakePSF.c (modified) (2 diffs)
-
ppSubMatchPSFs.c (modified) (2 diffs)
-
ppSubReadout.c (modified) (1 diff)
-
ppSubReadoutPhotometry.c (modified) (3 diffs)
-
ppSubReadoutRenorm.c (deleted)
-
ppSubReadoutStats.c (modified) (1 diff)
-
ppSubReadoutUpdate.c (deleted)
-
ppSubVarianceFactors.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/Makefile.am
r23740 r23753 32 32 ppSubReadoutStats.c \ 33 33 ppSubReadoutSubtract.c \ 34 ppSubSetMasks.c \ 35 ppSubReadoutRenorm.c \ 36 ppSubVarianceFactors.c 34 ppSubSetMasks.c 37 35 38 36 ppSubKernel_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSUB_CFLAGS) -
trunk/ppSub/src/ppSub.c
r23740 r23753 41 41 psErrorStackPrint(stderr, "Error initialising model classes.\n"); 42 42 exitValue = PS_EXIT_PROG_ERROR; 43 psFree(config); 43 44 goto die; 44 45 } … … 47 48 psErrorStackPrint(stderr, "Error initialising psphot.\n"); 48 49 exitValue = PS_EXIT_PROG_ERROR; 50 psFree(config); 49 51 goto die; 50 52 } 51 53 52 data = ppSubDataAlloc( ); // Processing data54 data = ppSubDataAlloc(config); 53 55 54 if (!ppSubArguments(argc, argv, config,data)) {56 if (!ppSubArguments(argc, argv, data)) { 55 57 psErrorStackPrint(stderr, "Error reading arguments.\n"); 56 58 exitValue = PS_EXIT_CONFIG_ERROR; … … 58 60 } 59 61 60 if (!ppSubCamera( config,data)) {62 if (!ppSubCamera(data)) { 61 63 psErrorStackPrint(stderr, "Error setting up camera.\n"); 62 64 exitValue = PS_EXIT_CONFIG_ERROR; … … 64 66 } 65 67 66 if (!ppSubLoop( config,data)) {68 if (!ppSubLoop(data)) { 67 69 psErrorStackPrint(stderr, "Error performing subtraction.\n"); 68 70 exitValue = PS_EXIT_SYS_ERROR; … … 75 77 76 78 psFree(data); 77 psFree(config);78 79 79 80 pmVisualClose(); //close plot windows, if -visual is set -
trunk/ppSub/src/ppSub.h
r23740 r23753 40 40 /// Data for processing 41 41 typedef struct { 42 pmConfig *config; // Configuration 42 43 psErrorCode quality; // Quality code; 0 for no problem 43 44 bool photometry; // Perform photometry? … … 45 46 psString stamps; // Stamps file 46 47 pmPSF *psf; // Point Spread Function 48 psString statsName; // Name of statistics file 47 49 FILE *statsFile; // Statistics file 48 50 psMetadata *stats; // Statistics … … 50 52 51 53 /// Constructor 52 ppSubData *ppSubDataAlloc(void); 54 ppSubData *ppSubDataAlloc(pmConfig *config ///< Configuration 55 ); 53 56 54 57 /// Setup the arguments parsing 55 58 bool ppSubArguments(int argc, char *argv[], ///< Command-line arguments 56 pmConfig *config, ///< Configuration57 59 ppSubData *data ///< Processing data 58 60 ); 59 61 60 62 /// Parse the camera input 61 bool ppSubCamera(pmConfig *config, ///< Configuration 62 ppSubData *data ///< Processing data 63 bool ppSubCamera(ppSubData *data ///< Processing data 63 64 ); 64 65 65 66 /// Loop over the FPA hierarchy 66 bool ppSubLoop(pmConfig *config, ///< Configuration 67 ppSubData *data ///< Processing data 68 ); 69 70 /// Perform PSF-matched image subtraction on the readout 71 bool ppSubReadout(pmConfig *config, ///< Configuration 72 ppSubData *data ///< Processing data 67 bool ppSubLoop(ppSubData *data ///< Processing data 73 68 ); 74 69 … … 79 74 /// Generate the PSF-matching kernel and convolve the images as needed. Most of this function involves 80 75 /// looking up the parameters in the recipe and supplying them to the function pmSubtractionMatch() 81 bool ppSubMatchPSFs(pmConfig *config, ///< Configuration 82 ppSubData *data ///< Processing data 76 bool ppSubMatchPSFs(ppSubData *data ///< Processing data 83 77 ); 84 78 … … 89 83 90 84 /// Photometry stage 1: measure the PSF from the minuend image 91 bool ppSubMakePSF(pmConfig *config, ///< Configuration 92 ppSubData *data ///< Processing data 85 bool ppSubMakePSF(ppSubData *data ///< Processing data 93 86 ); 94 87 … … 100 93 /// Photometry stage 2: find and measure sources on the subtracted image 101 94 bool ppSubReadoutPhotometry(const char *name, ///< Name of file to photometer 102 pmConfig *config, ///< Configuration103 95 ppSubData *data ///< Processing data 104 );105 106 /// Renormalize, update headers and generate JPEGs107 bool ppSubReadoutUpdate(pmConfig *config, ///< Configuration108 ppSubData *data ///< Processing data109 96 ); 110 97 … … 121 108 122 109 /// Mark the data quality as bad and prepare to suspend processing 123 void ppSubDataQuality(pmConfig *config, ///< Configuration 124 ppSubData *data, ///< Processing data 110 void ppSubDataQuality(ppSubData *data, ///< Processing data 125 111 psErrorCode error,///< Error code 126 112 ppSubFiles files ///< Files to deactivate … … 150 136 151 137 /// Collect statistics 152 bool ppSubReadoutStats(pmConfig *config,// Configuration 153 ppSubData *data // Processing data 138 bool ppSubReadoutStats(ppSubData *data // Processing data 154 139 ); 155 140 -
trunk/ppSub/src/ppSubArguments.c
r23740 r23753 57 57 } 58 58 59 bool ppSubArguments(int argc, char *argv[], p mConfig *config, ppSubData *data)59 bool ppSubArguments(int argc, char *argv[], ppSubData *data) 60 60 { 61 assert(data); 62 pmConfig *config = data->config; 61 63 assert(config); 62 64 … … 127 129 data->stamps = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-stamps")); 128 130 129 const char *statsName = psMetadataLookupStr(NULL, arguments, "-stats"); // Filename for statistics130 if ( statsName && strlen(statsName) > 0) {131 psString resolved = pmConfigConvertFilename( statsName, config, true, true); // Resolved filename131 data->statsName = psMetadataLookupStr(NULL, arguments, "-stats"); // Filename for statistics 132 if (data->statsName && strlen(data->statsName) > 0) { 133 psString resolved = pmConfigConvertFilename(data->statsName, config, true, true); // Resolved filename 132 134 data->statsFile = fopen(resolved, "w"); 133 135 if (!data->statsFile) { -
trunk/ppSub/src/ppSubCamera.c
r23740 r23753 134 134 135 135 136 bool ppSubCamera(p mConfig *config, ppSubData *data)136 bool ppSubCamera(ppSubData *data) 137 137 { 138 psAssert(data, "Require processing data"); 139 pmConfig *config = data->config; 138 140 psAssert(config, "Require configuration"); 139 141 -
trunk/ppSub/src/ppSubData.c
r23740 r23753 22 22 psFree(stats); 23 23 fclose(data->statsFile); 24 pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName); 24 25 } 26 psFree(data->statsName); 25 27 psFree(data->stamps); 26 28 psFree(data->psf); 27 29 psFree(data->stats); 30 31 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig"); 32 if (dump_file) { 33 pmConfigDump(data->config, dump_file); 34 } 35 psFree(data->config); 36 28 37 return; 29 38 } 30 39 31 ppSubData *ppSubDataAlloc( void)40 ppSubData *ppSubDataAlloc(pmConfig *config) 32 41 { 33 42 ppSubData *data = psAlloc(sizeof(ppSubData)); // Processing data, to return 34 43 psMemSetDeallocator(data, (psFreeFunc)subDataFree); 35 44 45 data->config = config; 36 46 data->quality = 0; 37 47 data->photometry = false; … … 39 49 data->stamps = NULL; 40 50 data->psf = NULL; 51 data->statsName = NULL; 41 52 data->statsFile = NULL; 42 53 data->stats = psMetadataAlloc(); … … 47 58 48 59 49 void ppSubDataQuality(p mConfig *config, ppSubData *data, psErrorCode error, ppSubFiles files)60 void ppSubDataQuality(ppSubData *data, psErrorCode error, ppSubFiles files) 50 61 { 51 psAssert(config, "Require configuration");52 62 psAssert(data, "Require processing data"); 53 63 … … 57 67 } 58 68 59 ppSubFilesActivate( config, files, false);69 ppSubFilesActivate(data->config, files, false); 60 70 61 71 psErrorClear(); -
trunk/ppSub/src/ppSubLoop.c
r23740 r23753 20 20 #include "ppSub.h" 21 21 22 bool ppSubLoop(p mConfig *config, ppSubData *data)22 bool ppSubLoop(ppSubData *data) 23 23 { 24 psAssert(data, "Require processing data"); 25 pmConfig *config = data->config; // Configuration 24 26 psAssert(config, "Require configuration."); 25 27 … … 45 47 } 46 48 47 if (!ppSubMatchPSFs( config,data)) {49 if (!ppSubMatchPSFs(data)) { 48 50 psError(PS_ERR_UNKNOWN, false, "Unable to match PSFs."); 49 51 return false; … … 74 76 } 75 77 76 if (!data->quality && !ppSubMakePSF( config,data)) {78 if (!data->quality && !ppSubMakePSF(data)) { 77 79 psError(PS_ERR_UNKNOWN, false, "Unable to generate PSF."); 78 80 return false; … … 101 103 } 102 104 103 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.OUTPUT", config,data)) {105 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.OUTPUT", data)) { 104 106 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry."); 105 107 return false; … … 112 114 113 115 // Perform statistics on the cell 114 if (!ppSubReadoutStats( config,data)) {116 if (!ppSubReadoutStats(data)) { 115 117 psError(PS_ERR_UNKNOWN, false, "Unable to collect statistics"); 116 118 return false; … … 150 152 } 151 153 152 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.INVERSE", config,data)) {154 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.INVERSE", data)) { 153 155 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry."); 154 156 return false; … … 168 170 } 169 171 170 psString dump_file = psMetadataLookupStr(NULL, config->arguments, "-dumpconfig");171 if (dump_file) {172 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file173 pmConfigDump(config, input->fpa, dump_file);174 }175 176 172 return true; 177 173 } -
trunk/ppSub/src/ppSubMakePSF.c
r23740 r23753 22 22 #include "ppSub.h" 23 23 24 bool ppSubMakePSF(p mConfig *config, ppSubData *data)24 bool ppSubMakePSF(ppSubData *data) 25 25 { 26 psAssert(data, "Require processing data"); 27 pmConfig *config = data->config; // Configuration 26 28 psAssert(config, "Require configuration"); 27 29 … … 105 107 psErrorStackPrint(stderr, "Unable to determine PSF"); 106 108 psWarning("Unable to determine PSF --- suspect bad data quality."); 107 ppSubDataQuality( config,data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV);109 ppSubDataQuality(data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV); 108 110 psFree(view); 109 111 return true; -
trunk/ppSub/src/ppSubMatchPSFs.c
r23740 r23753 22 22 #include "ppSub.h" 23 23 24 bool ppSubMatchPSFs(p mConfig *config, ppSubData *data)24 bool ppSubMatchPSFs(ppSubData *data) 25 25 { 26 psAssert(data, "Require processing data"); 27 pmConfig *config = data->config; // Configuration 26 28 psAssert(config, "Require configuration"); 27 29 … … 161 163 psErrorStackPrint(stderr, "Unable to find stamps"); 162 164 psWarning("Unable to find stamps --- suspect bad data quality."); 163 ppSubDataQuality( config,data, error, PPSUB_FILES_ALL);165 ppSubDataQuality(data, error, PPSUB_FILES_ALL); 164 166 return true; 165 167 } else { -
trunk/ppSub/src/ppSubReadout.c
r23740 r23753 21 21 #include "ppSub.h" 22 22 23 bool ppSubReadout(const char *name, bool reverse, p mConfig *config, ppSubData *data, const pmFPAview *view)23 bool ppSubReadout(const char *name, bool reverse, ppSubData *data, const pmFPAview *view) 24 24 { 25 psAssert(data, "Require processing data"); 26 pmConfig *config = data->config; // Configuration 27 psAssert(config, "Require configuration"); 28 25 29 psAssert(name, "Require name"); 26 psAssert(config, "Require configuration");27 psAssert(data, "Require data");28 30 psAssert(view, "Require view"); 29 31 -
trunk/ppSub/src/ppSubReadoutPhotometry.c
r23740 r23753 22 22 #include "ppSub.h" 23 23 24 bool ppSubReadoutPhotometry(const char *name, p mConfig *config, ppSubData *data)24 bool ppSubReadoutPhotometry(const char *name, ppSubData *data) 25 25 { 26 psAssert(data, "Require processing data"); 27 pmConfig *config = data->config; // Configuration 26 28 psAssert(config, "Require configuration"); 27 29 … … 51 53 psErrorStackPrint(stderr, "No PSF available"); 52 54 psWarning("No PSF available --- suspect bad data quality."); 53 ppSubDataQuality( config,data, psErrorCodeLast(), PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV);55 ppSubDataQuality(data, psErrorCodeLast(), PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV); 54 56 return true; 55 57 } … … 94 96 psErrorStackPrint(stderr, "Unable to perform photometry on image"); 95 97 psWarning("Unable to perform photometry on image --- suspect bad data quality."); 96 ppSubDataQuality( config,data, psErrorCodeLast(), PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV);98 ppSubDataQuality(data, psErrorCodeLast(), PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV); 97 99 } 98 100 -
trunk/ppSub/src/ppSubReadoutStats.c
r23740 r23753 10 10 11 11 12 bool ppSubReadoutStats(p mConfig *config, ppSubData *data)12 bool ppSubReadoutStats(ppSubData *data) 13 13 { 14 psAssert(data, "Require processing data"); 15 pmConfig *config = data->config; // Configuration 14 16 psAssert(config, "Require configuration"); 15 psAssert(data, "Require data");16 17 17 18 if (!data->statsFile) {
Note:
See TracChangeset
for help on using the changeset viewer.
