Commit cd0adad1 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cosmetics

parent c70bd81d
......@@ -97,6 +97,16 @@ template<typename T, size_t ndim> class mav
}
return true;
}
void fill(const T &val) const
{
if (ndim==1)
for (size_t i=0; i<shp[0]; ++i)
d[str[0]*i]=val;
else if (ndim==2)
for (size_t i=0; i<shp[0]; ++i)
for (size_t j=0; j<shp[1]; ++j)
d[str[0]*i + str[1]*j] = val;
}
};
template<typename T, size_t ndim> using const_mav = mav<const T, ndim>;
......@@ -853,9 +863,7 @@ template<typename T> void apply_holo
if (have_wgt) checkShape(wgt.shape(), {nvis});
checkShape(ogrid.shape(), {nu, nv});
for (size_t i=0; i<nu; ++i)
for (size_t j=0; j<nv; ++j)
ogrid(i,j) = T(0);
ogrid.fill(0);
T beta = gconf.Beta();
size_t supp = gconf.Supp();
......@@ -919,9 +927,7 @@ template<typename T> void get_correlations
size_t nthreads = gconf.Nthreads();
T beta = gconf.Beta();
for (size_t i=0; i<nu; ++i)
for (size_t j=0; j<nv; ++j)
ogrid(i,j) = T(0);
ogrid.fill(0);
size_t u0, u1, v0, v1;
if (du>=0)
......@@ -1141,10 +1147,7 @@ template<typename T, typename Serv> void x2dirty_wstack(
if (verbosity>0) cout << "Gridding using improved w-stacking" << endl;
wstack_common(gconf, srv, wmin, wval, dw, nplanes, nvis_plane, minplane, verbosity);
for (size_t i=0; i<nx_dirty; ++i)
for (size_t j=0; j<ny_dirty; ++j)
dirty(i,j) = 0.;
{
dirty.fill(0);
vector<complex<T>> vis_loc_;
vector<uint32_t> idx_loc_;
vector<uint32_t> mapper;
......@@ -1178,7 +1181,7 @@ template<typename T, typename Serv> void x2dirty_wstack(
vis_loc[i] = srv.getVis(ipart)*kernel(x);
idx_loc[i] = srv.getIdx(ipart);
}
grid_.fill(0.);
grid.fill(0);
vis2grid_c(srv.getBaselines(), gconf, const_mav<uint32_t,1>(idx_loc), const_mav<complex<T>,1>(vis_loc), grid, const_mav<T,1>(nullptr,{0}));
gconf.grid2dirty_c(grid, tdirty);
gconf.apply_wscreen(tdirty, tdirty, wcur, false);
......@@ -1187,7 +1190,6 @@ template<typename T, typename Serv> void x2dirty_wstack(
for (size_t j=0; j<ny_dirty; ++j)
dirty(i,j) += tdirty(i,j).real();
}
}
// correct for w gridding
apply_wcorr(gconf, dirty, kernel, dw);
}
......@@ -1417,9 +1419,7 @@ template<typename T> void degridding(const const_mav<T,2> &uvw,
GridderConfig<T> gconf(dirty.shape(0), dirty.shape(1), epsilon, pixsize_x, pixsize_y, nthreads);
auto idx = getWgtIndices(baselines, gconf, wgt);
auto idx2 = const_mav<uint32_t,1>(idx.data(),{idx.size()});
for (size_t i=0; i<ms.shape(0); ++i)
for (size_t j=0; j<ms.shape(1); ++j)
ms(i,j) = 0;
ms.fill(0);
auto srv = MsServ<T,mav<complex<T>,2>,const_mav<T,2>>(baselines,idx2,ms,wgt);
dirty2x(gconf, dirty, srv, verbosity);
}
......@@ -1446,9 +1446,7 @@ template<typename T> void full_degridding(const const_mav<T,2> &uvw,
GridderConfig<T> gconf(dirty.shape(0), dirty.shape(1), epsilon, pixsize_x, pixsize_y, nthreads);
auto idx = getWgtIndices(baselines, gconf, wgt);
auto idx2 = const_mav<uint32_t,1>(idx.data(),{idx.size()});
for (size_t i=0; i<ms.shape(0); ++i)
for (size_t j=0; j<ms.shape(1); ++j)
ms(i,j) = 0;
ms.fill(0);
auto srv = MsServ<T,mav<complex<T>,2>,const_mav<T,2>>(baselines,idx2,ms,wgt);
dirty2x_wstack(gconf, dirty, srv, verbosity);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment