23#include "pybind11/pybind11.h"
24#include "pybind11/stl.h"
38using namespace pybind11::literals;
43namespace photometryKron {
47void declareKronFluxControl(py::module &mod) {
48 py::class_<KronFluxControl>
cls(mod,
"KronFluxControl");
50 cls.def(py::init<>());
64void declareKronFluxAlgorithm(py::module &mod) {
65 py::class_<KronFluxAlgorithm, std::shared_ptr<KronFluxAlgorithm>, base::SimpleAlgorithm>
cls(
66 mod,
"KronFluxAlgorithm");
69 py::return_value_policy::copy);
82 daf::base::PropertySet &>(),
83 "ctrl"_a,
"name"_a,
"schema"_a,
"metadata"_a);
91using PyKronAperture = py::class_<KronAperture>;
99template <
typename ImageT>
100void declareKronApertureTemplatedMethods(PyKronAperture &cls) {
101 cls.def_static(
"determineRadius", &KronAperture::determineRadius<ImageT>,
"image"_a,
"axes"_a,
"center"_a,
103 cls.def(
"measureFlux", &KronAperture::measureFlux<ImageT>,
"image"_a,
"nRadiusForFlux"_a,
107void declareKronAperture(py::module &mod) {
108 PyKronAperture
cls(mod,
"KronAperture");
110 cls.def(py::init<geom::Point2D const &, afw::geom::ellipses::BaseCore const &, float>(),
"center"_a,
111 "core"_a,
"radiusForRadius"_a =
std::nanf(
""));
112 cls.def(py::init<afw::table::SourceRecord const &, float>(),
"source"_a,
114 cls.def(py::init<afw::table::SourceRecord const &, geom::AffineTransform const &, double, float>(),
115 "reference"_a,
"refToMeas"_a,
"radius"_a,
"radiusForRadius"_a =
std::nanf(
""));
124 py::return_value_policy::reference_internal);
127 declareKronApertureTemplatedMethods<afw::image::MaskedImage<float>>(
cls);
133 py::module::import(
"lsst.afw.geom");
134 py::module::import(
"lsst.afw.image");
135 py::module::import(
"lsst.afw.table");
136 py::module::import(
"lsst.daf.base");
138 declareKronFluxControl(mod);
139 declareKronFluxAlgorithm(mod);
140 declareKronAperture(mod);
float getRadiusForRadius() const
std::shared_ptr< KronAperture > transform(geom::AffineTransform const &trans) const
Transform a Kron Aperture to a different frame.
double getX() const
Accessors.
afw::geom::ellipses::Axes & getAxes()
geom::Point2D const & getCenter() const
static afw::geom::ellipses::Axes getKronAxes(afw::geom::ellipses::Axes const &shape, geom::LinearTransform const &transformation, double const radius)
Determine Kron axes from a reference image.
static meas::base::FlagDefinition const BAD_RADIUS
static meas::base::FlagDefinition const USED_MINIMUM_RADIUS
static meas::base::FlagDefinition const FAILURE
static meas::base::FlagDefinition const SMALL_RADIUS
KronFluxControl Control
A typedef to the Control object for this algorithm, defined above.
virtual void fail(afw::table::SourceRecord &measRecord, meas::base::MeasurementError *error=NULL) const
Handle an exception thrown by the current algorithm by setting flags in the given record.
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
Called to measure a single child source in an image.
static meas::base::FlagDefinition const BAD_SHAPE
static meas::base::FlagDefinitionList const & getFlagDefinitions()
virtual void measureForced(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure, afw::table::SourceRecord const &refRecord, afw::geom::SkyWcs const &refWcs) const
Called to measure a single child source in an image.
static meas::base::FlagDefinition const EDGE
static meas::base::FlagDefinition const NO_MINIMUM_RADIUS
static meas::base::FlagDefinition const NO_FALLBACK_RADIUS
static meas::base::FlagDefinition const BAD_SHAPE_NO_PSF
static meas::base::FlagDefinition const USED_PSF_RADIUS
PYBIND11_MODULE(photometryKron, mod)
#define LSST_DECLARE_CONTROL_FIELD(WRAPPER, CLASS, NAME)
Macro used to wrap fields declared by LSST_CONTROL_FIELD using Pybind11.