LSST Applications g0d97872fb5+4fd969bb9d,g1653933729+34a971ddd9,g28da252d5a+072f89fe25,g2bbee38e9b+a99b0ab4cd,g2bc492864f+a99b0ab4cd,g2ca4be77d2+c0e3b27cd8,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+a99b0ab4cd,g35bb328faa+34a971ddd9,g3a166c0a6a+a99b0ab4cd,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+9ed5ed841a,g569e0e2b34+cb4faa46ad,g5a97de2502+520531a62c,g717e5f8c0f+29153700a5,g7ede599f99+367733290c,g80478fca09+17051a22cc,g82479be7b0+f2f1ea0a87,g858d7b2824+29153700a5,g8b782ad322+29153700a5,g8cd86fa7b1+05420e7f7d,g9125e01d80+34a971ddd9,ga5288a1d22+e7f674aaf3,gae0086650b+34a971ddd9,gae74b0b5c6+45ef5cdc51,gb58c049af0+ace264a4f2,gc28159a63d+a99b0ab4cd,gcf0d15dbbd+8051a81198,gda6a2b7d83+8051a81198,gdaeeff99f8+7774323b41,gdf4d240d4a+34a971ddd9,ge2409df99d+cb167bac99,ge33fd446bb+29153700a5,ge79ae78c31+a99b0ab4cd,gf0baf85859+890af219f9,gf5289d68f6+9faa5c5784,w.2024.36
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
lsst::gauss2d::fit::FractionalIntegralModel::Shared_enabler Struct Reference
Inheritance diagram for lsst::gauss2d::fit::FractionalIntegralModel::Shared_enabler:
lsst::gauss2d::fit::FractionalIntegralModel lsst::gauss2d::fit::IntegralModel lsst::gauss2d::fit::Chromatic lsst::gauss2d::fit::Parametric lsst::gauss2d::Object

Public Types

typedef std::pair< std::reference_wrapper< const Channel >, std::shared_ptr< ProperFractionParameterD > > ChannelIntegralParameterD
 
typedef std::vector< ChannelIntegralParameterDData
 

Public Member Functions

template<typename... Args>
 Shared_enabler (Args &&...args)
 
std::shared_ptr< ProperFractionParameterDat (const Channel &channel)
 
std::shared_ptr< const ProperFractionParameterDat (const Channel &channel) const
 
Data::iterator begin () noexcept
 
Data::const_iterator cbegin () const noexcept
 
Data::iterator end () noexcept
 
Data::const_iterator cend () const noexcept
 
std::vector< std::reference_wrapper< const Channel > > get_channels () const override
 Get the set of channels this instance is applicable for.
 
const IntegralModelget_parent_model () const
 
double get_integral (const Channel &channel) const override
 Get the value of the integral in a single Channel.
 
std::vector< std::pair< ParamBaseCRef, ExtraParamFactorValues > > get_integral_derivative_factors (const Channel &channel) const override
 Return the partial derivative of the model w.r.t.
 
double get_integral_remainder (const Channel &channel) const
 
ProperFractionParameterDget_parameter_frac (const Channel &channel) const
 
ParamRefsget_parameters (ParamRefs &params, ParamFilter *filter=nullptr) const override
 Add Parameter refs matching the filter to a vector, in order.
 
ParamCRefsget_parameters_const (ParamCRefs &params, ParamFilter *filter=nullptr) const override
 Same as get_parameters(), but for const refs.
 
bool is_final () const
 
size_t size () 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.
 
std::string str () const override
 Return a brief, human-readable string representation of this.
 
ParamRefs get_parameters_new (ParamFilter *filter=nullptr) const
 Same as get_parameters(), but returning a new vector.
 
ParamCRefs get_parameters_const_new (ParamFilter *filter=nullptr) const
 Same as get_parameters_const(), but returning a new vector.
 

Static Public Member Functions

static std::shared_ptr< FractionalIntegralModelfind_model (const IntegralModel &model)
 Find the FractionalIntegralModel that depends on a given IntegralModel, if any.
 
