PURIFY
Next-generation radio interferometric imaging
wide_field_utilities.h
Go to the documentation of this file.
1 #ifndef PURIFY_WIDE_FIELD_UTILITIES_H
2 #define PURIFY_WIDE_FIELD_UTILITIES_H
3 
4 #include "purify/config.h"
5 #include "purify/types.h"
6 #include "purify/logging.h"
7 #ifdef PURIFY_MPI
8 #include <sopt/mpi/communicator.h>
9 #endif
10 namespace purify {
11 namespace widefield {
13 t_int w_support(const t_real w, const t_real du, const t_int min, const t_int max);
15 t_real pixel_to_lambda(const t_real cell, const t_uint imsize, const t_real oversample_ratio);
17 t_real estimate_cell_size(const t_real max_u, const t_uint imsize, const t_real oversample_ratio);
19 t_real equivalent_miriad_cell_size(const t_real cell, const t_uint imsize,
20  const t_real oversample_ratio);
22 Matrix<t_complex> estimate_sample_density(const Vector<t_real> &u, const Vector<t_real> &v,
23  const t_real cellx, const t_real celly,
24  const t_uint imsizex, const t_uint imsizey,
25  const t_real oversample_ratio, const t_real scale);
27 Vector<t_complex> sample_density_weights(const Vector<t_real> &u, const Vector<t_real> &v,
28  const t_real cellx, const t_real celly,
29  const t_uint imsizex, const t_uint imsizey,
30  const t_real oversample_ratio, const t_real scale);
31 #ifdef PURIFY_MPI
33 Vector<t_complex> sample_density_weights(const Vector<t_real> &u, const Vector<t_real> &v,
34  const t_real cellx, const t_real celly,
35  const t_uint imsizex, const t_uint imsizey,
36  const t_real oversample_ratio, const t_real scale,
37  const sopt::mpi::Communicator &comm);
38 #endif
40 t_real fov_cosine(t_real const cell, t_uint const imsize);
42 template <class DDE>
43 Matrix<t_complex> generate_dde(const DDE &dde, const t_real cell_x, const t_real cell_y,
44  const t_uint x_size, const t_uint y_size, const t_real stop_gap) {
45  assert(stop_gap <= 1);
46  const t_real L = fov_cosine(cell_x, x_size);
47  const t_real M = fov_cosine(cell_y, y_size);
48 
49  const t_real delt_x = L / x_size;
50  const t_real delt_y = M / y_size;
51  Image<t_complex> output = Image<t_complex>::Zero(y_size, x_size);
52 
53  for (t_int l = 0; l < x_size; ++l)
54  for (t_int m = 0; m < y_size; ++m) {
55  const t_real x = (l - x_size * 0.5) * delt_x;
56  const t_real y = (m - y_size * 0.5) * delt_y;
57  output(m, l) = ((x * x + y * y) < 1 - stop_gap) ? dde(y, x) : 0.;
58  }
59 
60  return output;
61 };
63 template <class DDE>
64 Matrix<t_complex> generate_chirp(const DDE &dde, const t_real w_rate, const t_real cell_x,
65  const t_real cell_y, const t_uint x_size, const t_uint y_size,
66  const t_real stop_gap = 0.1) {
67  const t_real nz = y_size * x_size;
68  const t_complex I(0, 1);
69  const auto chirp = [=](const t_real y, const t_real x) {
70  return dde(y, x) *
71  (std::exp(-2 * constant::pi * I * w_rate * (std::sqrt(1 - x * x - y * y) - 1))) /
72  std::sqrt(1 - x * x - y * y) / nz;
73  };
74  return generate_dde(chirp, cell_x, cell_y, x_size, y_size, stop_gap);
75 }
77 Matrix<t_complex> generate_chirp(const t_real w_rate, const t_real cell_x, const t_real cell_y,
78  const t_uint x_size, const t_uint y_size);
79 } // namespace widefield
80 } // namespace purify
81 #endif
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 fov_cosine(t_real const cell, t_uint const imsize)
Work out max L and M directional cosines from image parameters.
Matrix< t_complex > generate_dde(const DDE &dde, const t_real cell_x, const t_real cell_y, const t_uint x_size, const t_uint y_size, const t_real stop_gap)
Generate image of DDE for aw-stacking.
t_int w_support(const t_real w, const t_real du, const t_int min, const t_int max)
estimate support size of w given u resolution du
t_real equivalent_miriad_cell_size(const t_real cell, const t_uint imsize, const t_real oversample_ratio)
for a given purify cell size in arcsec provide the equivalent miriad cell size in arcsec
Vector< t_complex > sample_density_weights(const Vector< t_real > &u, const Vector< t_real > &v, const t_real cellx, const t_real celly, const t_uint imsizex, const t_uint imsizey, const t_real oversample_ratio, const t_real scale)
create sample density weights for a given field of view, uniform weighting
t_real pixel_to_lambda(const t_real cell, const t_uint imsize, const t_real oversample_ratio)
return factors to convert between arcsecond pixel size image space and lambda for uv space
Matrix< t_complex > estimate_sample_density(const Vector< t_real > &u, const Vector< t_real > &v, const t_real cellx, const t_real celly, const t_uint imsizex, const t_uint imsizey, const t_real oversample_ratio, const t_real scale)
estimate sample desity grid for a given field of view
Matrix< t_complex > generate_chirp(const t_real w_rate, const t_real cell_x, const t_real cell_y, const t_uint x_size, const t_uint y_size)
Generates image of chirp.
t_real estimate_cell_size(const t_real max_u, const t_uint imsize, const t_real oversample_ratio)
return cell size from the bandwidth