mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT > Struct Template Reference

template<typename _realT, typename _fpmaskFloatT>
struct mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >

The Lyot Coronagraph.

A generalized Lyot coronagraph, which can include a pupil apodization, a focal plane mask with complex transmission, and a Lyot stop. Light is propagated through the coronagraph plane-by-plane, and the complex wavefront can be accessed at any plane. Also provides functions for optimizing the pupil apodizer and focal plane mask.

Definition at line 56 of file lyotCoronagraph.hpp.

#include <wfp/lyotCoronagraph.hpp>

Public Types

typedef _realT realT
 The real floating point type. More...
 
typedef _fpmaskFloatT fpmaskFloatT
 The real floating point type for mask calculations. More...
 
typedef std::complex< realTcomplexT
 The complex floating point type. More...
 
typedef mx::wfp::imagingArray< std::complex< realT >, fftwAllocator< std::complex< realT > >, 0 > complexFieldT
 The wavefront complex field type. More...
 
typedef Eigen::Array< std::complex< fpmaskFloatT >, Eigen::Dynamic, Eigen::Dynamic > fpMaskT
 The focal plane mask type. More...
 
typedef Eigen::Array< realT, Eigen::Dynamic, Eigen::Dynamic > imageT
 The image type. More...
 

Public Member Functions

 lyotCoronagraph ()
 Default c'tor. More...
 
int wfSz ()
 Get the wavefront size in pixels. More...
 
void wfSz (int sz)
 Set the wavefront size in pixels. More...
 
void makeFocalMask (realT rad, fpmaskFloatT trans=0.0, int sz=0.0)
 Make the focal plane mask. More...
 
int loadApodizer (const std::string &apodName)
 Load the apodizer from a FITS file. More...
 
int loadFocalMask (const std::string &fpmName)
 Load the focal plane mask from a FITS file. More...
 
int loadLyotStop (const std::string &lyotName)
 Load the Lyot stop from a FITS file. More...
 
int loadCoronagraph (const std::string &apodName, const std::string &fpmName, const std::string &lyotName)
 Load the components of the coronagraph from FITS files. More...
 
int loadCoronagraph (const std::string &cName)
 Load the components of the coronagraph based in its base name. More...
 
int propagate (complexFieldT &pupilPlane)
 Propagate the given pupil-plane wavefront through the coronagraph. More...
 
int propagate (imageT &fpIntensity, complexFieldT &pupilPlane)
 
int propagateNC (complexFieldT &pupilPlane)
 Propagate the given pupil-plane wavefront without the coronagraph. More...
 
int propagateNC (imageT &fpIntensity, complexFieldT &pupilPlane)
 
void optimizeAPLCMC (imageT &geomPupil, realT fpmRadPix, realT relTol, realT absTol, int maxIter, const std::string &cname)
 Optimize the pupil amplitude apodization and focal-plane mask complex transmission. More...
 
void optimizeAPLCMC (imageT &geomPupil, realT fpmRadPix, imageT &fpmPhase, realT relTol, realT absTol, int maxIter, const std::string &cname)
 

Public Attributes

std::string m_fileDir {"coron"}
 The directory where coronagraph files are stored. More...
 
int m_wfSz {0}
 The linear size of the wavefront in pixels. More...
 
imageT m_pupilApodizer
 Image containing the pupil apodization. More...
 
int m_maskSource
 0= read from file, 1 = constructed by makeFocalMask, 2 = trans optimized. More...
 
std::string m_maskFile
 Name of file from which mask was loaded. More...
 
realT m_maskRad
 Radius of mask if it was constructed. More...
 
realT m_maskTrans
 Transmission of mask if it was constructed. More...
 
fpMaskT m_focalMask
 The focal plane mask. More...
 
imageT m_lyotStop
 Image containing the lyot stop. More...
 
fraunhoferPropagator< complexFieldTm_fp
 Fraunhofer propagator. More...
 

Member Typedef Documentation

◆ complexFieldT

template<typename _realT , typename _fpmaskFloatT >
typedef mx::wfp::imagingArray<std::complex<realT>, fftwAllocator<std::complex<realT> >, 0> mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::complexFieldT

The wavefront complex field type.

Definition at line 69 of file lyotCoronagraph.hpp.

◆ complexT

template<typename _realT , typename _fpmaskFloatT >
typedef std::complex<realT> mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::complexT

The complex floating point type.

Definition at line 66 of file lyotCoronagraph.hpp.

◆ fpmaskFloatT

template<typename _realT , typename _fpmaskFloatT >
typedef _fpmaskFloatT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::fpmaskFloatT

The real floating point type for mask calculations.

Definition at line 63 of file lyotCoronagraph.hpp.

◆ fpMaskT

