lsst.afw
tickets.DM-23835-g31c64b24f1
|
Go to the documentation of this file. 1 #ifndef AFW_TABLE_PYBIND11_SORTEDCATALOG_H_INCLUDED
2 #define AFW_TABLE_PYBIND11_SORTEDCATALOG_H_INCLUDED
26 #include "pybind11/pybind11.h"
38 template <
typename Record>
56 template <
typename Record>
59 namespace py = pybind11;
60 using namespace pybind11::literals;
63 using Table =
typename Record::Table;
65 auto clsBase = declareCatalog<Record>(wrappers,
name,
true);
69 fullName =
"_" +
name +
"SortedCatalogBase";
71 fullName =
name +
"Catalog";
78 [clsBase](
auto &mod,
auto &
cls) {
80 cls.def(pybind11::init<Schema const &>());
83 cls.def(pybind11::init<Catalog const &>());
93 (
Catalog(
Catalog::*)(ndarray::Array<bool const, 1>
const &)
const) & Catalog::subset);
103 [clsBase](py::object
const &
self, py::object
key) -> py::object {
104 if (
key.is(py::none())) {
105 key =
self.attr(
"table").attr(
"getIdKey")();
107 return clsBase.attr(
"isSorted")(
self,
key);
109 "key"_a = py::none());
111 [clsBase](py::object
const &
self, py::object
key) -> py::object {
112 if (
key.is(py::none())) {
113 key =
self.attr(
"table").attr(
"getIdKey")();
115 return clsBase.attr(
"sort")(
self,
key);
117 "key"_a = py::none());
119 [clsBase](py::object
const &
self, py::object
const &value,
120 py::object
key) -> py::object {
121 if (
key.is(py::none())) {
122 key =
self.attr(
"table").attr(
"getIdKey")();
124 return clsBase.attr(
"find")(
self, value,
key);
126 "value"_a,
"key"_a = py::none());
136 #endif // !AFW_TABLE_PYBIND11_CATALOG_H_INCLUDED
const int DEFAULT_HDU
Specify that the default HDU should be read.
PySortedCatalog< Record > declareSortedCatalog(utils::python::WrapperCollection &wrappers, std::string const &name, bool isBase=false)
Wrap an instantiation of lsst::afw::table::SortedCatalogT<Record>.
Lifetime-management for memory that goes into FITS memory files.
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
A base class for image defects.
pybind11::class_< SortedCatalogT< Record >, std::shared_ptr< SortedCatalogT< Record > >, CatalogT< Record > > PySortedCatalog
A custom container class for records, based on std::vector.
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...