Skip to content

Commit c33f25d

Browse files
committed
Merge remote-tracking branch 'origin/master' into pybind11
2 parents f4a5e3a + 275c859 commit c33f25d

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

maps/src/FlatSkyMap.cxx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,14 +1031,13 @@ flatskymap_setitem_masked(FlatSkyMap &skymap, const G3SkyMapMask &m,
10311031
{
10321032
g3_assert(m.IsCompatible(skymap));
10331033

1034+
if (val.size() != m.sum())
1035+
throw py::value_error("Item dimensions do not match masked area");
1036+
10341037
size_t j = 0;
10351038
for (auto i : skymap) {
1036-
if (!m.at(i.first))
1037-
continue;
1038-
if (j >= val.size())
1039-
throw py::value_error("Item dimensions do not match masked area");
1040-
skymap[i.first] = val[j];
1041-
j++;
1039+
if (m.at(i.first))
1040+
skymap[i.first] = val[j++];
10421041
}
10431042
}
10441043

maps/src/HealpixSkyMap.cxx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,14 +1087,13 @@ HealpixSkyMap_setitem_masked(HealpixSkyMap &skymap, const G3SkyMapMask &m,
10871087
{
10881088
g3_assert(m.IsCompatible(skymap));
10891089

1090+
if (val.size() != m.sum())
1091+
throw py::value_error("Item dimensions do not match masked area");
1092+
10901093
size_t j = 0;
10911094
for (auto i : skymap) {
1092-
if (!m.at(i.first))
1093-
continue;
1094-
if (j >= val.size())
1095-
throw py::value_error("Item dimensions do not match masked area");
1096-
skymap[i.first] = val[j];
1097-
j++;
1095+
if (m.at(i.first))
1096+
skymap[i.first] = val[j++];
10981097
}
10991098
}
11001099

@@ -1160,10 +1159,10 @@ PYBINDINGS("maps", scope)
11601159
"Instantiate a HealpixSkyMap with given nside")
11611160
.def(py::init<const std::vector<uint64_t> &, const std::vector<double> &,
11621161
size_t, bool, bool, MapCoordReference, G3Timestream::TimestreamUnits,
1163-
G3SkyMap::MapPolType, G3SkyMap::MapPolConv>(),
1164-
py::arg("nside"),
1162+
G3SkyMap::MapPolType, G3SkyMap::MapPolConv>(),
11651163
py::arg("index"),
11661164
py::arg("data"),
1165+
py::arg("nside"),
11671166
py::arg("weighted") = true,
11681167
py::arg("nested") = false,
11691168
py::arg("coord_ref") = MapCoordReference::Equatorial,

0 commit comments

Comments
 (0)