Commit 6040db81 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

hopefully fix all conversion factors

parent c5fc5971
......@@ -294,19 +294,20 @@ template<typename T> class Baselines
{
private:
vector<UVW<T>> coord;
vector<T> xlambda;
vector<T> f_over_c;
size_t nrows, nchan;
public:
Baselines(const pyarr_c<T> &coord_, const pyarr_c<T> &lambda_)
Baselines(const pyarr_c<T> &coord_, const pyarr_c<T> &freq_)
{
constexpr double speedOfLight = 299792458.;
checkArray(coord_, "coord", {0, 3});
checkArray(lambda_, "lambda", {0});
checkArray(freq_, "freq", {0});
nrows = coord_.shape(0);
nchan = lambda_.shape(0);
xlambda.resize(nchan);
nchan = freq_.shape(0);
f_over_c.resize(nchan);
for (size_t i=0; i<nchan; ++i)
xlambda[i] = T(1)/lambda_.data()[i];
f_over_c[i] = freq_.data()[i]/speedOfLight;
coord.resize(nrows);
auto cood = coord_.data();
for (size_t i=0; i<coord.size(); ++i)
......@@ -318,10 +319,10 @@ template<typename T> class Baselines
{
size_t irow = index/nchan;
size_t ichan = index-nchan*irow;
return coord[irow]*xlambda[ichan];
return coord[irow]*f_over_c[ichan];
}
UVW<T> effectiveCoord(size_t irow, size_t ichan) const
{ return coord[irow]*xlambda[ichan]; }
{ return coord[irow]*f_over_c[ichan]; }
size_t Nrows() const { return nrows; }
size_t Nchannels() const { return nchan; }
......@@ -375,7 +376,7 @@ template<typename T> class GridderConfig
GridderConfig(size_t nxdirty, size_t nydirty, double epsilon,
double fov_x, double fov_y)
: nx_dirty(nxdirty), ny_dirty(nydirty),
ucorr(1./fov_x), vcorr(1./fov_y),
ucorr(fov_x/nx_dirty), vcorr(fov_y/nx_dirty),
w(get_w(epsilon)), nsafe((w+1)/2),
nu(max(2*nsafe,2*nx_dirty)), nv(max(2*nsafe,2*ny_dirty)),
beta(2.3*w),
......@@ -847,8 +848,8 @@ Parameters
==========
coord: np.array((nrows, 3), dtype=np.float)
u, v and w coordinates for each row
lambda: np.array((nchannels,), dtype=np.float)
wave length for each individual channel
freq: np.array((nchannels,), dtype=np.float)
frequency for each individual channel (in Hz)
)""";
const char *BL_ms2vis_DS = R"""(
......@@ -1008,7 +1009,7 @@ PYBIND11_MODULE(nifty_gridder, m)
py::class_<Baselines<double>> (m, "Baselines", Baselines_DS)
.def(py::init<const pyarr_c<double> &, const pyarr_c<double> &>(),
"coord"_a, "lambda"_a)
"coord"_a, "freq"_a)
.def ("Nrows",&Baselines<double>::Nrows)
.def ("Nchannels",&Baselines<double>::Nchannels)
.def ("ms2vis",&Baselines<double>::ms2vis<complex<double>>, BL_ms2vis_DS, "ms"_a, "idx"_a)
......
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