LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
lsst::meas::modelfit Namespace Reference

Namespaces

namespace  cmodel
 
namespace  common
 
namespace  detail
 
namespace  optimizer
 
namespace  pixelFitRegion
 
namespace  priors
 
namespace  psf
 
namespace  version
 

Classes

class  AdaptiveImportanceSampler
 Sampler class that performs Monte Carlo sampling, while iteratively updating the analytic distribution from which points are drawn. More...
 
class  CModelAlgorithm
 Main public interface class for CModel algorithm. More...
 
struct  CModelControl
 The main control object for CModel, containing parameters for the final linear fit and aggregating the other control objects. More...
 
struct  CModelResult
 Master result object for CModel, containing results for the final linear fit and three nested CModelStageResult objects for the results of the previous stages. More...
 
struct  CModelStageControl
 Nested control object for CModel that configures one of the three ("initial", "exp", "dev") nonlinear fitting stages. More...
 
struct  CModelStageResult
 Result object for a single nonlinear fitting stage of the CModel algorithm. More...
 
class  DoubleShapeletPsfApproxAlgorithm
 An algorithm that fits a 2-component shapelet approximation to the PSF model. More...
 
class  DoubleShapeletPsfApproxControl
 Control object used to configure a 2-shapelet fit to a PSF model; see DoubleShapeletPsfApproxAlgorithm. More...
 
class  EpochFootprint
 An image at one epoch of a galaxy, plus associated info. More...
 
class  GeneralPsfFitter
 Class for fitting multishapelet models to PSF images. More...
 
class  GeneralPsfFitterAlgorithm
 
class  GeneralPsfFitterComponentControl
 Control object used to define one piece of multishapelet fit to a PSF model; see GeneralPsfFitterControl. More...
 
class  GeneralPsfFitterControl
 Control object used to configure a multishapelet fit to a PSF model; see GeneralPsfFitter. More...
 
class  ImportanceSamplerControl
 Control object for one iteration of adaptive importance sampling. More...
 
class  Likelihood
 Base class for optimizer/sampler likelihood functions that compute likelihood at a point. More...
 
struct  LocalUnitTransform
 A local mapping between two UnitSystems. More...
 
class  Mixture
 
class  MixtureComponent
 A weighted Student's T or Gaussian distribution used as a component in a Mixture. More...
 
class  MixturePrior
 A prior that's flat in amplitude parameters, and uses a Mixture for nonlinear parameters. More...
 
class  MixtureUpdateRestriction
 Helper class used to define restrictions to the form of the component parameters in Mixture::updateEM. More...
 
class  Model
 Abstract base class and concrete factories that define multi-shapelet galaxy models. More...
 
class  MultiModel
 A concrete Model class that simply concatenates several other Models. More...
 
class  MultiShapeletPsfLikelihood
 Likelihood object used to fit multishapelet models to PSF model images; mostly for internal use by GeneralPsfFitter. More...
 
class  Optimizer
 A numerical optimizer customized for least-squares problems with Bayesian priors. More...
 
class  OptimizerControl
 Configuration object for Optimizer. More...
 
class  OptimizerHistoryRecorder
 
class  OptimizerObjective
 Base class for objective functions for Optimizer. More...
 
class  PixelFitRegion
 
struct  PixelFitRegionControl
 
class  Prior
 Base class for Bayesian priors. More...
 
class  Sampler
 
class  SamplingObjective
 
class  SemiEmpiricalPrior
 A piecewise prior motivated by both real distributions and practical considerations. More...
 
struct  SemiEmpiricalPriorControl
 
class  SoftenedLinearPrior
 A prior that's linear in radius and flat in ellipticity, with a cubic roll-off at the edges. More...
 
struct  SoftenedLinearPriorControl
 
class  TruncatedGaussian
 Represents a multidimensional Gaussian function truncated at zero. More...
 
class  TruncatedGaussianEvaluator
 Helper class for evaluating the -log of a TruncatedGaussian. More...
 
class  TruncatedGaussianLogEvaluator
 Helper class for evaluating the -log of a TruncatedGaussian. More...
 
class  TruncatedGaussianSampler
 Helper class for drawing samples from a TruncatedGaussian. More...
 
