mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
fourierBasis.hpp
Go to the documentation of this file.
1/** \file fourierBasis.hpp
2 * \author Jared R. Males (jaredmales@gmail.com)
3 * \brief Generating a fourier basis.
4 * \ingroup mxAO_files
5 *
6 */
7
8#ifndef __fourierBasis_hpp__
9#define __fourierBasis_hpp__
10
15
16#include "aoPaths.hpp"
17
18namespace mx
19{
20namespace AO
21{
22
23/// Make the modified Fourier basis
24/**
25 * \param [in] basisName the name of the basis (not including the mx::AO path)
26 * \param [in] dim the linear size of the maps, that is they will be dimxdim in size.
27 * \param [in] N is the number of degrees of freedom. Number of modes will be (N+1)(N+1) - 1.
28 *
29 * \tparam realT the real numeric type for calculations
30 */
31template <typename realT>
32void makeModfBasis( const std::string &basisName, int dim, int N, realT ang, int nZern = 0 )
33{
35
37
39 bool fmodes_allocated;
40
41 if( nZern > 0 )
42 {
44
45 zModes.resize( dim, dim, nZern );
47
48 fmodes = new improc::eigenCube<realT>;
49 fmodes_allocated = true;
50 fmodes->resize( dim, dim, modes.planes() + nZern );
51
52 for( int p = 0; p < nZern; ++p )
53 {
54 fmodes->image( p ) = zModes.image( p );
55 }
56
57 for( int p = 0; p < modes.planes(); ++p )
58 {
59 fmodes->image( p + nZern ) = modes.image( p );
60 }
61
62 modes.resize( 0, 0, 0 );
63 zModes.resize( 0, 0, 0 );
64 }
65 else
66 {
67 fmodes = &modes;
68 fmodes_allocated = false;
69 }
70
72
73 std::string fName = mx::AO::path::basis::modes( basisName, true );
74
75 ff.write( fName, *fmodes );
76
77 if( fmodes_allocated )
78 {
79 delete fmodes;
80 }
81}
82
83} // namespace AO
84} // namespace mx
85
86#endif //__fourierBasis_hpp__
Standardized paths for the mx::AO system.
Class to manage interactions with a FITS file.
Definition fitsFile.hpp:84
error_t write(const dataT *im, int d1, int d2, int d3, fitsHeader< verboseT > *head)
Write the contents of a raw array to the FITS file.
An image cube with an Eigen-like API.
Definition eigenCube.hpp:33
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > image(Index n)
Returns a 2D Eigen::Eigen::Map pointed at the specified image.
An image cube with an Eigen API.
Declares and defines a class to work with a FITS file.
void makeModfBasis(const std::string &basisName, int dim, int N, realT ang, int nZern=0)
Make the modified Fourier basis.
Functions for generating 2D Fourier modes.
int makeFourierBasis_Rect(cubeT &cube, int dim, int N, int basisType, typename cubeT::Scalar ang=0)
Generate a rectangular Fourier basis.
#define MX_FOURIER_MODIFIED
Signifies the modified Fourier basis.
int zernikeBasis(cubeT &cube, typename cubeT::Scalar rad=-1, int minj=2)
Fill in an Eigencube-like array with Zernike polynomials in Noll order.
Definition zernike.hpp:506
The mxlib c++ namespace.
Definition mxlib.hpp:37
Working with the Zernike polynomials.