Skip to content

Commit

Permalink
Add includes and imports for clarity per style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Mar 14, 2017
1 parent 68eef77 commit 1e75587
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
2 changes: 2 additions & 0 deletions python/lsst/jointcal/associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "pybind11/pybind11.h"

#include "lsst/jointcal/Associations.h"
#include "lsst/jointcal/CcdImage.h"

namespace py = pybind11;
using namespace pybind11::literals;
Expand Down Expand Up @@ -58,6 +59,7 @@ void declareAssociations(py::module &mod) {
}

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

declareAssociations(mod);
Expand Down
6 changes: 4 additions & 2 deletions python/lsst/jointcal/astrometryFit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

#include "pybind11/pybind11.h"

#include "lsst/jointcal/Chi2.h"
#include "lsst/jointcal/Associations.h"
#include "lsst/jointcal/AstrometryFit.h"
#include "lsst/jointcal/AstrometryModel.h"
#include "lsst/jointcal/Chi2.h"

namespace py = pybind11;
using namespace pybind11::literals;
Expand All @@ -46,7 +46,9 @@ void declareAstrometryFit(py::module &mod) {
}

PYBIND11_PLUGIN(astrometryFit) {
py::module::import("lsst.jointcal.chi2"); // need this for computeChi2's return value
py::module::import("lsst.jointcal.associations");
py::module::import("lsst.jointcal.astrometryModels");
py::module::import("lsst.jointcal.chi2");
py::module mod("astrometryFit");

declareAstrometryFit(mod);
Expand Down
5 changes: 4 additions & 1 deletion python/lsst/jointcal/astrometryModels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "lsst/jointcal/AstrometryModel.h"
#include "lsst/jointcal/SimplePolyModel.h"
#include "lsst/jointcal/ConstrainedPolyModel.h"
#include "lsst/jointcal/Gtransfo.h"


namespace py = pybind11;
using namespace pybind11::literals;
Expand Down Expand Up @@ -55,7 +57,8 @@ void declareConstrainedPolyModel(py::module &mod) {
}

PYBIND11_PLUGIN(astrometryModels) {
py::module::import("lsst.jointcal.gtransfo"); // for produceSipWcs return value
py::module::import("lsst.jointcal.ccdImage");
py::module::import("lsst.jointcal.gtransfo");
py::module mod("astrometryModels");

declareAstrometryModel(mod);
Expand Down
5 changes: 1 addition & 4 deletions python/lsst/jointcal/ccdImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include <list>

#include "lsst/utils/python.h"
#include "lsst/jointcal/CcdImage.h"

namespace py = pybind11;
Expand Down Expand Up @@ -66,13 +65,11 @@ void declareCcdImageList(py::module &mod) {

cls.def("sizeValidForFit", &CcdImageList::sizeValidForFit);

// Make this behave like a std::list, which it is, but we can't wrap children of it easily.
// Make this behave like a std::list (which it is but we can't wrap std::list subclasses trivially)
cls.def("__len__", &CcdImageList::size);
cls.def("__iter__", [](const CcdImageList &self) {
return py::make_iterator(self.begin(), self.end());
}, py::keep_alive<0, 1>()); /* Essential: keep object alive while iterator exists */
// cls.def("__getitem__", [](CcdImageList const& self, std::ptrdiff_t i) {
// return self[utils::python::cppIndex(self.size(), i)]; });
}

PYBIND11_PLUGIN(ccdImage) {
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/jointcal/gtransfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PYBIND11_PLUGIN(gtransfo) {
declareTanSipPix2RaDec(mod);

// utility functions
mod.def("gtransfoToTanWcs", &gtransfoToTanWcs);
mod.def("gtransfoToTanWcs", &gtransfoToTanWcs); // from SipToGtransfo.h

return mod.ptr();
}
Expand Down
4 changes: 3 additions & 1 deletion python/lsst/jointcal/photometryFit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void declarePhotometryFit(py::module &mod) {
}

PYBIND11_PLUGIN(photometryFit) {
py::module::import("lsst.jointcal.chi2"); // need this for computeChi2's return value
py::module::import("lsst.jointcal.associations");
py::module::import("lsst.jointcal.chi2");
py::module::import("lsst.jointcal.photometryModels");
py::module mod("photometryFit");

declarePhotometryFit(mod);
Expand Down
3 changes: 2 additions & 1 deletion python/lsst/jointcal/photometryModels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ void declareSimplePhotometryModel(py::module &mod) {
}

PYBIND11_PLUGIN(photometryModels) {
py::module::import("lsst.jointcal.point"); // needed for photomFactor's default "where"
py::module::import("lsst.jointcal.ccdImage");
py::module::import("lsst.jointcal.point");
py::module mod("photometryModels");

declarePhotometryModel(mod);
Expand Down
1 change: 1 addition & 0 deletions python/lsst/jointcal/projectionHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void declareOneTPPerVisitHandler(py::module &mod) {
}

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

declareProjectionHandler(mod);
Expand Down

0 comments on commit 1e75587

Please sign in to comment.