IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 17, 2006, 2:47:15 PM (20 years ago)
Author:
Paul Price
Message:

Documenting pmShutterCorrection.[ch]

File:
1 edited

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 image
    6  
    7  * the measurement could be performed on any focal-plane unit at a time. for
    8  * GPC, the obvious scale is to measure the effect on the entire focal plane at
    9  * once, with a single reference point in the field.  this is a little more
    10  * complex than just measuring the effect for a single 2D image array.  the
    11  * reference point and the detailed analysis points need to be defined for the
    12  * entire hierarchy rather than just as coordinate pairs or regions.  a
    13  * pmFPAview would be a natural element with which to define these points, but
    14  * at the moment, the pmFPAview structure defines a band in the CCD, not a
    15  * coordinate.  An option is to instead specify the reference locations as a
    16  * pmFPAview coupled with a psRegion, though we need to be careful not to
    17  * 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 reference
    21  * coordinate, and F(k;T) is the measured number of counts at the point of
    22  * interest in this image.  given a collection of f(k;T) values, we need to
    23  * determine the model f(k;T) = A(k) (T + dTk) / (T + dTo) where dTk is the shutter
    24  * error at the given position, dTo is the shutter error at the reference
    25  * position, and A(k) is the scaling factor for the given position.
    26  
    27  - load the configuration information
    28  - load the input file information, build pmFPAfile's for all inputs
    29  
    30  - determine the reference point and detailed analysis regions from the config information
    31  - for each image
    32  -- measure the reference point counts
    33  - for each analysis region:
    34  -- measure shutter parameters (dTo, dTk, A):
    35  --- for each image:
    36  ---- measure counts at the region
    37  ---- divide by the reference counts
    38  --- linear extrapolation to find f(inf) = A(k)
    39  --- linear extrapolation to find f(0) = A(k) dTk / dTo
    40  --- linear interpolation to find coordinate where f(dTo) = A (1 + dTk/dTo) / 2
    41  --- 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 pixel
    44  -- divide by the reference counts
    45  -- 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 above
    47  -- save dTk, A(k) in output image pixels
    48  -- apply dTk, A(k) to measure residual images
    49  -- generate residual FITS/JPEG images
    50  
    51 */
    52 
    531#if HAVE_CONFIG_H
    542#include <config.h>
     
    6311#include "pmShutterCorrection.h"
    6412#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
    6555
    6656static void pmShutterCorrectionFree(pmShutterCorrection *pars)
     
    360350#define MEASURE_SAMPLES 4
    361351
    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                                    )
     352psImage *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)
    373355{
    374356    PS_ASSERT_VECTOR_NON_NULL(exptimes, NULL);
     
    376358    PS_ASSERT_ARRAY_NON_NULL(images, NULL);
    377359    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);
    380361    }
    381362    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);
    384364    }
    385365    long num = images->n;               // Number of images
     
    576556
    577557
    578 bool pmShutterCorrectionApply(pmReadout *readout, // Readout to which to apply shutter correction
    579                               const pmReadout *shutter // Shutter correction readout
    580                              )
     558bool pmShutterCorrectionApply(pmReadout *readout, const pmReadout *shutter)
    581559{
    582560    PS_ASSERT_PTR_NON_NULL(readout, false);
Note: See TracChangeset for help on using the changeset viewer.