ifw-odp  2.0.0-alpha
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
clipm_priv_irplib_flat.h File Reference
#include <cpl.h>

Go to the source code of this file.

Functions

cpl_imagelist * clipm_priv_irplib_flat_fit_set (cpl_imagelist *, int)
 Compute a flat-field out of a set of exposures. More...
 
double * clipm_priv_irplib_flat_fit_slope_robust (double *, double *, cpl_size)
 Fit a slope to a list of points (robust fit). More...
 

Function Documentation

cpl_imagelist* clipm_priv_irplib_flat_fit_set ( cpl_imagelist *  raw,
int  mode 
)

Compute a flat-field out of a set of exposures.

Parameters
rawInput image set
mode0 for proportional, 1 for robust fit
Returns
1 newly allocated set of 2 or 3 images

The input is assumed to be a cube containing planes of different intensities (usually increasing or decreasing). Typical inputs are: twilight data sets, halogen lamp, or skies of different airmasses in the thermal regime.

The input image list must be of type float.

In robust mode, the output is a set of 3 images. The first image contains a regression map, i.e. for each pixel position on the detector, a curve is plotted of the pixel intensity in each plane against the median intensity of the plane. A slope is fit, and the gain factor is stored into this first image.

The second image contains the y-intercepts of the slope fit. It is usually good to check it out in case of failures.

The third image contains the sum of squared errors for each fit. The fit is using a robust least-squares criterion rejecting outliers. This is the algorithm to use with big telescopes like the VLT, which collect so much light that objects are actually seen in the twilight sky.

In proportional mode, the output is a set of 2 images. The first image contains a regression map. The second image contains the sum of squared errors for each fit.

double* clipm_priv_irplib_flat_fit_slope_robust ( double *  x,
double *  y,
cpl_size  np 
)

Fit a slope to a list of points (robust fit).

Parameters
xx coordinates
yy coordinates
npnumber of points
Returns
Pointer to newly allocated array of 3 doubles.

The slope to fit has the following kind of equation: y = c[0] + c[1] * x

The returned coefficients are defined as: c[0] is the y-intercept. c[1] is the slope. c[2] is the median squared error of the fit. This is a very robust slope fit. It tolerates up to 50% of outliers in input.