LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+b203dec576,g18429d2f64+358861cd2c,g199a45376c+0ba108daf9,g1fd858c14a+dd066899e3,g262e1987ae+ebfced1d55,g29ae962dfc+72fd90588e,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+b668f15bc5,g4595892280+3897dae354,g47891489e3+abcf9c3559,g4d44eb3520+fb4ddce128,g53246c7159+8c5ae1fdc5,g67b6fd64d1+abcf9c3559,g67fd3c3899+1f72b5a9f7,g74acd417e5+cb6b47f07b,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+abcf9c3559,g8d7436a09f+bcf525d20c,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+6054cc57f1,g97be763408+06f794da49,g9dd6db0277+1f72b5a9f7,ga681d05dcb+7e36ad54cd,gabf8522325+735880ea63,gac2eed3f23+abcf9c3559,gb89ab40317+abcf9c3559,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+1f72b5a9f7,gdab6d2f7ff+cb6b47f07b,gdc713202bf+1f72b5a9f7,gdfd2d52018+8225f2b331,ge365c994fd+375fc21c71,ge410e46f29+abcf9c3559,geaed405ab2+562b3308c0,gf9a733ac38+8c5ae1fdc5,w.2025.35
LSST Data Management Base Package
Loading...
Searching...
No Matches
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 (const 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 39 of file centroidparameters.cc.

39 {
40 auto _c = py::classh<g2f::CentroidParameters, lsst::gauss2d::CentroidData>(m, "CentroidParameters")
41 .def(py::init<double, double>(), "x"_a = 0, "y"_a = 0)
44 "x"_a = nullptr, "y"_a = nullptr)
48 .def_property_readonly("x_param", &g2f::CentroidParameters::get_x_param)
49 .def_property_readonly("y_param", &g2f::CentroidParameters::get_y_param)
50 .def_property_readonly("x_param_ptr", &g2f::CentroidParameters::get_x_param_ptr)
51 .def_property_readonly("y_param_ptr", &g2f::CentroidParameters::get_y_param_ptr)
52 .def("__repr__", [](const g2f::CentroidParameters &self) { return self.repr(true); })
53 .def("__str__", &g2f::CentroidParameters::str);
54}
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 37 of file channel.cc.

37 {
38 auto _c = py::classh<g2f::Channel, lsst::gauss2d::Object>(m, "Channel")
39 .def(py::init(&g2f::Channel::make))
40 .def_static("erase", &g2f::Channel::erase)
41 .def_property_readonly_static("all",
42 [](py::object) { return g2f::Channel::get_channels(); })
43 .def_static("find", &g2f::Channel::find_channel)
44 .def_static("get", &g2f::Channel::get_channel)
45 .def_readonly("name", &g2f::Channel::name)
46 .def_property_readonly_static("NONE",
47 [](py::object) { return g2f::Channel::NONE_PTR(); })
48 .def("__repr__", [](const g2f::Channel &self) { return self.repr(true); })
49 .def("__str__", &g2f::Channel::str);
50 /*
51 const bool operator < ( const Channel &c ) const;
52 const bool operator == ( const Channel &c ) const;
53 const bool operator != ( const Channel &c ) const;
54 */
55}
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 ( const py::module & m)

Definition at line 36 of file chromatic.cc.

36{ auto _p = py::classh<g2f::Chromatic>(m, "Chromatic"); }

◆ bind_component()

void bind_component ( py::module & m)

Definition at line 37 of file component.cc.

37 {
38 auto _c = py::classh<g2f::Component, g2f::ParametricModel>(m, "Component");
39}

◆ bind_componentmixture()

void bind_componentmixture ( py::module & m)

Definition at line 37 of file componentmixture.cc.

37 {
38 auto _c = py::classh<g2f::ComponentMixture, g2f::ParametricModel>(m, "ComponentMixture");
39}

◆ 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 36 of file ellipticalcomponent.cc.

