170 using namespace pybind11::literals;
174 using ColumnView =
typename Record::ColumnView;
176 cls.def(
"isSorted", (
bool (
Catalog::*)(
Key<T> const &)
const) & Catalog::isSorted);
179 auto iter = self.find(value, key);
180 if (iter == self.end()) {
186 return self.upper_bound(value, key) - self.begin();
189 return self.lower_bound(value, key) - self.begin();
191 cls.def(
"equal_range", [](
Catalog &self, Value
const &value,
Key<T> const &key) {
192 auto p = self.equal_range(value, key);
193 return py::slice(p.first - self.begin(), p.second - self.begin(), 1);
198 return py::slice(
a,
b, 1);
201 cls.def(
"_get_column_from_key",
213 if constexpr (std::is_same_v<T, Angle>) {
279 using namespace pybind11::literals;
282 using Table =
typename Record::Table;
283 using ColumnView =
typename Record::ColumnView;
294 return wrappers.wrapType(
296 [](
auto &
mod,
auto &
cls) {
298 cls.def(py::init<Schema const &>(),
"schema"_a);
299 cls.def(py::init<std::shared_ptr<Table> const &>(),
"table"_a);
300 cls.def(py::init<Catalog const &>(),
"other"_a);
303 cls.def_static(
"readFits", (Catalog(*)(std::string const &, int, int)) & Catalog::readFits,
304 "filename"_a,
"hdu"_a = fits::DEFAULT_HDU,
"flags"_a = 0);
305 cls.def_static(
"readFits", (Catalog(*)(fits::MemFileManager &, int, int)) & Catalog::readFits,
306 "manager"_a,
"hdu"_a = fits::DEFAULT_HDU,
"flags"_a = 0);
310 cls.def(
"getTable", &Catalog::getTable);
311 cls.def_property_readonly(
"table", &Catalog::getTable);
312 cls.def(
"getSchema", &Catalog::getSchema);
313 cls.def_property_readonly(
"schema", &Catalog::getSchema);
314 cls.def(
"capacity", &Catalog::capacity);
315 cls.def(
"__len__", &Catalog::size);
316 cls.def(
"resize", &Catalog::resize);
320 cls.def(
"_getColumnView", &Catalog::getColumnView);
321 cls.def(
"_addNew", &Catalog::addNew);
322 cls.def(
"_extend", [](Catalog &self, Catalog const &other, bool deep) {
323 self.insert(self.end(), other.begin(), other.end(), deep);
326 self.
insert(
mapper, self.end(), other.begin(), other.end());
331 self.erase(self.begin() + utils::python::cppIndex(self.size(),
i));
333 cls.def(
"_delslice_", [](
Catalog &self, py::slice
const &s) {
336 throw py::error_already_set();
339 throw py::index_error(
"Slice step must not exactly 1");
341 self.erase(self.begin() + start, self.begin() +
stop);
345 cls.def(
"set", &Catalog::set);
347 return self.get(utils::python::cppIndex(self.size(),
i));
376 return py::make_iterator(
380 }, py::keep_alive<0, 1>());
381 cls.def(
"isContiguous", &Catalog::isContiguous);
385 "filename"_a,
"mode"_a =
"w",
"flags"_a = 0);
389 "manager"_a,
"mode"_a =
"w",
"flags"_a = 0);
390 cls.def(
"reserve", &Catalog::reserve);
392 (
Catalog(
Catalog::*)(ndarray::Array<bool const, 1>
const &)
const) & Catalog::subset);
408 cls.def(
"_get_column_from_key",
416 return pybind11::make_tuple(
423 [](
Catalog &self,
Key<Flag> const & key, ndarray::Array<bool const, 1>
const & array) {