-
Notifications
You must be signed in to change notification settings - Fork 6
/
Station.h
368 lines (332 loc) · 14.8 KB
/
Station.h
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
//# Station.h: Representation of the station beam former.
//#
//# Copyright (C) 2013
//# ASTRON (Netherlands Institute for Radio Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
//#
//# This file is part of the LOFAR software suite.
//# The LOFAR software suite is free software: you can redistribute it and/or
//# modify it under the terms of the GNU General Public License as published
//# by the Free Software Foundation, either version 3 of the License, or
//# (at your option) any later version.
//#
//# The LOFAR software suite is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License along
//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
//#
//# $Id$
#ifndef LOFAR_STATIONRESPONSE_STATION_H
#define LOFAR_STATIONRESPONSE_STATION_H
// \file
// Representation of the station beam former.
#include "AntennaField.h"
#include "Types.h"
#include <memory>
#include <vector>
namespace LOFAR
{
namespace StationResponse
{
// \addtogroup StationResponse
// @{
class Station
{
public:
typedef std::shared_ptr<Station> Ptr;
typedef std::shared_ptr<const Station> ConstPtr;
typedef std::vector<AntennaField::ConstPtr> FieldList;
/*!
* \brief Construct a new Station instance.
*
* \param name Name of the station.
* \param position Position of the station (ITRF, m).
*/
Station(const string &name, const vector3r_t &position);
/*!
* \brief Return the name of the station.
*/
const string &name() const;
/*!
* \brief Return the position of the station (ITRF, m).
*/
const vector3r_t &position() const;
/*!
* \brief Set the phase reference position. This is the position where the
* delay of the incoming plane wave is assumed to be zero.
*
* \param reference Phase reference position (ITRF, m).
*
* By default, it is assumed the position of the station is also the phase
* reference position. Use this method to set the phase reference position
* explicitly when this assumption is false.
*/
void setPhaseReference(const vector3r_t &reference);
/*!
* \brief Return the phase reference position (ITRF, m).
*
* \see Station::setPhaseReference()
*/
const vector3r_t &phaseReference() const;
/*!
* \brief Add an antenna field to the station.
*
* Physical %LOFAR stations consist of an LBA field, and either one (remote
* and international stations) or two (core stations) HBA fields. Virtual
* %LOFAR stations can consist of a combination of the antenna fields of
* several physical stations.
*
* Use this method to add the appropriate antenna fields to the station.
*/
void addField(const AntennaField::ConstPtr &field);
/*!
* \brief Return the number of available antenna fields.
*/
size_t nFields() const;
/*!
* \brief Return the requested antenna field.
*
* \param i Antenna field number (0-based).
* \return An AntennaField::ConstPtr to the requested AntennaField
* instance, or an empty AntennaField::ConstPtr if \p i is out of bounds.
*/
AntennaField::ConstPtr field(size_t i) const;
/*!
* \brief Return an iterator that points to the beginning of the list of
* antenna fields.
*/
FieldList::const_iterator beginFields() const;
/*!
* \brief Return an iterator that points to the end of the list of antenna
* fields.
*/
FieldList::const_iterator endFields() const;
/*!
* \brief Compute the response of the station for a plane wave of frequency
* \p freq, arriving from direction \p direction, with the %station beam
* former steered towards \p station0, and, for HBA stations, the analog
* %tile beam former steered towards \p tile0. For LBA stations, \p tile0
* has no effect.
*
* \param time Time, modified Julian date, UTC, in seconds (MJD(UTC), s).
* \param freq Frequency of the plane wave (Hz).
* \param direction Direction of arrival (ITRF, m).
* \param freq0 %Station beam former reference frequency (Hz).
* \param station0 %Station beam former reference direction (ITRF, m).
* \param tile0 Tile beam former reference direction (ITRF, m).
* \param rotate Boolean deciding if paralactic rotation should be applied.
* \return Jones matrix that represents the %station response.
*
* For any given sub-band, the %LOFAR station beam former computes weights
* for a single reference frequency. Usually, this reference frequency is
* the center frequency of the sub-band. For any frequency except the
* reference frequency, these weights are an approximation. This aspect of
* the system is taken into account in the computation of the response.
* Therefore, both the frequency of interest \p freq and the reference
* frequency \p freq0 need to be specified.
*
* The directions \p direction, \p station0, and \p tile0 are vectors that
* represent a direction of \e arrival. These vectors have unit length and
* point \e from the ground \e towards the direction from which the plane
* wave arrives.
*/
matrix22c_t response(real_t time, real_t freq, const vector3r_t &direction,
real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, const bool rotate = true)
const;
/*!
* \brief Compute the array factor of the station for a plane wave of
* frequency \p freq, arriving from direction \p direction, with the
* %station beam former steered towards \p station0, and, for HBA stations
* the analog %tile beam former steered towards \p tile0. For LBA stations,
* \p tile0 has no effect.
*
* \param time Time, modified Julian date, UTC, in seconds (MJD(UTC), s).
* \param freq Frequency of the plane wave (Hz).
* \param direction Direction of arrival (ITRF, m).
* \param freq0 %Station beam former reference frequency (Hz).
* \param station0 %Station beam former reference direction (ITRF, m).
* \param tile0 Tile beam former reference direction (ITRF, m).
* \param rotate Boolean deciding if paralactic rotation should be applied.
* \return A diagonal matrix with the array factor of the X and Y antennae.
*
* For any given sub-band, the %LOFAR station beam former computes weights
* for a single reference frequency. Usually, this reference frequency is
* the center frequency of the sub-band. For any frequency except the
* reference frequency, these weights are an approximation. This aspect of
* the system is taken into account in the computation of the response.
* Therefore, both the frequency of interest \p freq and the reference
* frequency \p freq0 need to be specified.
*
* The directions \p direction, \p station0, and \p tile0 are vectors that
* represent a direction of \e arrival. These vectors have unit length and
* point \e from the ground \e towards the direction from which the plane
* wave arrives.
*/
diag22c_t arrayFactor(real_t time, real_t freq, const vector3r_t &direction,
real_t freq0, const vector3r_t &station0, const vector3r_t &tile0)
const;
/*!
* \name Convenience member functions
* These member functions perform the same function as the corresponding
* non-template member functions, for a list of frequencies or (frequency,
* reference frequency) pairs.
*/
// @{
/*!
* \brief Convenience method to compute the response of the station for a
* list of frequencies, and a fixed reference frequency.
*
* \param count Number of frequencies.
* \param time Time, modified Julian date, UTC, in seconds (MJD(UTC), s).
* \param freq Input iterator for a list of frequencies (Hz) of length
* \p count.
* \param direction Direction of arrival (ITRF, m).
* \param freq0 %Station beam former reference frequency (Hz).
* \param station0 %Station beam former reference direction (ITRF, m).
* \param tile0 Tile beam former reference direction (ITRF, m).
* \param rotate Boolean deciding if paralactic rotation should be applied.
* \param buffer Output iterator with room for \p count instances of type
* ::matrix22c_t.
*
* \see response(real_t time, real_t freq, const vector3r_t &direction,
* real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const
*/
template <typename T, typename U>
void response(unsigned int count, real_t time, T freq,
const vector3r_t &direction, real_t freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer, const bool rotate=true) const;
/*!
* \brief Convenience method to compute the array factor of the station for
* a list of frequencies, and a fixed reference frequency.
*
* \param count Number of frequencies.
* \param time Time, modified Julian date, UTC, in seconds (MJD(UTC), s).
* \param freq Input iterator for a list of frequencies (Hz) of length
* \p count.
* \param direction Direction of arrival (ITRF, m).
* \param freq0 %Station beam former reference frequency (Hz).
* \param station0 %Station beam former reference direction (ITRF, m).
* \param tile0 Tile beam former reference direction (ITRF, m).
* \param rotate Boolean deciding if paralactic rotation should be applied.
* \param buffer Output iterator with room for \p count instances of type
* ::diag22c_t.
*
* \see arrayFactor(real_t time, real_t freq, const vector3r_t &direction,
* real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const
*/
template <typename T, typename U>
void arrayFactor(unsigned int count, real_t time, T freq,
const vector3r_t &direction, real_t freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer) const;
/*!
* \brief Convenience method to compute the response of the station for a
* list of (frequency, reference frequency) pairs.
*
* \param count Number of frequencies.
* \param time Time, modified Julian date, UTC, in seconds (MJD(UTC), s).
* \param freq Input iterator for a list of frequencies (Hz) of length
* \p count.
* \param direction Direction of arrival (ITRF, m).
* \param freq0 Input iterator for a list of %Station beam former reference
* frequencies (Hz) of length \p count.
* \param station0 %Station beam former reference direction (ITRF, m).
* \param tile0 Tile beam former reference direction (ITRF, m).
* \param rotate Boolean deciding if paralactic rotation should be applied.
* \param buffer Output iterator with room for \p count instances of type
* ::matrix22c_t.
*
* \see response(real_t time, real_t freq, const vector3r_t &direction,
* real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const
*/
template <typename T, typename U>
void response(unsigned int count, real_t time, T freq,
const vector3r_t &direction, T freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer, const bool rotate=true) const;
/*!
* \brief Convenience method to compute the array factor of the station for
* list of (frequency, reference frequency) pairs.
*
* \param count Number of frequencies.
* \param time Time, modified Julian date, UTC, in seconds (MJD(UTC), s).
* \param freq Input iterator for a list of frequencies (Hz) of length
* \p count.
* \param direction Direction of arrival (ITRF, m).
* \param freq0 %Station beam former reference frequency (Hz).
* \param station0 %Station beam former reference direction (ITRF, m).
* \param tile0 Tile beam former reference direction (ITRF, m).
* \param rotate Boolean deciding if paralactic rotation should be applied.
* \param buffer Output iterator with room for \p count instances of type
* ::diag22c_t.
*
* \see arrayFactor(real_t time, real_t freq, const vector3r_t &direction,
* real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const
*/
template <typename T, typename U>
void arrayFactor(unsigned int count, real_t time, T freq,
const vector3r_t &direction, T freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer) const;
// @}
private:
raw_array_factor_t fieldArrayFactor(const AntennaField::ConstPtr &field,
real_t time, real_t freq, const vector3r_t &direction, real_t freq0,
const vector3r_t &position0, const vector3r_t &direction0) const;
private:
string itsName;
vector3r_t itsPosition;
vector3r_t itsPhaseReference;
FieldList itsFields;
};
// @}
//# ------------------------------------------------------------------------- //
//# - Implementation: Station - //
//# ------------------------------------------------------------------------- //
template <typename T, typename U>
void Station::response(unsigned int count, real_t time, T freq,
const vector3r_t &direction, real_t freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer, const bool rotate) const
{
for(unsigned int i = 0; i < count; ++i)
{
*buffer++ = response(time, *freq++, direction, freq0, station0, tile0,
rotate);
}
}
template <typename T, typename U>
void Station::arrayFactor(unsigned int count, real_t time, T freq,
const vector3r_t &direction, real_t freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer) const
{
for(unsigned int i = 0; i < count; ++i)
{
*buffer++ = arrayFactor(time, *freq++, direction, freq0, station0,
tile0);
}
}
template <typename T, typename U>
void Station::response(unsigned int count, real_t time, T freq,
const vector3r_t &direction, T freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer, const bool rotate) const
{
for(unsigned int i = 0; i < count; ++i)
{
*buffer++ = response(time, *freq++, direction, *freq0++, station0,
tile0, rotate);
}
}
template <typename T, typename U>
void Station::arrayFactor(unsigned int count, real_t time, T freq,
const vector3r_t &direction, T freq0, const vector3r_t &station0,
const vector3r_t &tile0, U buffer) const
{
for(unsigned int i = 0; i < count; ++i)
{
*buffer++ = arrayFactor(time, *freq++, direction, *freq0++, station0,
tile0);
}
}
} //# namespace StationResponse
} //# namespace LOFAR
#endif