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

template<typename _wavefrontT>
class mx::wfp::fraunhoferPropagator< _wavefrontT >

Class to perform Fraunhofer propagation between pupil and focal planes.

This class uses the FFT to propagate between planes, and normalizes so that flux is conserved. For propagation from pupil to focal plane, the pupil wavefront is tilted so that the focal-plane image is centered at the geometric center of the array. After propagation from focal plane to pupil plane, the pupil plane wavefront is un-tilted to restore the pupil to its original position.

Template Parameters
_wavefrontTis an Eigen::Array-like type, with std::complex values.
Todo:
check if we should reverse the FFT orders to be proper

Definition at line 56 of file fraunhoferPropagator.hpp.

#include <wfp/fraunhoferPropagator.hpp>

Public Types

typedef _wavefrontT wavefrontT
 The wavefront data type. More...
 
typedef wavefrontT::Scalar complexT
 The complex data type. More...
 
typedef wavefrontT::Scalar::value_type realT
 The real data type. More...
 

Public Member Functions

 fraunhoferPropagator ()
 Constructor. More...
 
 ~fraunhoferPropagator ()
 Destructor. More...
 
int wholePixel ()
 Get the value of the wholePixel parameter. More...
 
void wholePixel (realT wp)
 Set the value of the wholePixel parameter. More...
 
void shiftPupil (wavefrontT &complexPupil)
 Apply the shift to a pupil wavefront which will center the resultant focal plane image, and apply the normalization. More...
 
void unshiftPupil (wavefrontT &complexPupil)
 Apply the shift to a pupil wavefront which will restore it to a centered pupil image, with correct flux. More...
 
void propagatePupilToFocal (wavefrontT &complexFocal, wavefrontT &complexPupil, bool doCenter=true)
 Propagate the wavefront from the pupil plane to the focal plane. More...
 
void propagateFocalToPupil (wavefrontT &complexPupil, wavefrontT &complexFocal, bool doCenter=true)
 Propagate the wavefront from Focal plane to Pupil plane. More...
 
void setWavefrontSizePixels (int wfsPix)
 Set the size of the wavefront, in pixels. More...
 

Protected Member Functions

void initialize ()
 Initialize members. More...
 
void makeShiftPhase ()
 Calculate the complex tilt arrays for centering and normalizing the wavefronts. More...
 

Protected Attributes

int m_wavefrontSizePixels {0}
 The size of the wavefront in pixels. More...
 
realT m_xcen {0}
 x-coordinate of focal plane center, in pixels More...
 
realT m_ycen {0}
 x-coordinate of focal plane center, in pixels More...
 
realT m_wholePixel {0}
 Determines how the image is centered.
More...
 
wavefrontT m_centerFocal
 Phase screen for tilting the pupil plane so that the focal plane image is centered. More...
 
wavefrontT m_centerPupil
 Phase screen for un-tilting the pupil plane after propagating from a centered focal plane. More...
 
math::fft::fftT< complexT, complexT, 2, 0 > m_fft_fwd
 FFT object for forward FFTs. More...
 
math::fft::fftT< complexT, complexT, 2, 0 > m_fft_back
 FFT object for backward FFTs. More...
 

Member Typedef Documentation

◆ complexT

template<typename _wavefrontT >
typedef wavefrontT::Scalar mx::wfp::fraunhoferPropagator< _wavefrontT >::complexT

The complex data type.

Definition at line 65 of file fraunhoferPropagator.hpp.

◆ realT

template<typename _wavefrontT >
typedef wavefrontT::Scalar::value_type mx::wfp::fraunhoferPropagator< _wavefrontT >::realT

The real data type.

Definition at line 68 of file fraunhoferPropagator.hpp.

◆ wavefrontT

template<typename _wavefrontT >
typedef _wavefrontT mx::wfp::fraunhoferPropagator< _wavefrontT >::wavefrontT

The wavefront data type.

Definition at line 62 of file fraunhoferPropagator.hpp.

Constructor & Destructor Documentation

◆ fraunhoferPropagator()

Constructor.

Definition at line 177 of file fraunhoferPropagator.hpp.

◆ ~fraunhoferPropagator()

template<typename wavefrontT >
mx::wfp::fraunhoferPropagator< wavefrontT >::~fraunhoferPropagator

Destructor.

Definition at line 182 of file fraunhoferPropagator.hpp.

Member Function Documentation

◆ initialize()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::initialize
protected

Initialize members.

Definition at line 168 of file fraunhoferPropagator.hpp.

◆ makeShiftPhase()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::makeShiftPhase
protected

Calculate the complex tilt arrays for centering and normalizing the wavefronts.

Host memory to build the shift screens

Definition at line 265 of file fraunhoferPropagator.hpp.

References mx::math::pi().

◆ propagateFocalToPupil()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::propagateFocalToPupil ( wavefrontT complexPupil,
wavefrontT complexFocal,
bool  doCenter = true 
)

Propagate the wavefront from Focal plane to Pupil plane.

After the fourier transform, the output pupil plane wavefront is de-tilted, restoring it to the state prior to calling propagatePupilToFocal. This can be prevented by setting doCenter to false.

Parameters
[out]complexPupilthe pupil plane wavefront. Must be pre-allocated to same size as complexFocal.
[in]complexFocalthe focal plane wavefront.
[in]doCenter[optional] set to false to not apply the centering shift

Definition at line 231 of file fraunhoferPropagator.hpp.

◆ propagatePupilToFocal()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::propagatePupilToFocal ( wavefrontT complexFocal,
wavefrontT complexPupil,
bool  doCenter = true 
)

Propagate the wavefront from the pupil plane to the focal plane.

The pupil plane wavefront (complexPupil) is multiplied by a tilt to place the image in the geometric center of the focal plane. This can be prevented by setting doCenter to false.

Parameters
[out]complexFocalthe focal plane wavefront. Must be pre-allocated to same size as complexPupil.
[in]complexPupilthe pupil plane wavefront. Modified due to application of centering tilt.
[in]doCenter[optional] set to false to not apply the centering shift

Definition at line 215 of file fraunhoferPropagator.hpp.

◆ setWavefrontSizePixels()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::setWavefrontSizePixels ( int  wfsPix)

Set the size of the wavefront, in pixels.

Checks if the size changes, does nothing if no change. Otherwise, calls makeShiftPhase to pre-calculate the tilt arrays and plans the FFTs.

Parameters
[in]wfsPixthe desired new size of the wavefront

Definition at line 247 of file fraunhoferPropagator.hpp.

◆ shiftPupil()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::shiftPupil ( wavefrontT complexPupil)

Apply the shift to a pupil wavefront which will center the resultant focal plane image, and apply the normalization.

You must have allocated the shift screens first, by calling propagatePupilToFocal, propagateFocalToPupil, or setWavefrontSizePixels.

Parameters
complexPupil[in.out] the complex pupil plane wavefront to shift

Definition at line 203 of file fraunhoferPropagator.hpp.

◆ unshiftPupil()

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::unshiftPupil ( wavefrontT complexPupil)

Apply the shift to a pupil wavefront which will restore it to a centered pupil image, with correct flux.

You must have allocated the shift screens first, by calling propagatePupilToFocal, propagateFocalToPupil, or setWavefrontSizePixels.

Parameters
complexPupil[in.out] the complex pupil plane wavefront to shift

Definition at line 209 of file fraunhoferPropagator.hpp.

◆ wholePixel() [1/2]

template<typename wavefrontT >
int mx::wfp::fraunhoferPropagator< wavefrontT >::wholePixel

Get the value of the wholePixel parameter.

The wholePixel parameter determines how the image is centered. If 0 (default) it is at 0.5*(wfSz-1), if true it is shifted by 0.5*m_wholePixel in each axis.

Returns
the value of m_wholePixel

Definition at line 187 of file fraunhoferPropagator.hpp.

◆ wholePixel() [2/2]

template<typename wavefrontT >
void mx::wfp::fraunhoferPropagator< wavefrontT >::wholePixel ( realT  wp)

Set the value of the wholePixel parameter.

The wholePixel parameter determines how the image is centered. If 0 (default) it is at 0.5*(wfSz-1), if true it is shifted by 0.5*m_wholePixel in each axis.

Parameters
[in]wpthe new wholePixel value

Definition at line 193 of file fraunhoferPropagator.hpp.

Member Data Documentation

◆ m_centerFocal

template<typename _wavefrontT >
wavefrontT mx::wfp::fraunhoferPropagator< _wavefrontT >::m_centerFocal
protected

Phase screen for tilting the pupil plane so that the focal plane image is centered.

Definition at line 84 of file fraunhoferPropagator.hpp.

◆ m_centerPupil

template<typename _wavefrontT >
wavefrontT mx::wfp::fraunhoferPropagator< _wavefrontT >::m_centerPupil
protected

Phase screen for un-tilting the pupil plane after propagating from a centered focal plane.

Definition at line 87 of file fraunhoferPropagator.hpp.

◆ m_fft_back

template<typename _wavefrontT >
math::fft::fftT<complexT, complexT,2,0> mx::wfp::fraunhoferPropagator< _wavefrontT >::m_fft_back
protected

FFT object for backward FFTs.

Definition at line 93 of file fraunhoferPropagator.hpp.

◆ m_fft_fwd

template<typename _wavefrontT >
math::fft::fftT<complexT, complexT,2,0> mx::wfp::fraunhoferPropagator< _wavefrontT >::m_fft_fwd
protected

FFT object for forward FFTs.

Definition at line 90 of file fraunhoferPropagator.hpp.

◆ m_wavefrontSizePixels

template<typename _wavefrontT >
int mx::wfp::fraunhoferPropagator< _wavefrontT >::m_wavefrontSizePixels {0}
protected

The size of the wavefront in pixels.

Definition at line 73 of file fraunhoferPropagator.hpp.

◆ m_wholePixel

template<typename _wavefrontT >
realT mx::wfp::fraunhoferPropagator< _wavefrontT >::m_wholePixel {0}
protected

Determines how the image is centered.

If 0 (default) it is at 0.5*(wfSz-1), if true it is shifted by 0.5*m_wholePixel in each axis.

Definition at line 81 of file fraunhoferPropagator.hpp.

◆ m_xcen

template<typename _wavefrontT >
realT mx::wfp::fraunhoferPropagator< _wavefrontT >::m_xcen {0}
protected

x-coordinate of focal plane center, in pixels

Definition at line 75 of file fraunhoferPropagator.hpp.

◆ m_ycen

template<typename _wavefrontT >
realT mx::wfp::fraunhoferPropagator< _wavefrontT >::m_ycen {0}
protected

x-coordinate of focal plane center, in pixels

Definition at line 76 of file fraunhoferPropagator.hpp.


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