11#include <mx/ioutils/fits/fitsFile.hpp>
12#include <mx/improc/eigenImage.hpp>
14#include <mx/wfp/imagingUtils.hpp>
16#include <mx/sigproc/signalWindows.hpp>
27template <
typename realT>
29 realT pupilDiamPixels,
30 realT pupilDiamMeters,
34 using namespace mx::improc;
35 using namespace mx::wfp;
36 using namespace mx::sigproc;
41 pup.resize( pupilDiamPixels, pupilDiamPixels );
46 phead.
append(
"SCALE", pupilDiamMeters / pupilDiamPixels,
"Scale in m/pix" );
47 phead.
append(
"PUPILD", pupilDiamMeters,
"Physical diameter of pupil image [m]" );
48 phead.
append(
"CENTOBS", centralObs,
"Central obscuration ratio" );
49 phead.
append(
"OVERSCAN", overscan,
"Fractional pixel overscan" );
53 std::string fName = mx::AO::path::pupil::pupilFile( pupilName,
true );
55 ff.
write( fName, pup, phead );
61template <
typename realT>
64 realT pupilDiamMeters,
70 using namespace mx::improc;
71 using namespace mx::wfp;
72 using namespace mx::sigproc;
75 Eigen::Array<realT, -1, -1> pup;
77 pup.resize( pupilDiamPixels, pupilDiamPixels );
79 realT cen = 0.5 * ( pupilDiamPixels - 1.0 );
83 window::tukey2d<realT>( pup.data(), pupilDiamPixels, pupilDiamPixels + overScan, tukeyAlpha, cen, cen );
87 window::tukey2dAnnulus<realT>(
88 pup.data(), pupilDiamPixels, pupilDiamPixels + overScan, centralObs, tukeyAlpha, cen, cen );
92 phead.
append(
"SCALE", pupilDiamMeters / pupilDiamPixels,
"Scale in m/pix" );
93 phead.
append(
"PUPILD", pupilDiamMeters,
"Physical diameter of pupil image [m]" );
94 phead.
append(
"CENTOBS", centralObs,
"Central obscuration ratio" );
95 phead.
append(
"TUKALPHA", tukeyAlpha,
"Tukey window alpha parameter" );
96 phead.
append(
"OVERSCAN", overScan,
"Apodization overscan" );
100 std::string fName = mx::AO::path::pupil::pupilFile( pupilName,
true );
102 ff.
write( fName, pup, phead );
Standardized paths for the mx::AO system.
Class to manage interactions with a FITS file.
int write(const dataT *im, int d1, int d2, int d3, fitsHeader *head)
Write the contents of a raw array to the FITS file.
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.
int circularPupil(arrayT &m, typename arrayT::Scalar eps=0, typename arrayT::Scalar rad=0, typename arrayT::Scalar overscan=0)
Fill in an Eigen-like array with a circular pupil mask.
void circularPupil(const std::string &pupilName, realT pupilDiamPixels, realT pupilDiamMeters, realT centralObs=0, realT overscan=0)
Generate a circular pupil and saves it to disk.
void circularApodizedPupil(const std::string &pupilName, int pupilDiamPixels, realT pupilDiamMeters, realT tukeyAlpha, realT centralObs=0, realT overScan=0)
Generates a circular apodized pupil and saves it to disk.