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-8467: Wrap lsst_distrib with pybind11 #9

Merged
merged 1 commit into from
Mar 7, 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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
.sconsign.dblite
config.log
examples/meas_shape
python/lsst/meas/extensions/shapeHSM/hsmLib.py
python/lsst/meas/extensions/shapeHSM/hsmLib_wrap.cc
python/lsst/meas/extensions/shapeHSM/hsmLib_wrap.os
tests/testshape
tests/.tests
ups/*.cfgc
Expand Down
1 change: 1 addition & 0 deletions include/lsst/meas/extensions/shapeHSM/HsmMomentsControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class HsmMomentsAlgorithm : public base::SimpleAlgorithm {
float const width // PSF width estimate, for starting moments
) const;

public:
void fail(
afw::table::SourceRecord & measRecord,
meas::base::MeasurementError * error=NULL
Expand Down
3 changes: 2 additions & 1 deletion python/lsst/meas/extensions/shapeHSM/SConscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- python -*-
from lsst.sconsUtils import scripts
scripts.BasicSConscript.python(['hsmLib'])
scripts.BasicSConscript.pybind11(['hsmMomentsControl',
'hsmShapeControl',])
9 changes: 6 additions & 3 deletions python/lsst/meas/extensions/shapeHSM/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#
# LSST Data Management System
# Copyright 2008, 2009, 2010 LSST Corporation.
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
# See the COPYRIGHT file
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -17,9 +17,13 @@
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
# see <https://www.lsstcorp.org/LegalNotices/>.
#

"""lsst.meas.extensions.shapeHSM
"""
from __future__ import absolute_import

from lsst.meas.base import BasePlugin, wrapSimpleAlgorithm

from .hsmLib import *
Expand All @@ -37,4 +41,3 @@
Control=HsmSourceMomentsControl, executionOrder=BasePlugin.SHAPE_ORDER)
wrapSimpleAlgorithm(HsmPsfMomentsAlgorithm, name="ext_shapeHSM_HsmPsfMoments",
Control=HsmPsfMomentsControl, executionOrder=BasePlugin.SHAPE_ORDER)
del lsst # cleanup namespace
51 changes: 51 additions & 0 deletions python/lsst/meas/extensions/shapeHSM/hsmAdapter.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* LSST Data Management System
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
* See the COPYRIGHT file
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the LSST License Statement and
* the GNU General Public License along with this program. If not,
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>

namespace py = pybind11;
using namespace pybind11::literals;

namespace lsst {
namespace meas {
namespace extensions {
namespace shapeHSM {

PYBIND11_PLUGIN(_hsmAdapter) {
py::module mod("_hsmAdapter", "Python wrapper for _hsmAdapter library");

/* Module level */

/* Member types and enums */

/* Constructors */

/* Operators */

/* Members */

return mod.ptr();
}
}
}
}
} // lsst::meas::extensions::shapeHSM
81 changes: 0 additions & 81 deletions python/lsst/meas/extensions/shapeHSM/hsmLib.i

This file was deleted.

4 changes: 4 additions & 0 deletions python/lsst/meas/extensions/shapeHSM/hsmLib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from __future__ import absolute_import

from ._hsmMomentsControl import *
from ._hsmShapeControl import *
76 changes: 76 additions & 0 deletions python/lsst/meas/extensions/shapeHSM/hsmMomentsControl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* LSST Data Management System
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
* See the COPYRIGHT file
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the LSST License Statement and
* the GNU General Public License along with this program. If not,
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>

#include "lsst/meas/extensions/shapeHSM/HsmMomentsControl.h"
#include "lsst/pex/config/python.h"

namespace py = pybind11;
using namespace pybind11::literals;

namespace lsst {
namespace meas {
namespace extensions {
namespace shapeHSM {

PYBIND11_PLUGIN(_hsmMomentsControl) {
py::module mod("_hsmMomentsControl", "Python wrapper for _hsmMomentsControl library");

/* Module level */
py::class_<HsmMomentsAlgorithm, std::shared_ptr<HsmMomentsAlgorithm>, base::SimpleAlgorithm>
clsHsmMomentsAlgorithm(mod, "HsmMomentsAlgorithm");

py::class_<HsmSourceMomentsAlgorithm, std::shared_ptr<HsmSourceMomentsAlgorithm>, HsmMomentsAlgorithm>
clsHsmSourceMomentsAlgorithm(mod, "HsmSourceMomentsAlgorithm");
py::class_<HsmSourceMomentsControl> clsHsmSourceMomentsControl(mod, "HsmSourceMomentsControl");

py::class_<HsmPsfMomentsAlgorithm, std::shared_ptr<HsmPsfMomentsAlgorithm>, HsmMomentsAlgorithm>
clsHsmPsfMomentsAlgorithm(mod, "HsmPsfMomentsAlgorithm");
py::class_<HsmPsfMomentsControl> clsHsmPsfMomentsControl(mod, "HsmPsfMomentsControl");

/* Member types and enums */

/* Constructors */
clsHsmSourceMomentsAlgorithm.def(
py::init<HsmSourceMomentsAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a, "name"_a, "schema"_a);
clsHsmSourceMomentsControl.def(py::init<>());

clsHsmPsfMomentsAlgorithm.def(
py::init<HsmPsfMomentsAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a, "name"_a, "schema"_a);
clsHsmPsfMomentsControl.def(py::init<>());

/* Operators */

/* Members */
LSST_DECLARE_CONTROL_FIELD(clsHsmSourceMomentsControl, HsmSourceMomentsControl, badMaskPlanes);

clsHsmMomentsAlgorithm.def("fail", &HsmMomentsAlgorithm::fail);

return mod.ptr();
}
}
}
}
} // lsst::meas::extensions::shapeHSM
98 changes: 98 additions & 0 deletions python/lsst/meas/extensions/shapeHSM/hsmShapeControl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* LSST Data Management System
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
* See the COPYRIGHT file
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the LSST License Statement and
* the GNU General Public License along with this program. If not,
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>

