Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04dff08e69+fafbcb10e2,g0d33ba9806+3d21495239,g0fba68d861+4a282a2c93,g1ec0fe41b4+f536777771,g1fd858c14a+ae46bc2a71,g35bb328faa+fcb1d3bbc8,g4af146b050+9c38a215af,g4d2262a081+36f1e108ba,g53246c7159+fcb1d3bbc8,g5a012ec0e7+b20b785ecb,g60b5630c4e+3d21495239,g6273192d42+d9e7b43dd0,g67b6fd64d1+4086c0989b,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g87b7deb4dc+2198278b84,g8852436030+54b48a5987,g89139ef638+4086c0989b,g9125e01d80+fcb1d3bbc8,g94187f82dc+3d21495239,g989de1cb63+4086c0989b,g9d31334357+3d21495239,g9f33ca652e+83205baa3c,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+85d1f90f4c,gb58c049af0+f03b321e39,gb89ab40317+4086c0989b,gc0bb628dac+d11454dffd,gcf25f946ba+54b48a5987,gd6cbbdb0b4+af3c3595f5,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+a74c3eaa38,ge278dab8ac+d65b3c2b70,ge410e46f29+4086c0989b,gf23fb2af72+b3e27b8ebc,gf67bdafdda+4086c0989b,v29.0.0.rc6
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
pybind11.h File Reference
#include <pybind11/pybind11.h>

Go to the source code of this file.

Functions

void bind_centroidparameters (py::module &m)
 
void bind_channel (py::module &m)
 
void bind_chromatic (py::module &m)
 
void bind_component (py::module &m)
 
void bind_componentmixture (py::module &m)
 
void bind_data (py::module &m)
 
void bind_ellipticalcomponent (py::module &m)
 
void bind_fractionalintegralmodel (py::module &m)
 
void bind_gaussiancomponent (py::module &m)
 
void bind_gaussianmodelintegral (py::module &m)
 
void bind_gaussianparametricellipse (py::module &m)
 
void bind_gaussianprior (py::module &m)
 
void bind_integralmodel (py::module &m)
 
void bind_interpolation (py::module &m)
 
void bind_linearintegralmodel (py::module &m)
 
void bind_linearsersicmixinterpolator (py::module &m)
 
void bind_model (py::module &m)
 
void bind_observation (py::module &m)
 
void bind_param_filter (py::module &m)
 
void bind_parameters (py::module &m)
 
void bind_parametric (py::module &m)
 
void bind_parametricgaussian1d (py::module &m)
 
void bind_parametricellipse (py::module &m)
 
void bind_parametricmodel (py::module &m)
 
void bind_prior (py::module &m)
 
void bind_psfmodel (py::module &m)
 
void bind_sersicmix (py::module &m)
 
void bind_sersicmixcomponent (py::module &m)
 
void bind_sersicparametricellipse (py::module &m)
 
void bind_shapeprior (py::module &m)
 
void bind_source (py::module &m)
 

Function Documentation

◆ bind_centroidparameters()

void bind_centroidparameters ( py::module & m)

Definition at line 42 of file centroidparameters.cc.

42 {
43 auto _c = py::class_<g2f::CentroidParameters, std::shared_ptr<g2f::CentroidParameters>,
44 lsst::gauss2d::CentroidData>(m, "CentroidParameters")
45 .def(py::init<double, double>(), "x"_a = 0, "y"_a = 0)
48 "x"_a = nullptr, "y"_a = nullptr)
52 .def_property_readonly("x_param", &g2f::CentroidParameters::get_x_param)
53 .def_property_readonly("y_param", &g2f::CentroidParameters::get_y_param)
54 .def_property_readonly("x_param_ptr", &g2f::CentroidParameters::get_x_param_ptr)
55 .def_property_readonly("y_param_ptr", &g2f::CentroidParameters::get_y_param_ptr)
56 .def("__repr__", [](const g2f::CentroidParameters &self) { return self.repr(true); })
57 .def("__str__", &g2f::CentroidParameters::str);
58}
Interface for an object storing Centroid data.
Definition centroid.h:43
A Centroid with Parameters for x and y.
double get_y() const override
Get the y value.
CentroidYParameterD & get_y_param() const
Get a ref to the y param.
CentroidXParameterD & get_x_param() const
Get a ref to the x param.
void set_xy(const std::array< double, 2 > &xy) override
std::array< double, 2 > get_xy() const override
Get the x and y values.
std::shared_ptr< CentroidYParameterD > get_y_param_ptr()
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
std::shared_ptr< CentroidXParameterD > get_x_param_ptr()
double get_x() const override
Get the x value.
std::string str() const override
Return a brief, human-readable string representation of this.

◆ bind_channel()

void bind_channel ( py::module & m)

Definition at line 39 of file channel.cc.

