PURIFY
Next-generation radio interferometric imaging
wkernel_integration.cc
Go to the documentation of this file.
1 #include "wkernel_integration.h"
2 #include <boost/math/special_functions/bessel.hpp>
3 
4 namespace purify {
5 
6 namespace projection_kernels {
7 t_complex fourier_wproj_kernel(const t_real x, const t_real y, const t_real w, const t_real u,
8  const t_real v, const t_real du, const t_real dv) {
9  // checking bounds don't go past the horizon...
10  if ((std::pow(x / du, 2) + std::pow(y / dv, 2)) < 1)
11  return std::exp(t_complex(
12  0.,
13  -2 * constant::pi *
14  (u * x + v * y + w * (std::sqrt(1 - (x * x) / (du * du) - (y * y) / (dv * dv)) - 1))));
15  else
16  return 0;
17 }
18 t_complex hankel_wproj_kernel(const t_real r, const t_real w, const t_real u, const t_real v,
19  const t_real du) {
20  return ((r / du < 1.) ? std::exp(t_complex(
21  0., -2 * constant::pi * w * (std::sqrt(1 - (r * r) / (du * du)) - 1)))
22  : 1) *
23  boost::math::cyl_bessel_j(0, 2 * constant::pi * r * std::sqrt(u * u + v * v)) * r;
24 }
25 t_complex exact_w_projection_integration_1d(const t_real u, const t_real v, const t_real w,
26  const t_real du, const t_real oversample_ratio,
27  const std::function<t_complex(t_real)> &ftkerneluv,
28  const t_uint &max_evaluations,
29  const t_real &absolute_error,
30  const t_real &relative_error,
31  const integration::method method, t_uint &evaluations) {
32  evaluations = 0;
33  const auto func = [&](const Vector<t_real> &x) -> t_complex {
34  evaluations++;
35  assert(std::abs(x(0)) <= 1);
36  return ftkerneluv(x(0)) * hankel_wproj_kernel(x(0), w, u, v, du);
37  };
38  const Vector<t_real> xmin = Vector<t_real>::Zero(1);
39  const Vector<t_real> xmax = Vector<t_real>::Constant(1, oversample_ratio / 2.);
40  return 2. * constant::pi *
41  integration::integrate(xmin, xmax, func, integration::norm_type::paired, absolute_error,
42  relative_error, max_evaluations, method) /
43  std::pow(xmax(0), 2);
44 }
45 
46 t_complex exact_w_projection_integration(const t_real u, const t_real v, const t_real w,
47  const t_real du, const t_real dv,
48  const t_real oversample_ratio,
49  const std::function<t_complex(t_real)> &ftkernelu,
50  const std::function<t_complex(t_real)> &ftkernelv,
51  const t_uint &max_evaluations,
52  const t_real &absolute_error, const t_real &relative_error,
53  const integration::method method, t_uint &evaluations) {
54  auto const func = [&](const Vector<t_real> &x) -> t_complex {
55  evaluations++;
56  return ftkernelu(x(0)) * ftkernelv(x(1)) * fourier_wproj_kernel(x(0), x(1), w, u, v, du, dv);
57  };
58  Vector<t_real> xmax = Vector<t_real>::Zero(2);
59  xmax(0) = oversample_ratio / 2.;
60  xmax(1) = oversample_ratio / 2.;
61  const Vector<t_real> xmin = -xmax;
62  return integration::integrate(xmin, xmax, func, integration::norm_type::paired, absolute_error,
63  relative_error, max_evaluations, method) /
64  (xmax(0) - xmin(0)) / (xmax(1) - xmin(1));
65 }
66 } // namespace projection_kernels
67 } // namespace purify
const std::vector< t_real > u
data for u coordinate
Definition: operators.cc:18
const std::vector< t_real > v
data for v coordinate
Definition: operators.cc:20
const t_real pi
mathematical constant
Definition: types.h:70
t_real integrate(const Vector< t_real > &xmin, const Vector< t_real > &xmax, const std::function< t_real(Vector< t_real >)> &func, const norm_type norm, const t_real required_abs_error, const t_real required_rel_error, const t_uint max_evaluations, const method methodtype)
adaptive integration with cubature for real scalar to vector
Definition: integration.cc:7
t_complex exact_w_projection_integration_1d(const t_real u, const t_real v, const t_real w, const t_real du, const t_real oversample_ratio, const std::function< t_complex(t_real)> &ftkerneluv, const t_uint &max_evaluations, const t_real &absolute_error, const t_real &relative_error, const integration::method method, t_uint &evaluations)
t_complex exact_w_projection_integration(const t_real u, const t_real v, const t_real w, const t_real du, const t_real dv, const t_real oversample_ratio, const std::function< t_complex(t_real)> &ftkernelu, const std::function< t_complex(t_real)> &ftkernelv, const t_uint &max_evaluations, const t_real &absolute_error, const t_real &relative_error, const integration::method method, t_uint &evaluations)
numerical integration of chirp and kernel in image domain
t_complex fourier_wproj_kernel(const t_real x, const t_real y, const t_real w, const t_real u, const t_real v, const t_real du, const t_real dv)
integration kernel for 2d fourier transform of chirp, bounded to a circle of radius x/du < 1
t_complex hankel_wproj_kernel(const t_real r, const t_real w, const t_real u, const t_real v, const t_real du)
integration kernel for hankel transform with chirp