Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04dff08e69+fafbcb10e2,g0d33ba9806+e09a96fa4e,g0fba68d861+cc01b48236,g1e78f5e6d3+fb95f9dda6,g1ec0fe41b4+f536777771,g1fd858c14a+ae46bc2a71,g35bb328faa+fcb1d3bbc8,g4af146b050+dd94f3aad7,g4d2262a081+7ee6f976aa,g53246c7159+fcb1d3bbc8,g5a012ec0e7+b20b785ecb,g60b5630c4e+e09a96fa4e,g6273192d42+bf8cfc5e62,g67b6fd64d1+4086c0989b,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g87b7deb4dc+831c06c8fc,g8852436030+54b48a5987,g89139ef638+4086c0989b,g9125e01d80+fcb1d3bbc8,g94187f82dc+e09a96fa4e,g989de1cb63+4086c0989b,g9f33ca652e+64be6d9d51,g9f7030ddb1+d11454dffd,ga2b97cdc51+e09a96fa4e,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+23605820ec,gb58c049af0+f03b321e39,gb89ab40317+4086c0989b,gcf25f946ba+54b48a5987,gd6cbbdb0b4+af3c3595f5,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+15f2daff9d,ge278dab8ac+d65b3c2b70,ge410e46f29+4086c0989b,gf67bdafdda+4086c0989b,v29.0.0.rc5
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
param_filter.h
Go to the documentation of this file.
1#ifndef LSST_GAUSS2D_FIT_PARAM_FILTER_H
2#define LSST_GAUSS2D_FIT_PARAM_FILTER_H
3
4#include <cstddef>
5#include <optional>
6
7#include "channel.h"
8#include "param_defs.h"
9
10namespace g2f = lsst::gauss2d::fit;
11
12namespace lsst::gauss2d::fit {
13
18 bool fixed = true;
19 bool free = true;
20 bool linear = true;
21 bool nonlinear = true;
22 std::optional<std::reference_wrapper<const Channel>> channel = std::nullopt;
23};
24
33template <typename t>
34inline void insert_param(g2f::ParamBase& param, t& params, ParamFilter* filter = nullptr) {
35 bool is_fixed = param.get_fixed();
36 bool is_linear = param.get_linear();
37 if ((filter == nullptr)
38 || (((is_fixed == filter->fixed) || (is_fixed != filter->free))
39 && ((is_linear == filter->linear) || (is_linear != filter->nonlinear)))) {
40 params.insert(params.end(), param);
41 }
42}
43
45template <typename t>
47 ParamFilter* filter) {
48 if ((filter == nullptr) || (filter->channel == std::nullopt) || (filter->channel == channel)) {
49 insert_param(param, params, filter);
50 }
51}
52
54template <typename t>
55inline void insert_params_ref(const t& params_in, t& params_out, ParamFilter* filter = nullptr) {
56 if (filter != nullptr)
57 for (auto& p : params_in) insert_param<t>(p.get(), params_out, filter);
58 else
59 for (auto& p : params_in) params_out.push_back(p);
60}
61
63template <typename t>
64inline void insert_params(const t params_in, t& params_out, ParamFilter* filter = nullptr) {
65 insert_params_ref<t>(params_in, params_out, filter);
66}
67
68} // namespace lsst::gauss2d::fit
69#endif // GAUSS2D_FIT_PARAM_FILTER_H
An observational channel, usually representing some range of wavelengths of light.
Definition channel.h:29
virtual bool get_fixed() const =0
Return whether the parameter is fixed (not free).
virtual bool get_linear() const =0
Return whether the parameter is linear.
void insert_param(g2f::ParamBase &param, t &params, ParamFilter *filter=nullptr)
Add a Parameter to a vector thereof, if it meets conditions.
void insert_params(const t params_in, t &params_out, ParamFilter *filter=nullptr)
Same as insert_param, but inserting from a collection of Parameter instances.
void insert_params_ref(const t &params_in, t &params_out, ParamFilter *filter=nullptr)
Same as insert_param, but inserting from a (ref to a) collection of Parameter instances.
lsst::modelfit::parameters::ParameterBase< double > ParamBase
Definition param_defs.h:9
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.
Options for filtering Parameter instances.
std::optional< std::reference_wrapper< const Channel > > channel