Commit 5eaf38fa authored by Martin Reinecke's avatar Martin Reinecke

more consistent epsilon handling

parent 9f0b4dbc
Pipeline #78571 passed with stages
in 16 minutes and 35 seconds
......@@ -1079,6 +1079,8 @@ template<typename T> void ms2dirty(const mav<double,2> &uvw,
bool negate_v=false)
{
Baselines baselines(uvw, freq, negate_v);
// adjust for increased error when gridding in 2 or 3 dimensions
epsilon /= do_wstacking ? 3 : 2;
GridderConfig<T> gconf(dirty.shape(0), dirty.shape(1), nu, nv, epsilon, pixsize_x, pixsize_y, nthreads);
auto idx = getWgtIndices(baselines, gconf, wgt, ms);
auto idx2 = mav<idx_t,1>(idx.data(),{idx.size()});
......@@ -1093,6 +1095,8 @@ template<typename T> void dirty2ms(const mav<double,2> &uvw,
size_t verbosity, bool negate_v=false)
{
Baselines baselines(uvw, freq, negate_v);
// adjust for increased error when gridding in 2 or 3 dimensions
epsilon /= do_wstacking ? 3 : 2;
GridderConfig<T> gconf(dirty.shape(0), dirty.shape(1), nu, nv, epsilon, pixsize_x, pixsize_y, nthreads);
mav<complex<T>,2> null_ms(nullptr, {0,0}, true);
auto idx = getWgtIndices(baselines, gconf, wgt, null_ms);
......
......@@ -264,7 +264,6 @@ void add_totalconvolve(py::module &msup)
.def ("deinterpol", &inter_f::pydeinterpol, deinterpol_DS, "ptg"_a, "data"_a)
.def ("getSlm", &inter_f::pygetSlm, getSlm_DS, "beam"_a)
.def ("support", &inter_f::support);
m.def("epsilon_guess", &epsilon_guess, "support"_a, "ofactor"_a);
}
}
......
......@@ -243,7 +243,7 @@ template<typename T> class Interpolator
ntheta(nphi/2+1),
nthreads(nthreads_),
ofactor(T(nphi)/(2*lmax+1)),
kernel(selectNESKernel<T>(ofactor, epsilon)),
kernel(selectNESKernel<T>(ofactor, 0.5*epsilon)),
supp(kernel->support()),
ncomp(separate ? slm.size() : 1),
#ifdef SIMD_INTERPOL
......@@ -359,7 +359,7 @@ template<typename T> class Interpolator
ntheta(nphi/2+1),
nthreads(nthreads_),
ofactor(T(nphi)/(2*lmax+1)),
kernel(selectNESKernel<T>(ofactor, epsilon)),
kernel(selectNESKernel<T>(ofactor, 0.5*epsilon)),
supp(kernel->support()),
ncomp(ncomp_),
#ifdef SIMD_INTERPOL
......@@ -928,13 +928,9 @@ template<typename T> class Interpolator
}
};
double epsilon_guess(size_t support, double ofactor)
{ return std::sqrt(12.)*std::exp(-(support*ofactor)); }
}
using detail_totalconvolve::Interpolator;
using detail_totalconvolve::epsilon_guess;
}
......
......@@ -571,7 +571,7 @@ template<typename T> auto selectNESKernel(double ofactor, double epsilon)
size_t Wmin=1000;
size_t idx = NEScache.size();
for (size_t i=0; i<NEScache.size(); ++i)
if ((NEScache[i].ofactor<=ofactor) && (1.3*NEScache[i].epsilon<=epsilon) && (NEScache[i].W<=Wmin))
if ((NEScache[i].ofactor<=ofactor) && (NEScache[i].epsilon<=epsilon) && (NEScache[i].W<=Wmin))
{
idx = i;
Wmin = NEScache[i].W;
......
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