mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::improc::eigenCube< dataT > Class Template Reference

template<typename dataT>
class mx::improc::eigenCube< dataT >

An image cube with an Eigen-like API.

Definition at line 30 of file eigenCube.hpp.

#include <improc/eigenCube.hpp>

Public Member Functions

 eigenCube (Index nrows, Index ncols, Index nplanes)
 C'tor which will allocate space.. More...
 
 eigenCube (dataT *ndata, size_t nrows, size_t ncols, size_t nplanes)
 C'tor taking an existing array as an argument. More...
 
void clear ()
 De-allocate and set all sizes to 0. More...
 
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > cube ()
 Returns a 2D Eigen::Eigen::Map pointed at the entire cube. More...
 
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > image (Index n)
 Returns a 2D Eigen::Eigen::Map pointed at the specified image. More...
 
const Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > image (Index n) const
 Returns a 2D Eigen::Eigen::Map pointed at the specified image. More...
 
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic >, Eigen::Unaligned, Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > > pixel (Index i, Index j)
 Returns an Eigen::Eigen::Map-ed vector of the pixels at the given coordinate. More...
 
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > asVectors ()
 Return an Eigen::Eigen::Map of the cube where each image is a vector. More...
 
void Covar (Eigen::Matrix< dataT, Eigen::Dynamic, Eigen::Dynamic > &cv)
 Calculate the covariance matrix of the images in the cube. More...
 
template<typename eigenT >
void sum (eigenT &mim)
 Calculate the sum image of the cube. More...
 
template<typename eigenT >
void mean (eigenT &mim)
 Calculate the mean image of the cube. More...
 
template<typename eigenT , typename eigenCubeT >
void mean (eigenT &mim, eigenCubeT &mask, double minGoodFract=0.0)
 Calculate the mean image of the cube with a mask. More...
 
template<typename eigenT >
void mean (eigenT &mim, std::vector< dataT > &weights)
 Calculate the weighted mean image of the cube. More...
 
template<typename eigenT , typename eigenCubeT >
void mean (eigenT &mim, std::vector< dataT > &weights, eigenCubeT &mask, double minGoodFract=0.0)
 Calculate the weighted mean image of the cube, with a mask cube. More...
 
template<typename eigenT >
void median (eigenT &mim)
 Calculate the median image of the cube. More...
 
template<typename eigenT >
void sigmaMean (eigenT &mim, Scalar sigma)
 Calculate the sigma clipped mean image of the cube. More...
 
template<typename eigenT , typename eigenCubeT >
void sigmaMean (eigenT &mim, eigenCubeT &mask, Scalar sigma, double minGoodFract=0.0)
 Calculate the sigma clipped mean image of the cube, with a mask cube. More...
 
template<typename eigenT >
void sigmaMean (eigenT &mim, std::vector< dataT > &weights, Scalar sigma)
 Calculate the sigma clipped weighted mean image of the cube. More...
 
template<typename eigenT , typename eigenCubeT >
void sigmaMean (eigenT &mim, std::vector< dataT > &weights, eigenCubeT &mask, Scalar sigma, double minGoodFract=0.0)
 Calculate the sigma clipped weighted mean image of the cube, with a mask cube. More...
 

Constructor & Destructor Documentation

◆ eigenCube() [1/2]

template<typename dataT >
mx::improc::eigenCube< dataT >::eigenCube ( Index  nrows,
Index  ncols,
Index  nplanes 
)

C'tor which will allocate space..

Parameters
[in]nrowsNumber of rows in the cube
[in]ncolsNumber of columns the cube
[in]nplanesNumber of planes in the cube

Definition at line 228 of file eigenCube.hpp.

◆ eigenCube() [2/2]

template<typename dataT >
mx::improc::eigenCube< dataT >::eigenCube ( dataT *  ndata,
size_t  nrows,
size_t  ncols,
size_t  nplanes 
)

C'tor taking an existing array as an argument.

The existing array is used as is, as in a map, and ownership is not taken. You are responsible for memory management, e.g. free-ing this array.

Parameters
[in]ndataAllocated array with a cube of nrows x ncols x nplanes
[in]nrowsNumber of rows in the cube
[in]ncolsNumber of columns the cube
[in]nplanesNumber of planes in the cube

Definition at line 239 of file eigenCube.hpp.

Member Function Documentation

◆ asVectors()

template<typename dataT >
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > mx::improc::eigenCube< dataT >::asVectors