static std::shared_ptr< FractionalIntegralModelmake (std::optional< const Data > data, std::shared_ptr< const IntegralModel > model, bool is_final=false)
 Construct a FractionalIntegralModel and add to registry.
 
static const std::shared_ptr< const FractionalIntegralModelmake_const (std::optional< const Data > data, std::shared_ptr< const IntegralModel > model, bool is_final=false)
 
static std::string_view null_str (const std::string_view &namespace_separator)
 

Static Public Attributes

static constexpr std::string_view CC_NAMESPACE_SEPARATOR = "::"
 The C++ namespace separator.
 
static constexpr std::string_view NULL_STR_GENERAL = "None"
 
static constexpr std::string_view PY_NAMESPACE_SEPARATOR = "."
 

Detailed Description

Definition at line 83 of file fractionalintegralmodel.cc.

Member Typedef Documentation

◆ ChannelIntegralParameterD

Definition at line 33 of file fractionalintegralmodel.h.

◆ Data

Definition at line 34 of file fractionalintegralmodel.h.

Constructor & Destructor Documentation

◆ Shared_enabler()

template<typename... Args>
lsst::gauss2d::fit::FractionalIntegralModel::Shared_enabler::Shared_enabler ( Args &&... args)
inline

Definition at line 85 of file fractionalintegralmodel.cc.

85: FractionalIntegralModel(std::forward<Args>(args)...) {}
FractionalIntegralModel(const FractionalIntegralModel &)=delete

Member Function Documentation

◆ at() [1/2]

std::shared_ptr< ProperFractionParameterD > lsst::gauss2d::fit::FractionalIntegralModel::at ( const Channel & channel)
inherited

Definition at line 73 of file fractionalintegralmodel.cc.

73 {
74 return _map.at(channel);
75}

◆ at() [2/2]

std::shared_ptr< const ProperFractionParameterD > lsst::gauss2d::fit::FractionalIntegralModel::at ( const Channel & channel) const
inherited

Definition at line 76 of file fractionalintegralmodel.cc.

76 {
77 return _map.at(channel);
78}

◆ begin()

FractionalIntegralModel::Data::iterator lsst::gauss2d::fit::FractionalIntegralModel::begin ( )
noexceptinherited

Definition at line 88 of file fractionalintegralmodel.cc.

88 {
89 return _data.begin();
90}
T begin(T... args)

◆ cbegin()

FractionalIntegralModel::Data::const_iterator lsst::gauss2d::fit::FractionalIntegralModel::cbegin ( ) const
noexceptinherited

Definition at line 91 of file fractionalintegralmodel.cc.

91 {
92 return _data.begin();
93}

◆ cend()

FractionalIntegralModel::Data::const_iterator lsst::gauss2d::fit::FractionalIntegralModel::cend ( ) const
noexceptinherited

Definition at line 98 of file fractionalintegralmodel.cc.

98 {
99 return _data.cend();
100}
T cend(T... args)

◆ end()

FractionalIntegralModel::Data::iterator lsst::gauss2d::fit::FractionalIntegralModel::end ( )
noexceptinherited

Definition at line 95 of file fractionalintegralmodel.cc.

95 {
96 return _data.end();
97}

◆ find_model()

static std::shared_ptr< FractionalIntegralModel > lsst::gauss2d::fit::FractionalIntegralModel::find_model ( const IntegralModel & model)
inlinestaticinherited

Find the FractionalIntegralModel that depends on a given IntegralModel, if any.

Parameters
modelThe IntegralModel to search for
Returns
The FractionalIntegralModel that depends on model, or nullptr if none

Definition at line 56 of file fractionalintegralmodel.h.

56 {
57 const auto found = _registry_rev.find(model);
58 return (found == _registry_rev.end()) ? nullptr : (*found).second.lock();
59 }

◆ get_channels()

std::vector< std::reference_wrapper< const Channel > > lsst::gauss2d::fit::FractionalIntegralModel::get_channels ( ) const
overridevirtualinherited

Get the set of channels this instance is applicable for.

Note
Implementers must return a set (all unique items). This cannot be enforced (yet).

Implements lsst::gauss2d::fit::Chromatic.

