1 #include "purify/config.h"
4 #include "purify/directories.h"
11 int main(
int nargs,
char const **args) {
12 auto const session = sopt::mpi::init(nargs, args);
13 auto const world = sopt::mpi::Communicator::World();
16 auto const oversample_ratio = 2;
19 const t_real FoV = 30 * 60 * 60;
20 const t_real k_means_rel_diff = 1e-5;
21 std::string
const results =
output_filename(
"mems_" + std::to_string(world.size()) +
".txt");
22 std::ofstream out(world.is_root() ? results :
output_filename(
"empty.txt"));
23 if (world.is_root()) {
26 t_int
const number_of_vis = std::pow(10, 6);
27 const t_real rms_w = 200;
28 t_int
const imsizex = 1024;
29 t_int
const imsizey = imsizex;
30 const t_real cell = FoV /
static_cast<t_real
>(imsizex);
32 const t_int channels = 80;
34 const std::string pos_filename =
mwa_filename(
"Phase1_config.txt");
35 t_uint
const number_of_pixels = imsizex * imsizey;
38 Vector<t_real> mem_stack = Vector<t_real>::Zero(world.size());
39 Vector<t_real> mem_node = Vector<t_real>::Zero(world.size());
40 std::vector<t_real> frequencies;
41 for (t_int k = 0; k < channels; k++)
42 frequencies.push_back(87.68e6 +
43 (world.rank() * channels + k - world.size() * channels * 0.5) * 40e3);
45 const std::vector<t_real> times = {0., 8., 16., 24., 32., 40., 48., 56.,
46 64., 72., 80., 88., 96., 104., 112.};
51 theta_ra, phi_dec, latitude);
52 const t_real number_of_baselines = uv_data.size() / times.size() / channels;
54 const auto cost = [](t_real x) -> t_real {
return std::abs(x * x); };
56 std::vector<t_real> w_stacks;
57 std::vector<t_int> image_index;
59 uv_data, du, Ju, Jw, world, 100, 0., cost, k_means_rel_diff);
60 for (t_int k = 0; k < uv_data.size(); k++) {
62 static_cast<t_int
>(Ju),
static_cast<t_int
>(Jw));
63 const t_real mem = (Ju_max * Ju_max) * 16.;
64 mem_stack(image_index.at(k)) += mem;
65 mem_node(world.rank()) += mem;
67 world.all_sum_all<Vector<t_real>>(mem_stack);
68 world.all_sum_all<Vector<t_real>>(mem_node);
69 if (world.is_root()) {
70 out << number_of_vis <<
" " << rms_w << std::endl;
71 out <<
"stacks" << std::endl;
72 out << mem_stack.transpose() / mem_stack.sum() << std::endl;
73 out <<
"nodes" << std::endl;
74 out << mem_node.transpose() / mem_node.sum() << std::endl;
int main(int nargs, char const **args)
const t_real pi
mathematical constant
void set_level(const std::string &level)
Method to set the logging level of the default Log object.
utilities::vis_params read_ant_positions_to_coverage(const std::string &pos_name, const T &frequencies, const K ×, const t_real theta_ra, const t_real phi_dec, const t_real latitude)
utilities::vis_params conjugate_w(const utilities::vis_params &uv_vis)
reflects visibilities into the w >= 0 domain
std::tuple< utilities::vis_params, std::vector< t_int >, std::vector< t_real > > w_stacking_with_all_to_all(utilities::vis_params const ¶ms, const t_real du, const t_int min_support, const t_int max_support, sopt::mpi::Communicator const &comm, const t_int iters, const t_real fill_relaxation, const std::function< t_real(t_real)> &cost, const t_real k_means_rel_diff)
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 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
std::string output_filename(std::string const &filename)
Test output file.
std::string mwa_filename(std::string const &filename)
Specific mwa data.