SourceXtractorPlusPlus
0.19.2
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ModelFitting
src
lib
Parameters
ExpSigmoidConverter.cpp
Go to the documentation of this file.
1
23
#include <cmath>
24
#include <iostream>
25
26
#include <
ElementsKernel/Logging.h
>
27
28
#include "
ModelFitting/Parameters/ExpSigmoidConverter.h
"
29
30
namespace
ModelFitting
{
31
32
using namespace
std
;
33
34
static
Elements::Logging
logger
=
Elements::Logging::getLogger
(
"ModelFitting"
);
35
36
ExpSigmoidConverter::~ExpSigmoidConverter
() =
default
;
37
38
double
ExpSigmoidConverter::worldToEngine
(
const
double
world_value
)
const
{
39
if
(
world_value < m_min_value || world_value >
m_max_value
) {
40
logger
.warn() <<
"WorldToEngine ExpSigmoidConverter: world values outside of possible range"
;
41
}
42
43
auto
wv
=
std::max
(
m_min_value
,
std::min
(
m_max_value
,
world_value
));
44
return
log
(
log
(
wv
/
m_min_value
) /
log
(
m_max_value
/
wv
));
45
}
46
47
48
double
ExpSigmoidConverter::engineToWorld
(
const
double
engine_value
)
const
{
49
auto
clamped_value
=
std::max
(-50.0,
std::min
(50.0,
engine_value
));
50
return
m_min_value
*
exp
(
log
(
m_max_value
/
m_min_value
) / (1 +
exp
(-
clamped_value
)) );
51
}
52
53
double
ExpSigmoidConverter::getEngineToWorldDerivative
(
const
double
value)
const
{
54
return
value *
log
(value /
m_min_value
) *
log
(
m_max_value
/ value) /
log
(
m_max_value
/
m_min_value
);
55
}
56
57
58
}
// namespace ModelFitting
ExpSigmoidConverter.h
Logging.h
Elements::Logging
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
ModelFitting::ExpSigmoidConverter::engineToWorld
double engineToWorld(const double engine_value) const override
Engine to world coordinate converter.
Definition
ExpSigmoidConverter.cpp:48
ModelFitting::ExpSigmoidConverter::m_max_value
const double m_max_value
maximum model value in world coordinates
Definition
ExpSigmoidConverter.h:90
ModelFitting::ExpSigmoidConverter::~ExpSigmoidConverter
virtual ~ExpSigmoidConverter()
Destructor.
ModelFitting::ExpSigmoidConverter::m_min_value
const double m_min_value
minimum model value in world coordinates
Definition
ExpSigmoidConverter.h:87
ModelFitting::ExpSigmoidConverter::getEngineToWorldDerivative
double getEngineToWorldDerivative(const double value) const override
Definition
ExpSigmoidConverter.cpp:53
ModelFitting::ExpSigmoidConverter::worldToEngine
double worldToEngine(const double world_value) const override
World to engine coordinate converter.
Definition
ExpSigmoidConverter.cpp:38
std::exp
T exp(T... args)
std::function
std::log
T log(T... args)
std::max
T max(T... args)
std::min
T min(T... args)
ModelFitting
Definition
AsinhChiSquareComparator.h:30
ModelFitting::logger
static Elements::Logging logger
Definition
LevmarEngine.cpp:80
std
STL namespace.
Generated by
1.9.8