struct  UnitSystem
 A simple struct that combines a Wcs and a PhotoCalib. More...
 
class  UnitTransformedLikelihood
 A concrete Likelihood class that does not require its parameters and data to be in the same UnitSystem. More...
 
class  UnitTransformedLikelihoodControl
 Control object used to initialize a UnitTransformedLikelihood. More...
 

Typedefs

typedef float Pixel
 Typedefs to be used for pixel values.
 
typedef double Scalar
 Typedefs to be used for probability and parameter values.
 
typedef Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
 
typedef Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
 
typedef afw::table::Key< ScalarScalarKey
 
typedef afw::table::Key< afw::table::Array< Scalar > > ArrayKey
 
typedef std::vector< std::shared_ptr< Model > > ModelVector
 
using PyImportanceSamplerControl
 
using PyAdaptiveImportanceSampler
 
using PyLikelihood = py::class_<Likelihood, std::shared_ptr<Likelihood>>
 
using PyModel = py::class_<Model, std::shared_ptr<Model>>
 
using PyMultiModel = py::class_<MultiModel, std::shared_ptr<MultiModel>, Model>
 
using PyPixelFitRegionControl = py::class_<PixelFitRegionControl, std::shared_ptr<PixelFitRegionControl>>
 
using PyPixelFitRegion = py::class_<PixelFitRegion, std::shared_ptr<PixelFitRegion>>
 
using PySamplingObjective = py::class_<SamplingObjective, std::shared_ptr<SamplingObjective>>
 
using PySampler = py::class_<Sampler, std::shared_ptr<Sampler>>
 
using PyUnitSystem = py::class_<UnitSystem, std::shared_ptr<UnitSystem>>
 
using PyLocalUnitTransform = py::class_<LocalUnitTransform, std::shared_ptr<LocalUnitTransform>>
 
using PyUnitTransformedLikelihoodControl
 
using PyEpochFootprint = py::class_<EpochFootprint, std::shared_ptr<EpochFootprint>>
 
using PyUnitTransformedLikelihood
 

Functions

void solveTrustRegion (ndarray::Array< Scalar, 1, 1 > const &x, ndarray::Array< Scalar const, 2, 1 > const &F, ndarray::Array< Scalar const, 1, 1 > const &g, double r, double tolerance)
 Solve a symmetric quadratic matrix equation with a ball constraint.
 
