Changeset 9618 for trunk/psModules/src/detrend/pmShutterCorrection.c
- Timestamp:
- Oct 17, 2006, 2:47:15 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmShutterCorrection.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmShutterCorrection.c
r9539 r9618 1 /*2 * measure shutter correction:3 4 * input : collection of shutter correction exposures (pre-processed)5 * output : a shutter correction image6 7 * the measurement could be performed on any focal-plane unit at a time. for8 * GPC, the obvious scale is to measure the effect on the entire focal plane at9 * once, with a single reference point in the field. this is a little more10 * complex than just measuring the effect for a single 2D image array. the11 * reference point and the detailed analysis points need to be defined for the12 * entire hierarchy rather than just as coordinate pairs or regions. a13 * pmFPAview would be a natural element with which to define these points, but14 * at the moment, the pmFPAview structure defines a band in the CCD, not a15 * coordinate. An option is to instead specify the reference locations as a16 * pmFPAview coupled with a psRegion, though we need to be careful not to17 * over-specify the pixels (ie, conflict between pmFPAview and psRegion).18 19 * at each point in an image with exposure time T, we measure f(k;T) = F(k;T) /20 * F(0;T) where k is the coordinate of the point of interest, 0 is the reference21 * coordinate, and F(k;T) is the measured number of counts at the point of22 * interest in this image. given a collection of f(k;T) values, we need to23 * determine the model f(k;T) = A(k) (T + dTk) / (T + dTo) where dTk is the shutter24 * error at the given position, dTo is the shutter error at the reference25 * position, and A(k) is the scaling factor for the given position.26 27 - load the configuration information28 - load the input file information, build pmFPAfile's for all inputs29 30 - determine the reference point and detailed analysis regions from the config information31 - for each image32 -- measure the reference point counts33 - for each analysis region:34 -- measure shutter parameters (dTo, dTk, A):35 --- for each image:36 ---- measure counts at the region37 ---- divide by the reference counts38 --- linear extrapolation to find f(inf) = A(k)39 --- linear extrapolation to find f(0) = A(k) dTk / dTo40 --- linear interpolation to find coordinate where f(dTo) = A (1 + dTk/dTo) / 241 --- non-linear fit of T, f(T) to f(k;T) = A(k) (T + dTk) / (T + dTo)42 - use the collection of dTo values to choose a best value for dTo (median)43 - for each image pixel44 -- divide by the reference counts45 -- generate the vectors T, f(T)46 -- linear fit of T, f(T) to f(k;T) = A(k) (T + dTk) / (T + dTo) using dTo above47 -- save dTk, A(k) in output image pixels48 -- apply dTk, A(k) to measure residual images49 -- generate residual FITS/JPEG images50 51 */52 53 1 #if HAVE_CONFIG_H 54 2 #include <config.h> … … 63 11 #include "pmShutterCorrection.h" 64 12 #include "psVectorBracket.h" 13 14 /// Measure shutter correction: 15 /// 16 /// input : collection of shutter correction exposures (pre-processed) 17 /// output : a shutter correction image 18 /// 19 /// The measurement could be performed on any focal-plane unit at a time. for GPC, the obvious scale is to 20 /// measure the effect on the entire focal plane at once, with a single reference point in the field. this is 21 /// a little more complex than just measuring the effect for a single 2D image array. the reference point and 22 /// the detailed analysis points need to be defined for the entire hierarchy rather than just as coordinate 23 /// pairs or regions. a pmFPAview would be a natural element with which to define these points, but at the 24 /// moment, the pmFPAview structure defines a band in the CCD, not a coordinate. An option is to instead 25 /// specify the reference locations as a pmFPAview coupled with a psRegion, though we need to be careful not 26 /// to over-specify the pixels (ie, conflict between pmFPAview and psRegion). 27 /// 28 /// At each point in an image with exposure time T, we measure f(k;T) = F(k;T) / F(0;T) where k is the 29 /// coordinate of the point of interest, 0 is the reference coordinate, and F(k;T) is the measured number of 30 /// counts at the point of interest in this image. given a collection of f(k;T) values, we need to determine 31 /// the model f(k;T) = A(k) (T + dTk) / (T + dTo) where dTk is the shutter error at the given position, dTo is 32 /// the shutter error at the reference position, and A(k) is the scaling factor for the given position. 33 /// 34 /// The process for generating a shutter correction is as follows: 35 /// - for each image 36 /// -- measure the reference point counts 37 /// - for each analysis region: 38 /// -- measure shutter parameters (dTo, dTk, A): 39 /// --- for each image: 40 /// ---- measure counts at the region 41 /// ---- divide by the reference counts 42 /// --- linear extrapolation to find f(inf) = A(k) 43 /// --- linear extrapolation to find f(0) = A(k) dTk / dTo 44 /// --- linear interpolation to find coordinate where f(dTo) = A (1 + dTk/dTo) / 2 45 /// --- non-linear fit of T, f(T) to f(k;T) = A(k) (T + dTk) / (T + dTo) 46 /// - use the collection of dTo values to choose a best value for dTo (median) 47 /// - for each image pixel 48 /// -- divide by the reference counts 49 /// -- generate the vectors T, f(T) 50 /// -- linear fit of T, f(T) to f(k;T) = A(k) (T + dTk) / (T + dTo) using dTo above 51 /// -- save dTk, A(k) in output image pixels 52 /// -- apply dTk, A(k) to measure residual images 53 /// -- generate residual FITS/JPEG images 54 65 55 66 56 static void pmShutterCorrectionFree(pmShutterCorrection *pars) … … 360 350 #define MEASURE_SAMPLES 4 361 351 362 psImage *pmShutterCorrectionMeasure(const psVector *exptimes, // Exposure times 363 const psArray *images, // Input images 364 const psArray *weights, // Weight images 365 const psArray *masks, // Mask images 366 unsigned int size, // Size of samples 367 psStatsOptions meanStat, // Statistic to use for mean 368 psStatsOptions stdevStat, // Statistic to use for stdev 369 int nIter, // Number of iterations per pixel 370 float rej, // Rejection limit 371 psMaskType maskVal // Mask value 372 ) 352 psImage *pmShutterCorrectionMeasure(const psVector *exptimes, const psArray *images, const psArray *weights, 353 const psArray *masks, unsigned int size, psStatsOptions meanStat, 354 psStatsOptions stdevStat, int nIter, float rej, psMaskType maskVal) 373 355 { 374 356 PS_ASSERT_VECTOR_NON_NULL(exptimes, NULL); … … 376 358 PS_ASSERT_ARRAY_NON_NULL(images, NULL); 377 359 if (masks) { 378 // XXX ASSERT not defined 379 // PS_ASSERT_ARRAYS_SIZE_EQUAL(images, masks, NULL); 360 PS_ASSERT_ARRAYS_SIZE_EQUAL(images, masks, NULL); 380 361 } 381 362 if (weights) { 382 // XXX ASSERT not defined 383 // PS_ASSERT_ARRAYS_SIZE_EQUAL(images, weights, NULL); 363 PS_ASSERT_ARRAYS_SIZE_EQUAL(images, weights, NULL); 384 364 } 385 365 long num = images->n; // Number of images … … 576 556 577 557 578 bool pmShutterCorrectionApply(pmReadout *readout, // Readout to which to apply shutter correction 579 const pmReadout *shutter // Shutter correction readout 580 ) 558 bool pmShutterCorrectionApply(pmReadout *readout, const pmReadout *shutter) 581 559 { 582 560 PS_ASSERT_PTR_NON_NULL(readout, false);
Note:
See TracChangeset
for help on using the changeset viewer.