Definition at line 102 of file fractionalintegralmodel.cc.

102 {
104 for (auto &datum : _data) rval.emplace_back(datum.first);
105 return rval;
106}

◆ get_integral()

double lsst::gauss2d::fit::FractionalIntegralModel::get_integral ( const Channel & channel) const
overridevirtualinherited

Get the value of the integral in a single Channel.

Implements lsst::gauss2d::fit::IntegralModel.

Definition at line 115 of file fractionalintegralmodel.cc.

115 {
116 return _map.at(channel)->get_value() * (_get_integral_remainder(_parent.get(), *_model, channel));
117}
double _get_integral_remainder(const FractionalIntegralModel *frac, const IntegralModel &model, const Channel &channel)

◆ get_integral_derivative_factors()

std::vector< std::pair< ParamBaseCRef, ExtraParamFactorValues > > lsst::gauss2d::fit::FractionalIntegralModel::get_integral_derivative_factors ( const Channel & channel) const
overridevirtualinherited

Return the partial derivative of the model w.r.t.

each metaparameter.

This is generally needed only for nonlinear Parameter instances.

Parameters
channelThe Channel to return derivatives for.
Returns
A vector of Parameter/derivative pairs, with values ordered as specified in GaussianEvaluator (L, sigma_x, sigma_y).

Implements lsst::gauss2d::fit::IntegralModel.

Definition at line 120 of file fractionalintegralmodel.cc.

120 {
121 const auto &frac = *(this->_map.at(channel));
122 /*
123 For a model with no parent:
124 gauss2d will evaluate dmodel/dweight_comp
125 Fitters will want dmodel/dfrac
126
127 frac = weight_comp/weight_total
128 dfrac/dweight_comp = 1/weight_total
129 dweight_comp = dfrac*weight_total
130
131 dmodel/d_frac = weight_total*dmodel/dweight_comp
132
133 With a parent:
134
135 parent: weight_comp_parent = weight_total*frac_parent
136 child1: weight_comp_child1 = weight_total*(1 - frac_parent)
137 ...
138 childN: weight_comp_childN = weight_total*(1 - frac_parent)...*(1-frac_childNminus1)
139
140 dmodel/dfrac_parent = weight_total*(1 - frac_parent)*dmodel/dweight_comp
141 = -weight_total*dmodel/dweight_comp
142
143 i.e. there are N fraction parameters dependent on dmodel/dweight_comp for children.
144 (excluding the fixed fraction for an is_final child)
145 */
146 if (_parent == nullptr) {
147 return {{frac, {_model->get_integral(channel), 0., 0.}}};
148 }
149 auto factors = _parent->get_integral_derivative_factors(channel);
150 if (is_final()) {
151 /*
152 The last component's fraction is fixed, but it has an integral of
153 (1 - frac_previous)*integral_remaining, the derivative of which
154 w.r.t. frac_revious is -1*integral_remaining.
155 */
156 factors.back().second[0] *= -1.;
157 } else {
158 // TODO: Check this if/when it's ever enabled
159 factors.push_back({frac, {factors.back().second[0], 0., 0.}});
160 }
161 return factors;
162}

◆ get_integral_remainder()

double lsst::gauss2d::fit::FractionalIntegralModel::get_integral_remainder ( const Channel & channel) const
inherited

Definition at line 164 of file fractionalintegralmodel.cc.

164 {
165 return (1. - this->at(channel)->get_value()) * _get_integral_remainder(_parent.get(), *_model, channel);
166}
std::shared_ptr< ProperFractionParameterD > at(const Channel &channel)

◆ get_parameter_frac()

ProperFractionParameterD & lsst::gauss2d::fit::FractionalIntegralModel::get_parameter_frac ( const Channel & channel) const
inherited

Definition at line 168 of file fractionalintegralmodel.cc.

168 {
169 return *(_map.at(channel));
170}

◆ get_parameters()

ParamRefs & lsst::gauss2d::fit::FractionalIntegralModel::get_parameters ( ParamRefs & params,
ParamFilter * filter = nullptr ) const
overridevirtualinherited

Add Parameter refs matching the filter to a vector, in order.

