Changeset 23955
- Timestamp:
- Apr 23, 2009, 2:54:27 PM (17 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 2 edited
-
camera/pmReadoutFake.c (modified) (2 diffs)
-
imcombine/pmPSFEnvelope.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmReadoutFake.c
r21104 r23955 29 29 #define MAX_AXIS_RATIO 20.0 // Maximum axis ratio for PSF model 30 30 #define SOURCE_MASK (PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_CR_LIMIT) // Mask to apply to input sources 31 #define MODEL_MASK (PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE | \ 32 PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_LIMITS) // Mask to apply to models 31 33 32 34 … … 123 125 124 126 pmModel *fakeModel = pmModelFromPSFforXY(psf, x, y, flux); 125 if (!fakeModel) { 127 if (!fakeModel || (fakeModel->flags & MODEL_MASK)) { 128 psFree(fakeModel); 126 129 continue; 127 130 } -
trunk/psModules/src/imcombine/pmPSFEnvelope.c
r23242 r23955 33 33 34 34 35 //#define TESTING // Enable test output35 #define TESTING // Enable test output 36 36 #define PEAK_FLUX 1.0e4 // Peak flux for each source 37 37 #define SKY_VALUE 0.0e0 // Sky value for fake image … … 113 113 pmReadout *fakeRO = pmReadoutAlloc(NULL); // Fake readout 114 114 float maxRadius = 0.0; // Maximum radius of sources 115 psVector *numbers = psVectorAlloc(numFakes, PS_TYPE_S32); // Number of detections for each source 116 psVectorInit(numbers, 0); 115 117 for (int i = 0; i < inputs->n; i++) { 116 118 pmPSF *psf = inputs->data[i]; // PSF of interest … … 127 129 psFree(xOffset); 128 130 psFree(fakes); 131 psFree(numbers); 129 132 psf->residuals = resid; 130 133 return NULL; … … 140 143 141 144 double flux = fakeRO->image->data.F32[(int)y][(int)x]; 145 if (flux > 0) { 146 // The source is present 147 numbers->data.S32[j]++; 148 } 142 149 float norm = PEAK_FLUX / flux; // Normalisation for source 143 150 psRegion region = psRegionSet(x - radius, x + radius, y - radius, y + radius); // PSF region … … 190 197 191 198 // Put the fake sources onto a full-size image 199 psArray *goodFakes = psArrayAllocEmpty(numFakes); // Good fake sources 192 200 pmReadout *readout = pmReadoutAlloc(NULL); // Readout to contain envelope pixels 193 201 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); … … 195 203 for (int i = 0; i < numFakes; i++) { 196 204 pmSource *source = fakes->data[i]; // Fake source 205 if (numbers->data.S32[i] > 0) { 206 psArrayAdd(goodFakes, goodFakes->n, source); 207 } 208 197 209 // Position of source on fake image 198 210 int xFake = source->peak->x + xOffset->data.S32[i]; … … 213 225 psFree(yOffset); 214 226 psFree(fakes); 227 psFree(numbers); 215 228 return NULL; 216 229 } … … 220 233 psFree(yOffset); 221 234 psFree(envelope); 235 psFree(numbers); 236 237 psFree(fakes); 238 fakes = goodFakes; 239 numFakes = fakes->n; 222 240 223 241 // XXX Setting the variance seems to be an art
Note:
See TracChangeset
for help on using the changeset viewer.
