27 #ifndef math_func_airyPattern_hpp
28 #define math_func_airyPattern_hpp
31 #include <gsl/gsl_integration.h>
32 #include <gsl/gsl_errno.h>
34 #include "../constants.hpp"
58 template<
typename realT>
61 return pow(2*
jinc(pi<realT>()*x),2);
74 template<
typename realT>
79 return (1./pow(1.-eps*eps,2))*pow(2.*
jinc( pi<realT>()*x)-eps*eps*2.*
jinc(eps*pi<realT>()*x),2);
94 template<
typename realT>
105 realT r = sqrt( pow(x-x0,2) + pow(y-y0,2)) * ps;
120 template<
typename realT>
133 for(
size_t j=0;j<ny; ++j)
135 for(
size_t i=0;i<nx; ++i)
139 realT rad = sqrt( pow(i-x0,2) + pow(j-y0,2) ) * ps;
155 template<
typename realT>
160 return (0.488/(fwhm*fwhm))*pow(1. + (11./6.)*pow(x/fwhm,2), -11./6.);
171 template<
typename realT>
174 realT x1 = x*pi<realT>();
176 realT b0 = bessel_j<realT>(0,x1);
179 realT b1 = bessel_j<realT>(1,x1);
182 realT encp =
static_cast<realT
>(1) - b0 - b1;
187 template<
typename realT>
188 realT apeInt( realT x,
192 realT eps = *
static_cast<realT*
>(params);
194 return bessel_j<realT>(1,x)*bessel_j<realT>(1,eps*x)/x;
206 template<
typename realT>
214 func.function = apeInt<realT>;
221 realT x1 = x*pi<realT>();
223 gsl_set_error_handler_off();
224 gsl_integration_qng( &func, 0, x1, 1e-7, 1e-7, &jint,&abserr, &neval);
226 realT b0 = bessel_j<realT>(0,x1);
228 realT b1 = bessel_j<realT>(1,x1);
231 realT b0e = bessel_j<realT>(0,eps*x1);
233 realT b1e = bessel_j<realT>(1,eps*x1);
236 realT eps2 = pow(eps,2);
238 realT encp =
static_cast<realT
>(1) - b0 - b1 + eps2*(
static_cast<realT
>(1) - b0e - b1e);
240 encp = encp - 4*eps*jint;
241 encp = encp/(
static_cast<realT
>(1)-eps2);
Declares and defines Bessel functions of the first kind.
realT airyPatternEnclosed(realT x, realT eps)
Calculate the fraction of enclosed power at a given radius for the centrally obscured Airy Pattern.
realT seeingHalo(realT x, realT fwhm)
Seeing Halo Profile.
realT airyPattern(realT x, realT y, realT A0, realT A, realT x0, realT y0, realT ps, realT eps)
The general centrally obscured Airy pattern, with arbitrary center and platescale.
void airyPattern2D(realT *arr, size_t nx, size_t ny, const realT A0, const realT A, const realT x0, const realT y0, realT ps)
Fill in an array with the 2D arbitrarily-centered classical Airy pattern.
T jinc(const T &x)
The Jinc function.
Declares and defines the Jinc and Jinc2 functions.