template<typename _realT , typename _fpmaskFloatT >
typedef Eigen::Array< std::complex<fpmaskFloatT>, Eigen::Dynamic, Eigen::Dynamic> mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::fpMaskT

The focal plane mask type.

Definition at line 72 of file lyotCoronagraph.hpp.

◆ imageT

template<typename _realT , typename _fpmaskFloatT >
typedef Eigen::Array< realT, Eigen::Dynamic, Eigen::Dynamic> mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::imageT

The image type.

Definition at line 75 of file lyotCoronagraph.hpp.

◆ realT

template<typename _realT , typename _fpmaskFloatT >
typedef _realT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::realT

The real floating point type.

Definition at line 60 of file lyotCoronagraph.hpp.

Constructor & Destructor Documentation

◆ lyotCoronagraph()

template<typename _realT , typename _fpmaskFloatT >
mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::lyotCoronagraph

Default c'tor.

Definition at line 220 of file lyotCoronagraph.hpp.

Member Function Documentation

◆ loadApodizer()

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::loadApodizer ( const std::string &  apodName)

Load the apodizer from a FITS file.

Returns
0 on success.
-1 on error.
Parameters
[in]apodNameis the name of the FITS file containing the apodizer.

Definition at line 274 of file lyotCoronagraph.hpp.

References mx::fits::fitsFile< dataT >::read().

