File: fringetestcreater.cpp

package info (click to toggle)
aoflagger 3.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,960 kB
  • sloc: cpp: 83,076; python: 10,187; sh: 260; makefile: 178
file content (38 lines) | stat: -rw-r--r-- 1,385 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
#include "fringetestcreater.h"

#include "../structures/timefrequencydata.h"
#include "../structures/timefrequencymetadata.h"

#include "../imaging/uvimager.h"

namespace algorithms {

void FringeTestCreater::AddStaticFringe(class TimeFrequencyData& ftData,
                                        TimeFrequencyMetaDataCPtr metaData,
                                        long double strength) {
  Image2DCPtr real = ftData.GetRealPart(),
              imaginary = ftData.GetImaginaryPart();
  Image2DPtr newReal =
                 Image2D::CreateUnsetImagePtr(real->Width(), real->Height()),
             newImaginary =
                 Image2D::CreateUnsetImagePtr(real->Width(), real->Height());

  for (size_t channelIndex = 0; channelIndex < ftData.ImageHeight();
       ++channelIndex) {
    for (size_t t = 0; t < ftData.ImageWidth(); ++t) {
      const num_t fringeRotation =
          2.0 * M_PIn * UVImager::GetFringeCount(0, t, channelIndex, metaData);

      newReal->SetValue(
          t, channelIndex,
          strength * std::cos(fringeRotation) + real->Value(t, channelIndex));
      newImaginary->SetValue(t, channelIndex,
                             strength * std::sin(fringeRotation) +
                                 imaginary->Value(t, channelIndex));
    }
  }

  ftData.Set(ftData.Polarizations()[0], newReal, newImaginary);
}

}  // namespace algorithms