Return an Eigen::Eigen::Map of the cube where each image is a vector.

Definition at line 394 of file eigenCube.hpp.

Referenced by mx::AO::m2cMatrix(), and mx::improc::KLIPreduction< _realT, _derotFunctObj, _evCalcT >::worker().

◆ clear()

template<typename dataT >
void mx::improc::eigenCube< dataT >::clear

De-allocate and set all sizes to 0.

Definition at line 304 of file eigenCube.hpp.

◆ Covar()

template<typename dataT >
void mx::improc::eigenCube< dataT >::Covar ( Eigen::Matrix< dataT, Eigen::Dynamic, Eigen::Dynamic > &  cv)

Calculate the covariance matrix of the images in the cube.

Definition at line 400 of file eigenCube.hpp.

◆ cube()

template<typename dataT >
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > mx::improc::eigenCube< dataT >::cube

Returns a 2D Eigen::Eigen::Map pointed at the entire cube.

Definition at line 370 of file eigenCube.hpp.

Referenced by mx::improc::KLIPreduction< _realT, _derotFunctObj, _evCalcT >::worker().

◆ image() [1/2]

template<typename dataT >
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > mx::improc::eigenCube< dataT >::image ( Index  n)

◆ image() [2/2]

template<typename dataT >
const Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > mx::improc::eigenCube< dataT >::image ( Index  n) const

Returns a 2D Eigen::Eigen::Map pointed at the specified image.

Parameters
[in]nthe image number

Definition at line 382 of file eigenCube.hpp.

◆ mean() [1/4]

template<typename dataT >
template<typename eigenT >
void mx::improc::eigenCube< dataT >::mean ( eigenT &  mim)

Calculate the mean image of the cube.

Template Parameters
eigenTan Eigen-like type.
Parameters
[out]mimthe resultant mean image. Is resized.

Definition at line 423 of file eigenCube.hpp.

Referenced by mx::improc::HCIobservation< _realT >::coaddImages(), and mx::improc::KLIPreduction< _realT, _derotFunctObj, _evCalcT >::meanSubtract().

◆ mean() [2/4]

template<typename dataT >
template<typename eigenT , typename eigenCubeT >
void mx::improc::eigenCube< dataT >::mean ( eigenT &  mim,
eigenCubeT &  mask,
double  minGoodFract = 0.0 
)

Calculate the mean image of the cube with a mask.

Template Parameters
eigenTan Eigen-like type.
eigenCubeTan eigenCube type.
Parameters
[out]mimthe resultant mean image. Is resized.
[in]maska mask cube. Only pixels with value 1 are included in the mean calculation.
[in]minGoodFract[optional] the minimum fraction of good pixels, if not met then the pixel is NaN-ed.

Definition at line 439 of file eigenCube.hpp.

References mx::astro::constants::k(), and mx::math::vectorMean().

◆ mean() [3/4]

template<typename dataT >
template<typename eigenT >
void mx::improc::eigenCube< dataT >::mean ( eigenT &  mim,
std::vector< dataT > &  weights 
)

Calculate the weighted mean image of the cube.

Template Parameters
eigenTan Eigen-like type.
Parameters
[out]mimthe resultant mean image. Is resized.
[in]weightsa vector of weights to use for calculating the mean

Definition at line 479 of file eigenCube.hpp.

References mx::astro::constants::k(), and mx::math::vectorMean().

◆ mean() [4/4]

template<typename dataT >
template<typename eigenT , typename eigenCubeT >
void mx::improc::eigenCube< dataT >::mean ( eigenT &  mim,
std::vector< dataT > &  weights,
eigenCubeT &  mask,
double  minGoodFract = 0.0 
)

Calculate the weighted mean image of the cube, with a mask cube.

Template Parameters
eigenTan Eigen-like type.
eigenCubeTan eigenCube type.
Parameters
[out]mimthe resultant mean image. Is resized.
[in]weightsa vector of weights to use for calculating the mean
[in]maska mask cube. Only pixels with value 1 are included in the mean calculation.
[in]minGoodFract[optional] the minimum fraction of good pixels, if not met then the pixel is NaN-ed.

Definition at line 506 of file eigenCube.hpp.

References mx::astro::constants::k(), and mx::math::vectorMean().

◆ median()

template<typename dataT >
template<typename eigenT >
void mx::improc::eigenCube< dataT >::median ( eigenT &  mim)

