SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
TestImage.cpp
Go to the documentation of this file.
1
17/*
18 * TestImage.cpp
19 *
20 * Created on: Jul 12, 2017
21 * Author: mschefer
22 */
23
24#include "ElementsKernel/ProgramHeaders.h"
25
26
27#include <iostream>
28#include <fstream>
29#include <tuple>
30#include <vector>
31#include <valarray>
32#include <numeric>
33
34#include <cstdlib>
35#include <ctime>
36
37#include <boost/any.hpp>
38#include <boost/random.hpp>
39
40#include <CCfits/CCfits>
41
42#include "AlexandriaKernel/memory_tools.h"
43
52
65
66
67namespace po = boost::program_options;
68namespace fs = boost::filesystem;
69
70using namespace SourceXtractor;
71using namespace ModelFitting;
73
74const double pixel_scale = 1.0;
75
76const double gal_exp_min_i0 = 100000;
77const double gal_exp_max_i0 = 100001;
78const double gal_dev_min_i0 = 100000;
79const double gal_dev_max_i0 = 100001;
80
87
88//
89class DummyWCS : public CoordinateSystem {
90public:
91 DummyWCS(int image_width, int image_height, double rotation, double scale, double shift_x, double shift_y)
92 : m_image_width(image_width), m_image_height(image_height),
93 m_rotation(rotation), m_scale(1.0/scale), m_shift_x(shift_x), m_shift_y(shift_y) {}
94 virtual ~DummyWCS() {}
95
96 WorldCoordinate imageToWorld(ImageCoordinate image_coordinate) const override {
97 return WorldCoordinate(image_coordinate.m_x, image_coordinate.m_y);
98 }
99
100 ImageCoordinate worldToImage(WorldCoordinate world_coordinate) const override {
101 return ImageCoordinate(world_coordinate.m_alpha, world_coordinate.m_delta);
102 }
103
105 auto c = cos(m_rotation);
106 auto s = sin(m_rotation);
107
108 return {
109 {"CTYPE1", "'RA---TAN'"},
110 {"CTYPE2", "'DEC--TAN'"},
111 {"CUNIT1", "'deg'"},
112 {"CUNIT2", "'deg'"},
113 {"RADSYS", "'ICRS'"},
114 {"WCSAXES", "2"},
115 {"LATPOLE", std::to_string(10.0)},
116 {"LONPOLE", std::to_string(180.0)},
117 {"CDELT1", std::to_string(1.0)},
118 {"CDELT2", std::to_string(1.0)},
119 {"CRVAL1", std::to_string(10.0)},
120 {"CRVAL2", std::to_string(10.0)},
121 {"CRPIX1", std::to_string(m_image_width / 2.0 + 1.5 + m_shift_x)},
122 {"CRPIX2", std::to_string(m_image_height / 2.0 + 1.5 + m_shift_y)},
123
124 {"PC1_1", std::to_string(0.001 * c * m_scale)},
125 {"PC1_2", std::to_string(0.001 * s * m_scale)},
126 {"PC2_1", std::to_string(0.001 * -s * m_scale)},
127 {"PC2_2", std::to_string(0.001 * c * m_scale)}
128 };
129 }
130
131private:
133 double m_rotation = 0.0;
134 double m_scale = 1.0;
135 double m_shift_x = 0.0;
136 double m_shift_y = 0.0;
137};
138
139template <typename ImageType>
140class DummyPsf {
141public:
142 DummyPsf() : m_kernel(VectorImage<SeFloat>::create(1, 1)) {}
143
144 double getPixelScale() const {
145 return 1.0;
146 }
147
149 return 1;
150 }
151
155
156 void convolve(ImageType& /*image*/) const {
157 }
158
159private:
161
162};
163
165
166public:
167
168 po::options_description defineSpecificProgramOptions() override {
169 po::options_description config_options { "TestImage options" };
170
171 // Add the specific program options
172 config_options.add_options()
173 ("output", po::value<string>()->required(), "filename to save the created test image")
174 ("output-weight", po::value<string>()->default_value(""), "filename to save the created weight map image")
175 ("size", po::value<double>()->default_value(512.0), "image size")
176 ("bg-level", po::value<double>()->default_value(0.0), "background level")
177 ("bg-sigma", po::value<double>()->default_value(20.0), "standard deviation of background gaussian noise")
178 ("gain", po::value<double>()->default_value(0.0), "gain in e-/adu, 0 for infinite gain")
179 ("saturation", po::value<double>()->default_value(0.0), "image saturation level, 0 for no saturation")
180 ("psf-file", po::value<string>()->default_value(""), "Psf file for convolution")
181 ("psf-fwhm", po::value<double>()->default_value(5.0),
182 "Full width half maximum for generated gaussian psf (used when no psf file is provided)")
183 ("psf-scale", po::value<double>()->default_value(0.2), "Pixel scale for generated gaussian psf")
184 ("disable-psf", po::bool_switch(), "Disable psf convolution")
185 ("random-sources", po::value<int>()->default_value(0), "Nb of random sources to add")
186 ("source-list", po::value<string>()->default_value(""), "Use sources from file")
187 ("source-catalog", po::value<string>()->default_value(""), "Use sources from file (skymaker format)")
188 ("zero-point", po::value<double>()->default_value(0.0), "Zero point for magnitudes in catalog")
189 ("exposure-time", po::value<double>()->default_value(300.), "Exposure time for objects in catalog")
190 ("save-sources", po::value<string>()->default_value(""), "Filename to save final list of sources")
191 ("bad-pixels", po::value<double>()->default_value(0.0), "Probability for a pixel to be a bad pixel")
192 ("bad-columns", po::value<double>()->default_value(0.0), "Probability for a column of pixels to be bad")
193 ("rotation", po::value<double>()->default_value(0.0), "Rotate sources around middle point")
194 ("scale", po::value<double>()->default_value(1.0), "Scale factor")
195 ("shift-x", po::value<double>()->default_value(0.0), "Shift X")
196 ("shift-y", po::value<double>()->default_value(0.0), "Shift Y")
197 ("model-size", po::value<double>()->default_value(0.0), "Model size for the rasterization of sources, defaults to size")
198 ("max-tile-memory", po::value<int>()->default_value(512), "Maximum memory used for image tiles cache in megabytes")
199 ("tile-size", po::value<int>()->default_value(256), "Image tiles size in pixels")
200 ("copy-coordinate-system", po::value<string>()->default_value(""), "Copy the coordinate system from another FITS file")
201 ;
202
203 return config_options;
204 }
205
207 auto x_param = std::make_shared<ManualParameter>(source.x);
208 auto y_param = std::make_shared<ManualParameter>(source.y);
209
210 if (source.exp_flux > 0.0) {
211 // Exponential component
212
213 // Parameters
217 auto exp_n = std::make_shared<ManualParameter>(1);
218
219 auto exp_k = std::make_shared<ManualParameter>(1.7 / source.exp_rad);
221 source.exp_flux / (M_PI * 2.0 * 0.346 * source.exp_rad * source.exp_rad * source.exp_aspect));
222
223 // Model
226 component_list.clear();
227 component_list.emplace_back(std::move(exp));
229 std::move(component_list), xs, ys, rot, size, size, x_param, y_param, jacobian));
230 }
231
232 if (source.dev_flux > 0.0) {
233 // Devaucouleurs component
237 auto dev_n = std::make_shared<ManualParameter>(4);
238
239 auto dev_k = std::make_shared<ManualParameter>(pow(3459.0 / source.dev_rad, .25));
241 source.dev_flux * pow(10, 3.33) / (7.2 * M_PI * source.dev_rad * source.dev_rad * source.dev_aspect));
242
245 component_list.clear();
246 component_list.emplace_back(std::move(exp));
248 std::move(component_list), xs, ys, rot, size, size, x_param, y_param, jacobian));
249 }
250
251 if (source.point_flux > 0.0) {
252 auto flux_param = std::make_shared<ManualParameter>(source.point_flux);
253 point_models.emplace_back(x_param, y_param, flux_param);
254 }
255 }
256
257 void addPointSource(std::vector<PointModel>& point_models, double x, double y, double flux) {
258 auto x_param = std::make_shared<ManualParameter>(x);
259 auto y_param = std::make_shared<ManualParameter>(y);
260 auto flux_param = std::make_shared<ManualParameter>(flux);
261
262 point_models.emplace_back(x_param, y_param, flux_param);
263 }
264
265 void addBackgroundNoise(std::shared_ptr<WriteableImage<SeFloat>> image, double background_level, double background_sigma) {
266 // Add noise
267 ImageAccessor<SeFloat> accessor(image);
268 boost::random::normal_distribution<> bg_noise_dist(background_level, background_sigma);
269 for (int y=0; y < image->getHeight(); y++) {
270 for (int x=0; x < image->getWidth(); x++) {
271 // background (gaussian) noise
272 image->setValue(x, y, accessor.getValue(x, y) + bg_noise_dist(m_rng));
273 }
274 }
275 }
276
278 // Add noise
279 ImageAccessor<SeFloat> accessor(image);
280 if (gain > 0.0) {
281 for (int y=0; y < image->getHeight(); y++) {
282 for (int x=0; x < image->getWidth(); x++) {
283 auto pixel_value = accessor.getValue(x, y);
284 if (pixel_value > 0.) {
285 image->setValue(x, y, boost::random::poisson_distribution<>(pixel_value * gain)(m_rng) / gain);
286 }
287 }
288 }
289 }
290 }
291
292 void saturate(std::shared_ptr<WriteableImage<SeFloat>> image, double saturation_level) {
293 ImageAccessor<SeFloat> accessor(image);
294 if (saturation_level > 0.0) {
295 for (int y=0; y < image->getHeight(); y++) {
296 for (int x=0; x < image->getWidth(); x++) {
297 image->setValue(x, y, std::min(accessor.getValue(x, y), (float) saturation_level));
298 }
299 }
300 }
301 }
302
303 void addBadPixels(std::shared_ptr<WriteableImage<SeFloat>> weight_map, double probability) {
304 if (probability>0) {
305 for (int y=0; y < weight_map->getHeight(); y++) {
306 for (int x=0; x < weight_map->getWidth(); x++) {
307 if (boost::random::uniform_01<double>()(m_rng) < probability) {
308 weight_map->setValue(x, y, 0);
309 }
310 }
311 }
312 }
313 }
314
315 void addBadColumns(std::shared_ptr<WriteableImage<SeFloat>> weight_map, double probability) {
316 if (probability>0) {
317 for (int x=0; x < weight_map->getWidth(); x++) {
318 if (boost::random::uniform_01<double>()(m_rng) < probability) {
319 for (int y=0; y < weight_map->getHeight(); y++) {
320 weight_map->setValue(x, y, 0);
321 }
322 }
323 }
324 }
325 }
326
328 double x_min, double y_min, double x_max, double y_max) {
330
331// std::cout << x_min << " " << x_max << " " << y_min << " " << y_max << "\n";
332//
333 boost::random::uniform_real_distribution<> random_x(x_min, x_max);
334 boost::random::uniform_real_distribution<> random_y(y_min, y_max);
335 boost::random::uniform_real_distribution<> gal_exp_random_i0(gal_exp_min_i0, gal_exp_max_i0);
336 boost::random::uniform_real_distribution<> gal_dev_random_i0(gal_dev_min_i0, gal_dev_max_i0);
337
338 for (int i = 0; i < number_of_sources; i++) {
339 //auto total_flux = gal_exp_random_i0(rng);
340 sources.push_back({
341 random_x(m_rng), random_y(m_rng),
342
343 gal_exp_random_i0(m_rng),
344 boost::random::uniform_real_distribution<>(.5, 6)(m_rng),
345 boost::random::uniform_real_distribution<>(.2, .8)(m_rng),
346 boost::random::uniform_real_distribution<>(-M_PI/2, M_PI/2)(m_rng),
347
348 0,0,1,0,
349// gal_dev_random_i0(m_rng),
350// boost::random::uniform_real_distribution<>(.1, .5)(m_rng),
351// boost::random::uniform_real_distribution<>(.8, 1)(m_rng),
352// boost::random::uniform_real_distribution<>(-M_PI/2, M_PI/2)(m_rng),
353
354 0
355 });
356 }
357
358 return sources;
359 }
360
363
364 std::ifstream file;
365 file.open(filename);
366
367 while (file.good()) {
368 std::string line;
369 std::getline(file, line);
370// line = std::regex_replace(line, std::regex("\\s+#.*"), std::string(""));
371// line = std::regex_replace(line, std::regex("\\s+$"), std::string(""));
372 if (line.size() == 0) {
373 continue;
374 }
375
376 std::stringstream linestream(line);
377
378 TestImageSource source;
379 linestream >> source.x >> source.y
380 >> source.exp_flux >> source.exp_rad >> source.exp_aspect >> source.exp_rot
381 >> source.dev_flux >> source.dev_rad >> source.dev_aspect >> source.dev_rot
382 >> source.point_flux;
383
384 source.exp_rot *= -M_PI / 180.0;
385 source.dev_rot *= -M_PI / 180.0;
386
387 sources.emplace_back(std::move(source));
388 }
389
390 return sources;
391 }
392
393 void saveSources(const std::vector<TestImageSource>& sources, const std::string& filename) {
394 std::ofstream file;
395 file.open(filename);
396
397 for (const auto& source : sources) {
398 file << source.x << " " << source.y << " "
399 << source.exp_flux << " " << source.exp_rad << " " << source.exp_aspect << " " << (source.exp_rot * -180.0 / M_PI) << " "
400 << source.dev_flux << " " << source.dev_rad << " " << source.dev_aspect << " " << (source.dev_rot * -180.0 / M_PI) << " "
401 << source.point_flux << "\n";
402 }
403 }
404
405 void transformSources(std::vector<TestImageSource>& sources, int image_size, double rot_angle, double scale, double shift_x, double shift_y) {
406 auto center = image_size / 2.0;
407 auto c = cos(rot_angle);
408 auto s = sin(rot_angle);
409 for (auto& source : sources) {
410 source.x -= center;
411 source.y -= center;
412 double x = (source.x * c - source.y * s) * scale + shift_x;
413 double y = (source.x * s + source.y * c) * scale + shift_y;
414 source.x = x + center;
415 source.y = y + center;
416
417 source.exp_rot -= rot_angle;
418 source.dev_rot -= rot_angle;
419 }
420 }
421
424
425 //std::cout << "^^\n";
426
427 std::ifstream file;
428 file.open(filename);
429
430 while (file.good()) {
431 std::string line;
432 std::getline(file, line);
433// line = std::regex_replace(line, std::regex("\\s+#.*"), std::string(""));
434// line = std::regex_replace(line, std::regex("\\s+$"), std::string(""));
435 if (line.size() == 0) {
436 continue;
437 }
438
439 std::stringstream linestream(line);
440 int source_type;
441 linestream >> source_type;
442
443 //std::cout << source_type << "\n";
444
445 TestImageSource source{0.};
446 if (source_type == 200) {
447 double magnitude, bt, exp_angle_degree, dev_angle_degree;
448
449 linestream >> source.x >> source.y >> magnitude
450 >> bt
451 >> source.dev_rad >> source.dev_aspect >> dev_angle_degree
452 >> source.exp_rad >> source.exp_aspect >> exp_angle_degree;
453
454 // FIXME should change sign?
455 source.dev_rot = dev_angle_degree * M_PI / 180.0;
456 source.exp_rot = exp_angle_degree * M_PI / 180.0;
457
458 auto total_flux = pow(10, (magnitude - m_zero_point) / -2.5);
459 source.exp_flux = total_flux * (1.0 - bt);
460 source.dev_flux = total_flux * bt;
461
462// source.dev_rad *= 2;
463// source.exp_rad *= 2;
464
465 source.point_flux = 0;
466 } else if (source_type == 100) {
467 double magnitude;
468 linestream >> source.x >> source.y >> magnitude;
469 source.point_flux = pow(10, (magnitude - m_zero_point) / -2.5) * m_exp_time;
470
471 source.exp_flux = source.exp_rot = source.dev_flux = source.dev_rot = 0;
472 source.exp_aspect = source.exp_rad = source.dev_aspect = source.dev_rad = 1;
473 }
474
475 source.x -= 1.5;
476 source.y -= 1.5;
477
478 sources.emplace_back(std::move(source));
479 }
480
481 return sources;
482 }
483
484
487
488 auto max_tile_memory = args["max-tile-memory"].as<int>();
489 auto tile_size = args["tile-size"].as<int>();
490 TileManager::getInstance()->setOptions(tile_size, tile_size, max_tile_memory);
491
492 auto image_size = args["size"].as<double>();
493 auto rot_angle = args["rotation"].as<double>() / 180.0 * M_PI;
494 auto scale = args["scale"].as<double>();
495 auto shift_x = args["shift-x"].as<double>();
496 auto shift_y = args["shift-y"].as<double>();
497 auto model_size = args["model-size"].as<double>();
498 if (model_size <= 0.) {
499 model_size = image_size;
500 }
501
502 m_zero_point = args["zero-point"].as<double>();
503 m_exp_time = args["exposure-time"].as<double>();
504
505 std::vector<ConstantModel> constant_models;
507 std::vector<PointModel> point_models;
508
510
511 auto psf_filename = args["psf-file"].as<std::string>();
512 if (psf_filename != "") {
513 logger.info() << "Loading psf file: " << psf_filename;
514 vpsf = PsfPluginConfig::readPsf(psf_filename);
515 } else {
516 vpsf = PsfPluginConfig::generateGaussianPsf(args["psf-fwhm"].as<double>(), args["psf-scale"].as<double>());
517 }
518
519 std::shared_ptr<CoordinateSystem> coordinate_system;
520 auto copy_coordinate_system = args["copy-coordinate-system"].as<std::string>();
521 if (copy_coordinate_system != "") {
522 coordinate_system = std::make_shared<WCS>(FitsImageSource(copy_coordinate_system));
523 } else {
524 coordinate_system = std::make_shared<DummyWCS>(image_size, image_size, rot_angle, scale, shift_x, shift_y);
525 }
526
527 auto raster_model_size = model_size / vpsf->getPixelSampling() + std::max(vpsf->getWidth(), vpsf->getHeight());
528 if (raster_model_size * raster_model_size > std::numeric_limits<int>::max()) {
529 logger.fatal() << "The expected required memory for model rasterization exceeds the maximum size for an integer";
530 logger.fatal() << "Please, either reduce the model size, the image size, or increase the PSF pixel scale";
531 logger.fatal() << raster_model_size * raster_model_size << " > " << std::numeric_limits<int>::max();
533 }
534
535 // Generate a single PSF for the image
536 const auto& vpsf_components = vpsf->getComponents();
537 std::vector<double> psf_vals(vpsf_components.size());
538 for (auto i = 0u; i < psf_vals.size(); ++i) {
539 if (vpsf_components[i] == "X_IMAGE" || vpsf_components[i] == "Y_IMAGE") {
540 psf_vals[i] = image_size / 2 - 1;
541 }
542 else {
543 throw Elements::Exception() << "Unknown PSF component " << vpsf_components[i];
544 }
545 }
546
547 // Generate and normalize the PSF
548 auto p = vpsf->getPsf(psf_vals);
549 auto psf_sum = std::accumulate(p->getData().begin(), p->getData().end(), 0.);
551 auto psf = std::make_shared<ImagePsf>(vpsf->getPixelSampling(), p);
552
554
555 std::string sources_filename = args["source-list"].as<std::string>();
556 if (sources_filename != "") {
557 logger.info() << "Loading sources from < " << sources_filename << " >...";
558 auto loaded_sources = loadSourcesFromFile(sources_filename);
559 sources.insert(sources.end(), loaded_sources.begin(), loaded_sources.end());
560 }
561
562 std::string sources_cat_filename = args["source-catalog"].as<std::string>();
563 if (sources_cat_filename != "") {
564 logger.info() << "Loading source catalog from < " << sources_cat_filename << " >...";
565 auto loaded_sources = loadSourcesFromCatalog(sources_cat_filename);
566 sources.insert(sources.end(), loaded_sources.begin(), loaded_sources.end());
567 }
568
569 int nb_of_random_sources = args["random-sources"].as<int>();
570 if (nb_of_random_sources > 0) {
571 logger.info() << "Adding " << nb_of_random_sources << " random source" << (nb_of_random_sources>1 ? "s" : "") << "...";
572 auto random_sources = generateRandomSources(nb_of_random_sources, image_size * .1, image_size * .1, image_size * .9, image_size * .9);
573 sources.insert(sources.end(), random_sources.begin(), random_sources.end());
574 }
575
576 std::string sources_save_filename = args["save-sources"].as<std::string>();
577 if (sources_save_filename != "") {
578 logger.info() << "Saving sources to < " << sources_save_filename << " >...";
579 saveSources(sources, sources_save_filename);
580 }
581
582 logger.info("Transforming sources...");
583 transformSources(sources, image_size, rot_angle, scale, shift_x, shift_y);
584
585 logger.info("Creating source models...");
586 for (const auto& source : sources) {
587 addSource(point_models, extended_models, model_size, source, std::make_tuple(scale, 0, 0, scale));
588 }
589
590 logger.info("Rendering...");
591
592 auto filename = args["output"].as<std::string>();
593 auto target_image_source = std::make_shared<FitsImageSource>(filename, image_size, image_size,
594 ImageTile::ImageType::FloatImage, coordinate_system);
596
597 if (args["disable-psf"].as<bool>()) {
600 (std::size_t) image_size, (std::size_t) image_size,
601 std::move(constant_models),
602 std::move(point_models),
603 std::move(extended_models),
604 };
605 frame_model.rasterToImage(target_image);
606 } else {
609 (std::size_t) image_size, (std::size_t) image_size,
610 std::move(constant_models),
611 std::move(point_models),
612 std::move(extended_models),
613 *psf
614 };
615 frame_model.rasterToImage(target_image);
616 }
617
618
619 logger.info("Adding noise...");
620
621 addPoissonNoise(target_image, args["gain"].as<double>());
622 addBackgroundNoise(target_image, args["bg-level"].as<double>(), args["bg-sigma"].as<double>());
623
624 logger.info("Adding saturation...");
625
626 auto saturation_level = args["saturation"].as<double>();
627 saturate(target_image, saturation_level);
628
629 logger.info("Creating weight map...");
630
631 auto weight_filename = args["output-weight"].as<std::string>();
632 if (weight_filename != "") {
633 auto weight_map_source = std::make_shared<FitsImageSource>(weight_filename, image_size, image_size, ImageTile::ImageType::FloatImage);
634 auto weight_map = WriteableBufferedImage<SeFloat>::create(weight_map_source);
635 for (int y = 0; y < image_size; ++y) {
636 for (int x = 0; x < image_size; ++x) {
637 weight_map->setValue(x, y, 1);
638 }
639 }
640
641 logger.info("Adding bad pixels...");
642
643 addBadPixels(weight_map, args["bad-pixels"].as<double>());
644 addBadColumns(weight_map, args["bad-columns"].as<double>());
645
646 ImageAccessor<WeightImage::PixelType> weightAccessor(weight_map);
647 for (int y = 0; y < target_image->getHeight(); y++) {
648 for (int x = 0; x < target_image->getWidth(); x++) {
649 if (weightAccessor.getValue(x, y) == 0) {
650 target_image->setValue(x, y, saturation_level);
651 }
652 }
653 }
654 }
655
656 logger.info("All done ^__^");
657 TileManager::getInstance()->saveAllTiles();
659 }
660
661private:
662 boost::random::mt19937 m_rng { (unsigned int) time(NULL) } ;
663 double m_zero_point = 0.0, m_exp_time = 300.;
664
665};
666
668
const double gal_dev_min_i0
Definition TestImage.cpp:78
const double pixel_scale
Definition TestImage.cpp:74
const double gal_exp_max_i0
Definition TestImage.cpp:77
const double gal_exp_min_i0
Definition TestImage.cpp:76
const double gal_dev_max_i0
Definition TestImage.cpp:79
T accumulate(T... args)
double getPixelScale() const
void convolve(ImageType &) const
std::size_t getSize() const
std::shared_ptr< VectorImage< SourceXtractor::SeFloat > > m_kernel
std::shared_ptr< VectorImage< SourceXtractor::SeFloat > > getScaledKernel(double) const
double m_shift_x
ImageCoordinate worldToImage(WorldCoordinate world_coordinate) const override
double m_rotation
WorldCoordinate imageToWorld(ImageCoordinate image_coordinate) const override
Definition TestImage.cpp:96
double m_shift_y
int m_image_width
DummyWCS(int image_width, int image_height, double rotation, double scale, double shift_x, double shift_y)
Definition TestImage.cpp:91
std::map< std::string, std::string > getFitsHeaders() const override
int m_image_height
double m_scale
virtual ~DummyWCS()
Definition TestImage.cpp:94
static Logging getLogger(const std::string &name="")
void rasterToImage(ImageType &)
static std::shared_ptr< ProcessedImage< T, MultiplyOperation< T > > > create(std::shared_ptr< const Image< T > > image_a, std::shared_ptr< const Image< T > > image_b)
static std::shared_ptr< Psf > readPsf(const std::string &filename, int hdu_number=1)
static std::shared_ptr< Psf > generateGaussianPsf(SeFloat fwhm, SeFloat pixel_sampling)
static std::shared_ptr< TileManager > getInstance()
Image implementation which keeps the pixel values in memory.
Definition VectorImage.h:52
static std::shared_ptr< VectorImage< T > > create(Args &&... args)
static std::shared_ptr< WriteableBufferedImage< T > > create(std::shared_ptr< const ImageSource > source, std::shared_ptr< TileManager > tile_manager=TileManager::getInstance())
void addBadColumns(std::shared_ptr< WriteableImage< SeFloat > > weight_map, double probability)
Elements::ExitCode mainMethod(std::map< std::string, po::variable_value > &args) override
double m_exp_time
void addPoissonNoise(std::shared_ptr< WriteableImage< SeFloat > > image, double gain)
void addSource(std::vector< PointModel > &point_models, std::vector< std::shared_ptr< ModelFitting::ExtendedModel< WriteableInterfaceTypePtr > > > &extended_models, double size, const TestImageSource &source, std::tuple< double, double, double, double > jacobian)
void saveSources(const std::vector< TestImageSource > &sources, const std::string &filename)
po::options_description defineSpecificProgramOptions() override
void addPointSource(std::vector< PointModel > &point_models, double x, double y, double flux)
std::vector< TestImageSource > generateRandomSources(int number_of_sources, double x_min, double y_min, double x_max, double y_max)
std::vector< TestImageSource > loadSourcesFromFile(const std::string &filename)
void saturate(std::shared_ptr< WriteableImage< SeFloat > > image, double saturation_level)
double m_zero_point
void addBadPixels(std::shared_ptr< WriteableImage< SeFloat > > weight_map, double probability)
std::vector< TestImageSource > loadSourcesFromCatalog(const std::string &filename)
void addBackgroundNoise(std::shared_ptr< WriteableImage< SeFloat > > image, double background_level, double background_sigma)
void transformSources(std::vector< TestImageSource > &sources, int image_size, double rot_angle, double scale, double shift_x, double shift_y)
boost::random::mt19937 m_rng
T clear(T... args)
T cos(T... args)
T emplace_back(T... args)
T end(T... args)
T exp(T... args)
T getline(T... args)
T good(T... args)
#define MAIN_FOR(ELEMENTS_PROGRAM_NAME)
T insert(T... args)
T make_shared(T... args)
T make_tuple(T... args)
T max(T... args)
T min(T... args)
T move(T... args)
static Elements::Logging logger
std::unique_ptr< T > make_unique(Args &&... args)
std::shared_ptr< WriteableInterfaceType > WriteableInterfaceTypePtr
SeFloat32 SeFloat
Definition Types.h:32
T open(T... args)
T pow(T... args)
T push_back(T... args)
T sin(T... args)
T size(T... args)
T time(T... args)
T to_string(T... args)