Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04a91732dc+cc8870d3f5,g07dc498a13+5aa0b8792f,g0fba68d861+80045be308,g1409bbee79+5aa0b8792f,g1a7e361dbc+5aa0b8792f,g1fd858c14a+f64bc332a9,g208c678f98+1ae86710ed,g35bb328faa+fcb1d3bbc8,g4d2262a081+47ad8a29a8,g4d39ba7253+9633a327c1,g4e0f332c67+5d362be553,g53246c7159+fcb1d3bbc8,g60b5630c4e+9633a327c1,g668ecb457e+25d63fd678,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8852436030+8b64ca622a,g89139ef638+5aa0b8792f,g89e1512fd8+04325574d3,g8d6b6b353c+9633a327c1,g9125e01d80+fcb1d3bbc8,g989de1cb63+5aa0b8792f,g9f33ca652e+b196626af7,ga9baa6287d+9633a327c1,gaaedd4e678+5aa0b8792f,gabe3b4be73+1e0a283bba,gb1101e3267+71e32094df,gb58c049af0+f03b321e39,gb90eeb9370+2807b1ad02,gcf25f946ba+8b64ca622a,gd315a588df+a39986a76f,gd6cbbdb0b4+c8606af20c,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+4e42d81ab7,ge278dab8ac+932305ba37,ge82c20c137+76d20ab76d,gfe73954cf8+a1301e4c20,w.2025.11
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
linearintegralmodel.cc
Go to the documentation of this file.
2
6#include "lsst/gauss2d/fit/parameters.h"
8
9namespace lsst::gauss2d::fit {
10
11// not giving a nullptr default because users should explicitly use the null Channel
13 if (data_in != nullptr) {
14 size_t idx = 0;
15 for (const auto& datum : *data_in) {
16 if (datum.second == nullptr) {
17 throw std::runtime_error("LinearIntegralModel data[" + std::to_string(idx)
18 + "] can't be null");
19 }
20 if (_map.find(datum.first) != _map.end()) {
21 throw std::runtime_error("LinearIntegralModel data[" + std::to_string(idx)
22 + "] channel=" + datum.first.get().str() + " duplicated");
23 }
24 _data.emplace_back(datum.first, datum.second);
25 _map.insert(_data.back());
26 idx++;
27 }
28 } else {
30 _map.insert(_data.back());
31 }
32}
34
37 for (auto& datum : _data) rval.emplace_back(datum.first);
38 return rval;
39}
40
41double LinearIntegralModel::get_integral(const Channel& channel) const {
42 return _map.at(channel)->get_value();
43}
44
47 return {};
48}
49
51 return _map.at(channel);
52}
53
55 return _map.at(channel);
56}
57
58typename LinearIntegralModel::Data::iterator LinearIntegralModel::begin() noexcept { return _data.begin(); }
59typename LinearIntegralModel::Data::const_iterator LinearIntegralModel::cbegin() const noexcept {
60 return _data.begin();
61}
62
63typename LinearIntegralModel::Data::iterator LinearIntegralModel::end() noexcept { return _data.end(); }
64typename LinearIntegralModel::Data::const_iterator LinearIntegralModel::cend() const noexcept {
65 return _data.cend();
66}
67
69 for (const auto& p : _data) insert_param_channel(p.first, *p.second, params, filter);
70 return params;
71}
73 for (const auto& p : _data) insert_param_channel(p.first, *p.second, params, filter);
74 return params;
75}
76
77size_t LinearIntegralModel::size() const { return _data.size(); }
78
79std::string LinearIntegralModel::repr(bool name_keywords, std::string_view namespace_separator) const {
80 std::string s = type_name_str<LinearIntegralModel>(false, namespace_separator) + "("
81 + (name_keywords ? "data=" : "") + "{";
82 for (const auto& datum : _data) {
83 s += datum.first.get().repr(name_keywords, namespace_separator) + ": "
84 + datum.second->repr(name_keywords, namespace_separator) + ",";
85 }
86 return s + "})";
87}
88
91 for (const auto& datum : _data) {
92 s += datum.first.get().str() + ": " + datum.second->str() + ",";
93 }
94 return s + "})";
95}
96
97} // namespace lsst::gauss2d::fit
T at(T... args)
An observational channel, usually representing some range of wavelengths of light.
Definition channel.h:29
static const Channel & NONE()
Definition channel.cc:111
LinearIntegralModel(const Data *data_in)
Construct a LinearIntegralModel from input Data.
Data::const_iterator cbegin() const noexcept
ParamCRefs & get_parameters_const(ParamCRefs &params, ParamFilter *filter=nullptr) const override
Same as get_parameters(), but for const refs.
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.
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(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.
std::vector< ChannelIntegralParameterD > Data
Data::const_iterator cend() const noexcept
size_t size() const
Return the size of Data (number of Channel/IntegralParameterD instances)
T emplace_back(T... args)
T make_shared(T... args)
std::vector< ParamBaseRef > ParamRefs
Definition param_defs.h:13
std::vector< ParamBaseCRef > ParamCRefs
Definition param_defs.h:11
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.
std::string type_name_str(bool strip_namespace=false, std::string_view namespace_str=detail::NAMESPACE_SEPARATOR)
Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.
Definition type_name.h:104
T size(T... args)
Options for filtering Parameter instances.
T to_string(T... args)