39 {
40 auto _c = py::class_<g2f::Channel, std::shared_ptr<g2f::Channel> >(m, "Channel")
41 .def(py::init(&g2f::Channel::make))
42 .def_static("erase", &g2f::Channel::erase)
43 .def_property_readonly_static("all",
44 [](py::object) { return g2f::Channel::get_channels(); })
45 .def_static("find", &g2f::Channel::find_channel)
46 .def_static("get", &g2f::Channel::get_channel)
47 .def_readonly("name", &g2f::Channel::name)
48 .def_property_readonly_static("NONE",
49 [](py::object) { return g2f::Channel::NONE_PTR(); })
50 .def("__repr__", [](const g2f::Channel &self) { return self.repr(true); })
51 .def("__str__", &g2f::Channel::str);
52 /*
53 const bool operator < ( const Channel &c ) const;
54 const bool operator == ( const Channel &c ) const;
55 const bool operator != ( const Channel &c ) const;
56 */
57}
An observational channel, usually representing some range of wavelengths of light.
Definition channel.h:29
static void erase(std::string name)
Delete a channel with a given name.
Definition channel.cc:51
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition channel.cc:99
static const std::shared_ptr< const Channel > get_channel(std::string name)
Get a channel with the given name, creating it if it doesn't exist.
Definition channel.cc:74
static std::vector< std::shared_ptr< const Channel > > get_channels()
Definition channel.cc:80
static const std::shared_ptr< const Channel > NONE_PTR()
Definition channel.cc:106
static const std::shared_ptr< const Channel > find_channel(std::string name)
Find a channel with the given name.
Definition channel.cc:67
const std::string name
Definition channel.h:66
static std::shared_ptr< Channel > make(std::string name)
Construct a new Channel.
Definition channel.cc:89
std::string str() const override
Return a brief, human-readable string representation of this.
Definition channel.cc:104

◆ bind_chromatic()

void bind_chromatic ( py::module & m)

Definition at line 37 of file chromatic.cc.

37 {
38 auto _p = py::class_<g2f::Chromatic, std::shared_ptr<g2f::Chromatic>>(m, "Chromatic");
39}

◆ bind_component()

void bind_component ( py::module & m)

Definition at line 38 of file component.cc.

38 {
39 auto _c = py::class_<g2f::Component, std::shared_ptr<g2f::Component>, g2f::ParametricModel>(m,
40 "Component");
41}
A Parametric that can manage Parameter gradients and return Gaussians.

◆ bind_componentmixture()

void bind_componentmixture ( py::module & m)

Definition at line 38 of file componentmixture.cc.

38 {
39 auto _c = py::class_<g2f::ComponentMixture, std::shared_ptr<g2f::ComponentMixture>, g2f::ParametricModel>(
40 m, "ComponentMixture");
41}

◆ bind_data()

void bind_data ( py::module & m)

Definition at line 66 of file data.cc.

66 {
68 declare_data<float>(m, "F");
69}
void declare_data(py::module &m, std::string str_type)
Definition data.cc:44

◆ bind_ellipticalcomponent()

void bind_ellipticalcomponent ( py::module & m)

Definition at line 41 of file ellipticalcomponent.cc.

41 {
42 auto _e = py::class_<g2f::EllipticalComponent, std::shared_ptr<g2f::EllipticalComponent>, g2f::Component>(
43 m, "EllipticalComponent")
44 .def_property_readonly("centroid", &g2f::EllipticalComponent::get_centroid)
45 .def_property_readonly("ellipse", &g2f::EllipticalComponent::get_ellipse)
46 .def_property_readonly("integralmodel", &g2f::EllipticalComponent::get_integralmodel);
47}
An atomic constituent of a source.
Definition component.h:15
const ParametricEllipse & get_ellipse() const
Get the ellipse Parameter container.
const CentroidParameters & get_centroid() const
Get the centroid Parameter container.
const IntegralModel & get_integralmodel() const override

◆ bind_fractionalintegralmodel()

void bind_fractionalintegralmodel ( py::module & m)

Definition at line 40 of file fractionalintegralmodel.cc.

40 {
41 auto _p = py::class_<g2f::FractionalIntegralModel, std::shared_ptr<g2f::FractionalIntegralModel>,
42 g2f::IntegralModel>(m, "FractionalIntegralModel")
43 .def(py::init(&g2f::FractionalIntegralModel::make), "data"_a, "model"_a,
44 "is_final"_a = false)
45 .def_property_readonly("channels", &g2f::FractionalIntegralModel::get_channels)
46 .def("integral", &g2f::FractionalIntegralModel::get_integral, "channel"_a)
48 "channel"_a)
50 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
51 .def_property_readonly("parent_model", &g2f::FractionalIntegralModel::get_parent_model)
52 .def_static("model", &g2f::FractionalIntegralModel::find_model)
53 .def("__getitem__", [](const g2f::FractionalIntegralModel &self,
54 const g2f::Channel &c) { return self.at(c); })
56 .def("__repr__",
57 [](const g2f::FractionalIntegralModel &self) { return self.repr(true); })
58 .def("__str__", &g2f::FractionalIntegralModel::str);
59}
An IntegralModel that returns a Parameter-dependent fraction of the flux of another IntegralModel.
static std::shared_ptr< FractionalIntegralModel > find_model(const IntegralModel &model)
Find the FractionalIntegralModel that depends on a given IntegralModel, if any.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
std::string str() const override
Return a brief, human-readable string representation of this.
double get_integral_remainder(const Channel &channel) const
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
std::vector< std::reference_wrapper< const Channel > > get_channels() const override
Get the set of channels this instance is applicable for.
double get_integral(const Channel &channel) const override
Get the value of the integral in a single Channel.
std::shared_ptr< ProperFractionParameterD > at(const Channel &channel)
static std::shared_ptr< FractionalIntegralModel > make(std::optional< const Data > data, std::shared_ptr< const IntegralModel > model, bool is_final=false)
Construct a FractionalIntegralModel and add to registry.
A Parametric model for the integral of a 2D distribution.
std::vector< ParamBaseRef > ParamRefs
Definition param_defs.h:13

◆ bind_gaussiancomponent()

void bind_gaussiancomponent ( py::module & m)

Definition at line 40 of file gaussiancomponent.cc.

