File: generic_clean.h

package info (click to toggle)
wsclean 3.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,296 kB
  • sloc: cpp: 129,246; python: 22,066; sh: 360; ansic: 230; makefile: 185
file content (50 lines) | stat: -rw-r--r-- 1,820 bytes parent folder | download | duplicates (2)
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
49
50
// SPDX-License-Identifier: LGPL-3.0-only

#ifndef RADLER_GENERIC_CLEAN_H_
#define RADLER_GENERIC_CLEAN_H_

#include <aocommon/optionalnumber.h>
#include <aocommon/uvector.h>

#include "image_set.h"
#include "algorithms/deconvolution_algorithm.h"
#include "algorithms/simple_clean.h"

namespace radler::algorithms {
/**
 * This class implements a generalized version of Högbom clean. It performs a
 * single-channel or joined cleaning, depending on the number of images
 * provided. It can use a Clark-like optimization to speed up the cleaning. When
 * multiple frequencies are provided, it can perform spectral fitting.
 */
class GenericClean final : public DeconvolutionAlgorithm {
 public:
  explicit GenericClean(bool use_sub_minor_optimization);
  // TODO(AST-912) Make copy/move operations Google Style compliant.
  GenericClean(const GenericClean&) = default;
  GenericClean(GenericClean&&) = delete;
  GenericClean& operator=(const GenericClean&) = delete;
  GenericClean& operator=(GenericClean&&) = delete;

  DeconvolutionResult ExecuteMajorIteration(
      ImageSet& dirty_set, ImageSet& model_set,
      const std::vector<aocommon::Image>& psfs) final;

  std::unique_ptr<DeconvolutionAlgorithm> Clone() const final {
    return std::make_unique<GenericClean>(*this);
  }

 private:
  size_t convolution_width_;
  size_t convolution_height_;
  const float convolution_padding_;
  bool use_sub_minor_optimization_;

  // Scratch buffer should at least accomodate space for image.Size() floats
  // and is only used to avoid unnecessary memory allocations.
  aocommon::OptionalNumber<float> FindPeak(const aocommon::Image& image,
                                           float* scratch_buffer, size_t& x,
                                           size_t& y);
};
}  // namespace radler::algorithms
#endif