25 #include <boost/timer/timer.hpp>
51 namespace po = boost::program_options;
52 namespace fs = boost::filesystem;
54 using namespace ModelFitting;
55 using namespace SourceXtractor;
57 template <
typename ImageType>
83 template <
typename ImageType>
95 double getValue(
double x,
double y)
const override {
return 0.0; }
99 ImageType image = Traits::factory(size_x, size_y);
104 template <
typename ImageType>
116 double getValue(
double x,
double y)
const override {
return 0.0; }
120 ImageType image = Traits::factory(size_x, size_y);
124 Traits::at(image,
x,
y) =
x+
y;
133 template <
typename ImageType>
145 double getValue(
double x,
double y)
const override {
return 0.0; }
149 ImageType image = Traits::factory(size_x, size_y);
161 template <
typename ImageType>
173 double getValue(
double x,
double y)
const override {
return 0.0; }
177 ImageType image = Traits::factory(size_x, size_y);
215 int image_size = 256;
235 auto x_param = std::make_shared<ManualParameter>(128);
236 auto y_param = std::make_shared<ManualParameter>(128);
238 auto xs = std::make_shared<ManualParameter>(1);
239 auto ys = std::make_shared<ManualParameter>(1);
241 auto rot = std::make_shared<ManualParameter>(0);
242 auto dev_n = std::make_shared<ManualParameter>(4);
243 auto dev_k = std::make_shared<ManualParameter>(10);
244 auto dev_i0 = std::make_shared<ManualParameter>(1000);
247 auto exp = Euclid::make_unique<SersicModelComponent>(Euclid::make_unique<OldSharp>(), dev_i0, dev_n, dev_k);
248 component_list.clear();
251 std::move(component_list), xs, ys, rot, 256, 256, x_param, y_param));
255 int image_size = 256;
274 auto x_param = std::make_shared<ManualParameter>(128);
275 auto y_param = std::make_shared<ManualParameter>(128);
277 auto xs = std::make_shared<ManualParameter>(1);
278 auto ys = std::make_shared<ManualParameter>(1);
280 auto rot = std::make_shared<ManualParameter>(0);
281 auto n = std::make_shared<ManualParameter>(4);
282 auto k = std::make_shared<ManualParameter>(10);
283 auto i0 = std::make_shared<ManualParameter>(1000);
285 auto flux = std::make_shared<ManualParameter>(100000);
289 xs, ys, rot, 256, 256, x_param, y_param, flux,
std::make_tuple(1, 0, 0, 1)));
292 int image_size = 256;
312 auto x_param = std::make_shared<ManualParameter>(128);
313 auto y_param = std::make_shared<ManualParameter>(128);
315 auto xs = std::make_shared<ManualParameter>(1);
316 auto ys = std::make_shared<ManualParameter>(1);
318 auto rot = std::make_shared<ManualParameter>(0);
319 auto n = std::make_shared<ManualParameter>(4);
320 auto k = std::make_shared<ManualParameter>(10);
321 auto i0 = std::make_shared<ManualParameter>(1000);
324 xs, ys, rot, 256, 256, x_param, y_param));
327 int image_size = 256;
345 for (
int i=0; i<iterations; i++) {
346 frame_model.rasterToImage(image);
355 int iterations = 300;
357 auto empty_frame_model = makeEmptyFrameModel();
358 auto dummy_frame_model = makeDummyFrameModel<DummyModel<ImageInterfaceTypePtr>>();
359 auto dummy_fill_frame_model = makeDummyFrameModel<DummyFillModel<ImageInterfaceTypePtr>>();
360 auto dummy_exp_frame_model = makeDummyFrameModel<DummyExpModel<ImageInterfaceTypePtr>>();
361 auto dummy_sersic_frame_model = makeDummyFrameModel<DummySersicModel<ImageInterfaceTypePtr>>();
362 auto sersic_frame_model = makeSersicFrameModel();
363 auto compact_frame_model = makeCompactSersicFrameModel();
365 logger.
info() <<
"Testing with empty frame";
367 boost::timer::auto_cpu_timer t;
368 measureRasterToImage(iterations, empty_frame_model);
370 logger.
info() <<
"Testing with dummy (nop) model";
372 boost::timer::auto_cpu_timer t;
373 measureRasterToImage(iterations, dummy_frame_model);
375 logger.
info() <<
"Testing with dummy (fill) model";
377 boost::timer::auto_cpu_timer t;
378 measureRasterToImage(iterations, dummy_fill_frame_model);
380 logger.
info() <<
"Testing with dummy (fill exp) model";
382 boost::timer::auto_cpu_timer t;
383 measureRasterToImage(iterations, dummy_exp_frame_model);
385 logger.
info() <<
"Testing with dummy (sersic) model";
387 boost::timer::auto_cpu_timer t;
388 measureRasterToImage(iterations, dummy_sersic_frame_model);
390 logger.
info() <<
"Testing with old style Sersic model";
392 boost::timer::auto_cpu_timer t;
393 measureRasterToImage(iterations, sersic_frame_model);
395 logger.
info() <<
"Testing with compact Sersic model";
397 boost::timer::auto_cpu_timer t;
398 measureRasterToImage(iterations, compact_frame_model);
double getValue(double x, double y) const override
std::shared_ptr< VectorImage< SourceXtractor::SeFloat > > getScaledKernel(double) const
ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override
void info(const std::string &logMessage)
FrameModel< DummyPsf< ImageInterfaceTypePtr >, ImageInterfaceTypePtr > makeSersicFrameModel()
FrameModel< DummyPsf< ImageInterfaceTypePtr >, ImageInterfaceTypePtr > makeCompactSersicFrameModel()
static Elements::Logging logger
DummyFillModel(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< VectorImage< SourceXtractor::SeFloat > > m_kernel
std::shared_ptr< VectorImage< SeFloat > > measureRasterToImage(int iterations, T &frame_model)
#define MAIN_FOR(ELEMENTS_PROGRAM_NAME)
double getValue(double x, double y) const override
FrameModel< DummyPsf< ImageInterfaceTypePtr >, ImageInterfaceTypePtr > makeDummyFrameModel()
FrameModel< DummyPsf< ImageInterfaceTypePtr >, ImageInterfaceTypePtr > makeEmptyFrameModel()
DummyExpModel(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)
void convolve(ImageType &) const
DummySersicModel(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::size_t getSize() const
double getValue(double x, double y) const override
double getPixelScale() const
ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override
DummyModel(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)
Elements::ExitCode mainMethod(std::map< std::string, po::variable_value > &args) override
static Logging getLogger(const std::string &name="")
ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override
double getValue(double x, double y) const override
ImageType getRasterizedImage(double pixel_scale, std::size_t size_x, std::size_t size_y) const override