High-Level Data Reduction Library 1.6.0
High-Level data reduction routines for ESO pipelines
Loading...
Searching...
No Matches
Prototyping object (derived from MIME project)

Functions

cpl_image * hdrl_get_spatial_freq (cpl_image *ima, double gausfilt, int mirrorx, int mirrory)
 Get low spatial frequency componenets from an image using the FFTW.
 
cpl_image * hdrl_mime_image_polynomial_bkg (cpl_image *image, int dim_X, int dim_Y, cpl_matrix **coeffs)
 
cpl_error_code hdrl_mime_compute_polynomial_bkg (const cpl_imagelist *images, cpl_imagelist *bkg_images, int dim_X, int dim_Y, cpl_matrix **coeffs)
 Fit smooth background for a list of images.
 
cpl_matrix * hdrl_mime_legendre_tensors_create (int nx, int ny, int npx, int npy)
 Create tensor products of Legendre polynomials.
 
cpl_matrix * hdrl_mime_matrix_linspace_create (int n, double a, double b)
 Create equally spaced nodes.
 
cpl_matrix * hdrl_mime_legendre_polynomials_create (int npoly, double a, double b, const cpl_matrix *x)
 Create the Legendre polynomial basis on the interval (a,b).
 
cpl_matrix * hdrl_mime_linalg_pairwise_column_tensor_products_create (const cpl_matrix *mat1, const cpl_matrix *mat2)
 Create selected pairwise tensor products of the columns of two matrices.
 
cpl_error_code hdrl_mime_matrix_copy_column (const cpl_matrix *mat1, int j_1, cpl_matrix *mat2, int j_2)
 Copy a column from one matrix to another matrix.
 
cpl_matrix * hdrl_mime_linalg_tensor_products_columns_create (const cpl_matrix *mat1, const cpl_matrix *mat2)
 Create the tensor products of the columns of two matrices.
 
cpl_matrix * hdrl_mime_tensor_weights_create (int nx, int ny)
 Create tensor product weights.
 
cpl_error_code hdrl_mime_matrix_mask_rows (cpl_matrix *mat, const cpl_mask *mask)
 Fill matrix rows with zeros as indicated by a mask.
 
cpl_error_code hdrl_mime_matrix_rescale_rows (const cpl_matrix *mat, const cpl_matrix *d, cpl_matrix *dmat)
 Multiply the rows of a matrix by given factors.
 
cpl_matrix * hdrl_mime_linalg_solve_tikhonov (const cpl_matrix *mat, const cpl_matrix *rhs, double alpha)
 Solve an overdetermined linear system in the least-squares sense.
 
cpl_matrix * hdrl_mime_linalg_normal_equations_create (const cpl_matrix *mat, double alpha)
 Create the matrix transpose(A) * A + alpha for given A and alpha.
 
cpl_matrix * hdrl_mime_matrix_product_left_transpose_create (const cpl_matrix *mat1, const cpl_matrix *mat2)
 Create the product of the transpose of a matrix with another matrix.
 
cpl_error_code hdrl_mime_matrix_product (const cpl_matrix *mat1, const cpl_matrix *mat2, cpl_matrix *product)
 Fill a matrix with the product of two given matrices.
 

Detailed Description

This module contains functions derived from MIME project, adapted to HDRL.

Function Documentation

◆ hdrl_get_spatial_freq()

cpl_image * hdrl_get_spatial_freq ( cpl_image *  ima,
double  gausfilt,
int  mirrorx,
int  mirrory 
)

Get low spatial frequency componenets from an image using the FFTW.

Function to calculate the low spatial frequency

Parameters
imaimage
gausfiltGaussian Fourier filter size
mirrorxfor mirroring edges (ocfft continuity)
mirroryfor mirroring edges (ocfft continuity)
Returns
1 newly allocated image.

◆ hdrl_mime_compute_polynomial_bkg()

