Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-9190: Cleanup pybind11 remaining code #11

Merged
merged 1 commit into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.