40 {
41 auto _e = py::class_<g2f::GaussianComponent, std::shared_ptr<g2f::GaussianComponent>,
42 g2f::EllipticalComponent>(m, "GaussianComponent")
46 "ellipse"_a = nullptr, "centroid"_a = nullptr, "integral"_a = nullptr)
48 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
49 .def("gaussians",
50 [](const g2f::GaussianComponent &g, const g2f::Channel &c) {
52 })
53 .def_static("make_uniq_default_gaussians",
55 .def("__repr__", [](const g2f::GaussianComponent &self) { return self.repr(true); })
56 .def("__str__", &g2f::GaussianComponent::str);
57}
A Component with an elliptically-symmetric intensity profile.
A Component consisting of a 2D Gaussian.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
static std::vector< std::shared_ptr< Component > > make_uniq_default_gaussians(const std::vector< double > &sizes={2.}, bool fixed=true)
Construct a vector of default-initialized GaussianComponent instances.
std::string str() const override
Return a brief, human-readable string representation of this.

◆ bind_gaussianmodelintegral()

void bind_gaussianmodelintegral ( py::module & m)

Definition at line 41 of file gaussianmodelintegral.cc.

41 {
42 auto _p = py::class_<g2f::GaussianModelIntegral, std::shared_ptr<g2f::GaussianModelIntegral>,
43 lsst::gauss2d::GaussianIntegral>(m, "GaussianModelIntegral")
44 .def(py::init<const g2f::Channel &, const std::shared_ptr<const g2f::IntegralModel>>(),
45 "channel"_a, "integralmodel"_a)
46 .def_property("value", &g2f::GaussianModelIntegral::get_value,
48 .def("__repr__", [](const g2f::GaussianModelIntegral &self) { return self.repr(true); })
49 .def("__str__", &g2f::GaussianModelIntegral::str);
50 /*
51 typename Data::iterator begin() noexcept;
52 typename Data::const_iterator cbegin() const noexcept;
53
54 typename Data::iterator end() noexcept;
55 typename Data::const_iterator cend() const noexcept;
56 */
57}
Interface for the normalization (total integrated value) of a 2D Gaussian.
Definition gaussian.h:47
A single-channel GaussianIntegral referencing a Parametric IntegralModel.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
std::string str() const override
Return a brief, human-readable string representation of this.

◆ bind_gaussianparametricellipse()

void bind_gaussianparametricellipse ( py::module & m)

Definition at line 39 of file gaussianparametricellipse.cc.

39 {
40 auto _e = py::class_<g2f::GaussianParametricEllipse, std::shared_ptr<g2f::GaussianParametricEllipse>,
41 lsst::gauss2d::EllipseData, g2f::ParametricEllipse>(m, "GaussianParametricEllipse")
42 .def(py::init<double, double, double>(), "sigma_x"_a = 0, "sigma_y"_a = 0, "rho"_a = 0)
46 "sigma_x"_a = nullptr, "sigma_y"_a = nullptr, "rho"_a = nullptr)
47 .def_property("rho", &g2f::GaussianParametricEllipse::get_rho,
49 .def_property("sigma_x", &g2f::GaussianParametricEllipse::get_sigma_x,
51 .def_property("sigma_y", &g2f::GaussianParametricEllipse::get_sigma_y,
53 .def_property("size_x", &g2f::GaussianParametricEllipse::get_size_x,
55 .def_property("size_y", &g2f::GaussianParametricEllipse::get_size_y,
57 .def_property("xyr", &g2f::GaussianParametricEllipse::get_xyr,
59 .def_property_readonly("rho_param", &g2f::GaussianParametricEllipse::get_rho_param)
60 .def_property_readonly("sigma_x_param",
62 .def_property_readonly("sigma_y_param",
64 .def_property_readonly("size_x_param",
66 .def_property_readonly("size_y_param",
68 .def_property_readonly("rho_param_ptr",
70 .def_property_readonly("sigma_x_param_ptr",
72 .def_property_readonly("sigma_y_param_ptr",
74 .def_property_readonly("size_x_param_ptr",
76 .def_property_readonly("size_y_param_ptr",
79 .def("__repr__",
80 [](const g2f::GaussianParametricEllipse &self) { return self.repr(true); })
82}
Interface for an object storing Ellipse data.
Definition ellipse.h:132
A Parameter-based implementation of lsst::gauss2d::EllipseData and ParametricEllipse.
std::string str() const override
Return a brief, human-readable string representation of this.
std::shared_ptr< SizeYParameterD > get_size_y_param_ptr() override
void set(double sigma_x, double sigma_y, double rho) override
Set sigma_x, sigma_y, rho.
void set_sigma_y(double sigma_y) override
Set the y-axis dispersion (sigma)
SigmaXParameterD & get_sigma_x_param() const
Explicit alias for get_size_x_param.
void set_rho(double rho) override
Set the correlation parameter (rho)
std::shared_ptr< SigmaYParameterD > get_sigma_y_param_ptr()
Explicit alias for get_sigma_y_param_ptr.
std::shared_ptr< SigmaXParameterD > get_sigma_x_param_ptr()
Explicit alias for get_sigma_x_param_ptr.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
SigmaYParameterD & get_sigma_y_param() const
Explicit alias for get_size_y_param.
std::shared_ptr< SizeXParameterD > get_size_x_param_ptr() override
double get_size_y() const override
Get the size_y value.
std::shared_ptr< RhoParameterD > get_rho_param_ptr() override
void set_sigma_x(double sigma_x) override
Set the x-axis dispersion (sigma)
std::array< double, 3 > get_xyr() const override
Get sigma_x, sigma_y, rho.
void set_xyr(const std::array< double, 3 > &xyr) override
Set sigma_x, sigma_y, rho from an array.
double get_size_x() const override
Get the size_x value.

◆ bind_gaussianprior()

void bind_gaussianprior ( py::module & m)

Definition at line 40 of file gaussianprior.cc.

40 {
41 auto _e = py::class_<g2f::GaussianPrior, std::shared_ptr<g2f::GaussianPrior>, g2f::Prior>(m,
42 "GaussianPrior")
43 .def(py::init<std::shared_ptr<const g2f::ParamBase>, double, double, bool>(),
44 "param"_a = nullptr, "mean"_a = 0, "stddev"_a = 1., "transformed"_a = false)
45 .def("evaluate", &g2f::GaussianPrior::evaluate, "calc_jacobians"_a = false,
46 "normalize_loglike"_a = false)
47 .def_property_readonly("loglike_const_terms",
50 .def_property_readonly("param", &g2f::GaussianPrior::get_param)
51 .def_property("stddev", &g2f::GaussianPrior::get_stddev,
53 .def_property("transformed", &g2f::GaussianPrior::get_transformed,
55 .def("__len__", &g2f::GaussianPrior::size)
56 .def("__repr__", [](const g2f::GaussianPrior &self) { return self.repr(true); })
57 .def("__str__", &g2f::GaussianPrior::str);
58}
A 1D Gaussian prior for a single Parameter.
PriorEvaluation evaluate(bool calc_jacobians=false, bool normalize_loglike=false) const override
Evaluate the log likelihood and residual-dependent terms.
size_t size() const override
void set_transformed(bool transformed)
std::string str() const override
Return a brief, human-readable string representation of this.
std::vector< double > get_loglike_const_terms() const override
Return the constant terms of the log likelihood (dependent on stddevs only)
const ParamBase & get_param() const
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Interface for a prior probability function.
Definition prior.h:38

◆ bind_integralmodel()

void bind_integralmodel ( py::module & m)

Definition at line 37 of file integralmodel.cc.

37 {
38 auto _p = py::class_<g2f::IntegralModel, std::shared_ptr<g2f::IntegralModel>, g2f::Chromatic>(
39 m, "IntegralModel");
40}

◆ bind_interpolation()

void bind_interpolation ( py::module & m)

Definition at line 37 of file interpolation.cc.

37 {
38 auto _e = py::enum_<g2f::InterpType>(m, "InterpType")
39 .value("linear", g2f::InterpType::linear)
40 .value("polynomial", g2f::InterpType::polynomial)
41 .value("cspline", g2f::InterpType::cspline)
42 .value("akima", g2f::InterpType::akima);
43}
@ polynomial
Polynomial interpolation.
@ linear
Linear interpolation.
@ cspline
Cubic spline interpolation.
@ akima
Akima spline with natural boundary conditions.

◆ bind_linearintegralmodel()

void bind_linearintegralmodel ( py::module & m)

Definition at line 40 of file linearintegralmodel.cc.

40 {
41 auto _p = py::class_<g2f::LinearIntegralModel, std::shared_ptr<g2f::LinearIntegralModel>,
42 g2f::IntegralModel>(m, "LinearIntegralModel")
43 .def(py::init<const g2f::LinearIntegralModel::Data *>(), "data"_a)
44 .def_property_readonly("channels", &g2f::LinearIntegralModel::get_channels)
45 .def("integral", &g2f::LinearIntegralModel::get_integral, "channel"_a)
47 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
48 .def("__getitem__", [](const g2f::LinearIntegralModel &self,
49 const g2f::Channel &c) { return self.at(c); })
50 .def("__len__", &g2f::LinearIntegralModel::size)
51 .def("__repr__", [](const g2f::LinearIntegralModel &self) { return self.repr(true); })
52 .def("__str__", &g2f::LinearIntegralModel::str);
53 /*
54 typename Data::iterator begin() noexcept;
55 typename Data::const_iterator cbegin() const noexcept;
56
57 typename Data::iterator end() noexcept;
58 typename Data::const_iterator cend() const noexcept;
59 */
60}
An IntegralModel with a single linear IntegralParameterD per Channel.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
std::vector< std::reference_wrapper< const Channel > > get_channels() const override
Get the set of channels this instance is applicable for.
std::shared_ptr< IntegralParameterD > at(const Channel &channel)
Get the IntegralParameterD for the given Channel.
double get_integral(const Channel &channel) const override
Get the value of the integral in a single Channel.
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
std::string str() const override
Return a brief, human-readable string representation of this.
size_t size() const
Return the size of Data (number of Channel/IntegralParameterD instances)

◆ bind_linearsersicmixinterpolator()

void bind_linearsersicmixinterpolator ( py::module & m)

Definition at line 40 of file linearsersicmixinterpolator.cc.

40 {
41 auto _e = py::class_<g2f::LinearSersicMixInterpolator, std::shared_ptr<g2f::LinearSersicMixInterpolator>,
42 g2f::SersicMixInterpolator>(m, "LinearSersicMixInterpolator")
43 .def(py::init<short>(), "order"_a = g2f::SERSICMIX_ORDER_DEFAULT)
45 .def("integralsizes_derivs",
47 .def_property_readonly("order", &g2f::LinearSersicMixInterpolator::get_order)
48 .def("__repr__",
49 [](const g2f::LinearSersicMixInterpolator &self) { return self.repr(true); })
51}
A SersicMixInterpolator that uses linear interpolation between knots.
std::vector< IntegralSize > get_integralsizes(double sersicindex) const override
Get the vector of IntegralSize values for a given Sersic index.
std::string str() const override
Return a brief, human-readable string representation of this.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
std::vector< IntegralSize > get_integralsizes_derivs(double sersicindex) const override
An interpolator that returns IntegralSize vectors for a given Sersic index.
Definition sersicmix.h:34

◆ bind_model()

void bind_model ( py::module & m)

Definition at line 90 of file model.cc.

90 {
91 auto _e = py::enum_<g2f::EvaluatorMode>(m, "EvaluatorMode")
92 .value("image", g2f::EvaluatorMode::image)
93 .value("loglike", g2f::EvaluatorMode::loglike)
94 .value("loglike_image", g2f::EvaluatorMode::loglike_image)
95 .value("loglike_grad", g2f::EvaluatorMode::loglike_grad)
96 .value("jacobian", g2f::EvaluatorMode::jacobian)
97 .export_values();
98 auto _h = py::class_<g2f::HessianOptions, std::shared_ptr<g2f::HessianOptions>>(m, "HessianOptions")
99 .def(py::init<bool, double, double>(), "return_negative"_a = true,
100 "findiff_frac"_a = 1e-4, "findiff_add"_a = 1e-4)
101 .def_readwrite("return_negative", &g2f::HessianOptions::return_negative)
102 .def_readwrite("findiff_frac", &g2f::HessianOptions::return_negative)
103 .def_readwrite("findiff_add", &g2f::HessianOptions::return_negative);
104 declare_model<double>(m, "D");
105 declare_model<float>(m, "F");
106}
void declare_model(py::module &m, std::string str_type)
Definition model.cc:44
@ image
Compute the model images only.
Definition model.h:33
@ loglike_image
Compute the model images and log likelihood.
Definition model.h:35
@ loglike
Compute the log likelihood only.
Definition model.h:34
@ jacobian
Compute the model Jacobian.
Definition model.h:37
@ loglike_grad
Compute the gradients of the log likelihood.
Definition model.h:36

◆ bind_observation()

void bind_observation ( py::module & m)

Definition at line 64 of file observation.cc.

64 {
67}
void declare_observation(py::module &m, std::string str_type)

◆ bind_param_filter()

void bind_param_filter ( py::module & m)

Definition at line 38 of file param_filter.cc.

38 {
39 auto _p = py::class_<g2f::ParamFilter, std::shared_ptr<g2f::ParamFilter>>(m, "ParamFilter")
40 .def(py::init<bool, bool, bool, bool,
42 "fixed"_a = true, "free"_a = true, "linear"_a = true, "nonlinear"_a = true,
43 "channel"_a = std::nullopt)
44 .def_readwrite("channel", &g2f::ParamFilter::channel)
45 .def_readwrite("fixed", &g2f::ParamFilter::fixed)
46 .def_readwrite("free", &g2f::ParamFilter::free)
47 .def_readwrite("linear", &g2f::ParamFilter::linear)
48 .def_readwrite("nonlinear", &g2f::ParamFilter::nonlinear);
49}
std::optional< std::reference_wrapper< const Channel > > channel

◆ bind_parameters()

void bind_parameters ( py::module & m)

Definition at line 47 of file parameters.cc.

47 {
48 auto _u = py::class_<parameters::Unit, std::shared_ptr<parameters::Unit>>(m, "Unit");
49 py::class_<g2f::UnitNone, std::shared_ptr<g2f::UnitNone>, parameters::Unit>(m, "UnitNone")
50 .def(py::init<>())
51 .def_property_readonly("name", &g2f::UnitNone::get_name);
53 using Parameter = parameters::ParameterBase<double>;
54 auto _p = py::class_<Parameter, std::shared_ptr<Parameter>>(m, "ParameterD");
55 auto integral = declare_parameter<double, g2f::IntegralParameterD>(m, "Integral");
61 auto propfrac = declare_parameter<double, g2f::ProperFractionParameterD>(m, "ProperFraction");
62 propfrac.def_property("label", &g2f::ProperFractionParameterD::get_label,
81 // TODO: Determine why this won't work with std::shared_ptr<parameters::Limits<double>>
83 std::shared_ptr<parameters::Limits<double>>, double>(m, "LogitLimited");
86 "params"_a = _default);
87}
std::string get_name() const override
Return a string representation of this unit.
Definition parameters.h:19
Interface for parameters with values and metadata.
Definition parameter.h:58
virtual void set_label(std::string label)=0
A generic interface for physical units described by strings.
Definition unit.h:35
void declare_transform_base(py::module &m)
Definition parameters.h:139
auto declare_parameter(py::module &m, std::string name, std::string suffix=g2f::suffix_type_str< T >())
Definition parameters.h:114
auto declare_sizeparameter_base(py::module &m, std::string suffix=g2f::suffix_type_str< T >())
Definition parameters.h:133
void declare_limits(py::module &m)
Definition parameters.h:50
auto declare_sizeparameter(py::module &m, std::string name)
Definition parameters.h:128
void declare_transform(py::module &m, std::string name)
Definition parameters.h:170
void declare_transform_full(py::module &m, std::string name)
Definition parameters.h:145
std::vector< T > nonconsecutive_unique(const std::vector< T > &vec)
Definition util.h:92

◆ bind_parametric()

void bind_parametric ( py::module & m)

Definition at line 38 of file parametric.cc.

38 {
39 auto _p = py::class_<g2f::Parametric, std::shared_ptr<g2f::Parametric>, lsst::gauss2d::Object>(
40 m, "Parametric");
41}
A generic object from the gauss2d library.
Definition object.h:40

◆ bind_parametricellipse()

void bind_parametricellipse ( py::module & m)

Definition at line 38 of file parametricellipse.cc.

38 {
39 auto _p = py::class_<g2f::ParametricEllipse, std::shared_ptr<g2f::ParametricEllipse>, g2f::Parametric>(
40 m, "ParametricEllipse");
41}
A parametric object that can return and filter its Parameter instances.
Definition parametric.h:13

◆ bind_parametricgaussian1d()

void bind_parametricgaussian1d ( py::module & m)

Definition at line 39 of file parametricgaussian1d.cc.

39 {
40 auto _e = py::class_<g2f::ParametricGaussian1D, std::shared_ptr<g2f::ParametricGaussian1D>,
41 lsst::gauss2d::Object>(m, "ParametricGaussian1D")
44 "mean"_a = nullptr, "stddev"_a = nullptr)
45 .def_property("mean", &g2f::ParametricGaussian1D::get_mean,
47 .def_property_readonly("mean_parameter", &g2f::ParametricGaussian1D::get_mean_parameter)
48 .def_property("stddev", &g2f::ParametricGaussian1D::get_stddev,
50 .def_property_readonly("stddev_parameter",
52 .def("__repr__", [](const g2f::ParametricGaussian1D &self) { return self.repr(true); })
53 .def("__str__", &g2f::ParametricGaussian1D::str);
54}
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
std::string str() const override
Return a brief, human-readable string representation of this.

◆ bind_parametricmodel()

void bind_parametricmodel ( py::module & m)

Definition at line 38 of file parametricmodel.cc.

38 {
39 auto _p = py::class_<g2f::ParametricModel, std::shared_ptr<g2f::ParametricModel>, g2f::Parametric>(
40 m, "ParametricModel");
41}

◆ bind_prior()

void bind_prior ( py::module & m)

Definition at line 39 of file prior.cc.

39 {
40 auto _e = py::class_<g2f::PriorEvaluation, std::shared_ptr<g2f::PriorEvaluation>, lsst::gauss2d::Object>(
41 m, "PriorEvaluation")
42 .def(py::init<double, std::vector<double>,
44 "loglike"_a, "residuals"_a = std::vector<double>{},
46 .def_readonly("loglike", &g2f::PriorEvaluation::loglike)
47 .def_readonly("jacobians", &g2f::PriorEvaluation::jacobians)
48 .def_readonly("residuals", &g2f::PriorEvaluation::residuals)
49 .def("__repr__", [](const g2f::PriorEvaluation &self) { return self.repr(true); })
50 .def("__str__", &g2f::PriorEvaluation::str);
51 auto _p = py::class_<g2f::Prior, std::shared_ptr<g2f::Prior>, lsst::gauss2d::Object>(m, "Prior");
52}
Results from the evaluation of a prior probability function.
Definition prior.h:16
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition prior.cc:83
std::string str() const override
Return a brief, human-readable string representation of this.
Definition prior.cc:90
std::vector< double > residuals
Definition prior.h:21
std::reference_wrapper< const ParamBase > ParamBaseCRef
Definition param_defs.h:10

◆ bind_psfmodel()

void bind_psfmodel ( py::module & m)

Definition at line 40 of file psfmodel.cc.

40 {
41 auto _o = py::class_<g2f::PsfModel, std::shared_ptr<g2f::PsfModel>, g2f::ComponentMixture>(m, "PsfModel")
42 .def(py::init<g2f::Components &>(), "components"_a = nullptr)
43 .def_property_readonly("components", &g2f::PsfModel::get_components)
44 .def("gaussians",
45 [](const g2f::PsfModel &p, const g2f::Channel &c) {
47 })
48 .def("parameters", &g2f::PsfModel::get_parameters, "parameters"_a = g2f::ParamRefs(),
49 "paramfilter"_a = nullptr)
50 .def("__repr__", [](const g2f::PsfModel &self) { return self.repr(true); })
51 .def("__str__", &g2f::PsfModel::str);
52}
A list of related Component instances.
A Gaussian mixture model of a point spread function.
Definition psfmodel.h:26
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition psfmodel.cc:83
std::unique_ptr< const lsst::gauss2d::Gaussians > get_gaussians(const Channel &channel=Channel::NONE()) const override
Return the vector of Gaussian sub-components controlled by this model.
Definition psfmodel.cc:50
std::string str() const override
Return a brief, human-readable string representation of this.
Definition psfmodel.cc:90
Components get_components() const override
Definition psfmodel.cc:48
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
Definition psfmodel.cc:65

◆ bind_sersicmix()

void bind_sersicmix ( py::module & m)

Definition at line 39 of file sersicmix.cc.

39 {
40 auto _is = py::class_<g2f::IntegralSize, std::shared_ptr<g2f::IntegralSize>, lsst::gauss2d::Object>(
41 m, "IntegralSize")
42 .def(py::init<const double, const double>(), "integral"_a = 0, "sigma"_a = 0)
43 .def_readonly("integral", &g2f::IntegralSize::integral)
44 .def_readonly("sigma", &g2f::IntegralSize::sigma)
45 .def("__repr__", [](const g2f::IntegralSize &self) { return self.repr(true); })
46 .def("__str__", &g2f::IntegralSize::str);
47
48 auto _smi = py::class_<g2f::SersicMixInterpolator, std::shared_ptr<g2f::SersicMixInterpolator>>(
49 m, "SersicMixInterpolator");
50
51 auto _smv
52 = py::class_<g2f::SersicMixValues, std::shared_ptr<g2f::SersicMixValues>, lsst::gauss2d::Object>(
53 m, "SersicMixValues")
54 .def(py::init<double, std::vector<g2f::IntegralSize>>(), "sersicindex"_a, "values"_a)
55 .def_readonly("sersicindex", &g2f::SersicMixValues::sersicindex)
56 .def_readonly("values", &g2f::SersicMixValues::values)
57 .def("__repr__", [](const g2f::SersicMixValues &self) { return self.repr(true); })
58 .def("__str__", &g2f::SersicMixValues::str);
59
60 m.def("sersic_mix_knots", &g2f::get_sersic_mix_knots_copy, "order"_a = g2f::SERSICMIX_ORDER_DEFAULT,
61 py::return_value_policy::copy);
62}
A pair of integral - size values for a Gaussian (sub)Component.
Definition sersicmix.h:19
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition sersicmix.cc:14
std::string str() const override
Return a brief, human-readable string representation of this.
Definition sersicmix.cc:20
A vector of IntegralSize values for a given Sersic index.
Definition sersicmix.h:55
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition sersicmix.cc:27
std::string str() const override
Return a brief, human-readable string representation of this.
Definition sersicmix.cc:33
const std::vector< IntegralSize > values
Definition sersicmix.h:66
std::vector< SersicMixValues > get_sersic_mix_knots_copy(unsigned short order)
Definition sersicmix.cc:68

◆ bind_sersicmixcomponent()

void bind_sersicmixcomponent ( py::module & m)

Definition at line 44 of file sersicmixcomponent.cc.

44 {
45 using T = double;
47 using Base = g2f::SersicIndexParameterD;
48
49 std::string pyclass_name = "SersicMixComponentIndexParameter" + g2f::suffix_type_str<T>();
51 // note that Base is the actual name of the base Parameter class, not the CRTP class
52 // that it is "derived" from
53 py::class_<C, std::shared_ptr<C>, Base>(m, pyclass_name.c_str()))
54 // new properties
55 .def_property_readonly("integralratio",
57 .def_property_readonly("interptype", &g2f::SersicMixComponentIndexParameterD::get_interptype)
58 .def_property_readonly("order", &g2f::SersicMixComponentIndexParameterD::get_order)
59 .def_property_readonly("sizeratio", &g2f::SersicMixComponentIndexParameterD::get_sizeratio)
60 // constructor with added arg
61 .def(py::init<T, std::shared_ptr<const parameters::Limits<T>>,
65 "value"_a = g2f::SersicMixComponentIndexParameterD::_get_default(), "limits"_a = nullptr,
66 "transform"_a = nullptr, "unit"_a = lsst::gauss2d::fit::unit_none, "fixed"_a = false,
67 "label"_a = "", "interpolator"_a = nullptr);
68
69 auto _e = py::class_<g2f::SersicMixComponent, std::shared_ptr<g2f::SersicMixComponent>,
70 g2f::EllipticalComponent>(m, "SersicMixComponent")
75 "ellipse"_a = nullptr, "centroid"_a = nullptr, "integral"_a = nullptr,
76 "sersicindex"_a = nullptr)
77 .def_property("sersicindex", &g2f::SersicMixComponent::get_sersicindex,
79 .def_property_readonly("sersicindex_param",
81 .def_property_readonly("sersicindex_param_ptr",
84 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
85 .def("gaussians",
86 [](const g2f::SersicMixComponent &g, const g2f::Channel &c) {
88 })
89 .def("__repr__", [](const g2f::SersicMixComponent &self) { return self.repr(true); })
90 .def("__str__", &g2f::SersicMixComponent::str);
91}
T c_str(T... args)
A Gaussian mixture approximation to a Sersic profile Component.
std::string str() const override
Return a brief, human-readable string representation of this.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
SersicMixComponentIndexParameterD & get_sersicindex_param() const
std::shared_ptr< SersicMixComponentIndexParameterD > get_sersicindex_param_ptr()
A SersicIndexParameter for a Gaussian mixture Component.
double get_sizeratio(unsigned short index) const
Return the size ratio for a given Gaussian sub-component index.
double get_integralratio(unsigned short index) const
Return the integral ratio for a given Gaussian sub-component index.
Range-based limits for parameter values.
Definition limits.h:45
A reversible transformation of a real scalar value.
Definition transform.h:45
auto declare_parameter_methods(py::class_< C, Args... > c)
Definition parameters.h:70
std::string suffix_type_str()
Definition utils.h:17

◆ bind_sersicparametricellipse()

void bind_sersicparametricellipse ( py::module & m)

Definition at line 39 of file sersicparametricellipse.cc.

39 {
40 auto _e = py::class_<g2f::SersicParametricEllipse, std::shared_ptr<g2f::SersicParametricEllipse>,
41 g2f::ParametricEllipse>(m, "SersicParametricEllipse")
42 .def(py::init<double, double, double>(), "size_x"_a = 0, "size_y"_a = 0, "rho"_a = 0)
46 "size_x"_a = nullptr, "size_y"_a = nullptr, "rho"_a = nullptr)
47 .def_property("rho", &g2f::SersicParametricEllipse::get_rho,
49 .def_property("size_x", &g2f::SersicParametricEllipse::get_size_x,
51 .def_property("size_y", &g2f::SersicParametricEllipse::get_size_y,
53 .def_property("xyr", &g2f::SersicParametricEllipse::get_xyr,
55 .def_property_readonly("rho_param", &g2f::SersicParametricEllipse::get_rho_param)
56 .def_property_readonly("size_x_param", &g2f::SersicParametricEllipse::get_size_x_param)
57 .def_property_readonly("size_y_param", &g2f::SersicParametricEllipse::get_size_y_param)
58 .def_property_readonly("rho_param_ptr",
60 .def_property_readonly("size_x_param_ptr",
62 .def_property_readonly("size_y_param_ptr",
64 .def("__repr__",
65 [](const g2f::SersicParametricEllipse &self) { return self.repr(true); })
66 .def("__str__", &g2f::SersicParametricEllipse::str);
67}
virtual void set_xyr(const std::array< double, 3 > &xyr)
A ParametericEllipse with effective radius Parameters.
double get_rho() const override
Get the rho value.
std::shared_ptr< SizeYParameterD > get_size_y_param_ptr() override
SizeYParameterD & get_size_y_param() const override
SizeXParameterD & get_size_x_param() const override
double get_size_y() const override
Get the size_y value.
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
double get_size_x() const override
Get the size_x value.
std::shared_ptr< SizeXParameterD > get_size_x_param_ptr() override
std::string str() const override
Return a brief, human-readable string representation of this.
std::shared_ptr< RhoParameterD > get_rho_param_ptr() override
std::array< double, 3 > get_xyr() const override
Get the array of size_x, size_y, rho.

◆ bind_shapeprior()

void bind_shapeprior ( py::module & m)

Definition at line 41 of file shapeprior.cc.

41 {
42 auto _o = py::class_<g2f::ShapePriorOptions, std::shared_ptr<g2f::ShapePriorOptions>,
43 lsst::gauss2d::Object>(m, "ShapePriorOptions")
44 .def(py::init<double, double, double>(),
48 .def("check_delta_jacobian", &g2f::ShapePriorOptions::check_delta_jacobian)
49 .def("check_size_maj_floor", &g2f::ShapePriorOptions::check_size_maj_floor)
50 .def("check_axrat_floor", &g2f::ShapePriorOptions::check_axrat_floor)
51 .def_property("delta_jacobian", &g2f::ShapePriorOptions::get_delta_jacobian,
53 .def_property("size_maj_floor", &g2f::ShapePriorOptions::get_size_maj_floor,
55 .def_property("size_maj_floor", &g2f::ShapePriorOptions::get_size_maj_floor,
57 .def("__repr__", [](const g2f::ShapePriorOptions &self) { return self.repr(true); })
58 .def("__str__", &g2f::ShapePriorOptions::str);
59
60 auto _s = py::class_<g2f::ShapePrior, std::shared_ptr<g2f::ShapePrior>, g2f::Prior>(m, "ShapePrior")
65 "ellipse"_a, "prior_size"_a = nullptr, "prior_axrat"_a = nullptr,
66 "options"_a = nullptr)
67 .def("evaluate", &g2f::ShapePrior::evaluate, "calc_jacobians"_a = false,
68 "normalize_loglike"_a = false)
69 .def_property_readonly("loglike_const_terms", &g2f::ShapePrior::get_loglike_const_terms)
70 .def_property("prior_size", &g2f::ShapePrior::get_prior_size,
72 .def_property("prior_axrat", &g2f::ShapePrior::get_prior_axrat,
74 .def("__len__", &g2f::ShapePrior::size)
75 .def("__repr__", [](const g2f::ShapePrior &self) { return self.repr(true); })
76 .def("__str__", &g2f::ShapePrior::str);
77}
A two-part prior on the shape of a parametric ellipse.
Definition shapeprior.h:63
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
size_t size() const override
PriorEvaluation evaluate(bool calc_jacobians=false, bool normalize_loglike=false) const override
Evaluate the log likelihood and residual-dependent terms.
std::string str() const override
Return a brief, human-readable string representation of this.
std::shared_ptr< ParametricGaussian1D > get_prior_axrat() const
void set_prior_size(std::shared_ptr< ParametricGaussian1D > prior_size)
std::shared_ptr< ParametricGaussian1D > get_prior_size() const
std::vector< double > get_loglike_const_terms() const override
Return the constant terms of the log likelihood (dependent on stddevs only)
void set_prior_axrat(std::shared_ptr< ParametricGaussian1D > prior_axrat)
Options for a ShapePrior.
Definition shapeprior.h:18
static const double delta_jacobian_default
Definition shapeprior.h:20
void set_size_maj_floor(double size_maj_floor)
Definition shapeprior.cc:86
bool check_axrat_floor(double axrat_floor, bool do_throw=false)
Definition shapeprior.cc:64
bool check_size_maj_floor(double size_maj_floor, bool do_throw=false)
Definition shapeprior.cc:53
static const double size_maj_floor_default
Definition shapeprior.h:21
std::string str() const override
Return a brief, human-readable string representation of this.
void set_delta_jacobian(double delta_jacobian)
Definition shapeprior.cc:81
bool check_delta_jacobian(double delta_jacobian, bool do_throw=false)
Definition shapeprior.cc:42
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition shapeprior.cc:96
static const double axrat_floor_default
Definition shapeprior.h:22

◆ bind_source()

void bind_source ( py::module & m)

Definition at line 39 of file source.cc.

39 {
40 auto _s = py::class_<g2f::Source, std::shared_ptr<g2f::Source>, g2f::ComponentMixture>(m, "Source")
41 .def(py::init<g2f::Components &>(), "components"_a = nullptr)
42 .def_property_readonly("components", &g2f::Source::get_components)
43 .def("gaussians",
44 [](const g2f::Source &g, const g2f::Channel &c) {
46 })
47 .def("parameters", &g2f::Source::get_parameters, "parameters"_a = g2f::ParamRefs(),
48 "paramfilter"_a = nullptr)
49 .def("__repr__", [](const g2f::Source &self) { return self.repr(true); })
50 .def("__str__", &g2f::Source::str);
51}
An association of physically-related Component instances.
Definition source.h:22
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition source.cc:79
std::string str() const override
Return a brief, human-readable string representation of this.
Definition source.cc:86
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
Definition source.cc:55
Components get_components() const override
Definition source.cc:37