◆ loadCoronagraph() [1/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::loadCoronagraph ( const std::string &  apodName,
const std::string &  fpmName,
const std::string &  lyotName 
)

Load the components of the coronagraph from FITS files.

Returns
0 on success.
-1 on error.
Parameters
[in]apodNameis the name of the FITS file containing the apodizer.
[in]fpmNameis the name of the FITS file containing the focal plane mask.
[in]lyotNameis the name of the FITS file containing the lyot stop.

Definition at line 330 of file lyotCoronagraph.hpp.

◆ loadCoronagraph() [2/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::loadCoronagraph ( const std::string &  cName)

Load the components of the coronagraph based in its base name.

Looks in _filDir for the files.

Returns
0 on success.
-1 on error.
Parameters
[in]cNameis the base name of the coronagraph without directory or file extension.

Definition at line 342 of file lyotCoronagraph.hpp.

◆ loadFocalMask()

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::loadFocalMask ( const std::string &  fpmName)

Load the focal plane mask from a FITS file.

Returns
0 on success.
-1 on error.
Parameters
[in]fpmNameis the name of the FITS file containing the focal plane mask.

Definition at line 283 of file lyotCoronagraph.hpp.

References mx::astro::constants::c(), mx::improc::eigenCube< dataT >::image(), and mx::fits::fitsFile< dataT >::read().

◆ loadLyotStop()

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::loadLyotStop ( const std::string &  lyotName)

Load the Lyot stop from a FITS file.

Returns
0 on success.
-1 on error.
Parameters
[in]lyotNameis the name of the FITS file containing the lyot stop.

Definition at line 321 of file lyotCoronagraph.hpp.

References mx::fits::fitsFile< dataT >::read().

◆ makeFocalMask()

template<typename _realT , typename _fpmaskFloatT >
void mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::makeFocalMask ( realT  rad,
fpmaskFloatT  trans = 0.0,
int  sz = 0.0 
)

Make the focal plane mask.

Definition at line 241 of file lyotCoronagraph.hpp.

References mx::wfp::circularPupil().

◆ optimizeAPLCMC() [1/2]

template<typename _realT , typename _fpmaskFloatT >
void mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::optimizeAPLCMC ( imageT geomPupil,
realT  fpmRadPix,
imageT fpmPhase,
realT  relTol,
realT  absTol,
int  maxIter,
const std::string &  cname 
)
Parameters
geomPupilThe geometric pupil mask, binary 1/0 transmission.
fpmRadPixThe radius in pixels of the FPM.
relTolRelative tolerance for convergence.
absTolAbsolute tolerance for convergence.
maxIterMaximum number of iterations to allow.
cnameName of coronagraph, used as base-name for output files in m_fileDir.

Definition at line 661 of file lyotCoronagraph.hpp.

References mx::wfp::circularPupil(), and mx::wfp::makeComplexPupil().

◆ optimizeAPLCMC() [2/2]

template<typename _realT , typename _fpmaskFloatT >
void mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::optimizeAPLCMC ( imageT geomPupil,
realT  fpmRadPix,
realT  relTol,
realT  absTol,
int  maxIter,
const std::string &  cname 
)

Optimize the pupil amplitude apodization and focal-plane mask complex transmission.

Uses the algorithm in Guyon (2014) [8] for optimizing an Apodized-Pupil Lyot Complex Mask Coronagraph (APLCMC).

Parameters
geomPupilThe geometric pupil mask, binary 1/0 transmission.
fpmRadPixThe radius in pixels of the FPM.
relTolRelative tolerance for convergence.
absTolAbsolute tolerance for convergence.
maxIterMaximum number of iterations to allow.
cnameName of coronagraph, used as base-name for output files in m_fileDir.

Definition at line 494 of file lyotCoronagraph.hpp.

References mx::wfp::circularPupil(), and mx::wfp::makeComplexPupil().

◆ propagate() [1/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::propagate ( complexFieldT pupilPlane)

Propagate the given pupil-plane wavefront through the coronagraph.

Parameters
pupilPlane[in.out] The wavefront at the input pupil plane. It is modified by the coronagraph.

Definition at line 420 of file lyotCoronagraph.hpp.

◆ propagate() [2/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::propagate ( imageT fpIntensity,
complexFieldT pupilPlane 
)
Parameters
[out]fpIntensityThe intensity image in the focal plane. This should be pre-allocated.
pupilPlane[in.out] The wavefront at the input pupil plane. It is modified by the coronagraph.

Definition at line 446 of file lyotCoronagraph.hpp.

◆ propagateNC() [1/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::propagateNC ( complexFieldT pupilPlane)

Propagate the given pupil-plane wavefront without the coronagraph.

For a Lyot coronagraph, this applies the pupil apodization and Lyot stop, but not the FPM, to the given pupil-plane wavefront such that the result will produce the non-coronagraphic (off-axis) PSF.

Parameters
pupilPlane[in.out] The wavefront at the input pupil plane. It is modified by the coronagraph.

Definition at line 462 of file lyotCoronagraph.hpp.

◆ propagateNC() [2/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::propagateNC ( imageT fpIntensity,
complexFieldT pupilPlane 
)
Parameters
[out]fpIntensityThe intensity image in the focal plane. This should be pre-allocated.
pupilPlane[in.out] The wavefront at the input pupil plane. It is modified by the coronagraph.

Definition at line 476 of file lyotCoronagraph.hpp.

◆ wfSz() [1/2]

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::wfSz

Get the wavefront size in pixels.

Returns
the wavefront size in pixels

Definition at line 225 of file lyotCoronagraph.hpp.

◆ wfSz() [2/2]

template<typename _realT , typename _fpmaskFloatT >
void mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::wfSz ( int  sz)

Set the wavefront size in pixels.

Parameters
[in]szis the new size

Definition at line 231 of file lyotCoronagraph.hpp.

Member Data Documentation

◆ m_fileDir

template<typename _realT , typename _fpmaskFloatT >
std::string mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_fileDir {"coron"}

The directory where coronagraph files are stored.

Definition at line 81 of file lyotCoronagraph.hpp.

◆ m_focalMask

template<typename _realT , typename _fpmaskFloatT >
fpMaskT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_focalMask

The focal plane mask.

Definition at line 97 of file lyotCoronagraph.hpp.

◆ m_fp

template<typename _realT , typename _fpmaskFloatT >
fraunhoferPropagator<complexFieldT> mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_fp

Fraunhofer propagator.

Definition at line 112 of file lyotCoronagraph.hpp.

◆ m_lyotStop

template<typename _realT , typename _fpmaskFloatT >
imageT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_lyotStop

Image containing the lyot stop.

Definition at line 100 of file lyotCoronagraph.hpp.

◆ m_maskFile

template<typename _realT , typename _fpmaskFloatT >
std::string mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_maskFile

Name of file from which mask was loaded.

Definition at line 91 of file lyotCoronagraph.hpp.

◆ m_maskRad

template<typename _realT , typename _fpmaskFloatT >
realT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_maskRad

Radius of mask if it was constructed.

Definition at line 93 of file lyotCoronagraph.hpp.

◆ m_maskSource

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_maskSource

0= read from file, 1 = constructed by makeFocalMask, 2 = trans optimized.

Definition at line 90 of file lyotCoronagraph.hpp.

◆ m_maskTrans

template<typename _realT , typename _fpmaskFloatT >
realT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_maskTrans

Transmission of mask if it was constructed.

Definition at line 94 of file lyotCoronagraph.hpp.

◆ m_pupilApodizer

template<typename _realT , typename _fpmaskFloatT >
imageT mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_pupilApodizer

Image containing the pupil apodization.

Definition at line 87 of file lyotCoronagraph.hpp.

◆ m_wfSz

template<typename _realT , typename _fpmaskFloatT >
int mx::wfp::lyotCoronagraph< _realT, _fpmaskFloatT >::m_wfSz {0}

The linear size of the wavefront in pixels.

Definition at line 84 of file lyotCoronagraph.hpp.


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