Skip to content

Commit

Permalink
Cleanup pybind11
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 8055633 commit 0a21a22
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 60 deletions.
2 changes: 1 addition & 1 deletion python/lsst/coadd/utils/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from lsst.sconsUtils import scripts
scripts.BasicSConscript.pybind11(['addToCoadd',
'copyGoodPixels',
'setCoaddEdgeBits'])
'setCoaddEdgeBits'], addUnderscore=False)
7 changes: 5 additions & 2 deletions python/lsst/coadd/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@

"""lsst.coadd.utils
"""
from __future__ import absolute_import
from __future__ import absolute_import, division, print_function

from .addToCoadd import *
from .copyGoodPixels import *
from .setCoaddEdgeBits import *
from .version import *

from .makeBitMask import *
from .utilsLib import *
from .coadd import *
from .coaddDataIdContainer import *
30 changes: 13 additions & 17 deletions python/lsst/coadd/utils/addToCoadd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/

#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>
#include "pybind11/pybind11.h"

#include "lsst/coadd/utils/addToCoadd.h"

Expand All @@ -33,6 +32,7 @@ namespace coadd {
namespace utils {

namespace {

template <typename CoaddPixelT, typename WeightPixelT>
void declareAddToCoadd(py::module &mod) {
namespace afwGeom = lsst::afw::geom;
Expand All @@ -49,12 +49,15 @@ void declareAddToCoadd(py::module &mod) {
addToCoadd,
"coadd"_a, "weightMap"_a, "maskedImage"_a, "badPixelMask"_a, "weight"_a);
}
}

PYBIND11_PLUGIN(_addToCoadd) {
py::module mod("_addToCoadd", "Python wrapper for afw _addToCoadd library");
} // <anonymous>

PYBIND11_PLUGIN(addToCoadd) {
py::module::import("lsst.afw.geom");
py::module::import("lsst.afw.image");

py::module mod("addToCoadd");

/* Module level */
declareAddToCoadd<double, double>(mod);
declareAddToCoadd<double, float>(mod);
declareAddToCoadd<double, int>(mod);
Expand All @@ -64,16 +67,9 @@ PYBIND11_PLUGIN(_addToCoadd) {
declareAddToCoadd<float, int>(mod);
declareAddToCoadd<float, std::uint16_t>(mod);

/* Member types and enums */

/* Constructors */

/* Operators */

/* Members */

return mod.ptr();
}
}
}
} // lsst::coadd::utils

} // utils
} // coadd
} // lsst
4 changes: 2 additions & 2 deletions python/lsst/coadd/utils/coadd.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 division
from __future__ import absolute_import, division, print_function
import math

from builtins import object
Expand All @@ -28,7 +28,7 @@
from lsst.log import Log
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
from .utilsLib import addToCoadd, setCoaddEdgeBits
from . import addToCoadd, setCoaddEdgeBits

__all__ = ["Coadd"]

Expand Down
29 changes: 12 additions & 17 deletions python/lsst/coadd/utils/copyGoodPixels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/

#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>
#include "pybind11/pybind11.h"

#include "lsst/coadd/utils/copyGoodPixels.h"

Expand All @@ -33,6 +32,7 @@ namespace coadd {
namespace utils {

namespace {

template <typename ImagePixelT>
void declareCopyGoodPixels(py::module &mod) {
namespace afwImage = lsst::afw::image;
Expand All @@ -46,27 +46,22 @@ void declareCopyGoodPixels(py::module &mod) {
copyGoodPixels,
"destImage"_a, "srcImage"_a, "badPixelMask"_a);
}
}

PYBIND11_PLUGIN(_copyGoodPixels) {
py::module mod("_copyGoodPixels", "Python wrapper for afw _copyGoodPixels library");
} // <anonymous>

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

py::module mod("copyGoodPixels");

/* Module level */
declareCopyGoodPixels<double>(mod);
declareCopyGoodPixels<float>(mod);
declareCopyGoodPixels<int>(mod);
declareCopyGoodPixels<std::uint16_t>(mod);

/* Member types and enums */

/* Constructors */

/* Operators */

/* Members */

return mod.ptr();
}
}
}
} // lsst::coadd::utils

} // utils
} // coadd
} // lsst
29 changes: 12 additions & 17 deletions python/lsst/coadd/utils/setCoaddEdgeBits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/

#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>
#include "pybind11/pybind11.h"

#include "lsst/coadd/utils/setCoaddEdgeBits.h"

Expand All @@ -33,6 +32,7 @@ namespace coadd {
namespace utils {

namespace {

template <typename WeightPixelT>
void declareSetCoaddEdgeBits(py::module &mod) {
namespace afwImage = lsst::afw::image;
Expand All @@ -42,27 +42,22 @@ void declareSetCoaddEdgeBits(py::module &mod) {
setCoaddEdgeBits,
"coaddMask"_a, "weightMap"_a);
}
}

PYBIND11_PLUGIN(_setCoaddEdgeBits) {
py::module mod("_setCoaddEdgeBits", "Python wrapper for afw _setCoaddEdgeBits library");
} // <anonymous>

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

py::module mod("setCoaddEdgeBits");

/* Module level */
declareSetCoaddEdgeBits<double>(mod);
declareSetCoaddEdgeBits<float>(mod);
declareSetCoaddEdgeBits<int>(mod);
declareSetCoaddEdgeBits<std::uint16_t>(mod);

/* Member types and enums */

/* Constructors */

/* Operators */

/* Members */

return mod.ptr();
}
}
}
} // lsst::coadd::utils

} // utils
} // coadd
} // lsst
4 changes: 0 additions & 4 deletions python/lsst/coadd/utils/utilsLib.py

This file was deleted.

0 comments on commit 0a21a22

Please sign in to comment.