Parameters
paramsThe vector to add to.
filterThe filter to apply to this Object's parameters.
Returns
A ref to params (for method chaining)

Implements lsst::gauss2d::fit::Parametric.

Definition at line 172 of file fractionalintegralmodel.cc.

172 {
173 _model->get_parameters(params, filter);
174 // Don't return the n_channels fixed frac=1 parameters at the end
175 const size_t n_p_max = _data.size() - (this->is_final() ? this->get_channels().size() : 0);
176 size_t i = 0;
177 for (auto &p : _data) {
178 if (i++ == n_p_max) break;
179 insert_param_channel(p.first, *p.second, params, filter);
180 }
181 return params;
182}
std::vector< std::reference_wrapper< const Channel > > get_channels() const override
Get the set of channels this instance is applicable for.
void insert_param_channel(const lsst::gauss2d::fit::Channel &channel, g2f::ParamBase &param, t &params, ParamFilter *filter)
Same as insert_param, but only inserting if filter has a null or matching Channel.
T size(T... args)

◆ get_parameters_const()

ParamCRefs & lsst::gauss2d::fit::FractionalIntegralModel::get_parameters_const ( ParamCRefs & params,
ParamFilter * filter = nullptr ) const
overridevirtualinherited

Same as get_parameters(), but for const refs.

Implements lsst::gauss2d::fit::Parametric.

Definition at line 184 of file fractionalintegralmodel.cc.

184 {
185 _model->get_parameters_const(params, filter);
186 const size_t n_p_max = _data.size() - (this->is_final() ? this->get_channels().size() : 0);
187 size_t i = 0;
188 for (const auto &p : _data) {
189 if (i++ == n_p_max) break;
190 insert_param_channel(p.first, *p.second, params, filter);
191 }
192 return params;
193}

◆ get_parameters_const_new()

ParamCRefs lsst::gauss2d::fit::Parametric::get_parameters_const_new ( ParamFilter * filter = nullptr) const
inlineinherited

Same as get_parameters_const(), but returning a new vector.

Definition at line 33 of file parametric.h.

33 {
34 ParamCRefs params{};
35 get_parameters_const(params, filter);
36 return params;
37 }
virtual ParamCRefs & get_parameters_const(ParamCRefs &params, ParamFilter *filter=nullptr) const =0
Same as get_parameters(), but for const refs.
std::vector< ParamBaseCRef > ParamCRefs
Definition param_defs.h:11

◆ get_parameters_new()

ParamRefs lsst::gauss2d::fit::Parametric::get_parameters_new ( ParamFilter * filter = nullptr) const
inlineinherited

Same as get_parameters(), but returning a new vector.

Definition at line 27 of file parametric.h.

27 {
28 ParamRefs params{};
29 get_parameters(params, filter);
30 return params;
31 }
virtual ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const =0
Add Parameter refs matching the filter to a vector, in order.
std::vector< ParamBaseRef > ParamRefs
Definition param_defs.h:13

◆ get_parent_model()

const IntegralModel & lsst::gauss2d::fit::FractionalIntegralModel::get_parent_model ( ) const
inherited

Definition at line 108 of file fractionalintegralmodel.cc.

108{ return *_model; }

◆ is_final()

bool lsst::gauss2d::fit::FractionalIntegralModel::is_final ( ) const
inherited

Definition at line 195 of file fractionalintegralmodel.cc.

195{ return _is_final; }

◆ make()

std::shared_ptr< FractionalIntegralModel > lsst::gauss2d::fit::FractionalIntegralModel::make ( std::optional< const Data > data,
std::shared_ptr< const IntegralModel > model,
bool is_final = false )
staticinherited

Construct a FractionalIntegralModel and add to registry.

Parameters
dataThe map of ProperFractionParameter instances for each channel.
modelThe IntegralModel that ProperFractionParameter instances multiply by.
is_finalWhether these fractions are the last in the chain.
Note
Input parameters are validated and will throw exceptions if invalid, e.g. if data and model do not cover the same channels.
Returns
A new FractionalIntegralModel instance

Definition at line 230 of file fractionalintegralmodel.cc.

