Changeset 25027 for branches/pap/psModules/src/camera/pmReadoutFake.c
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/psModules
- Property svn:mergeinfo deleted
-
branches/pap/psModules/src/camera/pmReadoutFake.c
r21104 r25027 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 … … 80 82 81 83 int numSources = sources->n; // Number of stars 82 83 float flux0 = NAN; // Flux for central intensity of 1.084 if (normalisePeak) {85 pmModel *fakeModel = pmModelFromPSFforXY(psf, (float)numCols / 2.0, (float)numRows / 2.0,86 1.0); // Fake model, with central intensity of 1.087 psAssert(fakeModel, "failed to generate model: should this be an error or not?");88 89 if (circularise && !circulariseModel(fakeModel)) {90 psError(PS_ERR_UNKNOWN, false, "Unable to circularise PSF model.");91 psFree(fakeModel);92 return false;93 }94 95 flux0 = fakeModel->modelFlux(fakeModel->params); // Flux for central intensity of 1.096 psFree(fakeModel);97 }98 99 84 for (int i = 0; i < numSources; i++) { 100 85 pmSource *source = sources->data[i]; // Source of interest … … 118 103 119 104 float flux = powf(10.0, -0.4 * source->psfMag); // Flux of source 105 120 106 if (normalisePeak) { 121 flux /= flux0; 107 // Normalise flux 108 pmModel *normModel = pmModelFromPSFforXY(psf, x, y, 1.0); // Model for normalisation 109 if (!normModel || (normModel->flags & MODEL_MASK)) { 110 psFree(normModel); 111 continue; 112 } 113 if (circularise && !circulariseModel(normModel)) { 114 psError(PS_ERR_UNKNOWN, false, "Unable to circularise PSF model."); 115 psFree(normModel); 116 return false; 117 } 118 119 flux /= normModel->modelFlux(normModel->params); 120 psFree(normModel); 122 121 } 123 122 124 123 pmModel *fakeModel = pmModelFromPSFforXY(psf, x, y, flux); 125 if (!fakeModel) { 124 if (!fakeModel || (fakeModel->flags & MODEL_MASK)) { 125 psFree(fakeModel); 126 126 continue; 127 127 }
Note:
See TracChangeset
for help on using the changeset viewer.