36 {
37 auto _e = py::classh<g2f::EllipticalComponent, g2f::Component>(m, "EllipticalComponent")
38 .def_property_readonly("centroid", &g2f::EllipticalComponent::get_centroid)
39 .def_property_readonly("ellipse", &g2f::EllipticalComponent::get_ellipse)
40 .def_property_readonly("integralmodel", &g2f::EllipticalComponent::get_integralmodel);
41}
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 39 of file fractionalintegralmodel.cc.

39 {
40 auto _p = py::classh<g2f::FractionalIntegralModel, g2f::IntegralModel>(m, "FractionalIntegralModel")
41 .def(py::init(&g2f::FractionalIntegralModel::make), "data"_a, "model"_a,
42 "is_final"_a = false)
43 .def_property_readonly("channels", &g2f::FractionalIntegralModel::get_channels)
44 .def("integral", &g2f::FractionalIntegralModel::get_integral, "channel"_a)
46 "channel"_a)
48 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
49 .def_property_readonly("parent_model", &g2f::FractionalIntegralModel::get_parent_model)
50 .def_static("model", &g2f::FractionalIntegralModel::find_model)
51 .def("__getitem__", [](const g2f::FractionalIntegralModel &self,
52 const g2f::Channel &c) { return self.at(c); })
54 .def("__repr__",
55 [](const g2f::FractionalIntegralModel &self) { return self.repr(true); })
56 .def("__str__", &g2f::FractionalIntegralModel::str);
57}
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.
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::classh<g2f::GaussianComponent, g2f::EllipticalComponent>(m, "GaussianComponent")
45 "ellipse"_a = nullptr, "centroid"_a = nullptr, "integral"_a = nullptr)
47 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
48 .def("gaussians",
49 [](const g2f::GaussianComponent &g, const g2f::Channel &c) {
51 })
52 .def_static("make_uniq_default_gaussians",
54 .def("__repr__", [](const g2f::GaussianComponent &self) { return self.repr(true); })
55 .def("__str__", &g2f::GaussianComponent::str);
56}
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 42 of file gaussianmodelintegral.cc.