Calculate the median image of the cube.

Template Parameters
eigenTan Eigen-like type.
Parameters
[out]mimthe resultant median image. Is resized.

Definition at line 548 of file eigenCube.hpp.

References mx::improc::HCI::imageMedian.

Referenced by mx::improc::HCIobservation< _realT >::coaddImages(), and mx::improc::KLIPreduction< _realT, _derotFunctObj, _evCalcT >::meanSubtract().

◆ pixel()

template<typename dataT >
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic >, Eigen::Unaligned, Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > > mx::improc::eigenCube< dataT >::pixel ( Index  i,
Index  j 
)

Returns an Eigen::Eigen::Map-ed vector of the pixels at the given coordinate.

Definition at line 388 of file eigenCube.hpp.

Referenced by SCENARIO().

◆ sigmaMean() [1/4]

template<typename dataT >
template<typename eigenT , typename eigenCubeT >
void mx::improc::eigenCube< dataT >::sigmaMean ( eigenT &  mim,
eigenCubeT &  mask,
Scalar  sigma,
double  minGoodFract = 0.0 
)

Calculate the sigma clipped mean image of the cube, with a mask cube.

Template Parameters
eigenTan Eigen-like type.
eigenCubeTan eigenCube type.
Parameters
[out]mimthe resultant mean image. Is resized.
[in]maska mask cube. Only pixels with value 1 are included in the mean calculation.
[in]sigmathe sigma value at which to clip.
[in]minGoodFract[optional] the minimum fraction of good pixels, if not met then the pixel is NaN-ed.

Definition at line 592 of file eigenCube.hpp.

References mx::astro::constants::k(), mx::astro::constants::sigma(), and mx::math::vectorSigmaMean().

◆ sigmaMean() [2/4]

template<typename dataT >
template<typename eigenT >
void mx::improc::eigenCube< dataT >::sigmaMean ( eigenT &  mim,
Scalar  sigma 
)

Calculate the sigma clipped mean image of the cube.

Template Parameters
eigenTan Eigen-like type.
Parameters
[out]mimthe resultant mean image
[in]sigmathe sigma value at which to clip.

Definition at line 566 of file eigenCube.hpp.

References mx::astro::constants::k(), mx::astro::constants::sigma(), and mx::math::vectorSigmaMean().

◆ sigmaMean() [3/4]

template<typename dataT >
template<typename eigenT , typename eigenCubeT >
void mx::improc::eigenCube< dataT >::sigmaMean ( eigenT &  mim,
std::vector< dataT > &  weights,
eigenCubeT &  mask,
Scalar  sigma,
double  minGoodFract = 0.0 
)

Calculate the sigma clipped weighted mean image of the cube, with a mask cube.

Template Parameters
eigenTan Eigen-like type.
eigenCubeTan eigenCube type.
Parameters
[out]mimthe resultant mean image. Is resized.
[in]weightsa vector of weights to use for calculating the mean
[in]maska mask cube. Only pixels with value 1 are included in the mean calculation.
[in]sigmathe sigma value at which to clip.
[in]minGoodFract[optional] the minimum fraction of good pixels, if not met then the pixel is NaN-ed.

Definition at line 661 of file eigenCube.hpp.

References mx::astro::constants::k(), mx::astro::constants::sigma(), and mx::math::vectorSigmaMean().

◆ sigmaMean() [4/4]

template<typename dataT >
template<typename eigenT >
void mx::improc::eigenCube< dataT >::sigmaMean ( eigenT &  mim,
std::vector< dataT > &  weights,
Scalar  sigma 
)

Calculate the sigma clipped weighted mean image of the cube.

Template Parameters
eigenTan Eigen-like type.
Parameters
[out]mimthe resultant mean image. Is resized.
[in]weightsa vector of weights to use for calculating the mean
[in]sigmathe sigma value at which to clip.

Definition at line 634 of file eigenCube.hpp.

References mx::astro::constants::k(), mx::astro::constants::sigma(), and mx::math::vectorSigmaMean().

◆ sum()

template<typename dataT >
template<typename eigenT >
void mx::improc::eigenCube< dataT >::sum ( eigenT &  mim)

Calculate the sum image of the cube.

Template Parameters
eigenTan Eigen-like type.
Parameters
[out]mimthe resultant sum image. Is resized.

Definition at line 407 of file eigenCube.hpp.


The documentation for this class was generated from the following file: