SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
CompactExponentialModel.h
Go to the documentation of this file.
1/*
2 * CompactExponentialModel.h
3 *
4 * Created on: Aug 19, 2019
5 * Author: mschefer
6 */
7
8#ifndef _MODELFITTING_MODELS_COMPACTEXPONENTIALMODEL_H_
9#define _MODELFITTING_MODELS_COMPACTEXPONENTIALMODEL_H_
10
12
13namespace ModelFitting {
14
15template <typename ImageType>
16class CompactExponentialModel : public CompactModelBase<ImageType> {
17
18public:
22 std::shared_ptr<BasicParameter> rotation, double width, double height,
26
27 virtual ~CompactExponentialModel() = default;
28
29 double getValue(double x, double y) const override;
31
32private:
33 using CompactModelBase<ImageType>::getMaxRadiusSqr;
35 using CompactModelBase<ImageType>::m_jacobian;
36 using CompactModelBase<ImageType>::samplePixel;
38 using CompactModelBase<ImageType>::renormalize;
39
42 double i0, k;
43 double max_r_sqr;
44
45 inline float evaluateModel(float x, float y) const {
46 float x2 = x * transform[0] + y * transform[1];
47 float y2 = x * transform[2] + y * transform[3];
48 float r_sqr = x2*x2 + y2*y2;
49 if (r_sqr < max_r_sqr) {
50 float r = std::sqrt(r_sqr);
51 return float(i0) * std::exp(float(-k * r));
52 } else {
53 return 0;
54 }
55 }
56 };
57
59
60 // Exponential parameters
64};
65
66}
67
69
70#endif /* _MODELFITTING_MODELS_COMPACTEXPONENTIALMODEL_H_ */
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
const double pixel_scale
Definition TestImage.cpp:74
virtual ~CompactExponentialModel()=default
std::shared_ptr< BasicParameter > m_k
std::shared_ptr< BasicParameter > m_i0
CompactExponentialModel(double sharp_radius, std::shared_ptr< BasicParameter > i0, std::shared_ptr< BasicParameter > k, std::shared_ptr< BasicParameter > x_scale, std::shared_ptr< BasicParameter > y_scale, std::shared_ptr< BasicParameter > rotation, double width, double height, std::shared_ptr< BasicParameter > x, std::shared_ptr< BasicParameter > y, std::shared_ptr< BasicParameter > flux, std::tuple< double, double, double, double > transform)
double getValue(double x, double y) const override
std::shared_ptr< BasicParameter > m_flux
ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override
float samplePixel(const ModelEvaluator &model_eval, int x, int y, unsigned int subsampling) const
void renormalize(ImageType &image, double flux) const
double getMaxRadiusSqr(std::size_t size_x, std::size_t size_y, const Mat22 &transform) const
Mat22 getCombinedTransform(double pixel_scale) const
float adaptiveSamplePixel(const ModelEvaluator &model_eval, int x, int y, unsigned int max_subsampling, float threshold=1.1) const
T exp(T... args)
T sqrt(T... args)
T transform(T... args)