Changeset 16841 for trunk/psModules/src/detrend
- Timestamp:
- Mar 6, 2008, 10:47:50 AM (18 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/Makefile.am
r14505 r16841 13 13 pmDetrendDB.c \ 14 14 pmShutterCorrection.c \ 15 pmShifts.c 15 pmShifts.c \ 16 pmDark.c 16 17 17 18 # pmSkySubtract.c … … 27 28 pmDetrendDB.h \ 28 29 pmShutterCorrection.h \ 29 pmShifts.h 30 pmShifts.h \ 31 pmDark.h 30 32 31 33 # pmSkySubtract.h -
trunk/psModules/src/detrend/pmBias.c
r15162 r16841 113 113 } 114 114 if (dark) { 115 psWarning("Dark processing is now available using pmDark --- perhaps you should use that instead?"); 115 116 PS_ASSERT_PTR_NON_NULL(view, false); 116 117 PS_ASSERT_IMAGE_NON_NULL(dark->image, false); … … 121 122 122 123 if (!pmOverscanSubtract (in, overscanOpts)) { 123 return false;124 return false; 124 125 } 125 126 … … 148 149 } 149 150 150 float darkNorm = 1.0;151 float darkNorm = 1.0; 151 152 float inNorm = pmFPADarkNorm(in->parent->parent->parent, view, inTime); 152 153 153 // if we have a normalized dark exposure, we simply multiply the master by inNorm. if154 // we do not have a normalized exposure, we have to scale the master as well. XXX do155 // we need to explicitly identify the master as normalized?154 // if we have a normalized dark exposure, we simply multiply the master by inNorm. if 155 // we do not have a normalized exposure, we have to scale the master as well. XXX do 156 // we need to explicitly identify the master as normalized? 156 157 157 if (darkTime != 1.0) {158 darkNorm = pmFPADarkNorm(dark->parent->parent->parent, view, darkTime);159 }158 if (darkTime != 1.0) { 159 darkNorm = pmFPADarkNorm(dark->parent->parent->parent, view, darkTime); 160 } 160 161 161 if (isnan(inNorm) || isnan(darkNorm)) {162 if (isnan(inNorm) || isnan(darkNorm)) { 162 163 psError(PS_ERR_UNKNOWN, false, "Unable to determine dark normalisations."); 163 164 return false; -
trunk/psModules/src/detrend/pmDark.c
r16824 r16841 25 25 static bool ordinateLookup(float *value, // Value of ordinate, to return 26 26 const char *name, // Name of ordinate (concept name) 27 bool scale, // Scale the value? 28 float min, float max, // Minimum and maximum values for scaling 27 29 const pmReadout *ro // Readout of interest 28 30 ) … … 60 62 psWarning("Non-finite value (%f) of concept %s in readout", *value, name); 61 63 return false; 64 } 65 if (scale) { 66 if (*value < min || *value > max) { 67 psWarning("Value of concept %s (%f) outside range (%f:%f)", name, *value, min, max); 68 return false; 69 } 70 *value = 2.0 * (*value - min) / (max - min) - 1.0; 62 71 } 63 72 … … 130 139 131 140 float value = NAN; // Value of ordinate 132 if (!ordinateLookup(&value, ord->name, ro)) {141 if (!ordinateLookup(&value, ord->name, ord->scale, ord->min, ord->max, ro)) { 133 142 roMask->data.U8[j] = 0xff; 134 143 val->data.F32[i] = NAN; 135 144 numBadInputs++; 136 145 continue; 137 }138 if (ord->scale) {139 value = 2.0 * (value - ord->min) / (ord->max - ord->min) - 1.0;140 146 } 141 147 val->data.F32[i] = value; … … 280 286 return false; 281 287 } 282 PS_ASSERT_ARRAYS_SIZE_EQUAL(dark->readouts, ordinates, false);283 288 284 289 int numOrdinates = ordinates->n; // Number of ordinates … … 287 292 pmDarkOrdinate *ord = ordinates->data[i]; // Ordinate of interest 288 293 float value = NAN; // Value for ordinate 289 if (!ordinateLookup(&value, ord->name, readout)) {294 if (!ordinateLookup(&value, ord->name, ord->scale, ord->min, ord->max, readout)) { 290 295 psError(PS_ERR_UNKNOWN, true, "Unable to find value for %s", ord->name); 291 296 psFree(values); … … 317 322 } 318 323 float value = psPolynomialMDEval(poly, values); // Value of dark current 319 readout->image->data.F32[y][x] = value;324 readout->image->data.F32[y][x] -= value; 320 325 if (readout->mask && !isfinite(value)) { 321 326 readout->mask->data.PS_TYPE_MASK_DATA[y][x] = bad;
Note:
See TracChangeset
for help on using the changeset viewer.