cpl_error_code hdrl_mime_compute_polynomial_bkg ( const cpl_imagelist *  images,
cpl_imagelist *  bkg_images,
int  dim_X,
int  dim_Y,
cpl_matrix **  coeffs 
)

Fit smooth background for a list of images.

Parameters
imagesList of images.
[out]bkg_imagesSmooth background images.
dim_X,dim_Ydimensions of polynomials in $x$ and $y$.
[out]coeffsPolynomial coefficients.
Returns
CPL_ERROR_NONE or the appropriate error code.

This function computes smooth background images by fitting polynomial surfaces to the input images. Bad-pixel masks for the images are taken into account.

◆ hdrl_mime_image_polynomial_bkg()

cpl_image * hdrl_mime_image_polynomial_bkg ( cpl_image *  image,
int  dim_X,
int  dim_Y,
cpl_matrix **  coeffs 
)

◆ hdrl_mime_legendre_polynomials_create()

cpl_matrix * hdrl_mime_legendre_polynomials_create ( int  npoly,
double  a,
double  b,
const cpl_matrix *  x 
)

Create the Legendre polynomial basis on the interval (a,b).

Parameters
npolyNumber of polynomials.
aLeft endpoint of the interval.
bRight endpoint of the interval.
xNodes, at which the polynomials are evaluated.
Returns
A matrix with the values of the polynomials at x.

The i-th column contains the values of the i-th polynomial at the given nodes. The polynomials have degrees 0, 1, ..., npoly-1. The nodes must lie on the interval [a, b]. The specific dimensions of the matrix x are not used, only its size.

The returned matrix must be deallocated using cpl_matrix_delete().

◆ hdrl_mime_legendre_tensors_create()

cpl_matrix * hdrl_mime_legendre_tensors_create ( int  nx,
int  ny,
int  npx,
int  npy 
)

Create tensor products of Legendre polynomials.

Parameters
nxNumber of nodes in the x-direction.
nyNumber of x nodes in the y-direction.
npxNumber of tensor products of functions of x.
npyNumber of tensor products of functions of y.
Returns
The tensor products of Legendre polynomials.

The returned matrix must be deallocated using cpl_matrix_delete().

◆ hdrl_mime_linalg_normal_equations_create()

cpl_matrix * hdrl_mime_linalg_normal_equations_create ( const cpl_matrix *  mat,
double  alpha 
)

Create the matrix transpose(A) * A + alpha for given A and alpha.

Parameters
matMatrix,
alphaThe regularization parameter.
Returns
The matrix transpose(mat) * mat + alpha.
Note
Only the upper triangle is computed, since cpl_matrix_decomp_chol() only requires the upper triangle.

◆ hdrl_mime_linalg_pairwise_column_tensor_products_create()

cpl_matrix * hdrl_mime_linalg_pairwise_column_tensor_products_create ( const cpl_matrix *  mat1,
const cpl_matrix *  mat2 
)

Create selected pairwise tensor products of the columns of two matrices.

Parameters
mat1A matrix,
mat2A matrix.
Returns
The tensor product of pairs the columns of the two matrices.

The tensor product of the j1-th and j2-th columns is created iff j1*(nc2-1) + j2*(nc1-1) <= (nc1-1)*(nc2-1). The two matrices may have different dimensions.

◆ hdrl_mime_linalg_solve_tikhonov()

cpl_matrix * hdrl_mime_linalg_solve_tikhonov ( const cpl_matrix *  mat,
const cpl_matrix *  rhs,
double  alpha 
)

Solve an overdetermined linear system in the least-squares sense.

Parameters
matA matrix.
rhsA matrix containing right-hand-side vectors.
alphaThe regularization parameter of the Tikhonov method.
Returns
A matrix with solutions of the least-squares problem.

Typically, this method is used for overdetermined systems, where the matrix has more rows than columns, but it can also be used for square and underdetermined systems. Several right-hand-sides can be provided. The regularization parameter increases with the noise level.

