Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions python/lsst/ip/diffim/detail/assessSpatialKernelVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ namespace {
*/
template <typename PixelT>
void declareAssessSpatialKernelVisitor(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
using PyCLass = py::class_<AssessSpatialKernelVisitor<PixelT>, std::shared_ptr<AssessSpatialKernelVisitor<PixelT>>,
lsst::afw::math::CandidateVisitor>;
using PyClass = py::classh<AssessSpatialKernelVisitor<PixelT>, lsst::afw::math::CandidateVisitor>;

std::string name = "AssessSpatialKernelVisitor" + suffix;

wrappers.wrapType(PyCLass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
wrappers.wrapType(PyClass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
cls.def(py::init<std::shared_ptr<afw::math::LinearCombinationKernel>,
afw::math::Kernel::SpatialFunctionPtr, daf::base::PropertySet const &>(),
"spatialKernel"_a, "spatialBackground"_a, "ps"_a);
Expand Down
3 changes: 1 addition & 2 deletions python/lsst/ip/diffim/detail/buildSingleKernelVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ namespace {
*/
template <typename PixelT>
void declareBuildSingleKernelVisitor(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
using PyClass = py::class_<BuildSingleKernelVisitor<PixelT>, std::shared_ptr<BuildSingleKernelVisitor<PixelT>>,
afw::math::CandidateVisitor>;
using PyClass = py::classh<BuildSingleKernelVisitor<PixelT>, afw::math::CandidateVisitor>;
std::string name = "BuildSingleKernelVisitor" + suffix;

wrappers.wrapType(PyClass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
Expand Down
3 changes: 1 addition & 2 deletions python/lsst/ip/diffim/detail/buildSpatialKernelVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ namespace {
template <typename PixelT>
void declareBuildSpatialKernelVisitor(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
std::string name = "BuildSpatialKernelVisitor" + suffix;
using PyClass = py::class_<BuildSpatialKernelVisitor<PixelT>, std::shared_ptr<BuildSpatialKernelVisitor<PixelT>>,
afw::math::CandidateVisitor>;
using PyClass = py::classh<BuildSpatialKernelVisitor<PixelT>, afw::math::CandidateVisitor>;
wrappers.wrapType(PyClass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
cls.def(py::init<afw::math::KernelList, geom::Box2I const &, daf::base::PropertySet const &>(), "basisList"_a,
"regionBBox"_a, "ps"_a);
Expand Down
5 changes: 2 additions & 3 deletions python/lsst/ip/diffim/detail/kernelPca.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace {
template <typename PixelT>
void declareKernelPca(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
using ImageT = afw::image::Image<PixelT>;
using PyClass = py::class_<KernelPca<ImageT>, std::shared_ptr<KernelPca<ImageT>>, afw::image::ImagePca<ImageT>>;
using PyClass = py::classh<KernelPca<ImageT>, afw::image::ImagePca<ImageT>>;

std::string name = "KernelPca" + suffix;
wrappers.wrapType(PyClass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
Expand All @@ -71,8 +71,7 @@ void declareKernelPca(lsst::cpputils::python::WrapperCollection &wrappers, std::
*/
template <typename PixelT>
void declareKernelPcaVisitor(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
using PyClass = py::class_<KernelPcaVisitor<PixelT>, std::shared_ptr<KernelPcaVisitor<PixelT>>,
afw::math::CandidateVisitor>;
using PyClass = py::classh<KernelPcaVisitor<PixelT>, afw::math::CandidateVisitor>;

std::string name = "KernelPcaVisitor" + suffix;
// note that KernelPcaVisitor<PixelT>::ImageT
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ip/diffim/detail/kernelSumVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ template <typename PixelT>
void declareKernelSumVisitor(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
using Class = KernelSumVisitor<PixelT>;

using PyClass = py::class_<Class, std::shared_ptr<Class>, afw::math::CandidateVisitor>;
using PyClass = py::classh<Class, afw::math::CandidateVisitor>;
std::string name = "KernelSumVisitor" + suffix;
auto clsDef = wrappers.wrapType(PyClass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
cls.def(py::init<daf::base::PropertySet const &>(), "ps"_a);
Expand Down
12 changes: 6 additions & 6 deletions python/lsst/ip/diffim/dipoleAlgorithms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ namespace diffim {
namespace {

void declareDipoleCentroidControl(lsst::cpputils::python::WrapperCollection &wrappers) {
using PyDipoleCentroidControl = py::class_<DipoleCentroidControl, std::shared_ptr<DipoleCentroidControl>>;
using PyDipoleCentroidControl = py::classh<DipoleCentroidControl>;

wrappers.wrapType(PyDipoleCentroidControl(wrappers.module, "DipoleCentroidControl"), [](auto &mod, auto &cls) {
cls.def(py::init<>());
});
}

void declareDipoleFluxControl(lsst::cpputils::python::WrapperCollection &wrappers) {
using PyDipoleFluxControl = py::class_<DipoleFluxControl, std::shared_ptr<DipoleFluxControl>>;
using PyDipoleFluxControl = py::classh<DipoleFluxControl>;

wrappers.wrapType(PyDipoleFluxControl(wrappers.module, "DipoleFluxControl"), [](auto &mod, auto &cls) {
cls.def(py::init<>());
Expand All @@ -58,7 +58,7 @@ void declareDipoleFluxControl(lsst::cpputils::python::WrapperCollection &wrapper

void declareDipolePsfFluxControl(lsst::cpputils::python::WrapperCollection &wrappers) {
using PyPsfDipoleFluxControl =
py::class_<PsfDipoleFluxControl, std::shared_ptr<PsfDipoleFluxControl>, DipoleFluxControl>;
py::classh<PsfDipoleFluxControl, DipoleFluxControl>;
wrappers.wrapType(PyPsfDipoleFluxControl(wrappers.module, "PsfDipoleFluxControl"), [](auto &mod, auto &cls) {
cls.def(py::init<>());

Expand All @@ -72,7 +72,7 @@ void declareDipolePsfFluxControl(lsst::cpputils::python::WrapperCollection &wrap
void declareDipoleCentroidAlgorithm(lsst::cpputils::python::WrapperCollection &wrappers) {
// Abstract class, so add a leading underscore to Python name and do not wrap constructor
using PyDipoleCentroidAlgorithm =
py::class_<DipoleCentroidAlgorithm, std::shared_ptr<DipoleCentroidAlgorithm>, meas::base::SimpleAlgorithm>;
py::classh<DipoleCentroidAlgorithm, meas::base::SimpleAlgorithm>;

wrappers.wrapType(PyDipoleCentroidAlgorithm(wrappers.module, "_DipoleCentroidAlgorithm"), [](auto &mod, auto &cls) {
cls.attr("FAILURE") = py::cast(DipoleCentroidAlgorithm::FAILURE);
Expand All @@ -89,7 +89,7 @@ void declareDipoleCentroidAlgorithm(lsst::cpputils::python::WrapperCollection &w
void declareDipoleFluxAlgorithm(lsst::cpputils::python::WrapperCollection &wrappers) {
// Abstract class, so add a leading underscore to Python name and do not wrap constructor
using PyDipoleFluxAlgorithm =
py::class_<DipoleFluxAlgorithm, std::shared_ptr<DipoleFluxAlgorithm>, meas::base::SimpleAlgorithm>;
py::classh<DipoleFluxAlgorithm, meas::base::SimpleAlgorithm>;
wrappers.wrapType(PyDipoleFluxAlgorithm(wrappers.module, "_DipoleFluxAlgorithm"), [](auto &mod, auto &cls) {
cls.attr("FAILURE") = py::cast(DipoleFluxAlgorithm::FAILURE);
cls.attr("POS_FLAG") = py::cast(DipoleFluxAlgorithm::POS_FLAG);
Expand All @@ -103,7 +103,7 @@ void declareDipoleFluxAlgorithm(lsst::cpputils::python::WrapperCollection &wrapp
}

void declarePsfDipoleFlux(lsst::cpputils::python::WrapperCollection &wrappers) {
using PyPsfDipoleFlux = py::class_<PsfDipoleFlux, std::shared_ptr<PsfDipoleFlux>, DipoleFluxAlgorithm>;
using PyPsfDipoleFlux = py::classh<PsfDipoleFlux, DipoleFluxAlgorithm>;

wrappers.wrapType(PyPsfDipoleFlux(wrappers.module, "PsfDipoleFlux"), [](auto &mod, auto &cls) {
cls.def(py::init<PsfDipoleFlux::Control const &, std::string const &, afw::table::Schema &>(), "ctrl"_a,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ip/diffim/imageStatistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace {
*/
template <typename PixelT>
void declareImageStatistics(lsst::cpputils::python::WrapperCollection &wrappers, std::string const &suffix) {
using PyImageStatistics = py::class_<ImageStatistics<PixelT>, std::shared_ptr<ImageStatistics<PixelT>>>;
using PyImageStatistics = py::classh<ImageStatistics<PixelT>>;

std::string name = "ImageStatistics" + suffix;
wrappers.wrapType(PyImageStatistics(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
Expand Down
3 changes: 1 addition & 2 deletions python/lsst/ip/diffim/kernelCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ void declareKernelCandidate(lsst::cpputils::python::WrapperCollection &wrappers,
using PyCandidateSwitch = py::enum_<CandidateSwitch>;

std::string name = "KernelCandidate" + suffix;
using PyKernelCandidate = py::class_<KernelCandidate<PixelT>, std::shared_ptr<KernelCandidate<PixelT>>,
afw::math::SpatialCellImageCandidate>;
using PyKernelCandidate = py::classh<KernelCandidate<PixelT>, afw::math::SpatialCellImageCandidate>;

auto clsDef = wrappers.wrapType(PyKernelCandidate(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
cls.def(py::init<float const, float const, std::shared_ptr<afw::image::MaskedImage<PixelT>> const &,
Expand Down
14 changes: 5 additions & 9 deletions python/lsst/ip/diffim/kernelSolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace {
* Wrap KernelSolution
*/
void declareKernelSolution(lsst::cpputils::python::WrapperCollection &wrappers) {
using PyKernelSolution = py::class_<KernelSolution, std::shared_ptr<KernelSolution>>;
using PyKernelSolution = py::classh<KernelSolution>;

wrappers.wrapType(PyKernelSolution(wrappers.module, "KernelSolution"), [](auto &mod, auto &cls) {
cls.def(py::init<Eigen::MatrixXd, Eigen::VectorXd, bool>(), "mMat"_a, "bVec"_a, "fitForBackground"_a);
Expand Down Expand Up @@ -93,8 +93,7 @@ void declareKernelSolution(lsst::cpputils::python::WrapperCollection &wrappers)
*/
template <typename InputT>
void declareStaticKernelSolution(lsst::cpputils::python::WrapperCollection &wrappers, std::string const &suffix) {
using PyStaticKernelSolution =
py::class_<StaticKernelSolution<InputT>, std::shared_ptr<StaticKernelSolution<InputT>>, KernelSolution>;
using PyStaticKernelSolution = py::classh<StaticKernelSolution<InputT>, KernelSolution>;
std::string name = ("StaticKernelSolution" + suffix);
wrappers.wrapType(PyStaticKernelSolution(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
cls.def(py::init<lsst::afw::math::KernelList const &, bool>(), "basisList"_a, "fitForBackground"_a);
Expand All @@ -119,8 +118,7 @@ void declareStaticKernelSolution(lsst::cpputils::python::WrapperCollection &wrap
*/
template <typename InputT>
void declareMaskedKernelSolution(lsst::cpputils::python::WrapperCollection &wrappers, std::string const &suffix) {
using PyMaskedKernelSolution = py::class_<MaskedKernelSolution<InputT>, std::shared_ptr<MaskedKernelSolution<InputT>>,
StaticKernelSolution<InputT>>;
using PyMaskedKernelSolution = py::classh<MaskedKernelSolution<InputT>, StaticKernelSolution<InputT>>;
std::string name = "MaskedKernelSolution" + suffix;
wrappers.wrapType(PyMaskedKernelSolution(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
cls.def(py::init<lsst::afw::math::KernelList const &, bool>(), "basisList"_a, "fitForBackground"_a);
Expand All @@ -144,8 +142,7 @@ void declareMaskedKernelSolution(lsst::cpputils::python::WrapperCollection &wrap
template <typename InputT>
void declareRegularizedKernelSolution(lsst::cpputils::python::WrapperCollection &wrappers, std::string const &suffix) {
using PyRegularizedKernelSolution =
py::class_<RegularizedKernelSolution<InputT>,
std::shared_ptr<RegularizedKernelSolution<InputT>>,StaticKernelSolution<InputT>>;
py::classh<RegularizedKernelSolution<InputT>, StaticKernelSolution<InputT>>;

std::string name = "RegularizedKernelSolution" + suffix;
wrappers.wrapType(PyRegularizedKernelSolution(wrappers.module, "RegularizedKernelSolution"), [](auto &mod, auto &cls) {
Expand All @@ -165,8 +162,7 @@ void declareRegularizedKernelSolution(lsst::cpputils::python::WrapperCollection
* Wrap SpatialKernelSolution
*/
void declareSpatialKernelSolution(lsst::cpputils::python::WrapperCollection &wrappers) {
using PySpatialKernelSolution =
py::class_<SpatialKernelSolution, std::shared_ptr<SpatialKernelSolution>, KernelSolution> ;
using PySpatialKernelSolution = py::classh<SpatialKernelSolution, KernelSolution> ;

wrappers.wrapType(PySpatialKernelSolution(wrappers.module, "SpatialKernelSolution"), [](auto &mod, auto &cls) {
cls.def(py::init<lsst::afw::math::KernelList const &, lsst::afw::math::Kernel::SpatialFunctionPtr,
Expand Down