#include "lsst/meas/extensions/shapeHSM/HsmShapeControl.h"
#include "lsst/pex/config/python.h"

namespace py = pybind11;
using namespace pybind11::literals;

namespace lsst {
namespace meas {
namespace extensions {
namespace shapeHSM {

PYBIND11_PLUGIN(_hsmShapeControl) {
py::module mod("_hsmShapeControl", "Python wrapper for _hsmShapeControl library");

/* Module level */
py::class_<HsmShapeAlgorithm, std::shared_ptr<HsmShapeAlgorithm>, base::SimpleAlgorithm>
clsHsmShapeAlgorithm(mod, "HsmShapeAlgorithm");
py::class_<HsmShapeControl> clsHsmShapeControl(mod, "HsmShapeControl");

py::class_<HsmShapeBjAlgorithm, std::shared_ptr<HsmShapeBjAlgorithm>, HsmShapeAlgorithm>
clsHsmShapeBjAlgorithm(mod, "HsmShapeBjAlgorithm");
py::class_<HsmShapeBjControl, HsmShapeControl> clsHsmShapeBjControl(mod, "HsmShapeBjControl");

py::class_<HsmShapeLinearAlgorithm, std::shared_ptr<HsmShapeLinearAlgorithm>, HsmShapeAlgorithm>
clsHsmShapeLinearAlgorithm(mod, "HsmShapeLinearAlgorithm");
py::class_<HsmShapeLinearControl, HsmShapeControl> clsHsmShapeLinearControl(mod, "HsmShapeLinearControl");

py::class_<HsmShapeKsbAlgorithm, std::shared_ptr<HsmShapeKsbAlgorithm>, HsmShapeAlgorithm>
clsHsmShapeKsbAlgorithm(mod, "HsmShapeKsbAlgorithm");
py::class_<HsmShapeKsbControl, HsmShapeControl> clsHsmShapeKsbControl(mod, "HsmShapeKsbControl");

py::class_<HsmShapeRegaussAlgorithm, std::shared_ptr<HsmShapeRegaussAlgorithm>, HsmShapeAlgorithm>
clsHsmShapeRegaussAlgorithm(mod, "HsmShapeRegaussAlgorithm");
py::class_<HsmShapeRegaussControl, HsmShapeControl> clsHsmShapeRegaussControl(mod,
"HsmShapeRegaussControl");

/* Member types and enums */

/* Constructors */
clsHsmShapeBjAlgorithm.def(
py::init<HsmShapeBjAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a, "name"_a, "schema"_a);
clsHsmShapeBjControl.def(py::init<>());

clsHsmShapeLinearAlgorithm.def(
py::init<HsmShapeLinearAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a, "name"_a, "schema"_a);
clsHsmShapeLinearControl.def(py::init<>());

clsHsmShapeKsbAlgorithm.def(
py::init<HsmShapeKsbAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a, "name"_a, "schema"_a);
clsHsmShapeKsbControl.def(py::init<>());

clsHsmShapeRegaussAlgorithm.def(
py::init<HsmShapeRegaussAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a, "name"_a, "schema"_a);
clsHsmShapeRegaussControl.def(py::init<>());

/* Operators */

/* Members */
LSST_DECLARE_CONTROL_FIELD(clsHsmShapeControl, HsmShapeControl, badMaskPlanes);
LSST_DECLARE_CONTROL_FIELD(clsHsmShapeControl, HsmShapeControl, deblendNChild);

clsHsmShapeAlgorithm.def("measure", &HsmShapeAlgorithm::measure);
clsHsmShapeAlgorithm.def("fail", &HsmShapeAlgorithm::fail);

return mod.ptr();
}
}
}
}
} // lsst::meas::extensions::shapeHSM