File: outputchannelinfo.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 (63 lines) | stat: -rw-r--r-- 2,121 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
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef OUTPUT_CHANNEL_INFO_H
#define OUTPUT_CHANNEL_INFO_H

#include <cmath>
#include <cstring>
#include <vector>

#include "../gridding/averagecorrection.h"

namespace wsclean {

struct OutputChannelInfo {
  OutputChannelInfo(size_t n_facets = 0, size_t n_dd_psfs = 0)
      : averageFacetCorrection(n_facets),
        averageBeamFacetCorrection(n_facets),
        averageDdPsfCorrection(n_dd_psfs) {}
  double weight = 0.0;
  double normalizationFactor = 1.0;
  std::size_t wGridSize = 0;
  std::size_t visibilityCount = 0;
  double effectiveVisibilityCount = 0.0;
  double visibilityWeightSum = 0.0;
  double beamMaj = 0.0;
  double beamMin = 0.0;
  double beamPA = 0.0;
  // The beam size estimate is calculated from the longest baseline, and used
  // as initial value when fitting the (accurate) beam
  double beamSizeEstimate = 0.0;
  double theoreticBeamSize = 0.0;
  double psfNormalizationFactor = 1.0;
  // For dd psf mode, this is the facet index that holds the central
  // psf.
  std::size_t centralPsfIndex = 0;
  // See VisibilityModifier for an explanation
  std::vector<AverageCorrection> averageFacetCorrection;
  std::vector<AverageCorrection> averageBeamFacetCorrection;
  // Same as averageFacetCorrection, but then for the DD PSF facets
  std::vector<AverageCorrection> averageDdPsfCorrection;
};

/**
 * Calculate the smallest "theoretic" beam size in a vector of channels.
 * Non-finite/NaN values are skipped. If no finite values are present,
 * NaN is returned.
 */
inline double SmallestTheoreticBeamSize(
    const std::vector<OutputChannelInfo>& channels) {
  double smallest_theoretic_beam_size = std::numeric_limits<double>::max();
  for (const OutputChannelInfo& channel : channels) {
    const double value = channel.theoreticBeamSize;
    if (std::isfinite(value)) {
      smallest_theoretic_beam_size =
          std::min(smallest_theoretic_beam_size, value);
    }
  }
  return (smallest_theoretic_beam_size == std::numeric_limits<double>::max())
             ? std::numeric_limits<double>::quiet_NaN()
             : smallest_theoretic_beam_size;
}

}  // namespace wsclean

#endif