231 {
232 std::shared_ptr<FractionalIntegralModel> ptr = std::make_shared<Shared_enabler>(data, model, is_final);
233 _registry.insert({*ptr, *model});
234 FractionalIntegralModel::_registry_rev.insert({*model, ptr});
235 return ptr;
236}
char * data
Definition BaseRecord.cc:61
std::uint64_t * ptr
Definition RangeSet.cc:95
model(data, psfmodels, sources)

◆ make_const()

const std::shared_ptr< const FractionalIntegralModel > lsst::gauss2d::fit::FractionalIntegralModel::make_const ( std::optional< const Data > data,
std::shared_ptr< const IntegralModel > model,
bool is_final = false )
staticinherited

Definition at line 238 of file fractionalintegralmodel.cc.

239 {
240 return make(data, model, is_final);
241}
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.

◆ null_str()

static std::string_view lsst::gauss2d::Object::null_str ( const std::string_view & namespace_separator)
inlinestaticinherited

Definition at line 49 of file object.h.

49 {
50 return namespace_separator == CC_NAMESPACE_SEPARATOR ? "nullptr" : NULL_STR_GENERAL;
51 }
static constexpr std::string_view CC_NAMESPACE_SEPARATOR
The C++ namespace separator.
Definition object.h:45
static constexpr std::string_view NULL_STR_GENERAL
Definition object.h:46

◆ repr()

std::string lsst::gauss2d::fit::FractionalIntegralModel::repr ( bool name_keywords = false,
std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR ) const
overridevirtualinherited

Return a full, callable string representation of this.

Parameters
name_keywordsWhether to prefix arguments with "{name}=", where name is the arg name in the header (as with keyword arguments in Python).
namespace_separatorThe string to use to delimit namespaces, i.e. :: in C++ and . in Python.
Returns
A callable string representation of this, which should return an an identical object to this.
Note
The representation with name_keywords=false must be callable in C++. The representation with name_keywords=true should be callable in Python, if there are any bindings.

Implements lsst::gauss2d::Object.

Definition at line 199 of file fractionalintegralmodel.cc.

199 {
200 std::string s = type_name_str<FractionalIntegralModel>(false, namespace_separator) + "("
201 + (name_keywords ? "data={" : "{");
202 for (const auto &datum : _data) {
203 s += datum.first.get().repr(name_keywords, namespace_separator) + ": "
204 + datum.second->repr(name_keywords, namespace_separator) + ",";
205 }
206 return s + "})";
207}

◆ size()

size_t lsst::gauss2d::fit::FractionalIntegralModel::size ( ) const
inherited

Definition at line 197 of file fractionalintegralmodel.cc.

197{ return _data.size(); }

◆ str()

std::string lsst::gauss2d::fit::FractionalIntegralModel::str ( ) const
overridevirtualinherited

Return a brief, human-readable string representation of this.

Implements lsst::gauss2d::Object.

Definition at line 209 of file fractionalintegralmodel.cc.

209 {
210 std::string s = type_name_str<FractionalIntegralModel>(true) + "(data={";
211 for (const auto &datum : _data) {
212 s += datum.first.get().str() + ": " + datum.second->str() + ",";
213 }
214 s += "}, model=" + _model->str() + ", is_final=" + std::to_string(_is_final) + ")";
215 return s;
216}
T to_string(T... args)

Member Data Documentation

◆ CC_NAMESPACE_SEPARATOR

constexpr std::string_view lsst::gauss2d::Object::CC_NAMESPACE_SEPARATOR = "::"
staticconstexprinherited

The C++ namespace separator.

Definition at line 45 of file object.h.

◆ NULL_STR_GENERAL

constexpr std::string_view lsst::gauss2d::Object::NULL_STR_GENERAL = "None"
staticconstexprinherited

Definition at line 46 of file object.h.

◆ PY_NAMESPACE_SEPARATOR

constexpr std::string_view lsst::gauss2d::Object::PY_NAMESPACE_SEPARATOR = "."
staticconstexprinherited

Definition at line 47 of file object.h.


The documentation for this struct was generated from the following file: