Commit 73a27198 authored by Martin Reinecke's avatar Martin Reinecke

bug fix

parent 5e415e5d
......@@ -1303,7 +1303,7 @@ template<typename T> void update_idx(vector<T> &v, vector<T> &vold,
{
if (irem!=erem)
{
while ((iin!=ein) && (*iin==*irem))
while ((iin!=ein) && (irem!=erem) && (*iin==*irem))
{ ++irem; ++iin; } // skip the entries to be removed
if (iin==ein) break;
}
......
......@@ -26,7 +26,7 @@
using namespace std;
using namespace gridder;
using gridder::detail::idx_t;
namespace py = pybind11;
namespace {
......@@ -167,7 +167,7 @@ class PyBaselines: public Baselines
The visibility data for the index array
)""";
template<typename T> pyarr<T> effectiveuvw(const pyarr<uint32_t> &idx_) const
template<typename T> pyarr<T> effectiveuvw(const pyarr<idx_t> &idx_) const
{
size_t nvis = size_t(idx_.shape(0));
auto idx=make_const_mav<1>(idx_);
......@@ -181,7 +181,7 @@ class PyBaselines: public Baselines
}
template<typename T> pyarr<T> ms2vis(const pyarr<T> &ms_,
const pyarr<uint32_t> &idx_, size_t nthreads) const
const pyarr<idx_t> &idx_, size_t nthreads) const
{
auto idx=make_const_mav<1>(idx_);
size_t nvis = size_t(idx.shape(0));
......@@ -213,7 +213,7 @@ class PyBaselines: public Baselines
the measurement set's visibility data (0 where not covered by idx)
)""";
template<typename T> pyarr<T> vis2ms(const pyarr<T> &vis_,
const pyarr<uint32_t> &idx_, py::object &ms_in, size_t nthreads) const
const pyarr<idx_t> &idx_, py::object &ms_in, size_t nthreads) const
{
auto vis=make_const_mav<1>(vis_);
auto idx=make_const_mav<1>(idx_);
......@@ -462,7 +462,7 @@ np.array((nu,nv), dtype=np.complex128):
)""";
template<typename T> pyarr<complex<T>> Pyvis2grid_c(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const pyarr<uint32_t> &idx_, const pyarr<complex<T>> &vis_,
const pyarr<idx_t> &idx_, const pyarr<complex<T>> &vis_,
py::object &grid_in, const py::object &wgt_)
{
auto vis2 = make_const_mav<1>(vis_);
......@@ -504,7 +504,7 @@ np.array((nu,nv), dtype=np.float64):
the gridded visibilities (made real by making use of Hermitian symmetry)
)""";
template<typename T> pyarr<T> Pyvis2grid(const PyBaselines &baselines,
const PyGridderConfig &gconf, const pyarr<uint32_t> &idx_,
const PyGridderConfig &gconf, const pyarr<idx_t> &idx_,
const pyarr<complex<T>> &vis_, py::object &grid_in, const py::object &wgt_)
{
auto tmp=Pyvis2grid_c(baselines, gconf, idx_, vis_, None, wgt_);
......@@ -542,7 +542,7 @@ np.array((nu,nv), dtype=np.complex128):
)""";
template<typename T> pyarr<complex<T>> Pyms2grid_c(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const pyarr<uint32_t> &idx_, const pyarr<complex<T>> &ms_,
const pyarr<idx_t> &idx_, const pyarr<complex<T>> &ms_,
py::object &grid_in, const py::object &wgt_)
{
auto nrows = baselines.Nrows();
......@@ -562,7 +562,7 @@ template<typename T> pyarr<complex<T>> Pyms2grid_c(
template<typename T> pyarr<T> Pyms2grid(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const pyarr<uint32_t> &idx_, const pyarr<complex<T>> &ms_,
const pyarr<idx_t> &idx_, const pyarr<complex<T>> &ms_,
py::object &grid_in, const py::object &wgt_)
{
auto tmp = Pyms2grid_c(baselines, gconf, idx_, ms_, None, wgt_);
......@@ -577,7 +577,7 @@ template<typename T> pyarr<T> Pyms2grid(
template<typename T> pyarr<complex<T>> Pygrid2vis_c(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const pyarr<uint32_t> &idx_, const pyarr<complex<T>> &grid_,
const pyarr<idx_t> &idx_, const pyarr<complex<T>> &grid_,
const py::object &wgt_)
{
auto grid2 = make_const_mav<2>(grid_);
......@@ -618,7 +618,7 @@ np.array((nvis,), dtype=np.complex)
The degridded visibility data
)""";
template<typename T> pyarr<complex<T>> Pygrid2vis(const PyBaselines &baselines,
const PyGridderConfig &gconf, const pyarr<uint32_t> &idx_,
const PyGridderConfig &gconf, const pyarr<idx_t> &idx_,
const pyarr<T> &grid_, const py::object &wgt_)
{
auto tmp=makeArray<complex<T>>({gconf.Nu(), gconf.Nv()});
......@@ -628,7 +628,7 @@ template<typename T> pyarr<complex<T>> Pygrid2vis(const PyBaselines &baselines,
template<typename T> pyarr<complex<T>> Pygrid2ms_c(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const pyarr<uint32_t> &idx_, const pyarr<complex<T>> &grid_,
const pyarr<idx_t> &idx_, const pyarr<complex<T>> &grid_,
py::object &ms_in, const py::object &wgt_)
{
auto nrows = baselines.Nrows();
......@@ -647,7 +647,7 @@ template<typename T> pyarr<complex<T>> Pygrid2ms_c(
}
template<typename T> pyarr<complex<T>> Pygrid2ms(const PyBaselines &baselines,
const PyGridderConfig &gconf, const pyarr<uint32_t> &idx_,
const PyGridderConfig &gconf, const pyarr<idx_t> &idx_,
const pyarr<T> &grid_, py::object &ms_in, const py::object &wgt_)
{
auto grid2_ = makeArray<complex<T>>({gconf.Nu(), gconf.Nv()});
......@@ -660,7 +660,7 @@ template<typename T> pyarr<complex<T>> apply_holo2(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const py::array &idx_, const py::array &grid_, const py::object &wgt_)
{
auto idx = getPyarr<uint32_t>(idx_, "idx");
auto idx = getPyarr<idx_t>(idx_, "idx");
auto idx2 = make_const_mav<1>(idx);
auto grid = getPyarr<complex<T>>(grid_, "grid");
auto grid2 = make_const_mav<2>(grid);
......@@ -687,7 +687,7 @@ py::array Pyapply_holo(
template<typename T> pyarr<T> Pyget_correlations(
const PyBaselines &baselines, const PyGridderConfig &gconf,
const pyarr<uint32_t> &idx_, int du, int dv, const py::object &wgt_)
const pyarr<idx_t> &idx_, int du, int dv, const py::object &wgt_)
{
auto idx = make_const_mav<1>(idx_);
pyarr<T> wgt2 = providePotentialArray<T>(wgt_, "wgt", {idx.shape(0)});
......@@ -729,7 +729,7 @@ np.array((nvis,), dtype=np.uint32)
the compressed indices for all entries which match the selected criteria
and are not flagged.
)""";
pyarr<uint32_t> PygetIndices(const PyBaselines &baselines,
pyarr<idx_t> PygetIndices(const PyBaselines &baselines,
const PyGridderConfig &gconf, const pyarr<bool> &flags_, int chbegin,
int chend, double wmin, double wmax)
{
......@@ -739,7 +739,7 @@ pyarr<uint32_t> PygetIndices(const PyBaselines &baselines,
py::gil_scoped_release release;
nidx = getIdxSize(baselines, flags, chbegin, chend, wmin, wmax, gconf.Nthreads());
}
auto res = makeArray<uint32_t>({nidx});
auto res = makeArray<idx_t>({nidx});
auto res2 = make_mav<1>(res);
{
py::gil_scoped_release release;
......@@ -753,7 +753,7 @@ template<typename T> pyarr<T> vis2dirty2(const PyBaselines &baselines,
const py::array &vis_, const py::object &wgt_, bool do_wstacking,
size_t verbosity)
{
auto idx = getPyarr<uint32_t>(idx_, "idx");
auto idx = getPyarr<idx_t>(idx_, "idx");
auto idx2 = make_const_mav<1>(idx);
auto dirty = makeArray<T>({gconf.Nxdirty(), gconf.Nydirty()});
auto dirty2 = make_mav<2>(dirty);
......@@ -816,11 +816,11 @@ py::array Pyvis2dirty(const PyBaselines &baselines,
}
template<typename T> pyarr<complex<T>> dirty2vis2(const PyBaselines &baselines,
const PyGridderConfig &gconf, const pyarr<uint32_t> &idx_,
const PyGridderConfig &gconf, const pyarr<idx_t> &idx_,
const pyarr<T> &dirty_, const py::object &wgt_, bool do_wstacking,
size_t verbosity)
{
auto idx = getPyarr<uint32_t>(idx_, "idx");
auto idx = getPyarr<idx_t>(idx_, "idx");
auto idx2 = make_const_mav<1>(idx);
auto dirty = getPyarr<T>(dirty_, "dirty");
auto dirty2 = make_const_mav<2>(dirty_);
......
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