LSST Applications g0f08755f38+82efc23009,g12f32b3c4e+e7bdf1200e,g1653933729+a8ce1bb630,g1a0ca8cf93+50eff2b06f,g28da252d5a+52db39f6a5,g2bbee38e9b+37c5a29d61,g2bc492864f+37c5a29d61,g2cdde0e794+c05ff076ad,g3156d2b45e+41e33cbcdc,g347aa1857d+37c5a29d61,g35bb328faa+a8ce1bb630,g3a166c0a6a+37c5a29d61,g3e281a1b8c+fb992f5633,g414038480c+7f03dfc1b0,g41af890bb2+11b950c980,g5fbc88fb19+17cd334064,g6b1c1869cb+12dd639c9a,g781aacb6e4+a8ce1bb630,g80478fca09+72e9651da0,g82479be7b0+04c31367b4,g858d7b2824+82efc23009,g9125e01d80+a8ce1bb630,g9726552aa6+8047e3811d,ga5288a1d22+e532dc0a0b,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+37c5a29d61,gcf0d15dbbd+2acd6d4d48,gd7358e8bfb+778a810b6e,gda3e153d99+82efc23009,gda6a2b7d83+2acd6d4d48,gdaeeff99f8+1711a396fd,ge2409df99d+6b12de1076,ge79ae78c31+37c5a29d61,gf0baf85859+d0a5978c5a,gf3967379c6+4954f8c433,gfb92a5be7c+82efc23009,gfec2e1e490+2aaed99252,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
sersicmixcomponent.cc
Go to the documentation of this file.
1#include <stdexcept>
2#include <string>
3
9
20
21namespace lsst::gauss2d::fit {
22
24public:
29 unsigned short index)
30 : _size_x(std::move(size_x)),
31 _size_y(std::move(size_y)),
32 _rho(std::move(rho)),
33 _sersicindex(std::move(sersicindex)),
34 _index(index) {
35 if ((_size_x == nullptr) || (_size_y == nullptr) || (_rho == nullptr) || (_sersicindex == nullptr)) {
36 throw std::invalid_argument("SersicEllipseData args must not be nullptr");
37 }
38 if (!(_index < _sersicindex->get_order())) {
39 throw std::invalid_argument("index=" + std::to_string(_index) + "!< sersicindex->get_order()="
40 + std::to_string(_sersicindex->get_order()));
41 }
42 }
43
44 double get_sizeratio() const { return _sersicindex->get_sizeratio(_index); }
45
46 double get_sigma_x() const override { return get_sizeratio() * _size_x->get_value(); }
47 double get_sigma_y() const override { return get_sizeratio() * _size_y->get_value(); }
48 double get_rho() const override { return _rho->get_value(); }
49
50 double get_size_x() const override { return get_sigma_x(); };
51 double get_size_y() const override { return get_sigma_y(); };
52 std::array<double, 3> get_xyr() const override { return {get_size_x(), get_size_y(), get_rho()}; };
53
54 void set(double sigma_x, double sigma_y, double rho) override {
55 throw std::runtime_error("Can't set on SersicEllipseData");
56 }
57 void set_h(double hwhm_x, double hwhm_y, double rho) override {
58 throw std::runtime_error("Can't set on SersicEllipseData");
59 }
60 void set_sigma_x(double sigma_x) override { throw std::runtime_error("Can't set on SersicEllipseData"); }
61 void set_sigma_y(double sigma_y) override { throw std::runtime_error("Can't set on SersicEllipseData"); }
62 void set_rho(double rho) override { throw std::runtime_error("Can't set on SersicEllipseData"); }
63 void set_hxyr(const std::array<double, 3>& hxyr) override {
64 throw std::runtime_error("Can't set on SersicEllipseData");
65 }
66 void set_xyr(const std::array<double, 3>& xyr) override {
67 throw std::runtime_error("Can't set on SersicEllipseData");
68 }
69
70 std::string repr(bool name_keywords, std::string_view namespace_separator) const override {
71 return type_name_str<SersicEllipseData>(false, namespace_separator) + "("
72 + (name_keywords ? "size_x=" : "") + _size_x->repr(name_keywords, namespace_separator) + ", "
73 + (name_keywords ? "size_y=" : "") + _size_y->repr(name_keywords, namespace_separator) + ", "
74 + (name_keywords ? "rho=" : "") + _rho->repr(name_keywords, namespace_separator) + ")";
75 }
76
77 std::string str() const override {
78 return type_name_str<SersicEllipseData>(true) + "(size_x=" + _size_x->str()
79 + ", size_y=" + _size_y->str() + ", rho=" + _rho->str() + +")";
80 }
81
82private:
87 unsigned short _index;
88};
89
91public:
94 unsigned short index)
95 : GaussianModelIntegral(channel, integralmodel),
96 _sersicindex(std::move(sersicindex)),
97 _index(index) {
98 if (_sersicindex == nullptr) throw std::invalid_argument("sersicindex must not be null");
99 if (!(_index < _sersicindex->get_order())) {
100 throw std::invalid_argument("index=" + std::to_string(_index) + "!< sersicindex->get_order()="
101 + std::to_string(_sersicindex->get_order()));
102 }
103 }
104
106
108
109 double get_integral(const Channel& channel) const override {
110 if (channel != _channel) {
111 throw std::invalid_argument("channel=" + channel.str() + " != this->_channel=" + _channel.str());
112 }
113 return get_value();
114 }
116 const Channel& channel) const override {
117 // TODO: Refactor this?
118 return {};
119 }
120
121 double get_integralratio() const { return _sersicindex->get_integralratio(_index); }
122
123 ParamRefs& get_parameters(ParamRefs& params, ParamFilter* filter = nullptr) const override {
124 return _integralmodel->get_parameters(params, filter);
125 }
126
127 ParamCRefs& get_parameters_const(ParamCRefs& params, ParamFilter* filter = nullptr) const override {
128 return _integralmodel->get_parameters_const(params, filter);
129 }
130
131 double get_value() const override { return get_integralratio() * _integralmodel->get_integral(_channel); }
132 void set_value(double value) override { throw std::runtime_error("Can't set on SersicModelIntegral"); }
133
134 std::string repr(bool name_keywords, std::string_view namespace_separator) const override {
135 return type_name_str<SersicModelIntegral>(false, namespace_separator) + ")"
136 + (name_keywords ? "channel=" : "") + _channel.repr(name_keywords, namespace_separator) + ", "
137 + (name_keywords ? "integralmodel=" : "")
138 + _integralmodel->repr(name_keywords, namespace_separator) + ", "
139 + (name_keywords ? "sersicindex=" : "")
140 + _sersicindex->repr(name_keywords, namespace_separator) + ", "
141 + (name_keywords ? "index=" : "") + std::to_string(_index) + ")";
142 }
143
144 std::string str() const override {
145 return type_name_str<SersicModelIntegral>(true) + "(channel=" + _channel.str()
146 + ", integralmodel=" + _integralmodel->str() + ", sersicindex=" + _sersicindex->str()
147 + ", index=" + std::to_string(_index) + ")";
148 }
149
150private:
152 unsigned short _index;
153};
154
155// This is the gauss2d convention; see evaluator.h
156static const std::array<size_t, N_PARAMS_GAUSS2D> IDX_ORDER = {0, 1, 3, 4, 5, 2};
157
158// TODO: This could derive from lsst::gauss2d::Gaussian, but would that serve any purpose?
159// TODO: This was intended to derive from QuasiEllipticalComponent, but there also
160// seems to be no need to implement all of its functions
162public:
164 std::shared_ptr<CentroidParameters> centroid = nullptr,
165 std::shared_ptr<SersicModelIntegral> integralmodel = nullptr)
166 : _ellipsedata(std::move(ellipsedata)),
167 _centroid(std::move(centroid)),
168 _integralmodel(std::move(integralmodel)) {}
169
170 const SersicEllipseData& get_ellipse() const { return *_ellipsedata; }
171 const SersicModelIntegral& get_integralmodel() const { return *_integralmodel; }
172
174 lsst::gauss2d::Gaussians::Data gaussians = {std::make_shared<Gaussian>(
175 std::make_shared<Centroid>(this->_centroid), std::make_shared<Ellipse>(this->_ellipsedata),
176 std::make_shared<GaussianModelIntegral>(channel, this->_integralmodel))};
177 return std::make_unique<const lsst::gauss2d::Gaussians>(gaussians);
178 }
179
180private:
184};
185
186void SersicMixComponentIndexParameterD::_set_ratios(double sersicindex) {
187 _integralsizes = _interpolator->get_integralsizes(sersicindex);
188 _integralsizes_derivs = _interpolator->get_integralsizes_derivs(sersicindex);
189}
190
192 if (index >= get_order()) {
193 throw std::invalid_argument(this->str() + ".get_integralratio(index=" + std::to_string(index)
194 + " >= max(order=" + std::to_string(get_order()) + "))");
195 }
196 return _integralsizes[index].integral;
197}
198
200 if (index >= get_order()) {
201 throw std::invalid_argument(this->str() + ".get_integralratio_deriv(index=" + std::to_string(index)
202 + " >= max(order=" + std::to_string(get_order()) + "))");
203 }
204 return _integralsizes_derivs[index].integral;
205}
206
211
212double SersicMixComponentIndexParameterD::get_sizeratio(unsigned short index) const {
213 if (index >= get_order()) {
214 throw std::invalid_argument(this->str() + ".get_integralratio(index=" + std::to_string(index)
215 + " >= max(order=" + std::to_string(get_order()) + "))");
216 }
217 return _integralsizes[index].sigma;
218}
219
221 if (index >= get_order()) {
222 throw std::invalid_argument(this->str() + ".get_integralratio(index=" + std::to_string(index)
223 + " >= max(order=" + std::to_string(get_order()) + "))");
224 }
225 return _integralsizes_derivs[index].sigma;
226}
227
228static const std::string limits_sersic_name
229 = std::string(parameters::type_name<SersicMixComponentIndexParameterD>()) + ".limits_maximal";
230
231static const auto limits_sersic = std::make_shared<const parameters::Limits<double>>(
232 0.5, 8.0,
233 std::string(parameters::type_name<SersicMixComponentIndexParameterD>()) + ".limits_maximal");
234
238
240 double value, std::shared_ptr<const parameters::Limits<double>> limits,
244 : SersicIndexParameterD(value, nullptr, transform, unit, fixed, label),
245 _interpolator(std::move(interpolator == nullptr
246 ? SersicMixComponentIndexParameterD::get_interpolator_default(
247 SERSICMIX_ORDER_DEFAULT)
248 : interpolator)) {
249 // TODO: determine if this can be avoided
250 set_limits(std::move(limits));
251 _set_ratios(value);
252}
253
255 return _interpolator->get_interptype();
256}
257
258unsigned short SersicMixComponentIndexParameterD::get_order() const { return _interpolator->get_order(); }
259
262 _set_ratios(value);
263}
264
269
272 std::shared_ptr<IntegralModel> integralmodel,
274 : SersicParametricEllipseHolder(std::move(ellipse)),
275 EllipticalComponent(_ellipsedata, centroid, integralmodel),
276 _sersicindex(sersicindex != nullptr ? std::move(sersicindex)
277 : std::make_shared<SersicMixComponentIndexParameterD>()) {
278 for (const Channel& channel : _integralmodel->get_channels()) {
279 auto& gaussians = _gaussians[channel];
280 gaussians.reserve(_sersicindex->get_order());
281 for (size_t index = 0; index < _sersicindex->get_order(); ++index) {
282 auto ell = std::make_shared<SersicEllipseData>(
283 _ellipsedata->get_reff_x_param_ptr(), _ellipsedata->get_reff_y_param_ptr(),
284 _ellipsedata->get_rho_param_ptr(), _sersicindex, index);
285 auto integral
286 = std::make_shared<SersicModelIntegral>(channel, _integralmodel, _sersicindex, index);
287 gaussians.emplace_back(
288 std::make_unique<SersicMixGaussianComponent>(ell, this->_centroid, integral));
289 }
290 };
291}
292
294
296 const GradParamMap& map_grad, ParameterMap& offsets) const {
297 if (_sersicindex->get_free()) {
298 auto found = offsets.find(*_sersicindex);
299 if (found == offsets.end()) {
300 throw std::runtime_error("_sersicindex=" + _sersicindex->str()
301 + " not found in offsets; was add_grad_param_map called?");
302 }
303 const auto& offset = (*found).second;
304 const size_t order = _sersicindex->get_order();
305 const size_t size_map_grad = map_grad.size();
306 if (!(size_map_grad >= order)) {
307 throw std::invalid_argument("map_grad.size()=" + std::to_string(map_grad.size())
308 + "!>=order=" + std::to_string(order));
309 }
310 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
311 map_extra.push_back({size_map_grad - order + idx_g, offset});
312 }
313 } else {
314 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
315 map_extra.push_back({0, 0});
316 }
317 }
318}
319
321 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
322 factors.push_back({0, 0, 0});
323 }
324}
325
327 ParameterMap& offsets) const {
328 ParamCRefs params;
329 ParamFilter filter{};
330 filter.channel = channel;
331 this->get_parameters_const(params, &filter);
332
333 if (params.size() != N_PARAMS) {
334 throw std::runtime_error(this->str() + "get_parameters_const with channel=" + channel.str() + " size="
335 + std::to_string(params.size()) + "!=N_PARAMS=" + std::to_string(N_PARAMS));
336 }
337
338 std::array<size_t, N_PARAMS_GAUSS2D> values{0, 0, 0, 0, 0, 0};
339
340 size_t size_map = offsets.size();
341 size_t index_param_map;
342 for (size_t idx_param = 0; idx_param < N_PARAMS_GAUSS2D; ++idx_param) {
343 const size_t& order_param = IDX_ORDER[idx_param];
344 // The parameters must be in the same order as returned by get_parameters(_const)
345 const auto& param = params.at(idx_param).get();
346 if (!param.get_fixed()) {
347 if (offsets.find(param) == offsets.end()) {
348 index_param_map = ++size_map;
349 offsets[param] = index_param_map;
350 } else {
351 index_param_map = offsets[param];
352 }
353 values[order_param] = index_param_map;
354 }
355 }
356 if (_sersicindex->get_free() && (offsets.find(*_sersicindex) == offsets.end())) {
357 offsets[params[N_PARAMS_GAUSS2D]] = offsets.size() + 1;
358 }
359 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
360 map.push_back(values);
361 }
362}
363
365 ParamCRefs params;
366 ParamFilter filter{};
367 filter.channel = channel;
368 this->get_parameters_const(params, &filter);
369
370 if (params.size() != N_PARAMS) {
371 throw std::runtime_error(this->str() + "get_parameters_const with channel=" + channel.str() + " size="
372 + std::to_string(params.size()) + "!=N_PARAMS=" + std::to_string(N_PARAMS));
373 }
374
375 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
376 std::array<double, N_PARAMS_GAUSS2D> values{1., 1., 1., 1., 1., 1.};
377 factors.push_back(values);
378 }
379}
380
382 const Channel& channel) const {
384 // TODO: This isn't sufficient; need to implement get_n_components
385 const auto& components = _gaussians.at(channel);
386 in.reserve(components.size());
387 for (auto& component : components) {
388 in.push_back(component->get_gaussians(channel)->get_data());
389 }
390 return std::make_unique<lsst::gauss2d::Gaussians>(in);
391}
392
393size_t SersicMixComponent::get_n_gaussians(const Channel& channel) const {
394 return _gaussians.at(channel).size();
395};
396
399 insert_param(*_sersicindex, params, filter);
400 return params;
401}
402
405 insert_param(*_sersicindex, params, filter);
406 return params;
407}
408
409double SersicMixComponent::get_sersicindex() const { return this->_sersicindex->get_value(); }
410
412 return *(this->_sersicindex);
413}
414
418
420 size_t index) const {
421 if (_sersicindex->get_free()) {
422 const auto& integralmodel = this->get_integralmodel();
423 double dx = 1. / _sersicindex->get_transform_derivative();
424 const double dintegral = dx * integralmodel.get_integral(channel);
425 const double dreff_x = dx * _ellipse->get_size_x_param().get_size();
426 const double dreff_y = dx * _ellipse->get_size_y_param().get_size();
427 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
428 const double dsizeratio = _sersicindex->get_sizeratio_deriv(idx_g);
429 auto& values = factors.at(index + idx_g);
430 values[0] = dintegral * _sersicindex->get_integralratio_deriv(idx_g);
431 values[1] = dreff_x * dsizeratio;
432 values[2] = dreff_y * dsizeratio;
433 }
434 } else {
435 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
436 auto& values = factors[index + idx_g];
437 values[0] = 0;
438 values[1] = 0;
439 values[2] = 0;
440 }
441 }
442}
443
445 size_t index) const {
446 ParamCRefs params;
447 ParamFilter filter{};
448 filter.channel = channel;
449 this->get_parameters_const(params, &filter);
450
451 std::array<double, N_PARAMS_GAUSS2D> values_base{1., 1., 1., 1., 1., 1.};
452
453 for (size_t idx_param = 0; idx_param < N_PARAMS_GAUSS2D; ++idx_param) {
454 const size_t& order_param = IDX_ORDER[idx_param];
455 // The parameters must be in the same order as returned by get_parameters(_const)
456 const auto& param = params.at(idx_param).get();
457 if (param.get_fixed()) {
458 values_base[order_param] = 0;
459 } else {
460 const auto deriv = param.get_transform_derivative();
461 if (deriv == 0)
462 throw std::runtime_error("Param[idx=" + std::to_string(idx_param) + "]=" + param.str()
463 + " get_transform_derivative=0 (will result in divide by 0)");
464 values_base[order_param] /= deriv;
465 }
466 }
467
468 const auto& subcomps = _gaussians.at(channel);
469 for (size_t idx_g = 0; idx_g < _sersicindex->get_order(); ++idx_g) {
470 const auto& subcomp = subcomps[idx_g];
471 auto& values = factors[index + idx_g];
472 values[0] = values_base[0];
473 values[1] = values_base[1];
474 values[2] = values_base[2] * subcomp->get_integralmodel().get_integralratio();
475 const double sizeratio = subcomp->get_ellipse().get_sizeratio();
476 values[3] = values_base[3] * sizeratio;
477 values[4] = values_base[4] * sizeratio;
478 values[5] = values_base[5];
479 }
480}
481
482void SersicMixComponent::set_sersicindex(double value) { this->_sersicindex->set_value(value); }
483
484std::string SersicMixComponent::repr(bool name_keywords, std::string_view namespace_separator) const {
485 return type_name_str<SersicMixComponent>(false, namespace_separator) + "("
486 + EllipticalComponent::repr(name_keywords, namespace_separator) + ", "
487 + (name_keywords ? "sersicindex=" : "") + _sersicindex->repr(name_keywords, namespace_separator)
488 + ")";
489}
490
492 return type_name_str<SersicMixComponent>(true) + "(" + EllipticalComponent::str()
493 + ", sersicindex=" + _sersicindex->str() + ")";
494}
495
496} // namespace lsst::gauss2d::fit
table::Key< table::Array< int > > components
table::Key< int > transform
T at(T... args)
Interface for an object storing Ellipse data.
Definition ellipse.h:132
An observational channel, usually representing some range of wavelengths of light.
Definition channel.h:29
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
std::string str() const override
Return a brief, human-readable string representation of this.
Definition channel.cc:104
A Component with an elliptically-symmetric intensity profile.
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.
std::shared_ptr< CentroidParameters > _centroid
ParamCRefs & get_parameters_const(ParamCRefs &params, ParamFilter *filter=nullptr) const override
Same as get_parameters(), but for const refs.
std::shared_ptr< IntegralModel > _integralmodel
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
std::shared_ptr< ParametricEllipse > _ellipse
const IntegralModel & get_integralmodel() const override
A single-channel GaussianIntegral referencing a Parametric IntegralModel.
const std::shared_ptr< const IntegralModel > _integralmodel
A Parametric model for the integral of a 2D distribution.
A Parametric ellipse with two scale sizes.
void set_rho(double rho) override
Set the correlation parameter (rho)
void set_sigma_x(double sigma_x) override
Set the x-axis dispersion (sigma)
std::string str() const override
Return a brief, human-readable string representation of this.
std::array< double, 3 > get_xyr() const override
Get sigma_x, sigma_y, rho.
double get_sigma_y() const override
Get sigma_y.
SersicEllipseData(const std::shared_ptr< const ReffXParameterD > size_x, const std::shared_ptr< const ReffYParameterD > size_y, const std::shared_ptr< const RhoParameterD > rho, const std::shared_ptr< const SersicMixComponentIndexParameterD > sersicindex, unsigned short index)
void set_h(double hwhm_x, double hwhm_y, double rho) override
Set hwhm_x, hwhm_y, rho (half-width at half-max)
double get_sigma_x() const override
Get sigma_x.
void set_xyr(const std::array< double, 3 > &xyr) override
Set sigma_x, sigma_y, rho from an array.
std::string repr(bool name_keywords, std::string_view namespace_separator) const override
Return a full, callable string representation of this.
void set_sigma_y(double sigma_y) override
Set the y-axis dispersion (sigma)
double get_size_y() const override
Get the size_y value.
double get_size_x() const override
Get the size_x value.
void set(double sigma_x, double sigma_y, double rho) override
Set sigma_x, sigma_y, rho.
double get_rho() const override
Get rho.
void set_hxyr(const std::array< double, 3 > &hxyr) override
Set hwhm_x, hwhm_y, rho from an array.
std::unique_ptr< const lsst::gauss2d::Gaussians > get_gaussians(const Channel &channel) const
SersicMixGaussianComponent(std::shared_ptr< SersicEllipseData > ellipsedata=nullptr, std::shared_ptr< CentroidParameters > centroid=nullptr, std::shared_ptr< SersicModelIntegral > integralmodel=nullptr)
void set_extra_param_factors(const Channel &channel, ExtraParamFactors &factors, size_t index) const override
Set extra Parameter gradient factors in an existing map.
std::string str() const override
Return a brief, human-readable string representation of this.
std::unique_ptr< const lsst::gauss2d::Gaussians > get_gaussians(const Channel &channel) const override
Return the vector of Gaussian sub-components controlled by this model.
void set_grad_param_factors(const Channel &channel, GradParamFactors &factors, size_t index) const override
Set Parameter gradient factors in an existing map.
void add_extra_param_map(const Channel &channel, ExtraParamMap &map_extra, const GradParamMap &map_grad, ParameterMap &offsets) const override
Add extra Parameter indices to a map.
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()
SersicMixComponent(std::shared_ptr< SersicParametricEllipse > ellipse=nullptr, std::shared_ptr< CentroidParameters > centroid=nullptr, std::shared_ptr< IntegralModel > integralmodel=nullptr, std::shared_ptr< SersicMixComponentIndexParameterD > sersicindex=nullptr)
void add_extra_param_factors(const Channel &channel, ExtraParamFactors &factors) const override
Add extra Parameter gradient factors to an existing vector.
ParamCRefs & get_parameters_const(ParamCRefs &params, ParamFilter *filter=nullptr) const override
Same as get_parameters(), but for const refs.
void add_grad_param_map(const Channel &channel, GradParamMap &map, ParameterMap &offsets) const override
Add Parameter gradient indices to an existing map.
void add_grad_param_factors(const Channel &channel, GradParamFactors &factor) const override
Add Parameter gradient factors to an existing map.
size_t get_n_gaussians(const Channel &channel) const override
Return the number of Gaussian sub-components controlled by this model.
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_deriv(unsigned short index) const
Return the integral ratio derivative for a given Gaussian sub-component index.
SersicMixComponentIndexParameterD(double value=_get_default(), std::shared_ptr< const parameters::Limits< double > > limits=nullptr, std::shared_ptr< const parameters::Transform< double > > transform=nullptr, std::shared_ptr< const parameters::Unit > unit=nullptr, bool fixed=false, std::string label="", std::shared_ptr< const SersicMixInterpolator > interpolator=nullptr)
See docs for Parameter.
const parameters::Limits< double > & get_limits_maximal() const override
Return limits representing the maximum/minimum untransformed value.
double get_integralratio(unsigned short index) const
Return the integral ratio for a given Gaussian sub-component index.
void set_value_transformed(double value_transformed) override
static std::shared_ptr< const SersicMixInterpolator > get_interpolator_default(unsigned short order=SERSICMIX_ORDER_DEFAULT)
double get_sizeratio_deriv(unsigned short index) const
Return the size ratio derivative for a given Gaussian sub-component index.
std::string str() const override
Return a brief, human-readable string representation of this.
ParamCRefs & get_parameters_const(ParamCRefs &params, ParamFilter *filter=nullptr) const override
Same as get_parameters(), but for const refs.
std::vector< std::reference_wrapper< const Channel > > get_channels() const override
Get the set of channels this instance is applicable for.
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
double get_integral(const Channel &channel) const override
Get the value of the integral in a single Channel.
SersicModelIntegral(const Channel &channel, const std::shared_ptr< const IntegralModel > integralmodel, const std::shared_ptr< const SersicMixComponentIndexParameterD > sersicindex, unsigned short index)
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.
std::string repr(bool name_keywords, std::string_view namespace_separator) const override
Return a full, callable string representation of this.
A workaround class to store a SersicParametricEllipse.
std::shared_ptr< SersicParametricEllipse > _ellipsedata
Range-based limits for parameter values.
Definition limits.h:45
virtual void set_value(T value)=0
Set the untransformed value for this parameter instance.
virtual void set_value_transformed(T value_transformed)=0
Set the transformed value for this parameter instance.
T get_value() const override
Return the untransformed value of this parameter instance.
Definition parameter.h:256
void set_limits(std::shared_ptr< const Limits< T > > limits) override
Set the limits for this parameter instance.
Definition parameter.h:266
std::string str() const override
Return a brief, human-readable string representation of this.
Definition parameter.h:321
A reversible transformation of a real scalar value.
Definition transform.h:45
T move(T... args)
void insert_param(g2f::ParamBase &param, t &params, ParamFilter *filter=nullptr)
Add a Parameter to a vector thereof, if it meets conditions.
const std::shared_ptr< const SersicMixInterpolator > get_sersic_mix_interpolator_default(unsigned short order=SERSICMIX_ORDER_DEFAULT)
Definition sersicmix.cc:38
const size_t N_PARAMS_GAUSS2D
Definition evaluate.h:61
STL namespace.
T push_back(T... args)
T size(T... args)
Options for filtering Parameter instances.
std::optional< std::reference_wrapper< const Channel > > channel
T to_string(T... args)
table::Key< int > order