◆ hdrl_mime_linalg_tensor_products_columns_create()

cpl_matrix * hdrl_mime_linalg_tensor_products_columns_create ( const cpl_matrix *  mat1,
const cpl_matrix *  mat2 
)

Create the tensor products of the columns of two matrices.

Parameters
mat1A matrix,
mat2A matrix.
Returns
The tensor product of the columns of the two matrices.

The two matrices must have the same number of columns. The result has dimensions (nr1*nr2) x nc.

◆ hdrl_mime_matrix_copy_column()

cpl_error_code hdrl_mime_matrix_copy_column ( const cpl_matrix *  mat1,
int  j_1,
cpl_matrix *  mat2,
int  j_2 
)

Copy a column from one matrix to another matrix.

Parameters
mat1The matrix whose column is copied,
j_1The index of the column to be copied,
[in,out]mat2The matrix whose column is overwritten,
[in,out]j_2The index of the column to be overwritten.
Returns
CPL_ERROR_NONE or the appropriate error code.

Both matrices must have the same number of rows.

◆ hdrl_mime_matrix_linspace_create()

cpl_matrix * hdrl_mime_matrix_linspace_create ( int  n,
double  a,
double  b 
)

Create equally spaced nodes.

Parameters
nThe number of nodes,
aThe leftmost node,
bThe rightmost node.
Returns
A column matrix with the equally spaced nodes.

The number of nodes n must be at least 2.

◆ hdrl_mime_matrix_mask_rows()

cpl_error_code hdrl_mime_matrix_mask_rows ( cpl_matrix *  mat,
const cpl_mask *  mask 
)

Fill matrix rows with zeros as indicated by a mask.

Parameters
matA matrix,
maskA mask flagging rows to be filled with 0.0s,
Returns
CPL_ERROR_NONE or the appropriate error code.

The size of mask must be equal to the number of rows of mat. The rows corresponding to CPL_BINARY_1 are set to 0.0.

◆ hdrl_mime_matrix_product()

cpl_error_code hdrl_mime_matrix_product ( const cpl_matrix *  mat1,
const cpl_matrix *  mat2,
cpl_matrix *  product 
)

Fill a matrix with the product of two given matrices.

Parameters
mat1A matrix,
mat2A matrix,
[out]productThe product of the matrices.
Returns
CPL_ERROR_NONE or the appropriate error code.

The number of rows of mat1 must be equal to the number of rows of product. The number of columns of mat2 must be equal to the number of columns of product. The number of columns of mat1 must be equal to the number of rows of mat2.

◆ hdrl_mime_matrix_product_left_transpose_create()

cpl_matrix * hdrl_mime_matrix_product_left_transpose_create ( const cpl_matrix *  mat1,
const cpl_matrix *  mat2 
)

Create the product of the transpose of a matrix with another matrix.

Parameters
mat1A matrix,
mat2A matrix.
Returns
The product of the transpose of the first matrix with the second matrix.

The two matrices must have the same number of rows. The product matrix must be deallocated with cpl_matrix_delete().

◆ hdrl_mime_matrix_rescale_rows()

cpl_error_code hdrl_mime_matrix_rescale_rows ( const cpl_matrix *  mat,
const cpl_matrix *  d,
cpl_matrix *  dmat 
)

Multiply the rows of a matrix by given factors.

Parameters
matA matrix,
dThe factors.
[out]dmatThe matrix with rescaled rows.
Returns
CPL_ERROR_NONE or the appropriate error code.

The number of rows must be equal to the size of d. The matrix dmat must be allocated before calling this function.

◆ hdrl_mime_tensor_weights_create()

cpl_matrix * hdrl_mime_tensor_weights_create ( int  nx,
int  ny 
)

Create tensor product weights.

Parameters
nxNumber of nodes in the x-direction,
nyNumber of x nodes in the y-direction,
Returns
The tensor weights

The returned matrix must be deallocated using cpl_matrix_delete().