23 #include "pybind11/pybind11.h" 24 #include "pybind11/stl.h" 40 using PySchemaMapper = py::class_<SchemaMapper, std::shared_ptr<SchemaMapper>>;
43 void declareSchemaMapperOverloads(PySchemaMapper &
cls,
std::string const &suffix) {
44 cls.def(
"getMapping", (Key<T>(SchemaMapper::*)(Key<T>
const &)
const) & SchemaMapper::getMapping);
45 cls.def(
"isMapped", (
bool (SchemaMapper::*)(Key<T>
const &)
const) & SchemaMapper::isMapped);
49 py::module::import(
"lsst.afw.table.schema");
51 PySchemaMapper
cls(mod,
"SchemaMapper");
53 cls.def(py::init<>());
54 cls.def(py::init<Schema const &, Schema const &>());
55 cls.def(py::init<Schema const &, bool>(),
"input"_a,
"shareAliasMap"_a =
false);
58 cls.def(
"getOutputSchema", &SchemaMapper::getOutputSchema);
59 cls.def(
"editOutputSchema", &SchemaMapper::editOutputSchema, py::return_value_policy::reference_internal);
60 cls.def(
"addMinimalSchema", &SchemaMapper::addMinimalSchema,
"minimal"_a,
"doMap"_a =
true);
61 cls.def_static(
"removeMinimalSchema", &SchemaMapper::removeMinimalSchema);
64 declareSchemaMapperOverloads<std::uint8_t>(
cls,
"B");
65 declareSchemaMapperOverloads<std::uint16_t>(
cls,
"U");
66 declareSchemaMapperOverloads<std::int32_t>(
cls,
"I");
67 declareSchemaMapperOverloads<std::int64_t>(
cls,
"L");
68 declareSchemaMapperOverloads<float>(
cls,
"F");
69 declareSchemaMapperOverloads<double>(
cls,
"D");
70 declareSchemaMapperOverloads<std::string>(
cls,
"String");
71 declareSchemaMapperOverloads<lsst::geom::Angle>(
cls,
"Angle");
72 declareSchemaMapperOverloads<lsst::afw::table::Flag>(
cls,
"Flag");
73 declareSchemaMapperOverloads<lsst::afw::table::Array<std::uint8_t>>(
cls,
"ArrayB");
74 declareSchemaMapperOverloads<lsst::afw::table::Array<std::uint16_t>>(
cls,
"ArrayU");
75 declareSchemaMapperOverloads<lsst::afw::table::Array<int>>(
cls,
"ArrayI");
76 declareSchemaMapperOverloads<lsst::afw::table::Array<float>>(
cls,
"ArrayF");
77 declareSchemaMapperOverloads<lsst::afw::table::Array<double>>(
cls,
"ArrayD");
def getInputSchema(task, butler=None, schema=None)
Obtain the input schema either directly or froma butler reference.
PYBIND11_MODULE(camera, mod)
A base class for image defects.