Changeset 25230
- Timestamp:
- Sep 1, 2009, 4:50:46 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 edited
- 2 copied
-
psModules/src/camera/pmReadoutFake.c (modified) (6 diffs, 1 prop)
-
psphot/doc/efficiency.txt (copied) (copied from branches/pap/psphot/doc/efficiency.txt )
-
psphot/src/psphotFake.c (copied) (copied from branches/pap/psphot/src/psphotFake.c ) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmReadoutFake.c
-
Property svn:mergeinfo
set to
/branches/eam_branches/20090522/psModules/src/camera/pmReadoutFake.c merged eligible /branches/pap/psModules/src/camera/pmReadoutFake.c merged eligible
r23960 r25230 50 50 } 51 51 52 bool pmReadoutFakeFromSources(pmReadout *readout, int numCols, int numRows, const psArray *sources, 53 const psVector *xOffset, const psVector *yOffset, const pmPSF *psf, 54 float minFlux, int radius, bool circularise, bool normalisePeak) 52 53 bool pmReadoutFakeFromVectors(pmReadout *readout, int numCols, int numRows, 54 const psVector *x, const psVector *y, const psVector *mag, 55 const psVector *xOffset, const psVector *yOffset, 56 const pmPSF *psf, float minFlux, int radius, 57 bool circularise, bool normalisePeak) 55 58 { 56 59 PS_ASSERT_PTR_NON_NULL(readout, false); 57 60 PS_ASSERT_INT_LARGER_THAN(numCols, 0, false); 58 61 PS_ASSERT_INT_LARGER_THAN(numRows, 0, false); 59 PS_ASSERT_ARRAY_NON_NULL(sources, false); 60 62 PS_ASSERT_VECTOR_NON_NULL(x, false); 63 PS_ASSERT_VECTOR_TYPE(x, PS_TYPE_F32, false); 64 PS_ASSERT_VECTOR_NON_NULL(y, false); 65 PS_ASSERT_VECTOR_TYPE(y, PS_TYPE_F32, false); 66 PS_ASSERT_VECTORS_SIZE_EQUAL(y, x, false); 67 PS_ASSERT_VECTOR_NON_NULL(mag, false); 68 PS_ASSERT_VECTOR_TYPE(mag, PS_TYPE_F32, false); 69 PS_ASSERT_VECTORS_SIZE_EQUAL(mag, x, false); 70 long numSources = x->n; // Number of sources 61 71 if (xOffset || yOffset) { 62 72 PS_ASSERT_VECTOR_NON_NULL(xOffset, false); … … 64 74 PS_ASSERT_VECTORS_SIZE_EQUAL(xOffset, yOffset, false); 65 75 PS_ASSERT_VECTOR_TYPE(xOffset, PS_TYPE_S32, false); 66 PS_ASSERT_VECTOR_TYPE _EQUAL(xOffset, yOffset, false);67 if (xOffset->n != sources->n) {76 PS_ASSERT_VECTOR_TYPE(yOffset, PS_TYPE_S32, false); 77 if (xOffset->n != numSources) { 68 78 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 69 79 "Number of offset vectors (%ld) and sources (%ld) doesn't match", 70 xOffset->n, sources->n);80 xOffset->n, numSources); 71 81 return false; 72 82 } … … 81 91 psImageInit(readout->image, 0); 82 92 83 int numSources = sources->n; // Number of stars 84 for (int i = 0; i < numSources; i++) { 85 pmSource *source = sources->data[i]; // Source of interest 86 if (!source) { 87 continue; 88 } 89 if (source->mode & SOURCE_MASK) { 90 continue; 91 } 92 if (!isfinite(source->psfMag)) { 93 continue; 94 } 95 float x, y; // Coordinates of source 96 if (source->modelPSF) { 97 x = source->modelPSF->params->data.F32[PM_PAR_XPOS]; 98 y = source->modelPSF->params->data.F32[PM_PAR_YPOS]; 99 } else { 100 x = source->peak->xf; 101 y = source->peak->yf; 102 } 103 104 float flux = powf(10.0, -0.4 * source->psfMag); // Flux of source 93 for (long i = 0; i < numSources; i++) { 94 float flux = powf(10.0, -0.4 * mag->data.F32[i]); // Flux of source 95 float xSrc = x->data.F32[i], ySrc = y->data.F32[i]; // Coordinates of source 105 96 106 97 if (normalisePeak) { … … 137 128 138 129 pmSource *fakeSource = pmSourceAlloc(); // Fake source to generate 139 fakeSource->peak = pmPeakAlloc(x , y, fakeModel->params->data.F32[PM_PAR_I0], PM_PEAK_LONE);130 fakeSource->peak = pmPeakAlloc(xSrc, ySrc, fakeModel->params->data.F32[PM_PAR_I0], PM_PEAK_LONE); 140 131 float fakeRadius = radius > 0 ? radius : 141 132 PS_MAX(1.0, fakeModel->modelRadius(fakeModel->params, minFlux)); // Radius of fake source 142 133 143 134 if (xOffset) { 144 if (!pmSourceDefinePixels(fakeSource, readout, x + xOffset->data.S32[i],145 y + yOffset->data.S32[i], fakeRadius)) {135 if (!pmSourceDefinePixels(fakeSource, readout, xSrc + xOffset->data.S32[i], 136 ySrc + yOffset->data.S32[i], fakeRadius)) { 146 137 psErrorClear(); 147 138 continue; … … 153 144 } 154 145 } else { 155 if (!pmSourceDefinePixels(fakeSource, readout, x , y, fakeRadius)) {146 if (!pmSourceDefinePixels(fakeSource, readout, xSrc, ySrc, fakeRadius)) { 156 147 psErrorClear(); 157 148 continue; … … 168 159 return true; 169 160 } 161 162 163 bool pmReadoutFakeFromSources(pmReadout *readout, int numCols, int numRows, const psArray *sources, 164 const psVector *xOffset, const psVector *yOffset, const pmPSF *psf, 165 float minFlux, int radius, bool circularise, bool normalisePeak) 166 { 167 PS_ASSERT_ARRAY_NON_NULL(sources, false); 168 169 int numSources = sources->n; // Number of stars 170 psVector *x = psVectorAllocEmpty(numSources, PS_TYPE_F32); 171 psVector *y = psVectorAllocEmpty(numSources, PS_TYPE_F32); 172 psVector *mag = psVectorAllocEmpty(numSources, PS_TYPE_F32); 173 174 int numGood = 0; // Number of good sources 175 for (int i = 0; i < numSources; i++) { 176 pmSource *source = sources->data[i]; // Source of interest 177 if (!source) { 178 continue; 179 } 180 if (source->mode & SOURCE_MASK) { 181 continue; 182 } 183 if (!isfinite(source->psfMag)) { 184 continue; 185 } 186 float xSrc, ySrc; // Coordinates of source 187 if (source->modelPSF) { 188 xSrc = source->modelPSF->params->data.F32[PM_PAR_XPOS]; 189 ySrc = source->modelPSF->params->data.F32[PM_PAR_YPOS]; 190 } else { 191 xSrc = source->peak->xf; 192 ySrc = source->peak->yf; 193 } 194 195 x->data.F32[numGood] = xSrc; 196 y->data.F32[numGood] = ySrc; 197 mag->data.F32[numGood] = source->psfMag; 198 numGood++; 199 } 200 x->n = numGood; 201 y->n = numGood; 202 mag->n = numGood; 203 204 bool status = pmReadoutFakeFromVectors(readout, numCols, numRows, x, y, mag, xOffset, yOffset, psf, 205 minFlux, radius, circularise, normalisePeak); 206 psFree(x); 207 psFree(y); 208 psFree(mag); 209 210 return status; 211 } -
Property svn:mergeinfo
set to
-
trunk/psphot/src/psphotFake.c
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot/src/psphotFake.c merged eligible /branches/eam_branches/20090522/psphot/src/psphotFake.c 24238-24573
-
Property svn:mergeinfo
set to (toggle deleted branches)
Note:
See TracChangeset
for help on using the changeset viewer.
