File: subpixelrenderer.h

package info (click to toggle)
wsclean 3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,968 kB
  • sloc: cpp: 85,742; python: 3,526; sh: 245; makefile: 21
file content (48 lines) | stat: -rw-r--r-- 1,533 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef WSCLEAN_INTERPOLATING_RENDERER_H_
#define WSCLEAN_INTERPOLATING_RENDERER_H_

#include <cstring>

#include <aocommon/coordinatesystem.h>
#include <aocommon/image.h>
#include <aocommon/uvector.h>

namespace wsclean::math {

class SubPixelRenderer {
 public:
  SubPixelRenderer(size_t kernel_size)
      : x_kernel_(kernel_size + (kernel_size + 1) % 2),
        y_kernel_(kernel_size + (kernel_size + 1) % 2) {}

  /**
   * Render a source and convolve it with a sinc, which means it can be on
   * non-integer positions.
   */
  static void RenderSource(float* image, size_t width, size_t height,
                           float flux, double x, double y);

  /**
   * Render a source and convolve it with a sinc, which means it can be on
   * non-integer positions. The sinc is windowed to increase the performance. A
   * Hann-window is used. No corrections are made to correct for the window,
   * which implies it needs to be sufficient big to not cause errors.
   */
  void RenderWindowedSource(float* image, size_t width, size_t height,
                            float brightness, float x, float y);

 private:
  size_t kernel_size_;
  aocommon::UVector<float> x_kernel_;
  aocommon::UVector<float> y_kernel_;
};

std::vector<aocommon::Image> RenderSubPixelModel(
    const std::string& model_filename,
    const aocommon::CoordinateSystem& coordinate_system, double frequency,
    double bandwidth, size_t window_size, size_t n_terms, double mem_fraction,
    double mem_limit);

}  // namespace wsclean::math

#endif