42 {
43 auto _p = py::classh<g2f::GaussianModelIntegral, lsst::gauss2d::GaussianIntegral>(m,
44 "GaussianModelIntegral")
45 .def(py::init<const g2f::Channel &, const std::shared_ptr<const g2f::IntegralModel>>(),
46 "channel"_a, "integralmodel"_a)
47 .def_property("value", &g2f::GaussianModelIntegral::get_value,
49 .def("__repr__", [](const g2f::GaussianModelIntegral &self) { return self.repr(true); })
50 .def("__str__", &g2f::GaussianModelIntegral::str);
51 /*
52 typename Data::iterator begin() noexcept;
53 typename Data::const_iterator cbegin() const noexcept;
54
55 typename Data::iterator end() noexcept;
56 typename Data::const_iterator cend() const noexcept;
57 */
58}
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::classh<g2f::GaussianParametricEllipse, lsst::gauss2d::EllipseData, g2f::ParametricEllipse>(
41 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}
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::classh<g2f::GaussianPrior, g2f::Prior>(m, "GaussianPrior")
42 .def(py::init<std::shared_ptr<const g2f::ParamBase>, double, double, bool>(),
43 "param"_a = nullptr, "mean"_a = 0, "stddev"_a = 1., "transformed"_a = false)
44 .def("evaluate", &g2f::GaussianPrior::evaluate, "calc_jacobians"_a = false,
45 "normalize_loglike"_a = false)
46 .def_property_readonly("loglike_const_terms",
49 .def_property_readonly("param", &g2f::GaussianPrior::get_param)
50 .def_property("stddev", &g2f::GaussianPrior::get_stddev,
52 .def_property("transformed", &g2f::GaussianPrior::get_transformed,
54 .def("__len__", &g2f::GaussianPrior::size)
55 .def("__repr__", [](const g2f::GaussianPrior &self) { return self.repr(true); })
56 .def("__str__", &g2f::GaussianPrior::str);
57}
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.

◆ bind_integralmodel()

void bind_integralmodel ( py::module & m)

Definition at line 36 of file integralmodel.cc.

36 {
37 auto _p = py::classh<g2f::IntegralModel, g2f::Chromatic>(m, "IntegralModel");
38}

◆ bind_interpolation()

void bind_interpolation ( py::module & m)

Definition at line 36 of file interpolation.cc.

36 {
37 auto _e = py::enum_<g2f::InterpType>(m, "InterpType")
38 .value("linear", g2f::InterpType::linear)
39 .value("polynomial", g2f::InterpType::polynomial)
40 .value("cspline", g2f::InterpType::cspline)
41 .value("akima", g2f::InterpType::akima);
42}
@ 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 38 of file linearintegralmodel.cc.

38 {
39 auto _p = py::classh<g2f::LinearIntegralModel, g2f::IntegralModel>(m, "LinearIntegralModel")
40 .def(py::init<const g2f::LinearIntegralModel::Data *>(), "data"_a)
41 .def_property_readonly("channels", &g2f::LinearIntegralModel::get_channels)
42 .def("integral", &g2f::LinearIntegralModel::get_integral, "channel"_a)
44 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
45 .def("__getitem__", [](const g2f::LinearIntegralModel &self,
46 const g2f::Channel &c) { return self.at(c); })
47 .def("__len__", &g2f::LinearIntegralModel::size)
48 .def("__repr__", [](const g2f::LinearIntegralModel &self) { return self.repr(true); })
49 .def("__str__", &g2f::LinearIntegralModel::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}
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 37 of file linearsersicmixinterpolator.cc.

37 {
38 auto _e = py::classh<g2f::LinearSersicMixInterpolator, g2f::SersicMixInterpolator>(
39 m, "LinearSersicMixInterpolator")
40 .def(py::init<short>(), "order"_a = g2f::SERSICMIX_ORDER_DEFAULT)
42 .def("integralsizes_derivs",
44 .def_property_readonly("order", &g2f::LinearSersicMixInterpolator::get_order)
45 .def("__repr__",
46 [](const g2f::LinearSersicMixInterpolator &self) { return self.repr(true); })
48}
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

◆ bind_model()

void bind_model ( py::module & m)

Definition at line 89 of file model.cc.

89 {
90 auto _e = py::enum_<g2f::EvaluatorMode>(m, "EvaluatorMode")
91 .value("image", g2f::EvaluatorMode::image)
92 .value("loglike", g2f::EvaluatorMode::loglike)
93 .value("loglike_image", g2f::EvaluatorMode::loglike_image)
94 .value("loglike_grad", g2f::EvaluatorMode::loglike_grad)
95 .value("jacobian", g2f::EvaluatorMode::jacobian)
96 .export_values();
97 auto _h = py::classh<g2f::HessianOptions>(m, "HessianOptions")
98 .def(py::init<bool, double, double>(), "return_negative"_a = true,
99 "findiff_frac"_a = 1e-4, "findiff_add"_a = 1e-4)
100 .def_readwrite("return_negative", &g2f::HessianOptions::return_negative)
101 .def_readwrite("findiff_frac", &g2f::HessianOptions::return_negative)
102 .def_readwrite("findiff_add", &g2f::HessianOptions::return_negative);
103 declare_model<double>(m, "D");
104 declare_model<float>(m, "F");
105}
void declare_model(py::module &m, std::string str_type)
Definition model.cc:43
@ 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::classh<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 44 of file parameters.cc.

44 {
45 auto _u = py::classh<parameters::Unit>(m, "Unit");
46 py::classh<g2f::UnitNone, parameters::Unit>(m, "UnitNone")
47 .def(py::init<>())
48 .def_property_readonly("name", &g2f::UnitNone::get_name);
50 using Parameter = parameters::ParameterBase<double>;
51 auto _p = py::classh<Parameter>(m, "ParameterD");
52 auto integral = declare_parameter<double, g2f::IntegralParameterD>(m, "Integral");
58 auto propfrac = declare_parameter<double, g2f::ProperFractionParameterD>(m, "ProperFraction");
59 propfrac.def_property("label", &g2f::ProperFractionParameterD::get_label,
78 // TODO: Determine why this won't work with std::shared_ptr<parameters::Limits<double>>
80 std::shared_ptr<parameters::Limits<double>>, double>(m, "LogitLimited");
83 "params"_a = _default);
84}
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
void declare_transform_base(py::module &m)
Definition parameters.h:137
auto declare_parameter(py::module &m, std::string name, std::string suffix=g2f::suffix_type_str< T >())
Definition parameters.h:112
auto declare_sizeparameter_base(py::module &m, std::string suffix=g2f::suffix_type_str< T >())
Definition parameters.h:131
void declare_limits(py::module &m)
Definition parameters.h:48
auto declare_sizeparameter(py::module &m, std::string name)
Definition parameters.h:126
void declare_transform(py::module &m, std::string name)
Definition parameters.h:166
void declare_transform_full(py::module &m, std::string name)
Definition parameters.h:143
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 37 of file parametric.cc.

37 {
38 auto _p = py::classh<g2f::Parametric, lsst::gauss2d::Object>(m, "Parametric");
39}

◆ bind_parametricellipse()

void bind_parametricellipse ( py::module & m)

Definition at line 36 of file parametricellipse.cc.

36 {
37 auto _p = py::classh<g2f::ParametricEllipse, g2f::Parametric>(m, "ParametricEllipse");
38}

◆ bind_parametricgaussian1d()

void bind_parametricgaussian1d ( py::module & m)

Definition at line 38 of file parametricgaussian1d.cc.

38 {
39 auto _e = py::classh<g2f::ParametricGaussian1D, lsst::gauss2d::Object>(m, "ParametricGaussian1D")
42 "mean"_a = nullptr, "stddev"_a = nullptr)
43 .def_property("mean", &g2f::ParametricGaussian1D::get_mean,
45 .def_property_readonly("mean_parameter", &g2f::ParametricGaussian1D::get_mean_parameter)
46 .def_property("stddev", &g2f::ParametricGaussian1D::get_stddev,
48 .def_property_readonly("stddev_parameter",
50 .def("__repr__", [](const g2f::ParametricGaussian1D &self) { return self.repr(true); })
51 .def("__str__", &g2f::ParametricGaussian1D::str);
52}
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 37 of file parametricmodel.cc.

37 {
38 auto _p = py::classh<g2f::ParametricModel, g2f::Parametric>(m, "ParametricModel");
39}

◆ bind_prior()

void bind_prior ( py::module & m)

Definition at line 38 of file prior.cc.

38 {
39 auto _e = py::classh<g2f::PriorEvaluation, lsst::gauss2d::Object>(m, "PriorEvaluation")
40 .def(py::init<double, std::vector<double>,
42 "loglike"_a, "residuals"_a = std::vector<double>{},
44 .def_readonly("loglike", &g2f::PriorEvaluation::loglike)
45 .def_readonly("jacobians", &g2f::PriorEvaluation::jacobians)
46 .def_readonly("residuals", &g2f::PriorEvaluation::residuals)
47 .def("__repr__", [](const g2f::PriorEvaluation &self) { return self.repr(true); })
48 .def("__str__", &g2f::PriorEvaluation::str);
49 auto _p = py::classh<g2f::Prior, lsst::gauss2d::Object>(m, "Prior");
50}
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 39 of file psfmodel.cc.

39 {
40 auto _o = py::classh<g2f::PsfModel, g2f::ComponentMixture>(m, "PsfModel")
41 .def(py::init<g2f::Components &>(), "components"_a = nullptr)
42 .def_property_readonly("components", &g2f::PsfModel::get_components)
43 .def("gaussians",
44 [](const g2f::PsfModel &p, const g2f::Channel &c) {
46 })
47 .def("parameters", &g2f::PsfModel::get_parameters, "parameters"_a = g2f::ParamRefs(),
48 "paramfilter"_a = nullptr)
49 .def("__repr__", [](const g2f::PsfModel &self) { return self.repr(true); })
50 .def("__str__", &g2f::PsfModel::str);
51}
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 36 of file sersicmix.cc.

36 {
37 auto _is = py::classh<g2f::IntegralSize, lsst::gauss2d::Object>(m, "IntegralSize")
38 .def(py::init<const double, const double>(), "integral"_a = 0, "sigma"_a = 0)
39 .def_readonly("integral", &g2f::IntegralSize::integral)
40 .def_readonly("sigma", &g2f::IntegralSize::sigma)
41 .def("__repr__", [](const g2f::IntegralSize &self) { return self.repr(true); })
42 .def("__str__", &g2f::IntegralSize::str);
43
44 auto _smi = py::classh<g2f::SersicMixInterpolator, lsst::gauss2d::Object>(m, "SersicMixInterpolator");
45
46 auto _smv = py::classh<g2f::SersicMixValues, lsst::gauss2d::Object>(m, "SersicMixValues")
47 .def(py::init<double, std::vector<g2f::IntegralSize>>(), "sersicindex"_a, "values"_a)
48 .def_readonly("sersicindex", &g2f::SersicMixValues::sersicindex)
49 .def_readonly("values", &g2f::SersicMixValues::values)
50 .def("__repr__", [](const g2f::SersicMixValues &self) { return self.repr(true); })
51 .def("__str__", &g2f::SersicMixValues::str);
52
53 m.def("sersic_mix_knots", &g2f::get_sersic_mix_knots_copy, "order"_a = g2f::SERSICMIX_ORDER_DEFAULT,
54 py::return_value_policy::copy);
55}
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 43 of file sersicmixcomponent.cc.

43 {
44 using T = double;
46 using Base = g2f::SersicIndexParameterD;
47
48 std::string pyclass_name = "SersicMixComponentIndexParameter" + g2f::suffix_type_str<T>();
50 // note that Base is the actual name of the base Parameter class, not the CRTP class
51 // that it is "derived" from
52 py::classh<C, Base>(m, pyclass_name.c_str()))
53 // new properties
54 .def_property_readonly("integralratio",
56 .def_property_readonly("interptype", &g2f::SersicMixComponentIndexParameterD::get_interptype)
57 .def_property_readonly("order", &g2f::SersicMixComponentIndexParameterD::get_order)
58 .def_property_readonly("sizeratio", &g2f::SersicMixComponentIndexParameterD::get_sizeratio)
59 // constructor with added arg
60 .def(py::init<T, std::shared_ptr<const parameters::Limits<T>>,
64 "value"_a = g2f::SersicMixComponentIndexParameterD::_get_default(), "limits"_a = nullptr,
65 "transform"_a = nullptr, "unit"_a = lsst::gauss2d::fit::unit_none, "fixed"_a = false,
66 "label"_a = "", "interpolator"_a = nullptr);
67
68 auto _e = py::classh<g2f::SersicMixComponent, g2f::EllipticalComponent>(m, "SersicMixComponent")
73 "ellipse"_a = nullptr, "centroid"_a = nullptr, "integral"_a = nullptr,
74 "sersicindex"_a = nullptr)
75 .def_property("sersicindex", &g2f::SersicMixComponent::get_sersicindex,
77 .def_property_readonly("sersicindex_param",
79 .def_property_readonly("sersicindex_param_ptr",
82 "parameters"_a = g2f::ParamRefs(), "paramfilter"_a = nullptr)
83 .def("gaussians",
84 [](const g2f::SersicMixComponent &g, const g2f::Channel &c) {
86 })
87 .def("__repr__", [](const g2f::SersicMixComponent &self) { return self.repr(true); })
88 .def("__str__", &g2f::SersicMixComponent::str);
89}
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::classh< C, Args... > c)
Definition parameters.h:68
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::classh<g2f::SersicParametricEllipse, g2f::ParametricEllipse>(m, "SersicParametricEllipse")
41 .def(py::init<double, double, double>(), "size_x"_a = 0, "size_y"_a = 0, "rho"_a = 0)
45 "size_x"_a = nullptr, "size_y"_a = nullptr, "rho"_a = nullptr)
46 .def_property("rho", &g2f::SersicParametricEllipse::get_rho,
48 .def_property("size_x", &g2f::SersicParametricEllipse::get_size_x,
50 .def_property("size_y", &g2f::SersicParametricEllipse::get_size_y,
52 .def_property("xyr", &g2f::SersicParametricEllipse::get_xyr,
54 .def_property_readonly("rho_param", &g2f::SersicParametricEllipse::get_rho_param)
55 .def_property_readonly("size_x_param", &g2f::SersicParametricEllipse::get_size_x_param)
56 .def_property_readonly("size_y_param", &g2f::SersicParametricEllipse::get_size_y_param)
57 .def_property_readonly("rho_param_ptr",
59 .def_property_readonly("size_x_param_ptr",
61 .def_property_readonly("size_y_param_ptr",
63 .def("__repr__",
64 [](const g2f::SersicParametricEllipse &self) { return self.repr(true); })
65 .def("__str__", &g2f::SersicParametricEllipse::str);
66}
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::classh<g2f::ShapePriorOptions, lsst::gauss2d::Object>(m, "ShapePriorOptions")
43 .def(py::init<double, double, double>(),
47 .def("check_delta_jacobian", &g2f::ShapePriorOptions::check_delta_jacobian)
48 .def("check_size_maj_floor", &g2f::ShapePriorOptions::check_size_maj_floor)
49 .def("check_axrat_floor", &g2f::ShapePriorOptions::check_axrat_floor)
50 .def_property("delta_jacobian", &g2f::ShapePriorOptions::get_delta_jacobian,
52 .def_property("size_maj_floor", &g2f::ShapePriorOptions::get_size_maj_floor,
54 .def_property("size_maj_floor", &g2f::ShapePriorOptions::get_size_maj_floor,
56 .def("__repr__", [](const g2f::ShapePriorOptions &self) { return self.repr(true); })
57 .def("__str__", &g2f::ShapePriorOptions::str);
58
59 auto _s = py::classh<g2f::ShapePrior, g2f::Prior>(m, "ShapePrior")
64 "ellipse"_a, "prior_size"_a = nullptr, "prior_axrat"_a = nullptr,
65 "options"_a = nullptr)
66 .def("evaluate", &g2f::ShapePrior::evaluate, "calc_jacobians"_a = false,
67 "normalize_loglike"_a = false)
68 .def_property_readonly("loglike_const_terms", &g2f::ShapePrior::get_loglike_const_terms)
69 .def_property("prior_size", &g2f::ShapePrior::get_prior_size,
71 .def_property("prior_axrat", &g2f::ShapePrior::get_prior_axrat,
73 .def("__len__", &g2f::ShapePrior::size)
74 .def("__repr__", [](const g2f::ShapePrior &self) { return self.repr(true); })
75 .def("__str__", &g2f::ShapePrior::str);
76}
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 38 of file source.cc.

38 {
39 auto _s = py::classh<g2f::Source, g2f::ComponentMixture>(m, "Source")
40 .def(py::init<g2f::Components &>(), "components"_a = nullptr)
41 .def_property_readonly("components", &g2f::Source::get_components)
42 .def("gaussians",
43 [](const g2f::Source &g, const g2f::Channel &c) {
45 })
46 .def("parameters", &g2f::Source::get_parameters, "parameters"_a = g2f::ParamRefs(),
47 "paramfilter"_a = nullptr)
48 .def("__repr__", [](const g2f::Source &self) { return self.repr(true); })
49 .def("__str__", &g2f::Source::str);
50}
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