void wrapAdaptiveImportanceSampler (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapCmodel (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapIntegrals (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapLikelihood (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapMixture (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapModel (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapMultiModel (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapOptimizer (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapPixelFitRegion (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapPriors (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapPsf (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapSampler (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapTruncatedGaussian (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapUnitSystem (lsst::cpputils::python::WrapperCollection &wrappers)
 
void wrapUnitTransformedLikelihood (lsst::cpputils::python::WrapperCollection &wrappers)
 
 PYBIND11_MODULE (_modelfitLib, mod)
 

Typedef Documentation

◆ ArrayKey

Definition at line 48 of file common.h.

◆ Matrix

typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> lsst::meas::modelfit::Matrix

Definition at line 45 of file common.h.

◆ ModelVector

Definition at line 41 of file Model.h.

◆ Pixel

Typedefs to be used for pixel values.

Definition at line 37 of file common.h.

◆ PyAdaptiveImportanceSampler

Initial value:
py::class_<AdaptiveImportanceSampler, std::shared_ptr<AdaptiveImportanceSampler>, Sampler>

Definition at line 42 of file adaptiveImportanceSampler.cc.

◆ PyEpochFootprint

Definition at line 43 of file unitTransformedLikelihood.cc.

◆ PyImportanceSamplerControl

Initial value:
py::class_<ImportanceSamplerControl, std::shared_ptr<ImportanceSamplerControl>>

Definition at line 40 of file adaptiveImportanceSampler.cc.

◆ PyLikelihood

Definition at line 38 of file likelihood.cc.

◆ PyLocalUnitTransform

Definition at line 37 of file unitSystem.cc.

◆ PyModel

Definition at line 41 of file model.cc.

◆ PyMultiModel

Definition at line 37 of file multiModel.cc.

◆ PyPixelFitRegion

Definition at line 40 of file pixelFitRegion.cc.

◆ PyPixelFitRegionControl

Definition at line 39 of file pixelFitRegion.cc.

◆ PySampler

Definition at line 42 of file sampler.cc.

◆ PySamplingObjective

Definition at line 41 of file sampler.cc.

◆ PyUnitSystem

Definition at line 36 of file unitSystem.cc.

◆ PyUnitTransformedLikelihood

Initial value:
py::class_<UnitTransformedLikelihood, std::shared_ptr<UnitTransformedLikelihood>, Likelihood>

Definition at line 45 of file unitTransformedLikelihood.cc.

◆ PyUnitTransformedLikelihoodControl

Initial value:
py::class_<UnitTransformedLikelihoodControl, std::shared_ptr<UnitTransformedLikelihoodControl>>

Definition at line 40 of file unitTransformedLikelihood.cc.

◆ Scalar

Typedefs to be used for probability and parameter values.

Definition at line 44 of file common.h.

◆ ScalarKey

Definition at line 47 of file common.h.

◆ Vector

typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1> lsst::meas::modelfit::Vector

Definition at line 46 of file common.h.

Function Documentation

◆ PYBIND11_MODULE()

lsst::meas::modelfit::PYBIND11_MODULE ( _modelfitLib ,
mod  )

Definition at line 51 of file _modelfitLib.cc.

51 {
52 lsst::utils::python::WrapperCollection wrappers(mod, "lsst.meas.modelfit");
53
54 wrappers.addInheritanceDependency("lsst.meas.base");
55
56 wrappers.addSignatureDependency("lsst.afw.detection");
57 wrappers.addSignatureDependency("lsst.afw.image");
58 wrappers.addSignatureDependency("lsst.afw.math");
59 wrappers.addSignatureDependency("lsst.afw.geom.ellipses");
60 wrappers.addSignatureDependency("lsst.afw.table");
61 wrappers.addSignatureDependency("lsst.shapelet");
62
63 wrapPriors(wrappers);
64 wrapUnitSystem(wrappers);
65 wrapModel(wrappers);
66 wrapLikelihood(wrappers);
67 wrapMixture(wrappers);
68 wrapOptimizer(wrappers);
69 wrapSampler(wrappers);
70 wrapPixelFitRegion(wrappers);
71
73 wrapCmodel(wrappers);
74 wrapIntegrals(wrappers);
75 wrapMultiModel(wrappers);
76 wrapPsf(wrappers);
77 wrapTruncatedGaussian(wrappers);
79 wrappers.finish();
80}
void wrapPixelFitRegion(lsst::cpputils::python::WrapperCollection &wrappers)
void wrapPriors(lsst::cpputils::python::WrapperCollection &wrappers)
Definition priors.cc:124
void wrapTruncatedGaussian(lsst::cpputils::python::WrapperCollection &wrappers)
void wrapIntegrals(lsst::cpputils::python::WrapperCollection &wrappers)
Definition integrals.cc:36
void wrapMixture(lsst::cpputils::python::WrapperCollection &wrappers)
Definition mixture.cc:143
void wrapModel(lsst::cpputils::python::WrapperCollection &wrappers)
Definition model.cc:43
void wrapAdaptiveImportanceSampler(lsst::cpputils::python::WrapperCollection &wrappers)
void wrapSampler(lsst::cpputils::python::WrapperCollection &wrappers)
Definition sampler.cc:44
void wrapOptimizer(lsst::cpputils::python::WrapperCollection &wrappers)
Definition optimizer.cc:172
void wrapUnitSystem(lsst::cpputils::python::WrapperCollection &wrappers)
Definition unitSystem.cc:39
void wrapLikelihood(lsst::cpputils::python::WrapperCollection &wrappers)
Definition likelihood.cc:40
void wrapMultiModel(lsst::cpputils::python::WrapperCollection &wrappers)
Definition multiModel.cc:39
void wrapCmodel(lsst::cpputils::python::WrapperCollection &wrappers)
Definition cmodel.cc:205
void wrapUnitTransformedLikelihood(lsst::cpputils::python::WrapperCollection &wrappers)

◆ solveTrustRegion()

void lsst::meas::modelfit::solveTrustRegion ( ndarray::Array< Scalar, 1, 1 > const & x,
ndarray::Array< Scalar const, 2, 1 > const & F,
ndarray::Array< Scalar const, 1, 1 > const & g,
double r,
double tolerance )

Solve a symmetric quadratic matrix equation with a ball constraint.

This computes a near-exact solution to the "trust region subproblem" necessary in trust-region-based nonlinear optimizers:

\[ \min_x{\quad g^T x + \frac{1}{2}x^T F x}\quad\quad\quad \text{s.t.} ||x|| \le r \]

The tolerance parameter sets how close to \(r\) we require the norm of the solution to be when it lies on the constraint, as a fraction of \(r\) itself.

This implementation is based on the algorithm described in Section 4.3 of "Nonlinear Optimization" by Nocedal and Wright.

◆ wrapAdaptiveImportanceSampler()

void lsst::meas::modelfit::wrapAdaptiveImportanceSampler ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 45 of file adaptiveImportanceSampler.cc.

45 {
46 wrappers.wrapType(PyImportanceSamplerControl(wrappers.module, "ImportanceSamplerControl"), [](auto &mod, auto &cls) {
47 cls.def(py::init<>());
48 LSST_DECLARE_CONTROL_FIELD(cls, ImportanceSamplerControl, nSamples);
49 LSST_DECLARE_CONTROL_FIELD(cls, ImportanceSamplerControl, nUpdateSteps);
50 LSST_DECLARE_CONTROL_FIELD(cls, ImportanceSamplerControl, tau1);
51 LSST_DECLARE_CONTROL_FIELD(cls, ImportanceSamplerControl, tau2);
52 LSST_DECLARE_CONTROL_FIELD(cls, ImportanceSamplerControl, targetPerplexity);
53 LSST_DECLARE_CONTROL_FIELD(cls, ImportanceSamplerControl, maxRepeat);
54
55 PyAdaptiveImportanceSampler clsAdaptiveImportanceSampler(mod, "AdaptiveImportanceSampler");
56 clsAdaptiveImportanceSampler.def(py::init<afw::table::Schema &, std::shared_ptr<afw::math::Random>,
57 std::map<int, ImportanceSamplerControl> const &, bool>(),
58 "sampleSchema"_a, "rng"_a, "ctrls"_a, "doSaveIteration"_a = false);
59 // virtual run method already wrapped by Sampler base class
60 clsAdaptiveImportanceSampler.def("computeNormalizedPerplexity",
61 &AdaptiveImportanceSampler::computeNormalizedPerplexity);
62 clsAdaptiveImportanceSampler.def("computeEffectiveSampleSizeFraction",
63 &AdaptiveImportanceSampler::computeEffectiveSampleSizeFraction);
64 });
65}
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
Definition python.h:391
py::class_< ImportanceSamplerControl, std::shared_ptr< ImportanceSamplerControl > > PyImportanceSamplerControl

◆ wrapCmodel()

void lsst::meas::modelfit::wrapCmodel ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 205 of file cmodel.cc.

205 {
206 declareCModelStageControl(wrappers);
207 auto clsControl = declareCModelControl(wrappers);
208 declareCModelStageResult(wrappers);
209 auto clsResult = declareCModelResult(wrappers);
210 auto clsAlgorithm = declareCModelAlgorithm(wrappers);
211 clsAlgorithm.attr("Control") = clsControl;
212 clsAlgorithm.attr("Result") = clsResult;
213}

◆ wrapIntegrals()

void lsst::meas::modelfit::wrapIntegrals ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 36 of file integrals.cc.

36 {
37 wrappers.module.def("phid", &detail::phid);
38 wrappers.module.def("bvnu", &detail::bvnu);
39}

◆ wrapLikelihood()

void lsst::meas::modelfit::wrapLikelihood ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 40 of file likelihood.cc.

40 {
41 // py::module::import("lsst.meas.modelfit.model");
42 wrappers.wrapType(PyLikelihood(wrappers.module, "Likelihood"), [](auto &mod, auto &cls) {
43 cls.def("getDataDim", &Likelihood::getDataDim);
44 cls.def("getAmplitudeDim", &Likelihood::getAmplitudeDim);
45 cls.def("getNonlinearDim", &Likelihood::getNonlinearDim);
46 cls.def("getFixedDim", &Likelihood::getFixedDim);
47 cls.def("getFixed", &Likelihood::getFixed);
48 cls.def("getData", &Likelihood::getData);
49 cls.def("getUnweightedData", &Likelihood::getUnweightedData);
50 cls.def("getWeights", &Likelihood::getWeights);
51 cls.def("getVariance", &Likelihood::getVariance);
52 cls.def("getModel", &Likelihood::getModel);
53 cls.def("computeModelMatrix", &Likelihood::computeModelMatrix, "modelMatrix"_a, "nonlinear"_a,
54 "doApplyWeights"_a = true);
55 });
56}
py::class_< Likelihood, std::shared_ptr< Likelihood > > PyLikelihood
Definition likelihood.cc:38

◆ wrapMixture()

void lsst::meas::modelfit::wrapMixture ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 143 of file mixture.cc.

143 {
144 auto clsMixtureComponent = declareMixtureComponent(wrappers);
145 auto clsMixtureUpdateRestriction = declareMixtureUpdateRestriction(wrappers);
146 auto clsMixture = declareMixture(wrappers);
147 clsMixture.attr("Component") = clsMixtureComponent;
148 clsMixture.attr("UpdateRestriction") = clsMixtureUpdateRestriction;
149}

◆ wrapModel()

void lsst::meas::modelfit::wrapModel ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 43 of file model.cc.

43 {
44 wrappers.wrapType(PyModel(wrappers.module, "Model"), [](auto &mod, auto &cls) {
45 py::enum_<Model::CenterEnum>(cls, "CenterEnum")
46 .value("FIXED_CENTER", Model::FIXED_CENTER)
47 .value("SINGLE_CENTER", Model::SINGLE_CENTER)
48 .value("MULTI_CENTER", Model::MULTI_CENTER)
49 .export_values();
50
51 cls.def_static("make", (std::shared_ptr<Model>(*)(Model::BasisVector, Model::NameVector const &,
52 Model::CenterEnum)) &
53 Model::make,
54 "basisVector"_a, "prefixes"_a, "center"_a);
55 cls.def_static("make", (std::shared_ptr<Model>(*)(std::shared_ptr<shapelet::MultiShapeletBasis>,
56 Model::CenterEnum)) &
57 Model::make,
58 "basis"_a, "center"_a);
59 cls.def_static("makeGaussian", &Model::makeGaussian, "center"_a, "radius"_a = 1.0);
60 cls.def("getNonlinearDim", &Model::getNonlinearDim);
61 cls.def("getAmplitudeDim", &Model::getAmplitudeDim);
62 cls.def("getFixedDim", &Model::getFixedDim);
63 cls.def("getBasisCount", &Model::getBasisCount);
64 cls.def("getNonlinearNames", &Model::getNonlinearNames, py::return_value_policy::copy);
65 cls.def("getAmplitudeNames", &Model::getAmplitudeNames, py::return_value_policy::copy);
66 cls.def("getFixedNames", &Model::getFixedNames, py::return_value_policy::copy);
67 cls.def("getBasisVector", &Model::getBasisVector, py::return_value_policy::copy);
68 cls.def("makeShapeletFunction", &Model::makeShapeletFunction);
69 cls.def("adaptPrior", &Model::adaptPrior);
70 cls.def("makeEllipseVector", &Model::makeEllipseVector);
71 cls.def("writeEllipses",
72 (Model::EllipseVector (Model::*)(ndarray::Array<Scalar const, 1, 1> const &,
73 ndarray::Array<Scalar const, 1, 1> const &) const) &
74 Model::writeEllipses,
75 "nonlinear"_a, "fixed"_a);
76 cls.def("readEllipses",
77 (void (Model::*)(Model::EllipseVector const &, ndarray::Array<Scalar, 1, 1> const &,
78 ndarray::Array<Scalar, 1, 1> const &) const) &
79 Model::readEllipses,
80 "ellipses"_a, "nonlinear"_a, "fixed"_a);
81 cls.def("transformParameters", &Model::transformParameters, "transform"_a, "nonlinear"_a, "amplitudes"_a,
82 "fixed"_a);
83 });
84}
py::class_< Model, std::shared_ptr< Model > > PyModel
Definition model.cc:41

◆ wrapMultiModel()

void lsst::meas::modelfit::wrapMultiModel ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 39 of file multiModel.cc.

39 {
40 // py::module::import("lsst.meas.modelfit.model");
41 wrappers.wrapType(PyMultiModel(wrappers.module, "MultiModel"), [](auto &mod, auto &cls) {
42 cls.def(py::init<ModelVector, MultiModel::NameVector const &>(), "components"_a, "prefixes"_a);
43 cls.def("getComponents", &MultiModel::getComponents);
44
45 // All other MultiModel methods are virtuals already inherited from
46 // wrappers for Model.
47 });
48}
py::class_< MultiModel, std::shared_ptr< MultiModel >, Model > PyMultiModel
Definition multiModel.cc:37

◆ wrapOptimizer()

void lsst::meas::modelfit::wrapOptimizer ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 172 of file optimizer.cc.

172 {
173 auto clsObjective = declareOptimizerObjective(wrappers);
174 auto clsControl = declareOptimizerControl(wrappers);
175 auto clsHistoryRecorder = declareOptimizerHistoryRecorder(wrappers);
176 auto cls = declareOptimizer(wrappers);
177 cls.attr("Objective") = clsObjective;
178 cls.attr("Control") = clsControl;
179 cls.attr("HistoryRecorder") = clsHistoryRecorder;
180
181 wrappers.module.def("solveTrustRegion", &solveTrustRegion, "x"_a, "F"_a, "g"_a, "r"_a, "tolerance"_a);
182}

◆ wrapPixelFitRegion()

void lsst::meas::modelfit::wrapPixelFitRegion ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 42 of file pixelFitRegion.cc.

42 {
43 using Control = PixelFitRegionControl;
44
45 wrappers.wrapType(PyPixelFitRegionControl(wrappers.module, "PixelFitRegionControl"), [](auto &mod, auto &cls) {
46 cls.def(py::init<>());
47 LSST_DECLARE_CONTROL_FIELD(cls, Control, nKronRadii);
48 LSST_DECLARE_CONTROL_FIELD(cls, Control, nPsfSigmaMin);
49 LSST_DECLARE_CONTROL_FIELD(cls, Control, nPsfSigmaGrow);
50 LSST_DECLARE_CONTROL_FIELD(cls, Control, nFitRadiiMin);
51 LSST_DECLARE_CONTROL_FIELD(cls, Control, nFitRadiiMax);
52 LSST_DECLARE_CONTROL_FIELD(cls, Control, maxArea);
53 LSST_DECLARE_CONTROL_FIELD(cls, Control, badMaskPlanes);
54 LSST_DECLARE_CONTROL_FIELD(cls, Control, maxBadPixelFraction);
55 });
56
57 wrappers.wrapType(PyPixelFitRegion(wrappers.module, "PixelFitRegion"), [](auto &mod, auto &cls) {
58 cls.def(py::init<Control const &, afw::geom::ellipses::Quadrupole const &,
59 afw::geom::ellipses::Quadrupole const &, Scalar, int>(),
60 "ctrl"_a, "moments"_a, "psfMoments"_a, "kronRadius"_a, "footprintArea"_a);
61 cls.def(py::init<Control const &, afw::geom::ellipses::Quadrupole const &>(), "ctrl"_a, "ellipse"_a);
62 cls.def("applyEllipse", &PixelFitRegion::applyEllipse, "deconvolved"_a, "psfMoments"_a);
63 cls.def("applyMask", &PixelFitRegion::applyMask, "mask"_a, "center"_a);
64 // Data members are intentionally read-only from the Python side;
65 // they should only be set by the constructor and apply methods.
66 cls.def_readonly("ellipse", &PixelFitRegion::ellipse);
67 cls.def_readonly("footprint", &PixelFitRegion::footprint);
68 cls.def_readonly("usedFootprintArea", &PixelFitRegion::usedFootprintArea);
69 cls.def_readonly("usedPsfArea", &PixelFitRegion::usedPsfArea);
70 cls.def_readonly("maxArea", &PixelFitRegion::maxArea);
71 cls.def_readonly("maxBadPixelFraction", &PixelFitRegion::maxBadPixelFraction);
72 cls.def_readonly("usedMinEllipse", &PixelFitRegion::usedMinEllipse);
73 cls.def_readonly("usedMaxEllipse", &PixelFitRegion::usedMaxEllipse);
74 });
75}
py::class_< PixelFitRegionControl, std::shared_ptr< PixelFitRegionControl > > PyPixelFitRegionControl
py::class_< PixelFitRegion, std::shared_ptr< PixelFitRegion > > PyPixelFitRegion

◆ wrapPriors()

void lsst::meas::modelfit::wrapPriors ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 124 of file priors.cc.

124 {
125 // py::module::import("lsst.meas.modelfit.mixture");
126
127 declarePrior(wrappers);
128 declareMixturePrior(wrappers);
129 declareSemiEmpiricalPrior(wrappers);
130 declareSoftenedLinearPrior(wrappers);
131}

◆ wrapPsf()

void lsst::meas::modelfit::wrapPsf ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 164 of file psf.cc.

164 {
165 declareDoubleShapelet(wrappers);
166 declareGeneral(wrappers);
167}

◆ wrapSampler()

void lsst::meas::modelfit::wrapSampler ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 44 of file sampler.cc.

44 {
45 wrappers.wrapType(PySamplingObjective(wrappers.module, "SamplingObjective"), [](auto &mod, auto &cls) {
46 cls.def("getParameterDim", &SamplingObjective::getParameterDim);
47 cls.def("__call__", &SamplingObjective::operator(), "parameters"_a, "sample"_a);
48 });
49 wrappers.wrapType(PySampler(wrappers.module, "Sampler"), [](auto &mod, auto &cls) {
50 cls.def("run", &Sampler::run, "objective"_a, "proposal"_a, "samples"_a);
51 });
52}
py::class_< SamplingObjective, std::shared_ptr< SamplingObjective > > PySamplingObjective
Definition sampler.cc:41
py::class_< Sampler, std::shared_ptr< Sampler > > PySampler
Definition sampler.cc:42

◆ wrapTruncatedGaussian()

void lsst::meas::modelfit::wrapTruncatedGaussian ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 121 of file truncatedGaussian.cc.

121 {
122 declareSampleStrategy(wrappers);
123 auto clsTruncatedGaussian = declareTruncatedGaussian(wrappers);
124 clsTruncatedGaussian.attr("LogEvaluator") = declareEvaluator<LogEvaluator, PyLogEvaluator>(wrappers, "LogEvaluator");
125 clsTruncatedGaussian.attr("Evaluator") = declareEvaluator<Evaluator, PyEvaluator>(wrappers, "Evaluator");
126 clsTruncatedGaussian.attr("Sampler") = declareSampler(wrappers);
127}

◆ wrapUnitSystem()

void lsst::meas::modelfit::wrapUnitSystem ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 39 of file unitSystem.cc.

39 {
40 // Data member wrappers in this module are intentionally read-only;
41 // setting them in Python should never be necessary and hence always
42 // represents a mistake we want to fail on as early as possible.
43 wrappers.wrapType(PyUnitSystem(wrappers.module, "UnitSystem"), [](auto &mod, auto &cls) {
44 cls.def_readonly("wcs", &UnitSystem::wcs);
45 cls.def_readonly("photoCalib", &UnitSystem::photoCalib);
46 cls.def(
47 py::init<geom::SpherePoint const &, std::shared_ptr<afw::image::PhotoCalib const>, double>(),
48 "position"_a, "calibIn"_a, "flux"_a);
49 cls.def(py::init<geom::SpherePoint const &, Scalar>(), "position"_a, "mag"_a);
50 cls.def(
51 py::init<std::shared_ptr<afw::geom::SkyWcs const>, std::shared_ptr<afw::image::PhotoCalib const>>(),
52 "wcs"_a, "photoCalib"_a);
53 cls.def(py::init<afw::image::Exposure<float> const &>(), "exposure"_a);
54 cls.def(py::init<afw::image::Exposure<double> const &>(), "exposure"_a);
55 });
56
57 wrappers.wrapType(PyLocalUnitTransform(wrappers.module, "LocalUnitTransform"), [](auto &mod, auto &cls) {
58 cls.def_readonly("geometric", &LocalUnitTransform::geometric);
59 cls.def_readonly("flux", &LocalUnitTransform::flux);
60 cls.def_readonly("sb", &LocalUnitTransform::sb);
61 cls.def(py::init<geom::Point2D const &, UnitSystem const &, UnitSystem const &>(),
62 "sourcePixel"_a, "source"_a, "destination"_a);
63 cls.def(py::init<>());
64 });
65}
py::class_< LocalUnitTransform, std::shared_ptr< LocalUnitTransform > > PyLocalUnitTransform
Definition unitSystem.cc:37
py::class_< UnitSystem, std::shared_ptr< UnitSystem > > PyUnitSystem
Definition unitSystem.cc:36

◆ wrapUnitTransformedLikelihood()

void lsst::meas::modelfit::wrapUnitTransformedLikelihood ( lsst::cpputils::python::WrapperCollection & wrappers)

Definition at line 48 of file unitTransformedLikelihood.cc.

48 {
49 wrappers.wrapType(
50 PyUnitTransformedLikelihoodControl(wrappers.module, "UnitTransformedLikelihoodControl"),
51 [](auto &mod, auto &cls) {
52 LSST_DECLARE_CONTROL_FIELD(cls, UnitTransformedLikelihoodControl, usePixelWeights);
53 LSST_DECLARE_CONTROL_FIELD(cls, UnitTransformedLikelihoodControl, weightsMultiplier);
54 cls.def(py::init<bool>(), "usePixelWeights"_a = false);
55 });
56 wrappers.wrapType(PyEpochFootprint(wrappers.module, "EpochFootprint"), [](auto &mod, auto &cls) {
57 cls.def(py::init<afw::detection::Footprint const &, afw::image::Exposure<Pixel> const &,
58 shapelet::MultiShapeletFunction const &>(),
59 "footprint"_a, "exposure"_a, "psf"_a);
60 cls.def_readonly("footprint", &EpochFootprint::footprint);
61 cls.def_readonly("exposure", &EpochFootprint::exposure);
62 cls.def_readonly("psf", &EpochFootprint::psf);
63 });
64
65 wrappers.wrapType(PyUnitTransformedLikelihood(wrappers.module, "UnitTransformedLikelihood"),[](auto &mod, auto &cls) {
66 cls.def(
67 py::init<std::shared_ptr<Model>, ndarray::Array<Scalar const, 1, 1> const &, UnitSystem const &,
68 geom::SpherePoint const &, afw::image::Exposure<Pixel> const &,
69 afw::detection::Footprint const &, shapelet::MultiShapeletFunction const &,
70 UnitTransformedLikelihoodControl const &>(),
71 "model"_a, "fixed"_a, "fitSys"_a, "position"_a, "exposure"_a, "footprint"_a, "psf"_a,
72 "ctrl"_a);
73 cls.def(
74 py::init<std::shared_ptr<Model>, ndarray::Array<Scalar const, 1, 1> const &, UnitSystem const &,
75 geom::SpherePoint const &, std::vector<std::shared_ptr<EpochFootprint>> const &,
76 UnitTransformedLikelihoodControl const &>(),
77 "model"_a, "fixed"_a, "fitSys"_a, "position"_a, "epochFootprintList"_a, "ctrl"_a);
78 });
79}
py::class_< UnitTransformedLikelihood, std::shared_ptr< UnitTransformedLikelihood >, Likelihood > PyUnitTransformedLikelihood
py::class_< UnitTransformedLikelihoodControl, std::shared_ptr< UnitTransformedLikelihoodControl > > PyUnitTransformedLikelihoodControl
py::class_< EpochFootprint, std::shared_ptr< EpochFootprint > > PyEpochFootprint