Skip to content

Commit

Permalink
Additional pybind11 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Pim Schellart authored and Pim Schellart committed Mar 25, 2017
1 parent 2902d61 commit 8c90517
Show file tree
Hide file tree
Showing 29 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/growthcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"""
%prog [options] arg
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
import sys
import optparse
import math
Expand Down
2 changes: 1 addition & 1 deletion examples/runSingleFrameTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import print_function
from __future__ import absolute_import, division, print_function
import os
import sys
import numpy
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/meas/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

"""lsst..meas.base
"""
from __future__ import absolute_import
from __future__ import absolute_import, division, print_function
# Needed for pybind11-generated docstrings
from lsst.afw.image import Calib, Wcs

Expand Down
3 changes: 3 additions & 0 deletions python/lsst/meas/base/algorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ namespace meas {
namespace base {

PYBIND11_PLUGIN(algorithm) {
py::module::import("lsst.afw.image");
py::module::import("lsst.afw.table");

py::module mod("algorithm");

/* Module level */
Expand Down
3 changes: 3 additions & 0 deletions python/lsst/meas/base/apertureFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ PyFluxTransform declareFluxTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(apertureFlux) {
py::module::import("lsst.afw.geom");
py::module::import("lsst.afw.image");
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.fluxUtilities");
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/meas/base/applyApCorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division
from __future__ import absolute_import, division, print_function
import math

from builtins import object
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/blendedness.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ PyBlendenessAlgorithm declareBlendednessAlgorithm(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(blendedness) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");

Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/centroidUtilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void declareCentroidChecker(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(centroidUtilities) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.transform");

py::module mod("centroidUtilities");
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/meas/base/circularApertureFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ using PyApertureFluxClass = py::class_<CircularApertureFluxAlgorithm,
} // <anonymous>

PYBIND11_PLUGIN(circularApertureFlux) {
py::module::import("lsst.daf.base");
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");

py::module mod("circularApertureFlux");
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/meas/base/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ PYBIND11_PLUGIN(exceptions) {
using lsst::pex::exceptions::DomainError;
using lsst::pex::exceptions::RuntimeError;

py::module::import("lsst.pex.exceptions");

py::module mod("exceptions");

/* Module level */
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/meas/base/flagHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ void declareFlagHandler(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(flagHandler) {
py::module::import("lsst.afw.table");

py::module mod("flagHandler");

declareFlagDefinition(mod);
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/meas/base/fluxUtilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ void declareMagResultKey(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(fluxUtilities) {
py::module::import("lsst.afw.table");

py::module mod("fluxUtilities");

declareFluxResult(mod);
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/gaussianCentroid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ PyCentroidAlgorithm declareCentroidAlgorithm(py::module & mod) {
} // <anonymous>

PYBIND11_PLUGIN(gaussianCentroid) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.transform");
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/gaussianFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ PyFluxTransform declareFluxTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(gaussianFlux) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.transform");
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/meas/base/inputUtilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace meas {
namespace base {

PYBIND11_PLUGIN(inputUtilities) {
py::module::import("lsst.afw.table");

py::module mod("inputUtilities");

/* Module level */
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/naiveCentroid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ PyCentroidTransform declareCentroidTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(naiveCentroid) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.transform");
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/peakLikelihoodFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ PyFluxTransform declareFluxTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(peakLikelihoodFlux) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.transform");
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/pixelFlags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace meas {
namespace base {

PYBIND11_PLUGIN(pixelFlags) {
py::module::import("lsst.afw.table");
py::module mod("pixelFlags");

py::class_<PixelFlagsAlgorithm, std::shared_ptr<PixelFlagsAlgorithm>, SimpleAlgorithm> clsPixelFlagsAlgorithm(mod, "PixelFlagsAlgorithm");
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/psfFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ PyFluxTransform declareFluxTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(psfFlux) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.fluxUtilities");
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/scaledApertureFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ PyFluxTransform declareFluxTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(scaledApertureFlux) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.fluxUtilities");
py::module::import("lsst.meas.base.transform");
Expand Down
1 change: 1 addition & 0 deletions python/lsst/meas/base/sdssCentroid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ PyCentroidTransform declareCentroidTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(sdssCentroid) {
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.transform");
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/meas/base/sdssShape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
namespace py = pybind11;
using namespace pybind11::literals;

namespace afwGeom = lsst::afw::geom;

namespace lsst {
namespace meas {
namespace base {
Expand Down Expand Up @@ -167,6 +165,8 @@ PyShapeTransform declareShapeTransform(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(sdssShape) {
py::module::import("lsst.afw.geom");
py::module::import("lsst.afw.table");
py::module::import("lsst.meas.base.algorithm");
py::module::import("lsst.meas.base.flagHandler");
py::module::import("lsst.meas.base.centroidUtilities"); // for CentroidResult
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/meas/base/shapeUtilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ void declareShapeResultKey(py::module &mod) {
} // <anonymous>

PYBIND11_PLUGIN(shapeUtilities) {
py::module::import("lsst.afw.table");

py::module mod("shapeUtilities");

if (_import_array() < 0) {
Expand Down
2 changes: 1 addition & 1 deletion tests/centroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import print_function
from __future__ import absolute_import, division, print_function
import os
import re
import math
Expand Down
2 changes: 1 addition & 1 deletion tests/sillyCentroid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import absolute_import, division, print_function

from lsst.meas.base import SimpleAlgorithm, wrapSimpleAlgorithm, wrapTransform, BasePlugin
from _sillyCentroid import SillyCentroidAlgorithm, SillyCentroidControl, SillyTransform
Expand Down
2 changes: 1 addition & 1 deletion tests/testGaussianFlux.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import division, absolute_import, print_function
from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import range
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/testImportCentroidAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import division, absolute_import, print_function
from __future__ import absolute_import, division, print_function
import unittest

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion tests/testInputCount.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""
Tests for InputCounts measurement algorithm
"""
from __future__ import division, absolute_import, print_function
from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import range
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion tests/testLib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import absolute_import, division, print_function

from lsst.meas.base import SimpleAlgorithm
from _sillyCentroid import *
Expand Down

0 comments on commit 8c90517

Please sign in to comment.