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 17, 2018
1 parent 128aaef commit eae0fc2
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 70 deletions.
6 changes: 1 addition & 5 deletions python/lsst/jointcal/associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,9 @@ void declareAssociations(py::module &mod) {
cls.def("computeCommonTangentPoint", &Associations::computeCommonTangentPoint);
}

PYBIND11_PLUGIN(associations) {
PYBIND11_MODULE(associations, mod) {
py::module::import("lsst.jointcal.ccdImage");
py::module mod("associations");

declareAssociations(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/astrometryMappings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,13 @@ void declareSimplePolyMapping(py::module &mod) {
mod, "SimplePolyMapping");
}

PYBIND11_PLUGIN(astrometryMappings) {
PYBIND11_MODULE(astrometryMappings, mod) {
py::module::import("lsst.jointcal.star");
py::module::import("lsst.jointcal.gtransfo");
py::module mod("astrometryMappings");

declareAstrometryMapping(mod);
declareTwoTransfoMapping(mod);
declareSimpleGtransfoMapping(mod);
declareSimplePolyMapping(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/astrometryModels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,13 @@ void declareConstrainedAstrometryModel(py::module &mod) {
py::return_value_policy::reference_internal);
}

PYBIND11_PLUGIN(astrometryModels) {
PYBIND11_MODULE(astrometryModels, mod) {
py::module::import("lsst.jointcal.ccdImage");
py::module::import("lsst.jointcal.gtransfo");
py::module::import("lsst.jointcal.astrometryMappings");
py::module mod("astrometryModels");

declareAstrometryModel(mod);
declareSimpleAstrometryModel(mod);
declareConstrainedAstrometryModel(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/ccdImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,8 @@ void declareCcdImage(py::module &mod) {
cls.def("readWCS", &CcdImage::readWCS, py::return_value_policy::reference_internal);
}

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

PYBIND11_MODULE(ccdImage, mod) {
declareCcdImage(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/chi2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ void declareChi2(py::module &mod) {
cls.def_readwrite("ndof", &Chi2Statistic::ndof);
}

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

PYBIND11_MODULE(chi2, mod) {
declareChi2(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/fitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ void declarePhotometryFit(py::module &mod) {
"photometryModel"_a);
}

PYBIND11_PLUGIN(fitter) {
PYBIND11_MODULE(fitter, mod) {
py::module::import("lsst.jointcal.associations");
py::module::import("lsst.jointcal.astrometryModels");
py::module::import("lsst.jointcal.chi2");
py::module::import("lsst.jointcal.photometryModels");
py::module mod("fitter");

py::enum_<MinimizeResult>(mod, "MinimizeResult")
.value("Converged", MinimizeResult::Converged)
.value("Chi2Increased", MinimizeResult::Chi2Increased)
Expand All @@ -75,8 +73,6 @@ PYBIND11_PLUGIN(fitter) {
declareFitterBase(mod);
declareAstrometryFit(mod);
declarePhotometryFit(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ void declareFrame(py::module &mod) {
utils::python::addOutputOp(cls, "__str__");
}

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

PYBIND11_MODULE(frame, mod) {
declareFrame(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/gtransfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,10 @@ void declareTanSipPix2RaDec(py::module &mod) {
py::class_<TanSipPix2RaDec, std::shared_ptr<TanSipPix2RaDec>, BaseTanWcs> cls(mod, "TanSipPix2RaDec");
}

PYBIND11_PLUGIN(gtransfo) {
PYBIND11_MODULE(gtransfo, mod) {
py::module::import("astshim.mapping");
py::module::import("lsst.jointcal.frame");
py::module::import("lsst.jointcal.star");
py::module mod("gtransfo");

declareGtransfo(mod);
declareGtransfoIdentity(mod);
declareGtransfoPoly(mod);
Expand All @@ -136,8 +134,6 @@ PYBIND11_PLUGIN(gtransfo) {
// utility functions
mod.def("inversePolyTransfo", &inversePolyTransfo, "forward"_a, "domain"_a, "precision"_a,
"maxOrder"_a = 9, "nSteps"_a = 50);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/jointcalControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ void declareJointcalControl(py::module &mod) {
LSST_DECLARE_CONTROL_FIELD(cls, JointcalControl, sourceFluxField);
}

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

PYBIND11_MODULE(jointcalControl, mod) {
declareJointcalControl(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/photometryMappings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,12 @@ void declareChipVisitPhotometryMapping(py::module &mod) {
cls.def("getVisitMapping", &ChipVisitPhotometryMapping::getVisitMapping);
}

PYBIND11_PLUGIN(photometryMappings) {
PYBIND11_MODULE(photometryMappings, mod) {
py::module::import("lsst.jointcal.star");
py::module::import("lsst.jointcal.photometryTransfo");
py::module mod("photometryMappings");

declarePhotometryMappingBase(mod);
declarePhotometryMapping(mod);
declareChipVisitPhotometryMapping(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/photometryModels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,13 @@ void declareConstrainedPhotometryModel(py::module &mod) {
"visitOrder"_a = 7);
}

PYBIND11_PLUGIN(photometryModels) {
PYBIND11_MODULE(photometryModels, mod) {
py::module::import("lsst.jointcal.ccdImage");
py::module::import("lsst.jointcal.photometryTransfo");
py::module::import("lsst.jointcal.star");
py::module mod("photometryModels");

declarePhotometryModel(mod);
declareSimplePhotometryModel(mod);
declareConstrainedPhotometryModel(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/photometryTransfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ void declarePhotometryTransfoChebyshev(py::module &mod) {
cls.def("getBBox", &PhotometryTransfoChebyshev::getBBox);
}

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

PYBIND11_MODULE(photometryTransfo, mod) {
declarePhotometryTransfo(mod);
declarePhotometryTransfoSpatiallyInvariant(mod);
declarePhotometryTransfoChebyshev(mod);

return mod.ptr();
}

} // namespace
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/projectionHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ void declareOneTPPerVisitHandler(py::module &mod) {
cls.def(py::init<CcdImageList const &>(), "ccdImageList"_a);
}

PYBIND11_PLUGIN(projectionHandler) {
PYBIND11_MODULE(projectionHandler, mod) {
py::module::import("lsst.jointcal.ccdImage");
py::module mod("projectionHandler");

declareProjectionHandler(mod);
declareOneTPPerVisitHandler(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/jointcal/star.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,13 @@ void declareMeasuredStar(py::module &mod) {
cls.def("getYFocal", &MeasuredStar::getYFocal);
}

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

PYBIND11_MODULE(star, mod) {
declarePoint(mod);
declareFatPoint(mod);
declareBaseStar(mod);
declareRefStar(mod);
declareFittedStar(mod);
declareMeasuredStar(mod);

return mod.ptr();
}
} // namespace
} // namespace jointcal
Expand Down

0 comments on commit eae0fc2

Please sign in to comment.