Skip to content
Snippets Groups Projects
Commit ba2ac6dd authored by Jakob Maljaars's avatar Jakob Maljaars Committed by Andre Offringa
Browse files

Add doxygen documentation and minor changes

parent 59108fe5
Branches
Tags
No related merge requests found
......@@ -3,7 +3,6 @@
#include "MathUtil.h"
namespace everybeam {
vector3r_t Antenna::transform_to_local_direction(const vector3r_t &direction) {
vector3r_t local_direction{
dot(m_coordinate_system.axes.p, direction),
......@@ -13,5 +12,4 @@ vector3r_t Antenna::transform_to_local_direction(const vector3r_t &direction) {
return local_direction;
}
} // namespace everybeam
\ No newline at end of file
......@@ -9,12 +9,17 @@
namespace everybeam {
/**
* @brief (Virtual) class describing an antenna, and computing the corresponding response()
* and arrayFactor().
*
*/
class Antenna
{
public:
/**
* \brief Station coordinate system.
* \brief %Station coordinate system.
*
* A right handed, cartesian, local coordinate system with coordinate axes
* \p p, \p q, and \p r is associated with each antenna field.
......@@ -66,16 +71,24 @@ public:
typedef std::shared_ptr<Antenna> Ptr;
/**
* @brief Struct containing antenna options
*
*/
struct Options
{
real_t freq0;
vector3r_t station0;
vector3r_t tile0;
bool rotate;
vector3r_t east;
vector3r_t north;
real_t freq0; //!< %Antenna reference frequency (Hz).
vector3r_t station0; //!< Reference direction (ITRF, m)
vector3r_t tile0; //!< Tile beam former reference direction (ITRF, m).
bool rotate; //!< Boolean deciding if paralactic rotation should be applied.
vector3r_t east; //!< Eastward pointing unit vector
vector3r_t north; //!< Northward pointing unit vector
};
/**
* @brief Construct a new %Antenna object
*
*/
Antenna() :
// default coordinate system
// no shift of origin, no rotation
......@@ -85,11 +98,23 @@ public:
})
{}
/**
* @brief Construct a new %Antenna object, given a coordinate system
*
* @param coordinate_system
*/
Antenna(const CoordinateSystem &coordinate_system) :
// default phase reference system is the origin of the coordinate system
Antenna(coordinate_system, coordinate_system.origin)
{}
/**
* @brief Construct a new %Antenna object, given a coordinate system and a
* phase reference position.
*
* @param coordinate_system Coordinate system
* @param phase_reference_position Phase reference position
*/
Antenna(const CoordinateSystem &coordinate_system, const vector3r_t &phase_reference_position) :
m_coordinate_system(coordinate_system),
m_phase_reference_position(phase_reference_position),
......@@ -97,6 +122,15 @@ public:
{
}
/**
* @brief Compute the %Antenna response
*
* @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 options
* @return matrix22c_t Jones matrix
*/
matrix22c_t response(
real_t time,
real_t freq,
......@@ -117,6 +151,15 @@ public:
return response;
}
/**
* @brief Compute the array factor of the antenna
*
* @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 options
* @return diag22c_t
*/
diag22c_t arrayFactor(
real_t time,
real_t freq,
......
......@@ -6,11 +6,12 @@
#include <cmath>
namespace everybeam {
vector3r_t BeamFormer::transform_to_local_position(const vector3r_t &position) {
// Get antenna position relative to coordinate system origin
vector3r_t dposition{position[0] - m_coordinate_system.origin[0],
position[1] - m_coordinate_system.origin[1],
position[2] - m_coordinate_system.origin[2]};
// Inner product on orthogonal unit vectors of coordinate system
vector3r_t local_position{
dot(m_coordinate_system.axes.p, dposition),
dot(m_coordinate_system.axes.q, dposition),
......@@ -21,30 +22,11 @@ vector3r_t BeamFormer::transform_to_local_position(const vector3r_t &position) {
}
std::vector<std::complex<double>> BeamFormer::compute_geometric_response(
double freq, const vector3r_t &direction) const {
std::vector<std::complex<double>> result;
result.reserve(m_antennas.size());
const double freq, const vector3r_t &direction) const {
// Initialize and fill result vector by looping over antennas
std::vector<std::complex<double>> result(m_antennas.size());
for (auto &antenna : m_antennas) {
// std::cout << "(" << antenna->m_phase_reference_position[0] << ",
// " <<
// antenna->m_phase_reference_position[1] << ", " <<
// antenna->m_phase_reference_position[2] << ")" << std::endl;
//
// std::cout << "(" << m_local_phase_reference_position[0] << ", "
// <<
// m_local_phase_reference_position[1] << ", " <<
// m_local_phase_reference_position[2] << ")" << std::endl;
//
// std::cout << "(" << (antenna->m_phase_reference_position[0] -
// m_local_phase_reference_position[0]) << ", " <<
// (antenna->m_phase_reference_position[1] -
// m_local_phase_reference_position[1]) << ", " <<
// (antenna->m_phase_reference_position[2] -
// m_local_phase_reference_position[2]) << ")" << std::endl;
//
// std::cout << "======" << std::endl;
double dl = direction[0] * (antenna->m_phase_reference_position[0] -
const double dl = direction[0] * (antenna->m_phase_reference_position[0] -
m_local_phase_reference_position[0]) +
direction[1] * (antenna->m_phase_reference_position[1] -
m_local_phase_reference_position[1]) +
......@@ -59,20 +41,27 @@ std::vector<std::complex<double>> BeamFormer::compute_geometric_response(
std::vector<std::pair<std::complex<double>, std::complex<double>>>
BeamFormer::compute_weights(const vector3r_t &pointing, double freq) const {
std::vector<std::pair<std::complex<double>, std::complex<double>>> result;
double weight_sum[2] = {0.0, 0.0};
// Get geometric response for pointing direction
auto geometric_response = compute_geometric_response(freq, pointing);
result.reserve(geometric_response.size());
for (unsigned int antenna_idx = 0; antenna_idx < m_antennas.size();
// Initialize and fill result
double weight_sum[2] = {0.0, 0.0};
std::vector<std::pair<std::complex<double>, std::complex<double>>> result(
geometric_response.size());
for (std::size_t antenna_idx = 0; antenna_idx < m_antennas.size();
++antenna_idx) {
auto phasor = geometric_response[antenna_idx];
// Compute conjugate of geometric response
auto phasor_conj = std::conj(geometric_response[antenna_idx]);
// Compute the delays in x/y direction
result.push_back(
{std::conj(phasor) * (1.0 * m_antennas[antenna_idx]->m_enabled[0]),
std::conj(phasor) * (1.0 * m_antennas[antenna_idx]->m_enabled[1])});
{phasor_conj * (1.0 * m_antennas[antenna_idx]->m_enabled[0]),
phasor_conj * (1.0 * m_antennas[antenna_idx]->m_enabled[1])});
weight_sum[0] += (1.0 * m_antennas[antenna_idx]->m_enabled[0]);
weight_sum[1] += (1.0 * m_antennas[antenna_idx]->m_enabled[1]);
}
for (unsigned int antenna_idx = 0; antenna_idx < m_antennas.size();
// Normalize the weight by the number of antennas
for (std::size_t antenna_idx = 0; antenna_idx < m_antennas.size();
++antenna_idx) {
result[antenna_idx].first /= weight_sum[0];
result[antenna_idx].second /= weight_sum[1];
......@@ -84,7 +73,9 @@ BeamFormer::compute_weights(const vector3r_t &pointing, double freq) const {
matrix22c_t BeamFormer::local_response(real_t time, real_t freq,
const vector3r_t &direction,
const Options &options) const {
// Weights based on pointing direction of beam
auto weights = compute_weights(options.station0, options.freq0);
// Weights based on direction of interest
auto geometric_response = compute_geometric_response(freq, direction);
matrix22c_t result = {0};
......@@ -108,5 +99,4 @@ matrix22c_t BeamFormer::local_response(real_t time, real_t freq,
}
return result;
}
} // namespace everybeam
......@@ -8,45 +8,69 @@
#include "Types.h"
namespace everybeam {
class BeamFormer : public Antenna
{
public:
typedef std::shared_ptr<BeamFormer> Ptr;
/**
* @brief Construct a new BeamFormer object
*
*/
BeamFormer() :
Antenna()
{
m_local_phase_reference_position = transform_to_local_position(m_phase_reference_position);
}
/**
* @brief Construct a new BeamFormer object given a coordinate system.
*
* @param coordinate_system
*/
BeamFormer(const CoordinateSystem &coordinate_system) :
Antenna(coordinate_system)
{
m_local_phase_reference_position = transform_to_local_position(m_phase_reference_position);
}
/**
* @brief Construct a new BeamFormer object given a coordinate system and a phase reference position
*
* @param coordinate_system
* @param phase_reference_position
*/
BeamFormer(CoordinateSystem coordinate_system, vector3r_t phase_reference_position) :
Antenna(coordinate_system, phase_reference_position)
{
m_local_phase_reference_position = transform_to_local_position(m_phase_reference_position);
}
/**
* @brief Add an antenna to the m_antenna array.
*
* @param antenna
*/
void add_antenna(Antenna::Ptr antenna) {m_antennas.push_back(antenna);}
private:
vector3r_t m_local_phase_reference_position; // in coordinate system of Antenna
// Transform position vector into a local position vector
vector3r_t transform_to_local_position(const vector3r_t &position);
// Compute the BeamFormer response in certain direction of arrival (ITRF, m)
// and return (Jones) matrix of response
virtual matrix22c_t local_response(
real_t time,
real_t freq,
const vector3r_t &direction,
const Options &options) const override;
// Compute the local arrayFactor, with arrayFactor a vectorial "representation"
// of Jones matrix
virtual diag22c_t local_arrayFactor(
real_t time,
real_t freq,
......@@ -56,15 +80,16 @@ private:
return {1.0, 1.0};
}
std::vector<std::complex<double>> compute_geometric_response(double freq, const vector3r_t &direction) const;
// Compute the geometric response for all the antennas in the BeamFormer based on
// the probing frequency and a specified direction (either pointing dir or dir of interest).
std::vector<std::complex<double>> compute_geometric_response(const double freq, const vector3r_t &direction) const;
// Compute the weights based on the pointing direction of the beam and the beam reference frequence.
std::vector<std::pair<std::complex<double>,std::complex<double>>> compute_weights(const vector3r_t &direction, double freq) const;
// List of antennas in BeamFormer
// TODO: Maybe refactor to _m_antennas to indicate m_antennas is a private attribute
std::vector<Antenna::Ptr> m_antennas;
};
} // namespace everybeam
#endif
//# Constants.h: %Constants used in this library.
//#
//# 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$
// Constants.h: %Constants used in this library.
//
// 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 EVERYBEAM_CONSTANTS_H
#define EVERYBEAM_CONSTANTS_H
......
......@@ -2,7 +2,6 @@
#include "MathUtil.h"
namespace everybeam {
matrix22c_t Element::local_response(real_t time, real_t freq,
const vector3r_t &direction, size_t id,
const Options &options) const {
......@@ -31,5 +30,4 @@ matrix22c_t Element::local_response(real_t time, real_t freq,
const Options &options) const {
return local_response(time, freq, direction, m_id, options);
}
} // namespace everybeam
......@@ -10,18 +10,40 @@
namespace everybeam {
/**
* @brief Elementary antenna, for which a response can be computed,
* but without any substructure like a beamformer
*
*/
class Element : public Antenna
{
public:
typedef std::shared_ptr<Element> Ptr;
/**
* @brief Construct a new Element object
*
* @param coordinate_system (antenna) CoordinateSystem
* @param element_response ElementResponseModel
* @param id
*/
Element(const CoordinateSystem &coordinate_system, ElementResponse::Ptr element_response, int id) :
Antenna(coordinate_system),
m_id(id),
m_element_response(element_response)
{}
/**
* @brief Compute the local response of the element.
*
* @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 id ID of element
* @param options
* @return matrix22c_t
*/
matrix22c_t local_response(
real_t time,
real_t freq,
......@@ -30,7 +52,6 @@ public:
const Options &options) const;
private:
virtual matrix22c_t local_response(
real_t time,
real_t freq,
......
#include "ElementResponse.h"
namespace everybeam {
std::ostream& operator<<(std::ostream& os, ElementResponseModel model) {
switch (model) {
case Unknown:
......@@ -24,5 +23,4 @@ std::ostream& operator<<(std::ostream& os, ElementResponseModel model) {
}
return os;
}
} // namespace everybeam
......@@ -18,18 +18,41 @@ enum ElementResponseModel {
std::ostream& operator<<(std::ostream& os, ElementResponseModel model);
/**
* @brief Virtual class for the element response model. All the (antenna/element)
* response models inherit from this class.
*
*/
class ElementResponse
{
public:
typedef MutablePtr<ElementResponse> Ptr;
typedef MutablePtr<ElementResponse> Ptr; //!< Pointer to ElementResponse object
/**
* @brief Virtual implementation of response method
*
* @param freq Frequency of the plane wave (Hz).
* @param theta Angle wrt. z-axis (rad)
* @param phi Angle in the xy-plane wrt. x-axis (rad)
* @param result Pointer to 2x2 array of Jones matrix
*/
virtual void response(
double freq,
double theta,
double phi,
std::complex<double> (&result)[2][2]) const = 0;
/**
* @brief Virtual implementation of response method
*
* @param element_id ID of element
* @param freq Frequency of the plane wave (Hz).
* @param theta Angle wrt. z-axis (rad)
* @param phi Angle in the xy-plane wrt. x-axis (rad)
* @param result Pointer to 2x2 array of Jones matrix
*/
virtual void response(
int element_id,
double freq,
......@@ -41,7 +64,5 @@ public:
}
};
} // namespace everybeam
#endif
//# Dir2ITRF.cc: Convertor that maps time to an ITRF direction.
// Dir2ITRF.cc: Convertor that maps time to an ITRF direction.
#include "ITRFDirection.h"
#include "ITRFConverter.h"
......
//# Dir2ITRF.h: Convertor that maps time to an ITRF direction.
// Dir2ITRF.h: Convertor that maps time to an ITRF direction.
#ifndef EVERYBEAM_DIR2ITRF_H
#define EVERYBEAM_DIR2ITRF_H
......@@ -16,6 +16,11 @@
namespace everybeam {
/**
* @brief Class providing utilities for coordinate transformations
* to and from ITRF (International Terrestrial Reference Frame)
*
*/
class ITRFConverter
{
public:
......@@ -36,7 +41,5 @@ private:
casacore::MeasFrame itsFrame;
mutable casacore::MDirection::Convert itsConverter;
};
} // namespace everybeam
#endif
//# ITRFDirection.cc: Functor that maps time to an ITRF direction.
//#
//# 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$
// ITRFDirection.cc: Functor that maps time to an ITRF direction.
//
// 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$
#include "ITRFDirection.h"
......
//# ITRFDirection.h: Functor that maps time to an ITRF direction.
//#
//# 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$
// ITRFDirection.h: Functor that maps time to an ITRF direction.
//
// 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 EVERYBEAM_ITRFDIRECTION_H
#define EVERYBEAM_ITRFDIRECTION_H
......
//# LofarMetaDataUtil.cc: Utility functions to read the meta data relevant for
//# simulating the beam from LOFAR observations stored in MS format.
//#
//# 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$
// LofarMetaDataUtil.cc: Utility functions to read the meta data relevant for
// simulating the beam from LOFAR observations stored in MS format.
//
// 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$
#include "LofarMetaDataUtil.h"
// #include "AntennaFieldLBA.h"
......
//# LofarMetaDataUtil.h: Utility functions to read the meta data relevant for
//# simulating the beam from LOFAR observations stored in MS format.
//#
//# 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$
// LofarMetaDataUtil.h: Utility functions to read the meta data relevant for
// simulating the beam from LOFAR observations stored in MS format.
//
// 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 EVERYBEAM_LOFARMETADATAUTIL_H
#define EVERYBEAM_LOFARMETADATAUTIL_H
......@@ -39,11 +39,28 @@ namespace everybeam {
const ElementResponseModel defaultElementResponseModel = ElementResponseModel::Hamaker;
/**
* @brief Read single station from MeasurementSet
*
* @param ms Measurement set
* @param id Station id
* @param model Element response model
* @return Station::Ptr
*/
Station::Ptr readStation(
const casacore::MeasurementSet &ms,
unsigned int id,
const ElementResponseModel model = defaultElementResponseModel);
/**
* @brief Read multiple stations from measurment set into buffer out_it
* Loops over readStation for all the antennas in MeasurementSet
*
* @tparam T Template type
* @param ms Measurement set
* @param out_it Out buffer
* @param model Element Response buffer
*/
template <typename T>
void readStations(
const casacore::MeasurementSet &ms,
......
//# MathUtil.cc: Various mathematical operations on vectors and matrices.
//#
//# 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$
// MathUtil.cc: Various mathematical operations on vectors and matrices.
//
// 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$
#include "MathUtil.h"
......
//# MathUtil.h: Various mathematical operations on vectors and matrices.
//#
//# 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$
// MathUtil.h: Various mathematical operations on vectors and matrices.
//
// 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 EVERYBEAM_MATHUTIL_H
#define EVERYBEAM_MATHUTIL_H
......
//# MutablePtr.h: Representation of an LBA antenna field.
//#
//# 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$
// MutablePtr.h: Representation of an LBA antenna field.
//
// 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 EVERYBEAM_MUTABLEPTR_H
#define EVERYBEAM_MUTABLEPTR_H
......@@ -82,7 +82,5 @@ public:
void set(std::shared_ptr<T> ptr) { *(this->get()) = ptr;}
explicit operator bool() const noexcept {return **this;}
};
} // namespace everybeam
#endif
//# Station.cc: 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$
// Station.cc: 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$
#include "Station.h"
#include "MathUtil.h"
......
//# 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$
// 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 EVERYBEAM_STATION_H
#define EVERYBEAM_STATION_H
......@@ -36,7 +36,6 @@
#include <vector>
namespace everybeam {
class Station
{
public:
......@@ -57,14 +56,10 @@ public:
void setModel(const ElementResponseModel model);
/*!
* \brief Return the name of the station.
*/
//! Return the name of the station.
const std::string &name() const;
/*!
* \brief Return the position of the station (ITRF, m).
*/
//! Return the position of the station (ITRF, m).
const vector3r_t &position() const;
/*!
......@@ -79,50 +74,43 @@ public:
*/
void setPhaseReference(const vector3r_t &reference);
/*!
* \brief Return the phase reference position (ITRF, m).
*
* \see Station::setPhaseReference()
*/
//! 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
* 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
* (%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.
*/
//! 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.
*/
// /*!
// * \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.
*/
// /*!
// * \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.
*/
// /*!
// * \brief Return an iterator that points to the end of the list of antenna
// * fields.
// */
// FieldList::const_iterator endFields() const;
/*!
......@@ -141,7 +129,7 @@ public:
* \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 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
......@@ -174,7 +162,7 @@ public:
* \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 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
......@@ -304,12 +292,32 @@ public:
const ElementResponse::Ptr get_element_response() {return itsElementResponse;}
/**
* @brief Compute the Jones matrix for the element response
*
* @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 id Element id
* @param rotate Boolean deciding if paralactic rotation should be applied.
* @return matrix22c_t Jones matrix of element response
*/
matrix22c_t elementResponse(real_t time, real_t freq,
const vector3r_t &direction, size_t id, const bool rotate) const;
/**
* @brief Compute the Jones matrix for the element response
*
* @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 rotate Boolean deciding if paralactic rotation should be applied.
* @return matrix22c_t Jones matrix of element response
*/
matrix22c_t elementResponse(real_t time, real_t freq,
const vector3r_t &direction, const bool rotate = true) const;
//! Specialized implementation of response function.
matrix22c_t response(
real_t time,
real_t freq,
......@@ -318,17 +326,17 @@ public:
return itsAntenna->response(time, freq, direction);
}
//! Set antenna attribute, usually a BeamFormer, but can also be an Element
void set_antenna(Antenna::Ptr antenna) {itsAntenna = antenna;}
//! Set Element attribute
void set_element(Element::Ptr element) {itsElement = element;}
private:
vector3r_t ncp(real_t time) const;
vector3r_t ncppol0(real_t time) const;
/** Compute the parallactic rotation. */
//! Compute the parallactic rotation.
matrix22r_t rotation(real_t time, const vector3r_t &direction) const;
std::string itsName;
......@@ -357,9 +365,9 @@ private:
};
//# ------------------------------------------------------------------------- //
//# - Implementation: Station - //
//# ------------------------------------------------------------------------- //
// ------------------------------------------------------------------------- //
// - Implementation: Station - //
// ------------------------------------------------------------------------- //
template <typename T, typename U>
void Station::response(unsigned int count, real_t time, T freq,
......@@ -408,7 +416,5 @@ void Station::arrayFactor(unsigned int count, real_t time, T freq,
tile0);
}
}
} // namespace everybeam
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment