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

template<typename _wavefrontT, int _cudaGPU = 0>
class mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >

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 88 of file fraunhoferPropagator.hpp.

#include <wfp/fraunhoferPropagator.hpp>

Public Types

typedef _wavefrontT wavefrontT
 The wavefront data type.
 
typedef wavefrontT::Scalar complexT
 The complex data type.
 
typedef wavefrontT::Scalar::value_type realT
 The real data type.
 
typedef fraunhoferPropagatorArrayT< wavefrontT, cudaGPU >::arrayT arrayT
 The array data type.
 

Public Member Functions

 fraunhoferPropagator ()
 Constructor.
 
 ~fraunhoferPropagator ()
 Destructor.
 
int wholePixel ()
 Get the value of the wholePixel parameter.
 
void wholePixel (realT wp)
 Set the value of the wholePixel parameter.
 
template<int ccudaGPU = cudaGPU>
error_t shiftPupil (arrayT &complexPupil, typename std::enable_if< ccudaGPU==0 >::type *=0)
 Apply the shift to a pupil wavefront and apply the normalization.
 
template<int ccudaGPU = cudaGPU>
error_t shiftPupil (arrayT &complexPupil, typename std::enable_if< ccudaGPU==1 >::type *=0)
 Apply the shift to a pupil wavefront and apply the normalization.
 
template<int ccudaGPU = cudaGPU>
error_t unshiftPupil (arrayT &complexPupil, typename std::enable_if< ccudaGPU==0 >::type *=0)
 Apply the shift to a pupil wavefront which will restore it to a centered pupil image, with correct flux.
 
template<int ccudaGPU = cudaGPU>
error_t unshiftPupil (arrayT &complexPupil, typename std::enable_if< ccudaGPU==1 >::type *=0)
 Apply the shift to a pupil wavefront which will restore it to a centered pupil image, with correct flux.
 
error_t propagatePupilToFocal (arrayT &complexFocal, arrayT &complexPupil, bool doCenter=true)
 Propagate the wavefront from the pupil plane to the focal plane.
 
error_t propagateFocalToPupil (arrayT &complexPupil, arrayT &complexFocal, bool doCenter=true)
 Propagate the wavefront from Focal plane to Pupil plane.
 
void setWavefrontSizePixels (int wfsPix)
 Set the size of the wavefront, in pixels.
 

Protected Member Functions

void makeShiftPhase ()
 Calculate the complex tilt arrays for centering and normalizing the wavefronts.
 

Protected Attributes

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

Member Typedef Documentation

◆ arrayT

template<typename _wavefrontT , int _cudaGPU = 0>
typedef fraunhoferPropagatorArrayT<wavefrontT,cudaGPU>::arrayT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::arrayT

The array data type.

Definition at line 104 of file fraunhoferPropagator.hpp.

◆ complexT

template<typename _wavefrontT , int _cudaGPU = 0>
typedef wavefrontT::Scalar mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::complexT

The complex data type.

Definition at line 98 of file fraunhoferPropagator.hpp.

◆ realT

template<typename _wavefrontT , int _cudaGPU = 0>
typedef wavefrontT::Scalar::value_type mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::realT

The real data type.

Definition at line 101 of file fraunhoferPropagator.hpp.

◆ wavefrontT

template<typename _wavefrontT , int _cudaGPU = 0>
typedef _wavefrontT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::wavefrontT

The wavefront data type.

Definition at line 93 of file fraunhoferPropagator.hpp.

Constructor & Destructor Documentation

◆ fraunhoferPropagator()

template<typename wavefrontT , int cudaGPU>
mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::fraunhoferPropagator ( )

Constructor.

Definition at line 239 of file fraunhoferPropagator.hpp.

◆ ~fraunhoferPropagator()

template<typename wavefrontT , int cudaGPU>
mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::~fraunhoferPropagator ( )

Destructor.

Definition at line 244 of file fraunhoferPropagator.hpp.

Member Function Documentation

◆ makeShiftPhase()

template<typename wavefrontT , int cudaGPU>
void mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::makeShiftPhase ( )
protected

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

Host memory to build the shift screens

Definition at line 475 of file fraunhoferPropagator.hpp.

References mx::math::six_fifths().

◆ propagateFocalToPupil()

template<typename wavefrontT , int cudaGPU>
error_t mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::propagateFocalToPupil ( arrayT complexPupil,
arrayT 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 365 of file fraunhoferPropagator.hpp.

References mx::noerror.

◆ propagatePupilToFocal()

template<typename wavefrontT , int cudaGPU>
error_t mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::propagatePupilToFocal ( arrayT complexFocal,
arrayT 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 330 of file fraunhoferPropagator.hpp.

References mx::noerror.

◆ setWavefrontSizePixels()

template<typename wavefrontT , int cudaGPU>
void mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::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 399 of file fraunhoferPropagator.hpp.

References backward.

◆ shiftPupil() [1/2]

template<typename wavefrontT , int cudaGPU>
template<int ccudaGPU>
error_t mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::shiftPupil ( arrayT complexPupil,
typename std::enable_if< ccudaGPU==0 >::type *  = 0 
)

Apply the shift to a pupil wavefront and apply the normalization.

This will center the resultant focal plane image. 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 268 of file fraunhoferPropagator.hpp.

References mx::noerror.

◆ shiftPupil() [2/2]

template<typename wavefrontT , int cudaGPU>
template<int ccudaGPU>
error_t mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::shiftPupil ( arrayT complexPupil,
typename std::enable_if< ccudaGPU==1 >::type *  = 0 
)

Apply the shift to a pupil wavefront and apply the normalization.

This will center the resultant focal plane image. 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 278 of file fraunhoferPropagator.hpp.

References mx::noerror.

◆ unshiftPupil() [1/2]

template<typename wavefrontT , int cudaGPU>
template<int ccudaGPU>
error_t mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::unshiftPupil ( arrayT complexPupil,
typename std::enable_if< ccudaGPU==0 >::type *  = 0 
)

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 302 of file fraunhoferPropagator.hpp.

References mx::noerror.

◆ unshiftPupil() [2/2]

template<typename wavefrontT , int cudaGPU>
template<int ccudaGPU>
error_t mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::unshiftPupil ( arrayT complexPupil,
typename std::enable_if< ccudaGPU==1 >::type *  = 0 
)

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 312 of file fraunhoferPropagator.hpp.

References mx::noerror.

◆ wholePixel() [1/2]

template<typename wavefrontT , int cudaGPU>
int mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::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 249 of file fraunhoferPropagator.hpp.

◆ wholePixel() [2/2]

template<typename wavefrontT , int cudaGPU>
void mx::wfp::fraunhoferPropagator< wavefrontT, cudaGPU >::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 255 of file fraunhoferPropagator.hpp.

Member Data Documentation

◆ m_centerFocal

template<typename _wavefrontT , int _cudaGPU = 0>
fraunhoferPropagatorArrayT<wavefrontT,cudaGPU>::arrayT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::m_centerFocal
protected

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

Definition at line 121 of file fraunhoferPropagator.hpp.

◆ m_centerPupil

template<typename _wavefrontT , int _cudaGPU = 0>
fraunhoferPropagatorArrayT<wavefrontT,cudaGPU>::arrayT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::m_centerPupil
protected

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

Definition at line 124 of file fraunhoferPropagator.hpp.

◆ m_fft_back

template<typename _wavefrontT , int _cudaGPU = 0>
math::ft::fftT<complexT, complexT, 2, cudaGPU> mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::m_fft_back
protected

FFT object for backward FFTs.

Definition at line 130 of file fraunhoferPropagator.hpp.

◆ m_fft_fwd

template<typename _wavefrontT , int _cudaGPU = 0>
math::ft::fftT<complexT, complexT, 2, cudaGPU> mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::m_fft_fwd
protected

FFT object for forward FFTs.

Definition at line 127 of file fraunhoferPropagator.hpp.

◆ m_wavefrontSizePixels

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

The size of the wavefront in pixels.

Definition at line 110 of file fraunhoferPropagator.hpp.

◆ m_wholePixel

template<typename _wavefrontT , int _cudaGPU = 0>
realT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::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 118 of file fraunhoferPropagator.hpp.

◆ m_xcen

template<typename _wavefrontT , int _cudaGPU = 0>
realT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::m_xcen { 0 }
protected

x-coordinate of focal plane center, in pixels

Definition at line 112 of file fraunhoferPropagator.hpp.

◆ m_ycen

template<typename _wavefrontT , int _cudaGPU = 0>
realT mx::wfp::fraunhoferPropagator< _wavefrontT, _cudaGPU >::m_ycen { 0 }
protected

x-coordinate of focal plane center, in pixels

Definition at line 113 of file fraunhoferPropagator.hpp.


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