59 using namespace pybind11::literals;
62 using Table =
typename Record::Table;
68 fullName =
"_" + name +
"SortedCatalogBase";
70 fullName = name +
"Catalog";
77 [clsBase](
auto &mod,
auto &cls) {
79 cls.def(pybind11::init<Schema const &>());
80 cls.def(pybind11::init<std::shared_ptr<Table> const &>(),
81 "table"_a = std::shared_ptr<Table>());
82 cls.def(pybind11::init<Catalog const &>());
85 cls.def_static(
"readFits", (Catalog(*)(std::string const &, int, int)) & Catalog::readFits,
86 "filename"_a,
"hdu"_a = fits::DEFAULT_HDU,
"flags"_a = 0);
87 cls.def_static(
"readFits", (Catalog(*)(fits::MemFileManager &, int, int)) & Catalog::readFits,
88 "manager"_a,
"hdu"_a = fits::DEFAULT_HDU,
"flags"_a = 0);
92 (Catalog(Catalog::*)(ndarray::Array<bool const, 1> const &) const) & Catalog::subset);
94 (Catalog(Catalog::*)(std::ptrdiff_t, std::ptrdiff_t, std::ptrdiff_t) const) &
102 [clsBase](py::object const &self, py::object key) -> py::object {
103 if (key.is(py::none())) {
104 key = self.attr(
"table").attr(
"getIdKey")();
106 return clsBase.attr(
"isSorted")(self, key);
108 "key"_a = py::none());
110 [clsBase](py::object
const &self, py::object key) -> py::object {
111 if (key.is(py::none())) {
112 key = self.attr(
"table").attr(
"getIdKey")();
114 return clsBase.attr(
"sort")(self, key);
116 "key"_a = py::none());
118 [clsBase](py::object
const &self, py::object
const &value,
119 py::object key) -> py::object {
120 if (key.is(py::none())) {
121 key = self.attr(
"table").attr(
"getIdKey")();
123 return clsBase.attr(
"find")(self, value, key);
125 "value"_a,
"key"_a = py::none());
PyCatalog< Record > declareCatalog(cpputils::python::WrapperCollection &wrappers, std::string const &name, bool isBase=false)
Wrap an instantiation of lsst::afw::table::CatalogT<Record>.
PySortedCatalog< Record > declareSortedCatalog(cpputils::python::WrapperCollection &wrappers, std::string const &name, bool isBase=false)
Wrap an instantiation of lsst::afw::table::SortedCatalogT<Record>.