mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Functions for generating 2D Fourier modes. More...
Functions for generating 2D Fourier modes.
Definition in file fourierModes.hpp.
Go to the source code of this file.
Classes | |
struct | mx::sigproc::fourierModeDef |
Structure to contain the parameters of a Fourier mode. More... | |
Namespaces | |
mx | |
The mxlib c++ namespace. | |
Functions | |
template<class typeN > | |
int | mx::sigproc::makeFourierModeC (typeN im, typename typeN::Scalar m, typename typeN::Scalar n) |
Populate a single cosine mode. More... | |
template<class typeN > | |
int | mx::sigproc::makeFourierModeS (typeN im, typename typeN::Scalar m, typename typeN::Scalar n) |
Populate a single sine mode. More... | |
template<class typeN > | |
int | mx::sigproc::makeFourierMode (typeN im, typename typeN::Scalar m, typename typeN::Scalar n, int p) |
Populate a single basic Fourier mode. More... | |
template<class typeN > | |
int | mx::sigproc::makeModifiedFourierMode (typeN im, typename typeN::Scalar m, typename typeN::Scalar n, int p, typename typeN::Scalar ang=0) |
Populate a single modified Fourier mode. More... | |
template<class typeN > | |
int | mx::sigproc::makeModifiedFourierModeP (typeN im, typename typeN::Scalar m, typename typeN::Scalar n, typename typeN::Scalar ang=0) |
Populate a single modified Fourier +1 mode. More... | |
template<class typeN > | |
int | mx::sigproc::makeModifiedFourierModeM (typeN im, typename typeN::Scalar m, typename typeN::Scalar n, typename typeN::Scalar ang=0) |
Populate a single modified Fourier -1 mode. More... | |
bool | mx::sigproc::comp_fourierModeDef_PandV (const fourierModeDef &spf1, const fourierModeDef &spf2) |
Sorting functor for modes according to the Poyner and Veran (2005) standard. More... | |
int | mx::sigproc::makeFourierModeFreqs_PandV (std::vector< fourierModeDef > &spf, int N) |
Generate a Poyneer and Veran spatial frequency grid. More... | |
bool | mx::sigproc::comp_fourierModeDef (const fourierModeDef &spf1, const fourierModeDef &spf2) |
Sorting functor for modes according to the mx::AO standard. More... | |
int | mx::sigproc::makeFourierModeFreqs_Circ (std::vector< fourierModeDef > &spf, int N) |
Generate a circular spatial frequency grid. More... | |
int | mx::sigproc::fourierModeNumber (int m, int n, int p) |
Calculate the index of a Fourier mode given its (m,n,p) coordinates. More... | |
int | mx::sigproc::fourierModeCoordinates (int &m, int &n, int &p, int i) |
Calculate the (m,n,p) coordinates of a Fourier mode given its index. More... | |
int | mx::sigproc::makeFourierModeFreqs_Rect (std::vector< fourierModeDef > &spf, int N) |
Generate a rectangular spatial frequency grid. More... | |
template<typename cubeT > | |
int | mx::sigproc::fillFourierBasis (cubeT &cube, int dim, std::vector< fourierModeDef > spf, int basisType, typename cubeT::Scalar ang=0) |
Fill in a cube with a Fourier basis. More... | |
template<typename cubeT > | |
int | mx::sigproc::makeFourierBasis_PandV (cubeT &cube, int dim, int N, int basisType) |
Generate a rectangular modified Fourier basis with the Poyneer and Veran ordering. More... | |
template<typename cubeT > | |
int | mx::sigproc::makeFourierBasis_Circ (cubeT &cube, int dim, int N, int basisType) |
Generate a circular Fourier basis. More... | |
template<typename cubeT > | |
int | mx::sigproc::makeFourierBasis_Rect (cubeT &cube, int dim, int N, int basisType, typename cubeT::Scalar ang=0) |
Generate a rectangular Fourier basis. More... | |
bool mx::sigproc::comp_fourierModeDef | ( | const fourierModeDef & | spf1, |
const fourierModeDef & | spf2 | ||
) |
Sorting functor for modes according to the mx::AO standard.
Given a spatial frequency vector \( \vec{k} = k_u \hat{u} + k_v \hat{v} \), sorts first by \( | \vec{k} | \), then by the angle from the u axis. Results in mode numbers increasing radially and counter-clockwise from the \( u \) axis.
[in] | spf1 | is an object of type fourierModeDef to compare with spf2 |
[in] | spf2 | is an object of type fourierModeDef to compare with spf1 |
Definition at line 410 of file fourierModes.hpp.
References mx::sigproc::comp_fourierModeDef(), mx::sigproc::fourierModeDef::m, mx::sigproc::fourierModeDef::n, and mx::sigproc::fourierModeDef::p.
Referenced by mx::sigproc::comp_fourierModeDef(), and mx::sigproc::makeFourierModeFreqs_Circ().
bool mx::sigproc::comp_fourierModeDef_PandV | ( | const fourierModeDef & | spf1, |
const fourierModeDef & | spf2 | ||
) |
Sorting functor for modes according to the Poyner and Veran (2005) standard.
Follows the conventions of Poyneer & Veran (2005) [19]
[in] | spf1 | is an object of type fourierModeDef to compare with spf2 |
[in] | spf2 | is an object of type fourierModeDef to compare with spf1 |
Definition at line 321 of file fourierModes.hpp.
References mx::sigproc::comp_fourierModeDef_PandV(), mx::sigproc::fourierModeDef::m, mx::sigproc::fourierModeDef::n, and mx::sigproc::fourierModeDef::p.
Referenced by mx::sigproc::comp_fourierModeDef_PandV(), and mx::sigproc::makeFourierModeFreqs_PandV().
int mx::sigproc::fillFourierBasis | ( | cubeT & | cube, |
int | dim, | ||
std::vector< fourierModeDef > | spf, | ||
int | basisType, | ||
typename cubeT::Scalar | ang = 0 |
||
) |
Fill in a cube with a Fourier basis.
Fills the cube with either the basic or modified Fourier basis for the modes specified.
[out] | cube | will be allocated to hold and will be filled with the modes |
[in] | dim | is the linear size of the maps, each is |
[in] | spf | is a vector of mode definitions to use for each mode |
[in] | basisType | is either MX_FOURIER_MODIFIED or MX_FOURIER_BASIC |
cubeT | is an eigen-like cube, e.g. mx::eigenCube. |
Definition at line 639 of file fourierModes.hpp.
References mx::sigproc::fillFourierBasis(), mx::sigproc::makeFourierMode(), and mx::sigproc::makeModifiedFourierMode().
Referenced by mx::sigproc::fillFourierBasis(), mx::sigproc::makeFourierBasis_Circ(), mx::sigproc::makeFourierBasis_PandV(), and mx::sigproc::makeFourierBasis_Rect().
int mx::sigproc::fourierModeCoordinates | ( | int & | m, |
int & | n, | ||
int & | p, | ||
int | i | ||
) |
Calculate the (m,n,p) coordinates of a Fourier mode given its index.
The index increases counter-clockwise from the m axis in squares, with p==-1 being even and p==1 being odd.
-1 | if i < 0 |
[out] | m | is the m spatial frequency coordinate |
[out] | n | is the n spatial frequency coordinage |
[out] | p | is the parity, +/-1, for sine or cosine or specifiying the modified Fourier mode. |
[in] | i | is the mode index. |
Definition at line 545 of file fourierModes.hpp.
References mx::sigproc::fourierModeCoordinates().
Referenced by mx::sigproc::fourierModeCoordinates(), and mx::sigproc::makeFourierModeFreqs_Rect().
int mx::sigproc::fourierModeNumber | ( | int | m, |
int | n, | ||
int | p | ||
) |
Calculate the index of a Fourier mode given its (m,n,p) coordinates.
The index increases counter-clockwise from the m axis in squares, with p==-1 being even and p==1 being odd.
[in] | m | is the m spatial frequency coordinate |
[in] | n | is the n spatial frequency coordinage |
[in] | p | is the parity, +/-1, for sine or cosine or specifiying the modified Fourier mode. |
Definition at line 498 of file fourierModes.hpp.
References mx::sigproc::fourierModeNumber().
Referenced by mx::sigproc::fourierModeNumber().
int mx::sigproc::makeFourierBasis_Circ | ( | cubeT & | cube, |
int | dim, | ||
int | N, | ||
int | basisType | ||
) |
Generate a circular Fourier basis.
Fills the cube with modes generated by makeFourierMode or makeModifiedFourierMode using the mode grid generated by makeFourierModeFreqs_Circ.
[out] | cube | will be allocated to hold and will be filled with the modes |
[in] | dim | is the linear size of the maps, each is |
[in] | N | is the linear number of degrees of freedom. The number of modes is ((N+1)(N+1) - 1). |
[in] | basisType | is either MX_FOURIER_MODIFIED or MX_FOURIER_BASIC |
cubeT | is an eigen-like cube, e.g. mx::eigenCube. |
Definition at line 703 of file fourierModes.hpp.
References mx::sigproc::fillFourierBasis(), mx::sigproc::makeFourierBasis_Circ(), and mx::sigproc::makeFourierModeFreqs_Circ().
Referenced by mx::sigproc::makeFourierBasis_Circ().
int mx::sigproc::makeFourierBasis_PandV | ( | cubeT & | cube, |
int | dim, | ||
int | N, | ||
int | basisType | ||
) |
Generate a rectangular modified Fourier basis with the Poyneer and Veran ordering.
Fills the cube with modes generated by makeFourierMode or makeModifiedFourierMode using the mode grid generated by makeFourierModeFreqs_PandV. This follows the convention of Poyneer and Veran (2005) [19] for mode numbering.
[out] | cube | will be allocated to hold and will be filled with the modes |
[in] | dim | is the linear size of the maps, each is |
[in] | N | is the linear number of degrees of freedom. The number of modes is ((N+1)(N+1) - 1). |
[in] | basisType | is either MX_FOURIER_MODIFIED or MX_FOURIER_BASIC |
cubeT | is an eigen-like cube, e.g. mx::eigenCube. |
Definition at line 677 of file fourierModes.hpp.
References mx::sigproc::fillFourierBasis(), mx::sigproc::makeFourierBasis_PandV(), and mx::sigproc::makeFourierModeFreqs_PandV().
Referenced by mx::sigproc::makeFourierBasis_PandV().
int mx::sigproc::makeFourierBasis_Rect | ( | cubeT & | cube, |
int | dim, | ||
int | N, | ||
int | basisType, | ||
typename cubeT::Scalar | ang = 0 |
||
) |
Generate a rectangular Fourier basis.
Fills the cube with modes generated by makeFourierMode or makeModifiedFourierMode using the mode grid generated by makeFourierModeFreqs_Rect.
[out] | cube | will be allocated to hold and will be filled with the modes |
[in] | dim | is the linear size of the maps, each is |
[in] | N | is the linear number of degrees of freedom. The number of modes is ((N+1)(N+1) - 1). |
[in] | basisType | is either MX_FOURIER_MODIFIED or MX_FOURIER_BASIC |
cubeT | is an eigen-like cube, e.g. mx::eigenCube. |
Definition at line 730 of file fourierModes.hpp.
References mx::sigproc::fillFourierBasis(), mx::sigproc::makeFourierBasis_Rect(), and mx::sigproc::makeFourierModeFreqs_Rect().
Referenced by mx::sigproc::makeFourierBasis_Rect().
int mx::sigproc::makeFourierMode | ( | typeN | im, |
typename typeN::Scalar | m, | ||
typename typeN::Scalar | n, | ||
int | p | ||
) |
Populate a single basic Fourier mode.
Makes a 2D image of the basic sine or cosine mode. Calls makeFourierModeC and makeFourierModeS.
[out] | im | is an Eigen-like image |
[in] | m | specifies the spatial frequency in the u direction |
[in] | n | specifies the spatial frequency in the v direction |
[in] | p | species sine (-1) or cosine (+1) |
0 | on success |
typeN | is an Eigen-like reference type. |
Definition at line 170 of file fourierModes.hpp.
References mx::sigproc::makeFourierMode(), mx::sigproc::makeFourierModeC(), and mx::sigproc::makeFourierModeS().
Referenced by mx::sigproc::fillFourierBasis(), and mx::sigproc::makeFourierMode().
int mx::sigproc::makeFourierModeC | ( | typeN | im, |
typename typeN::Scalar | m, | ||
typename typeN::Scalar | n | ||
) |
Populate a single cosine mode.
Makes a 2D image of the cosine mode:
\[ M_c(\vec{q}) = \cos\left( 2\pi\frac{m}{D}u + 2\pi\frac{n}{D}v \right) \]
where
\[ \vec{q} = u \hat{u} + v \hat{v} \]
and \( D \) is taken to be the maximum of the number of columns and rows in the image.
0 | on success |
typeN | is an Eigen-like reference type. |
[out] | im | is an Eigen-like image |
[in] | m | specifies the spatial frequency in the u direction |
[in] | n | n specifies the spatial frequency in the v direction |
Definition at line 79 of file fourierModes.hpp.
References mx::sigproc::makeFourierModeC().
Referenced by mx::sigproc::makeFourierMode(), and mx::sigproc::makeFourierModeC().
int mx::sigproc::makeFourierModeFreqs_Circ | ( | std::vector< fourierModeDef > & | spf, |
int | N | ||
) |
Generate a circular spatial frequency grid.
spf | |
N | is the linear number of degrees of freedom. The number of modes is ((N+1)(N+1) - 1). |
Definition at line 441 of file fourierModes.hpp.
References mx::sigproc::comp_fourierModeDef(), and mx::sigproc::makeFourierModeFreqs_Circ().
Referenced by mx::sigproc::makeFourierBasis_Circ(), and mx::sigproc::makeFourierModeFreqs_Circ().
int mx::sigproc::makeFourierModeFreqs_PandV | ( | std::vector< fourierModeDef > & | spf, |
int | N | ||
) |
Generate a Poyneer and Veran spatial frequency grid.
Follows the convention of Poyneer and Veran (2005) [19]
spf | |
N | is the linear number of degrees of freedom. |
Definition at line 347 of file fourierModes.hpp.
References mx::sigproc::comp_fourierModeDef_PandV(), mx::astro::constants::k(), and mx::sigproc::makeFourierModeFreqs_PandV().
Referenced by mx::sigproc::makeFourierBasis_PandV(), and mx::sigproc::makeFourierModeFreqs_PandV().
int mx::sigproc::makeFourierModeFreqs_Rect | ( | std::vector< fourierModeDef > & | spf, |
int | N | ||
) |
Generate a rectangular spatial frequency grid.
spf | is a vector of fourierModeDef structures, which will be resized and populated. |
N | is the linear number of degrees of freedom. The number of modes is ((N+1)(N+1) - 1). |
Definition at line 602 of file fourierModes.hpp.
References mx::sigproc::fourierModeCoordinates(), and mx::sigproc::makeFourierModeFreqs_Rect().
Referenced by mx::sigproc::makeFourierBasis_Rect(), and mx::sigproc::makeFourierModeFreqs_Rect().
int mx::sigproc::makeFourierModeS | ( | typeN | im, |
typename typeN::Scalar | m, | ||
typename typeN::Scalar | n | ||
) |
Populate a single sine mode.
Makes a 2D image of the cosine mode:
\[ M_s(\vec{q}) = \sin\left( 2\pi\frac{m}{D}u + 2\pi\frac{n}{D}v \right) \]
where
\[ \vec{q} = u \hat{u} + v \hat{v} \]
and \( D \) is taken to be the maximum of the number of columns and rows in the image.
[out] | im | is an Eigen-like image |
[in] | m | specifies the spatial frequency in the u direction |
[in] | n | specifies the spatial frequency in the v direction |
0 | on success |
typeN | is an Eigen-like reference type. |
Definition at line 129 of file fourierModes.hpp.
References mx::sigproc::makeFourierModeS().
Referenced by mx::sigproc::makeFourierMode(), and mx::sigproc::makeFourierModeS().
int mx::sigproc::makeModifiedFourierMode | ( | typeN | im, |
typename typeN::Scalar | m, | ||
typename typeN::Scalar | n, | ||
int | p, | ||
typename typeN::Scalar | ang = 0 |
||
) |
Populate a single modified Fourier mode.
Makes a 2D image of the modified fourier mode:
\[ M_p(\vec{q}) = \cos\left( 2\pi \frac{m}{D}u + 2\pi\frac{n}{D}v \right) + p \sin\left( 2\pi\frac{m}{D}u + 2\pi\frac{n}{D}v \right) \]
where \( p = \pm 1 \), \( \vec{q} = u \hat{u} + v \hat{v} \), and \( D \) is taken to be the maximum of the number of columns in the image.
[out] | im | is an Eigen-like image |
[in] | m | specifies the spatial frequency in the u direction |
[in] | n | specifies the spatial frequency in the v direction |
[in] | p | is +/- 1 specifying which modified Fourier mode |
0 | on success |
typeN | is an Eigen-like reference type. |
Definition at line 199 of file fourierModes.hpp.
References mx::sigproc::makeModifiedFourierMode().
Referenced by mx::sigproc::fillFourierBasis(), mx::sigproc::makeModifiedFourierMode(), mx::sigproc::makeModifiedFourierModeM(), and mx::sigproc::makeModifiedFourierModeP().
int mx::sigproc::makeModifiedFourierModeM | ( | typeN | im, |
typename typeN::Scalar | m, | ||
typename typeN::Scalar | n, | ||
typename typeN::Scalar | ang = 0 |
||
) |
Populate a single modified Fourier -1 mode.
See makeModifiedFourierMode.
[out] | im | is an Eigen-like image |
[in] | m | specifies the spatial frequency in the u direction |
[in] | n | specifies the spatial frequency in the v direction |
typeN | is an Eigen-like reference type. |
Definition at line 286 of file fourierModes.hpp.
References mx::sigproc::makeModifiedFourierMode(), and mx::sigproc::makeModifiedFourierModeM().
Referenced by mx::sigproc::makeModifiedFourierModeM().
int mx::sigproc::makeModifiedFourierModeP | ( | typeN | im, |
typename typeN::Scalar | m, | ||
typename typeN::Scalar | n, | ||
typename typeN::Scalar | ang = 0 |
||
) |
Populate a single modified Fourier +1 mode.
See makeModifiedFourierMode.
[out] | im | is an Eigen-like image |
[in] | m | specifies the spatial frequency in the u direction |
[in] | n | specifies the spatial frequency in the v direction |
typeN | is an Eigen-like reference type. |
Definition at line 267 of file fourierModes.hpp.
References mx::sigproc::makeModifiedFourierMode(), and mx::sigproc::makeModifiedFourierModeP().
Referenced by mx::sigproc::makeModifiedFourierModeP().