Changeset 27667 for trunk/ppViz/src
- Timestamp:
- Apr 12, 2010, 2:18:52 PM (16 years ago)
- Location:
- trunk/ppViz/src/ppVizPSF
- Files:
-
- 4 edited
-
ppVizPSF.h (modified) (2 diffs)
-
ppVizPSFArguments.c (modified) (2 diffs)
-
ppVizPSFData.c (modified) (2 diffs)
-
ppVizPSFLoop.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppViz/src/ppVizPSF/ppVizPSF.h
r26405 r27667 11 11 psString psfName; // Filename with PSF 12 12 psString sourcesName; // Filename with sources 13 int fakeNum; // Number of fake sources13 int fakeNum; // Number of fake sources 14 14 float fakeMag; // Magnitude of fake sources 15 15 psString outRoot; // Output root name … … 17 17 int size; // Size of PSF image 18 18 float x, y; // Position of fake source 19 psArray *input; // Input positions and magnitudes 19 20 pmConfig *config; // Configuration 20 21 } ppVizPSFData; -
trunk/ppViz/src/ppVizPSF/ppVizPSFArguments.c
r26405 r27667 50 50 psMetadataAddStr(arguments, PS_LIST_TAIL, "-psf", 0, "Filename of PSF", NULL); 51 51 psMetadataAddStr(arguments, PS_LIST_TAIL, "-sources", 0, "Filename of CMF sources", NULL); 52 psMetadataAddStr(arguments, PS_LIST_TAIL, "-input", 0, "Filename with x,y,mag", NULL); 52 53 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fake-num", 0, "Number of fake sources", 0); 53 54 psMetadataAddF32(arguments, PS_LIST_TAIL, "-fake-mag", 0, "Magnitude of fake sources", NAN); … … 68 69 psMetadataAddStr(data->config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Output root name", data->outRoot); 69 70 71 const char *inputName = psMetadataLookupStr(NULL, arguments, "-input"); // Name of input file 72 if (inputName) { 73 data->input = psVectorsReadFromFile(inputName, "%f %f %f"); 74 if (!data->input) { 75 psError(psErrorCodeLast(), false, "Unable to read input file %s", inputName); 76 return false; 77 } 78 } 79 70 80 psTrace("ppVizPSF", 1, "Done reading command-line arguments\n"); 71 81 psFree(arguments); -
trunk/ppViz/src/ppVizPSF/ppVizPSFData.c
r26405 r27667 16 16 psFree(data->sourcesName); 17 17 psFree(data->outRoot); 18 psFree(data->input); 18 19 psFree(data->config); 19 20 return; … … 36 37 data->x = NAN; 37 38 data->y = NAN; 39 data->input = NULL; 38 40 39 41 return data; -
trunk/ppViz/src/ppVizPSF/ppVizPSFLoop.c
r27666 r27667 75 75 psVector *xOffset = NULL, *yOffset = NULL; // Offset from source to true position 76 76 77 if (sources || (data->fakeNum > 0 && isfinite(data->fakeMag))) {77 if (sources || data->input || (data->fakeNum > 0 && isfinite(data->fakeMag))) { 78 78 numCols = psf->fieldNx; 79 79 numRows = psf->fieldNy; … … 82 82 if (sources) { 83 83 psMemIncrRefCounter(sources); 84 psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources", sources->n); 85 } 84 psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources from CMF file", sources->n); 85 } else if (data->input) { 86 psVector *x = data->input->data[0]; // x coordinates 87 psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources from text file", x->n); 88 } 89 86 90 if (data->fakeNum > 0 && isfinite(data->fakeMag)) { 87 91 long numOld = 0; // Old number of sources … … 113 117 } 114 118 } 115 if (!sources ) {119 if (!sources && !data->input) { 116 120 // Generate fake image with only a single realisation of the PSF 117 121 sources = psArrayAlloc(1); … … 137 141 psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC"); 138 142 *trimsec = psRegionSet(0, numCols, 0, numRows); 139 140 // We have trouble with PSF residuals in this case, so don't use them141 psFree(psf->residuals);142 psf->residuals = NULL;143 143 } 144 144 … … 148 148 } 149 149 150 if (!pmReadoutFakeFromSources(readout, numCols, numRows, sources, 0, xOffset, yOffset, psf, 151 data->minFlux, 0, false, true)) { 152 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake readout."); 153 return false; 150 // We have trouble with PSF residuals, so don't use them 151 psFree(psf->residuals); 152 psf->residuals = NULL; 153 154 if (sources) { 155 if (!pmReadoutFakeFromSources(readout, numCols, numRows, sources, 0, xOffset, yOffset, 156 psf, data->minFlux, 0, false, true)) { 157 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake readout."); 158 return false; 159 } 160 } else if (data->input) { 161 psVector *x = data->input->data[0]; // x coordinates 162 psVector *y = data->input->data[1]; // y coordinates 163 psVector *mag = data->input->data[2]; // Magnitudes 164 if (!pmReadoutFakeFromVectors(readout, numCols, numRows, x, y, mag, xOffset, yOffset, 165 psf, data->minFlux, 0, false, true)) { 166 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake readout."); 167 return false; 168 } 154 169 } 155 170
Note:
See TracChangeset
for help on using the changeset viewer.
