casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SDDoubleCircleGainCalImpl.h
Go to the documentation of this file.
1 /*
2  * SDDoubleCircleGainCal.h
3  *
4  * Created on: May 31, 2016
5  * Author: nakazato
6  */
7 
8 #ifndef SYNTHESIS_MEASUREMENTCOMPONENTS_SDDOUBLECIRCLEGAINCALIMPL_H_
9 #define SYNTHESIS_MEASUREMENTCOMPONENTS_SDDOUBLECIRCLEGAINCALIMPL_H_
10 
11 #include <map>
12 #include <list>
13 
14 #include <casacore/casa/aipstype.h>
20 
21 namespace casa { // namespace casa START
22 
23 class TimeRangeKey {
24 public:
25  struct Less {
26  bool operator()(TimeRangeKey const &a, TimeRangeKey const &b) const {
27  for (size_t i = 0; i < 3; ++i) {
28  if (a.meta_[i] != b.meta_[i]) {
29  return a.meta_[i] < b.meta_[i];
30  }
31  }
32  // a.meta_ == b.meta_
33  return false;
34  }
35  };
36  TimeRangeKey(casacore::Int const field_id, casacore::Int const antenna_id,
37  casacore::Int const feed_id) :
38  meta_(3) {
39  meta_[0] = field_id;
40  meta_[1] = antenna_id;
41  meta_[2] = feed_id;
42  }
43  ~TimeRangeKey() = default;
44 private:
46  TimeRangeKey() = delete;
47 };
48 
49 typedef std::pair<casacore::Double, casacore::Double> TimeRange;
50 typedef std::list<TimeRange> TimeRangeList;
51 
53 public:
54  static bool InRange(TimeRange const &timerange, casacore::Double const current_time) {
55  auto const time_from = timerange.first * (1.0 - casacore::C::dbl_epsilon);
56  auto const time_to = timerange.second * (1.0 + casacore::C::dbl_epsilon);
57  return time_from < current_time && current_time < time_to;
58  }
59 
60  static bool InRange(TimeRangeList const &timerange_list, casacore::Double const current_time) {
61  for (auto iter = timerange_list.begin(); iter != timerange_list.end(); ++iter) {
62  if (InRange(*iter, current_time)) {
63  return true;
64  }
65  }
66  return false;
67  }
68 };
69 
71 public:
74 
75  // getter
76  // get size of the central region in radian
78  return central_region_;
79  }
81  return do_smooth_;
82  }
83  // get smoothing size
85  return smooth_size_;
86  }
87  // get observing frequency in Hz
89  return observing_frequency_;
90  }
91  // get antenna diameter in meter
93  return antenna_diameter_;
94  }
95 
96  // primvary beam size in radian
98 
99  // default smoothing size
101 
102  // get radius of the central region in radian
104 
105  // get effective smoothing size
107 
108  // setter
109  // set radius of the central region in radian
112  }
113 
114  // activate smoothing and set smoothing size
116  do_smooth_ = true;
117  smooth_size_ = size;
118  }
119 
120  // deactivate smoothing
121  void unsetSmoothing() {
122  do_smooth_ = false;
123  smooth_size_ = -1;
124  }
125 
126  // set observing frequency in Hz
129  }
130 
131  // set antenna diameter in meter
134  }
135 
136  // gain calibration
137  // based on Stephen White's IDL script
140  casacore::Matrix<casacore::Double> const &direction,
143  // subspecies that take into account flag (false: valid, true: invalid)
145  casacore::Cube<casacore::Bool> const &flag,
147  casacore::Matrix<casacore::Double> const &direction,
150  casacore::Cube<casacore::Bool> &gain_flag);
151 
152  // gain calibration implementation
155  casacore::Cube<casacore::Bool> &gain_flag);
156 
157  // find time range that observed central region
159  casacore::Vector<casacore::Double> const &interval,
160  casacore::Matrix<casacore::Double> const &direction,
161  TimeRangeList &timerange);
162 
163  // apply gain factor
164 // void apply(casacore::Vector<casacore::Double> const &gain_time,
165 // casacore::Cube<casacore::Float> const &gain,
166 // casacore::Vector<casacore::Double> const &time,
167 // casacore::Cube<casacore::Float> &data);
168 
169 private:
170  // radius of the central region [rad]
172 
173  // flag for smoothing
175 
176  // smoothing size
178 
179  // parameter for primary beam size determination
180  // observing frequency [Hz]
182 
183  // antenna diameter [m]
185 
186  // logger
188 
189  // find data within radius
190  void findDataWithinRadius(casacore::Double const radius,
193  casacore::Matrix<casacore::Double> const &direction,
196  void findDataWithinRadius(casacore::Double const radius,
199  casacore::Cube<casacore::Bool> const &flag,
200  casacore::Matrix<casacore::Double> const &direction,
203  casacore::Cube<casacore::Bool> &gain_flag);
204 };
205 
206 } // namespace casa END
207 
208 #endif /* SYNTHESIS_MEASUREMENTCOMPONENTS_SDDOUBLECIRCLEGAINCALIMPL_H_ */
static bool InRange(TimeRange const &timerange, casacore::Double const current_time)
int Int
Definition: aipstype.h:50
casacore::Double central_region_
apply gain factor void apply(casacore::Vector&lt;casacore::Double&gt; const &amp;gain_time, casacore::Cube&lt;casa...
casacore::Int getSmoothingSize() const
get smoothing size
static bool InRange(TimeRangeList const &timerange_list, casacore::Double const current_time)
casacore::Double observing_frequency_
parameter for primary beam size determination observing frequency [Hz]
void setObservingFrequency(casacore::Double value)
set observing frequency in Hz
casacore::Block< casacore::Int > meta_
casacore::Bool do_smooth_
flag for smoothing
bool findTimeRange(casacore::Vector< casacore::Double > const &time, casacore::Vector< casacore::Double > const &interval, casacore::Matrix< casacore::Double > const &direction, TimeRangeList &timerange)
find time range that observed central region
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
ostream-like interface to creating log messages.
Definition: LogIO.h:167
void setCentralRegion(casacore::Double value)
setter set radius of the central region in radian
size_t size() const
bool operator()(TimeRangeKey const &a, TimeRangeKey const &b) const
casacore::Double getObservingFrequency() const
get observing frequency in Hz
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
casacore::Double getPrimaryBeamSize() const
primvary beam size in radian
casacore::Double getCentralRegion() const
getter get size of the central region in radian
void findDataWithinRadius(casacore::Double const radius, casacore::Vector< casacore::Double > const &time, casacore::Cube< casacore::Float > const &data, casacore::Matrix< casacore::Double > const &direction, casacore::Vector< casacore::Double > &gain_time, casacore::Cube< casacore::Float > &gain)
find data within radius
void setAntennaDiameter(casacore::Double value)
set antenna diameter in meter
double Double
Definition: aipstype.h:55
void setSmoothing(casacore::Int size)
activate smoothing and set smoothing size
std::pair< casacore::Double, casacore::Double > TimeRange
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
std::list< TimeRange > TimeRangeList
casacore::Int smooth_size_
smoothing size
void doCalibrate(casacore::Vector< casacore::Double > &gain_time, casacore::Cube< casacore::Float > &gain, casacore::Cube< casacore::Bool > &gain_flag)
gain calibration implementation
void calibrate(casacore::Cube< casacore::Float > const &data, casacore::Vector< casacore::Double > const &time, casacore::Matrix< casacore::Double > const &direction, casacore::Vector< casacore::Double > &gain_time, casacore::Cube< casacore::Float > &gain)
gain calibration based on Stephen White&#39;s IDL script
casacore::Double getRadius()
get radius of the central region in radian
~TimeRangeKey()=default
casacore::Int getDefaultSmoothingSize() const
default smoothing size
void unsetSmoothing()
deactivate smoothing
casacore::Double antenna_diameter_
antenna diameter [m]
casacore::Int getEffectiveSmoothingSize()
get effective smoothing size
const Double dbl_epsilon
Minimum double precision floating point number X such that 1+X does not equal X.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
TimeRangeKey(casacore::Int const field_id, casacore::Int const antenna_id, casacore::Int const feed_id)
casacore::Double getAntennaDiameter() const
get antenna diameter in meter