24 #include "pybind11/pybind11.h"
38 using namespace py::literals;
46 using PyPeakRecord = py::class_<PeakRecord, std::shared_ptr<PeakRecord>, table::BaseRecord>;
47 using PyPeakTable = py::class_<PeakTable, std::shared_ptr<PeakTable>, table::BaseTable>;
52 void declarePeakRecord(PyPeakRecord &
cls) {
53 cls.def(
"getTable", &PeakRecord::getTable);
54 cls.def_property_readonly(
"table", &PeakRecord::getTable);
55 cls.def(
"getId", &PeakRecord::getId);
56 cls.def(
"setId", &PeakRecord::setId);
57 cls.def(
"getIx", &PeakRecord::getIx);
58 cls.def(
"getIy", &PeakRecord::getIy);
59 cls.def(
"setIx", &PeakRecord::setIx);
60 cls.def(
"setIy", &PeakRecord::setIy);
61 cls.def(
"getI", &PeakRecord::getI);
64 cls.def(
"getFx", &PeakRecord::getFx);
65 cls.def(
"getFy", &PeakRecord::getFy);
66 cls.def(
"setFx", &PeakRecord::setFx);
67 cls.def(
"setFy", &PeakRecord::setFy);
68 cls.def(
"getF", &PeakRecord::getF);
69 cls.def(
"getPeakValue", &PeakRecord::getPeakValue);
70 cls.def(
"setPeakValue", &PeakRecord::setPeakValue);
78 void declarePeakTable(PyPeakTable &
cls) {
79 cls.def_static(
"make", &PeakTable::make,
"schema"_a,
"forceNew"_a =
false);
80 cls.def_static(
"makeMinimalSchema", &PeakTable::makeMinimalSchema);
81 cls.def_static(
"checkSchema", &PeakTable::checkSchema,
"schema"_a);
83 cls.def(
"setIdFactory", &PeakTable::setIdFactory,
"factory"_a);
84 cls.def_static(
"getIdKey", &PeakTable::getIdKey);
85 cls.def_static(
"getIxKey", &PeakTable::getIxKey);
86 cls.def_static(
"getIyKey", &PeakTable::getIyKey);
87 cls.def_static(
"getFxKey", &PeakTable::getFxKey);
88 cls.def_static(
"getFyKey", &PeakTable::getFyKey);
89 cls.def_static(
"getPeakValueKey", &PeakTable::getPeakValueKey);
91 cls.def(
"makeRecord", &PeakTable::makeRecord);
93 PeakTable::copyRecord);
95 afw::table::SchemaMapper
const &)) &
96 PeakTable::copyRecord);
104 auto clsPeakRecord = wrappers.
wrapType(PyPeakRecord(wrappers.
module,
"PeakRecord"),
105 [](
auto &mod,
auto &
cls) { declarePeakRecord(cls); });
106 auto clsPeakTable = wrappers.
wrapType(PyPeakTable(wrappers.
module,
"PeakTable"),
107 [](
auto &mod,
auto &
cls) { declarePeakTable(cls); });
109 auto clsPeakColumnView = table::python::declareColumnView<PeakRecord>(wrappers,
"Peak");
110 auto clsPeakCatalog = table::python::declareCatalog<PeakRecord>(wrappers,
"Peak");
112 clsPeakRecord.attr(
"Table") = clsPeakTable;
113 clsPeakRecord.attr(
"ColumnView") = clsPeakColumnView;
114 clsPeakRecord.attr(
"Catalog") = clsPeakCatalog;
115 clsPeakTable.attr(
"Record") = clsPeakRecord;
116 clsPeakTable.attr(
"ColumnView") = clsPeakColumnView;
117 clsPeakTable.attr(
"Catalog") = clsPeakCatalog;
118 clsPeakCatalog.attr(
"Record") = clsPeakRecord;
119 clsPeakCatalog.attr(
"Table") = clsPeakTable;
120 clsPeakCatalog.attr(
"ColumnView") = clsPeakColumnView;