lsst.gauss2d.fit
g199a45376c+7362695278
Toggle main menu visibility
Loading...
Searching...
No Matches
param_filter.h
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
10
namespace
g2f = lsst::gauss2d::fit;
11
12
namespace
lsst::gauss2d::fit {
13
17
struct
ParamFilter
{
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
33
template
<
typename
t>
34
inline
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
45
template
<
typename
t>
46
void
insert_param_channel(
const
lsst::gauss2d::fit::Channel
& channel, g2f::ParamBase& param, t& params,
47
ParamFilter* filter) {
48
if
((filter ==
nullptr
) || (filter->channel == std::nullopt) || (filter->channel == channel)) {
49
insert_param(param, params, filter);
50
}
51
}
52
54
template
<
typename
t>
55
inline
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
63
template
<
typename
t>
64
inline
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
lsst::gauss2d::fit::Channel
An observational channel, usually representing some range of wavelengths of light.
Definition
channel.h:29
lsst::gauss2d::fit::ParamFilter
Definition
param_filter.h:17
include
lsst
gauss2d
fit
param_filter.h
Generated by
1.17.0