File: histogrampagecontroller.h

package info (click to toggle)
aoflagger 3.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,688 kB
  • sloc: cpp: 83,116; python: 10,187; sh: 260; makefile: 178
file content (109 lines) | stat: -rw-r--r-- 3,950 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef HISTOGRAM_PAGE_CONTROLLER_H
#define HISTOGRAM_PAGE_CONTROLLER_H

#include <memory>
#include <string>

#include "aoqplotpagecontroller.h"

#include "../../plot/xyplot.h"

class HistogramPageController : public AOQPageController {
 public:
  HistogramPageController();
  ~HistogramPageController();

  void Attach(class HistogramPage* page) { _page = page; }

  void SetHistograms(const HistogramCollection* histograms) override final;

  void SetHistograms(const std::string& filename) {
    _statFilename = filename;
    readFromFile();
    updatePlot();
  }

  void CloseStatistics() override final;

  bool HasStatistics() const { return _histograms != nullptr; }

  XYPlot& Plot() { return _plot; }

  std::string SlopeText(const class LogHistogram& histogram);

  void SetAutomaticFitRange(bool automaticFitRange) {
    _automaticFitRange = automaticFitRange;
  }
  void SetFitStart(double fitStart) { _fitStart = fitStart; }
  void SetFitEnd(double fitEnd) { _fitEnd = fitEnd; }
  void SetFitLogarithmic(bool fitLog) { _fitLogarithmic = fitLog; }

  double FitStart() { return _fitStart; }
  double FitEnd() { return _fitEnd; }

  void SetAutomaticSlopeRange(bool automaticSlopeRange) {
    _automaticSlopeRange = automaticSlopeRange;
  }
  void SetSlopeStart(double start) { _slopeStart = start; }
  void SetSlopeEnd(double end) { _slopeEnd = end; }
  void SetSlopeRFIRatio(double rfiRatio) { _slopeRFIRatio = rfiRatio; }

  double SlopeStart() { return _slopeStart; }
  double SlopeEnd() { return _slopeEnd; }

  void SetDrawTotal(bool drawTotal) { _totalHistogram = drawTotal; }
  void SetDrawFit(bool drawFit) { _fit = drawFit; }
  void SetDrawSubtractedFit(bool drawSubtrFit) { _subtractFit = drawSubtrFit; }
  void SetDrawSlope(bool drawSlope) { _drawSlope = drawSlope; }
  void SetDrawSlope2(bool drawSlope2) { _drawSlope2 = drawSlope2; }
  void SetDrawRFI(bool drawRFI) { _rfiHistogram = drawRFI; }
  void SetDrawNonRFI(bool drawNonRFI) { _notRFIHistogram = drawNonRFI; }

  void SetDerivative(bool derivative) { _derivative = derivative; }
  void SetStaircase(bool staircaseFunction) {
    _staircaseFunction = staircaseFunction;
  }
  void SetNormalize(bool normalize) { _normalize = normalize; }
  void SetDeltaS(double deltaS) { _deltaS = deltaS; }

  void SetDrawXX(bool drawXX) { _drawXX = drawXX; }
  void SetDrawXY(bool drawXY) { _drawXY = drawXY; }
  void SetDrawYX(bool drawYX) { _drawYX = drawYX; }
  void SetDrawYY(bool drawYY) { _drawYY = drawYY; }
  void SetDrawSum(bool drawSum) { _drawSum = drawSum; }

 private:
  void updatePlot();
  void addHistogramToPlot(const class LogHistogram& histogram);
  void addRayleighToPlot(const class LogHistogram& histogram, double sigma,
                         double n);
  void addRayleighDifferenceToPlot(const LogHistogram& histogram, double sigma,
                                   double n);
  void plotPolarization(const HistogramCollection& histogramCollection,
                        unsigned polarization);
  void plotPolarization(const class LogHistogram& totalHistogram,
                        const class LogHistogram& rfiHistogram);
  void plotFit(const class LogHistogram& histogram, const std::string& title);
  void plotSlope(const class LogHistogram& histogram, const std::string& title,
                 bool useLowerLimit2);
  void readFromFile();

  class HistogramPage* _page;
  std::string _statFilename;
  XYPlot _plot;
  std::unique_ptr<class HistogramCollection> _histograms;
  std::unique_ptr<class HistogramCollection> _summedPolarizationHistograms;

  bool _drawXX, _drawXY, _drawYX, _drawYY, _drawSum;

  bool _automaticFitRange;
  double _fitStart, _fitEnd;
  bool _fitLogarithmic, _automaticSlopeRange;
  double _slopeStart, _slopeEnd, _slopeRFIRatio;
  bool _totalHistogram, _fit, _subtractFit, _drawSlope, _drawSlope2,
      _rfiHistogram, _notRFIHistogram;
  bool _derivative, _staircaseFunction, _normalize;
  double _deltaS;
};

#endif