Skip to content

Commit

Permalink
Update pybind11 wrappers for 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
r-owen committed Jul 18, 2018
1 parent 62f16c3 commit d9da773
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 74 deletions.
6 changes: 1 addition & 5 deletions python/lsst/meas/algorithms/coaddBoundedField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(coaddBoundedField) {
py::module mod("coaddBoundedField");

PYBIND11_MODULE(coaddBoundedField, mod) {
py::class_<CoaddBoundedFieldElement> clsCoaddBoundedFieldElement(mod, "CoaddBoundedFieldElement");

clsCoaddBoundedFieldElement.def(
Expand Down Expand Up @@ -86,8 +84,6 @@ PYBIND11_PLUGIN(coaddBoundedField) {
clsCoaddBoundedField.def("getDefault", &CoaddBoundedField::getDefault);
clsCoaddBoundedField.def("getElements", &CoaddBoundedField::getElements);
clsCoaddBoundedField.def("isPersistable", &CoaddBoundedField::isPersistable);

return mod.ptr();
}

} // namespace
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/meas/algorithms/coaddPsf/coaddPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(coaddPsf) {
py::module mod("coaddPsf");

PYBIND11_MODULE(coaddPsf, mod) {
/* CoaddPsfControl */
py::class_<CoaddPsfControl, std::shared_ptr<CoaddPsfControl>> clsControl(mod, "CoaddPsfControl");
clsControl.def(py::init<std::string, int>(), "warpingKernelName"_a = "lanczos3", "cacheSize"_a = 10000);
Expand Down Expand Up @@ -69,8 +67,6 @@ PYBIND11_PLUGIN(coaddPsf) {
clsCoaddPsf.def("getBBox", &CoaddPsf::getBBox);
clsCoaddPsf.def("getValidPolygon", &CoaddPsf::getValidPolygon);
clsCoaddPsf.def("isPersistable", &CoaddPsf::isPersistable);

return mod.ptr();
}

} // namespace
Expand Down
4 changes: 1 addition & 3 deletions python/lsst/meas/algorithms/coaddTransmissionCurve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(coaddTransmissionCurve) {
py::module mod("coaddTransmissionCurve");
PYBIND11_MODULE(coaddTransmissionCurve, mod) {
py::module::import("lsst.afw.geom");
py::module::import("lsst.afw.image");
py::module::import("lsst.afw.table");
mod.def("makeCoaddTransmissionCurve", &makeCoaddTransmissionCurve, "coaddWcs"_a, "inputSensors"_a);
return mod.ptr();
}

} // namespace
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/meas/algorithms/cr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ void declareFindCosmicRays(py::module& mod) {
"policy"_a, "keep"_a = false);
}

PYBIND11_PLUGIN(cr) {
py::module mod("cr");

PYBIND11_MODULE(cr, mod) {
declareFindCosmicRays<float>(mod);

return mod.ptr();
}

} // namespace
Expand Down
8 changes: 1 addition & 7 deletions python/lsst/meas/algorithms/doubleGaussianPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,22 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(doubleGaussianPsf) {
py::module mod("doubleGaussianPsf");

PYBIND11_MODULE(doubleGaussianPsf, mod) {
afw::table::io::python::declarePersistableFacade<DoubleGaussianPsf>(mod, "DoubleGaussianPsf");

py::class_<DoubleGaussianPsf, std::shared_ptr<DoubleGaussianPsf>,
afw::table::io::PersistableFacade<DoubleGaussianPsf>, KernelPsf>
clsDoubleGaussianPsf(mod, "DoubleGaussianPsf");

/* Constructors */
clsDoubleGaussianPsf.def(py::init<int, int, double, double, double>(), "width"_a, "height"_a, "sigma1"_a,
"sigma2"_a = 0.0, "b"_a = 0.0);

/* Members */
clsDoubleGaussianPsf.def("clone", &DoubleGaussianPsf::clone);
clsDoubleGaussianPsf.def("resized", &DoubleGaussianPsf::resized, "width"_a, "height"_a);
clsDoubleGaussianPsf.def("getSigma1", &DoubleGaussianPsf::getSigma1);
clsDoubleGaussianPsf.def("getSigma2", &DoubleGaussianPsf::getSigma2);
clsDoubleGaussianPsf.def("getB", &DoubleGaussianPsf::getB);
clsDoubleGaussianPsf.def("isPersistable", &DoubleGaussianPsf::isPersistable);

return mod.ptr();
}

} // namespace
Expand Down
5 changes: 1 addition & 4 deletions python/lsst/meas/algorithms/imagePsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(imagePsf) {
PYBIND11_MODULE(imagePsf, mod) {
py::module::import("lsst.afw.detection");
py::module mod("imagePsf");

afw::table::io::python::declarePersistableFacade<ImagePsf>(mod, "ImagePsf");

py::class_<ImagePsf, std::shared_ptr<ImagePsf>, afw::table::io::PersistableFacade<ImagePsf>,
afw::detection::Psf>
clsImagePsf(mod, "ImagePsf");

return mod.ptr();
}

} // namespace
Expand Down
9 changes: 1 addition & 8 deletions python/lsst/meas/algorithms/interp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ void declareInterpolateOverDefects(py::module& mod) {
"image"_a, "psf"_a, "badList"_a, "fallBackValue"_a = 0.0, "useFallbackValueAtEdge"_a = false);
}

PYBIND11_PLUGIN(interp) {
PYBIND11_MODULE(interp, mod) {
py::module::import("lsst.afw.image");

py::module mod("interp");

py::class_<Defect, std::shared_ptr<Defect>, afw::image::DefectBase> clsDefect(mod, "Defect");

/* Member types and enums */
py::enum_<Defect::DefectPosition>(clsDefect, "DefectPosition")
.value("LEFT", Defect::DefectPosition::LEFT)
.value("NEAR_LEFT", Defect::DefectPosition::NEAR_LEFT)
Expand All @@ -63,17 +60,13 @@ PYBIND11_PLUGIN(interp) {
.value("RIGHT", Defect::DefectPosition::RIGHT)
.export_values();

/* Constructors */
clsDefect.def(py::init<const geom::BoxI&>(), "bbox"_a = geom::BoxI());

/* Members */
clsDefect.def("classify", &Defect::classify);
clsDefect.def("getType", &Defect::getType);
clsDefect.def("getPos", &Defect::getPos);

declareInterpolateOverDefects<float>(mod);

return mod.ptr();
}

} // namespace
Expand Down
8 changes: 1 addition & 7 deletions python/lsst/meas/algorithms/kernelPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,19 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(kernelPsf) {
py::module mod("kernelPsf");

PYBIND11_MODULE(kernelPsf, mod) {
afw::table::io::python::declarePersistableFacade<KernelPsf>(mod, "KernelPsf");

py::class_<KernelPsf, std::shared_ptr<KernelPsf>, afw::table::io::PersistableFacade<KernelPsf>, ImagePsf>
clsKernelPsf(mod, "KernelPsf");

/* Constructors */
clsKernelPsf.def(py::init<afw::math::Kernel const &, geom::Point2D const &>(), "kernel"_a,
"averagePosition"_a = geom::Point2D());

/* Members */
clsKernelPsf.def("getKernel", &KernelPsf::getKernel);
clsKernelPsf.def("getAveragePosition", &KernelPsf::getAveragePosition);
clsKernelPsf.def("clone", &KernelPsf::clone);
clsKernelPsf.def("isPersistable", &KernelPsf::isPersistable);

return mod.ptr();
}

} // namespace
Expand Down
8 changes: 1 addition & 7 deletions python/lsst/meas/algorithms/pcaPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,17 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(pcaPsf) {
py::module mod("pcaPsf");

PYBIND11_MODULE(pcaPsf, mod) {
afw::table::io::python::declarePersistableFacade<PcaPsf>(mod, "PcaPsf");

py::class_<PcaPsf, std::shared_ptr<PcaPsf>, afw::table::io::PersistableFacade<PcaPsf>, KernelPsf>
clsPcaPsf(mod, "PcaPsf");

/* Constructors */
clsPcaPsf.def(py::init<std::shared_ptr<afw::math::LinearCombinationKernel>, geom::Point2D const &>(),
"kernel"_a, "averagePosition"_a = geom::Point2D());

/* Members */
clsPcaPsf.def("clone", &PcaPsf::clone);
clsPcaPsf.def("getKernel", &PcaPsf::getKernel);

return mod.ptr();
}

} // namespace
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/meas/algorithms/psfCandidate/psfCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ void declarePsfCandidate(py::module& mod, std::string const& suffix) {

} // namespace

PYBIND11_PLUGIN(psfCandidate) {
py::module mod("psfCandidate");

PYBIND11_MODULE(psfCandidate, mod) {
declarePsfCandidate<float>(mod, "F");

return mod.ptr();
}

} // namespace algorithms
Expand Down
8 changes: 1 addition & 7 deletions python/lsst/meas/algorithms/singleGaussianPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,19 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(singleGaussianPsf) {
py::module mod("singleGaussianPsf");

PYBIND11_MODULE(singleGaussianPsf, mod) {
afw::table::io::python::declarePersistableFacade<SingleGaussianPsf>(mod, "SingleGaussianPsf");

py::class_<SingleGaussianPsf, std::shared_ptr<SingleGaussianPsf>,
afw::table::io::PersistableFacade<SingleGaussianPsf>, KernelPsf>
clsSingleGaussianPsf(mod, "SingleGaussianPsf");

/* Constructors */
clsSingleGaussianPsf.def(py::init<int, int, double>(), "width"_a, "height"_a, "sigma"_a);

/* Members */
clsSingleGaussianPsf.def("clone", &SingleGaussianPsf::clone);
clsSingleGaussianPsf.def("resized", &SingleGaussianPsf::resized, "width"_a, "height"_a);
clsSingleGaussianPsf.def("getSigma", &SingleGaussianPsf::getSigma);
clsSingleGaussianPsf.def("isPersistable", &SingleGaussianPsf::isPersistable);

return mod.ptr();
}

} // namespace
Expand Down
7 changes: 1 addition & 6 deletions python/lsst/meas/algorithms/spatialModelPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ static void declareFunctions(py::module &mod) {
mod.def("fitKernelToImage", fitKernelToImage<MaskedImageT>, "kernel"_a, "image"_a, "pos"_a);
}

PYBIND11_PLUGIN(spatialModelPsf) {
py::module mod("spatialModelPsf");

/* Module level */
PYBIND11_MODULE(spatialModelPsf, mod) {
declareFunctions<float>(mod);

return mod.ptr();
}

} // namespace
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/meas/algorithms/warpedPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ namespace meas {
namespace algorithms {
namespace {

PYBIND11_PLUGIN(warpedPsf) {
py::module mod("warpedPsf");

PYBIND11_MODULE(warpedPsf, mod) {
py::class_<WarpedPsf, std::shared_ptr<WarpedPsf>, ImagePsf> clsWarpedPsf(mod, "WarpedPsf");

/* Constructors */
Expand All @@ -49,8 +47,6 @@ PYBIND11_PLUGIN(warpedPsf) {
/* Members */
clsWarpedPsf.def("getAveragePosition", &WarpedPsf::getAveragePosition);
clsWarpedPsf.def("clone", &WarpedPsf::clone);

return mod.ptr();
}

} // namespace
Expand Down

0 comments on commit d9da773

Please sign in to comment.