diff --git a/Antenna.cc b/Antenna.cc index 1fbd589b6252aee220f069a7963a20589ee89b11..7316941b86cc243110803620779fc0b7645491be 100644 --- a/Antenna.cc +++ b/Antenna.cc @@ -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 diff --git a/Antenna.h b/Antenna.h index 717f390c178b6f8d4c5cc83b8b5b5acd9ea0f6e0..087ed2b93de9b1f55f9c5012e302716475e4d44c 100644 --- a/Antenna.h +++ b/Antenna.h @@ -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, diff --git a/BeamFormer.cc b/BeamFormer.cc index 5b9a412b832d351193e2af4ce148861158eb300f..8f63c24c49f64324fe37472e9337e4021d8b5f7f 100644 --- a/BeamFormer.cc +++ b/BeamFormer.cc @@ -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,35 +22,16 @@ 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] - - m_local_phase_reference_position[0]) + - direction[1] * (antenna->m_phase_reference_position[1] - - m_local_phase_reference_position[1]) + - direction[2] * (antenna->m_phase_reference_position[2] - - m_local_phase_reference_position[2]); + 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]) + + direction[2] * (antenna->m_phase_reference_position[2] - + m_local_phase_reference_position[2]); double phase = -2 * M_PI * dl / (constants::c / freq); result.push_back({std::sin(phase), std::cos(phase)}); @@ -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 diff --git a/BeamFormer.h b/BeamFormer.h index c12a350dd2f6a63a541bd9d58476008d35c2d8bc..8fe72d32db622d05c06fcb0f4a1468916f392038 100644 --- a/BeamFormer.h +++ b/BeamFormer.h @@ -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, @@ -55,16 +79,17 @@ 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 diff --git a/Constants.h b/Constants.h index fa9e86ffd72acc1dd4a94803e01e9ed83bc86eef..53bf3eab7b4fb5c4c315f270dfe2c7043c69bc04 100644 --- a/Constants.h +++ b/Constants.h @@ -1,24 +1,24 @@ -//# 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 diff --git a/Element.cc b/Element.cc index 80b3226c9dc326af460bbc3c46772f4afd81f0b8..cfa6be3c0388c13dd757ec3ec271428406a70438 100644 --- a/Element.cc +++ b/Element.cc @@ -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 diff --git a/Element.h b/Element.h index 8595563cff103844d252b76cc336631f43ca22b0..83ba0ae0d843ca4a451824b70111cf25ab6b5192 100644 --- a/Element.h +++ b/Element.h @@ -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, diff --git a/ElementResponse.cc b/ElementResponse.cc index 77625f618342c79f91d5f9e354a23cea5677938b..6e11910608373f655348a7bec69b92a12240dc97 100644 --- a/ElementResponse.cc +++ b/ElementResponse.cc @@ -1,7 +1,6 @@ #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 diff --git a/ElementResponse.h b/ElementResponse.h index 43733f2bf13983b3016d0fcc058e35161912189c..eca9f106711237e4d8c38d46a42b4840b2cd2220 100644 --- a/ElementResponse.h +++ b/ElementResponse.h @@ -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 diff --git a/ITRFConverter.cc b/ITRFConverter.cc index 8ce27a2a8b68ce744639eb1f6e3b8eb8ae9116d1..e51b7aed95d048eff4d3b9e5b5e54128baf3bcf9 100644 --- a/ITRFConverter.cc +++ b/ITRFConverter.cc @@ -1,4 +1,4 @@ -//# 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" diff --git a/ITRFConverter.h b/ITRFConverter.h index c19b0c6a6e8611d21ce463d1686175c0421e3a1d..ff830b5e264a05d1c6cc980c5b4afbaa75007ba6 100644 --- a/ITRFConverter.h +++ b/ITRFConverter.h @@ -1,4 +1,4 @@ -//# 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 diff --git a/ITRFDirection.cc b/ITRFDirection.cc index 20a45cf83ecba0933ceee836d709d90244971670..50fe889dd800bdd7ecfcf0ba49c50eaa4895f11d 100644 --- a/ITRFDirection.cc +++ b/ITRFDirection.cc @@ -1,24 +1,24 @@ -//# 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" diff --git a/ITRFDirection.h b/ITRFDirection.h index 09234a9b2020f4176c8ef9a9bf834f1da4bd9df4..1a2e1428edded7976f846c6e29ca547f681ac680 100644 --- a/ITRFDirection.h +++ b/ITRFDirection.h @@ -1,24 +1,24 @@ -//# 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 diff --git a/LofarMetaDataUtil.cc b/LofarMetaDataUtil.cc index 9daf5fca4771bec9171fe2aa2bed2564d5100324..fc151d333a1fa5474da4e486709c731acf6057f1 100644 --- a/LofarMetaDataUtil.cc +++ b/LofarMetaDataUtil.cc @@ -1,25 +1,25 @@ -//# 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" diff --git a/LofarMetaDataUtil.h b/LofarMetaDataUtil.h index e8124a63f9d3b52b3a33ad8d309149837a3c1bd6..8d042fc33e2c2c3ff9a0216476a5e4c91666f530 100644 --- a/LofarMetaDataUtil.h +++ b/LofarMetaDataUtil.h @@ -1,25 +1,25 @@ -//# 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, diff --git a/MathUtil.cc b/MathUtil.cc index b73819ee27ea24b3cdf0bed45365d97274e75b20..005e08974f4213647633088830cd08003e35ae08 100644 --- a/MathUtil.cc +++ b/MathUtil.cc @@ -1,24 +1,24 @@ -//# 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" diff --git a/MathUtil.h b/MathUtil.h index 96c555507bc34803cd1e207228db9880b29c33f6..0a35cd0b0bc208758da98869a8a7c5cd518feb5a 100644 --- a/MathUtil.h +++ b/MathUtil.h @@ -1,24 +1,24 @@ -//# 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 diff --git a/MutablePtr.h b/MutablePtr.h index 4afb5f00a47c42e896ee2468fbff88357b1d62d4..b4ad46166c2b195ad0583d1aa4296381525767af 100644 --- a/MutablePtr.h +++ b/MutablePtr.h @@ -1,24 +1,24 @@ -//# 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 diff --git a/Station.cc b/Station.cc index 7a0749af4c7aa263eee8f2332e21b434575ba458..bf611b885e2c1c4415035159bbeaeb494e9a8ab3 100644 --- a/Station.cc +++ b/Station.cc @@ -1,24 +1,24 @@ -//# 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" diff --git a/Station.h b/Station.h index e09c546394c025e614379e27d4993c01ca8461bf..9ea54f7ef78b916d32ac9ef555be12cb52bd6517 100644 --- a/Station.h +++ b/Station.h @@ -1,24 +1,24 @@ -//# 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 diff --git a/Types.cc b/Types.cc index 8b5b807e8763daae9a823f4d16120cbd9685d57e..f75ae16544a909d24828216d8c11a85bec002566 100644 --- a/Types.cc +++ b/Types.cc @@ -1,24 +1,24 @@ -//# Types.cc: Declaration of types 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$ +// Types.cc: Declaration of types 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$ #include "Types.h" diff --git a/Types.h b/Types.h index 48ae0b63784c1acf3bc47c8a26f0bb0df18baf26..21fd299577918716648dad5b7ccdee5a2cbd86c9 100644 --- a/Types.h +++ b/Types.h @@ -1,24 +1,24 @@ -//# Types.h: Types 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$ +// Types.h: Types 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_TYPES_H #define EVERYBEAM_TYPES_H diff --git a/hamaker/HamakerCoeff.h b/hamaker/HamakerCoeff.h index 48a7837c3a42fa97ee379f90d85fd1c6c2cf38a7..1f46e1985916f0bd104e5ec6a78de6ffd0f17d82 100644 --- a/hamaker/HamakerCoeff.h +++ b/hamaker/HamakerCoeff.h @@ -10,15 +10,17 @@ #include <H5Cpp.h> +//! Hamaker coefficients class HamakerCoefficients { public: + //! Default constructor HamakerCoefficients(); - // Constructor for reading coeff from file + //! Constructor for reading coeff from file HamakerCoefficients( std::string& filename); - // Constructor for writing coeff to file + //! Constructor for writing coeff to file HamakerCoefficients( const double freq_center, const double freq_range, @@ -26,7 +28,14 @@ class HamakerCoefficients { const unsigned int nPowerTheta, const unsigned int nPowerFreq); - // Set + /** + * @brief Set Hamaker coefficients + * + * @param n + * @param t + * @param f + * @param value + */ void set_coeff( const unsigned int n, const unsigned int t, diff --git a/hamaker/HamakerElementResponse.cc b/hamaker/HamakerElementResponse.cc index 545e85a78f3f93c101446bc525fa7f5d88f047dc..f48ad4a804f0aec5df5beb98b414136a3e928c92 100644 --- a/hamaker/HamakerElementResponse.cc +++ b/hamaker/HamakerElementResponse.cc @@ -1,6 +1,6 @@ -//# HamakerElementResponse.cc: -//# Functions to compute the (idealized) response of a LOFAR -//# LBA or HBA dual dipole antenna. +// HamakerElementResponse.cc: +// Functions to compute the (idealized) response of a LOFAR +// LBA or HBA dual dipole antenna. #include <stdexcept> diff --git a/hamaker/HamakerElementResponse.h b/hamaker/HamakerElementResponse.h index 0dc663ecffe3b207522f1828427b25e9689b04a6..2a22c4eed721722509b657f58cf1c0437ce855f6 100644 --- a/hamaker/HamakerElementResponse.h +++ b/hamaker/HamakerElementResponse.h @@ -8,6 +8,7 @@ namespace everybeam { +//! Implementation of the Hamaker response model class HamakerElementResponse : public ElementResponse { public: diff --git a/lobes/ElementResponse.cc b/lobes/ElementResponse.cc index f11591f209a861605b4266fc2f5076579c982f64..5836334eff06fca24fe7c1309b0bb34fbf89bc04 100644 --- a/lobes/ElementResponse.cc +++ b/lobes/ElementResponse.cc @@ -1,25 +1,25 @@ -//# ElementResponse.cc: Functions to compute the (idealized) response of a LOFAR -//# LBA or HBA dual dipole antenna. -//# -//# Copyright (C) 2011 -//# 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$ +// ElementResponse.cc: Functions to compute the (idealized) response of a LOFAR +// LBA or HBA dual dipole antenna. +// +// Copyright (C) 2011 +// 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 "ElementResponse.h" diff --git a/lobes/ElementResponse.h b/lobes/ElementResponse.h index fbcac1389ba0826107a4d7cf13ab06c1b7df1ba7..90e65c18304557a864f258e99dbb935b42ddcb1a 100644 --- a/lobes/ElementResponse.h +++ b/lobes/ElementResponse.h @@ -1,25 +1,25 @@ -//# ElementResponse.h: Functions to compute the (idealized) response of a LOFAR -//# LBA or HBA dual dipole antenna. -//# -//# Copyright (C) 2011 -//# 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$ +// ElementResponse.h: Functions to compute the (idealized) response of a LOFAR +// LBA or HBA dual dipole antenna. +// +// Copyright (C) 2011 +// 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_ELEMENTRESPONSE_H #define LOFAR_ELEMENTRESPONSE_H @@ -96,6 +96,6 @@ void element_response(double freq, double theta, double phi, // @} -} //# namespace everybeam +} // namespace everybeam #endif diff --git a/lobes/LOBESElementResponse.h b/lobes/LOBESElementResponse.h index c63306019988ffd53698036c37c994a2f28a8910..738d6c21a2552b266133562b3392bb8f1603d9e0 100644 --- a/lobes/LOBESElementResponse.h +++ b/lobes/LOBESElementResponse.h @@ -7,6 +7,7 @@ namespace everybeam { +//! Implementation of the Lobes response model class LOBESElementResponse : public ElementResponse { public: diff --git a/lobes/lobes.h b/lobes/lobes.h index b2386c7b352b2e1c90d7cc4241f5c5d5f87c3fa6..00112ee246ea5cd42badbd47e707b365e664e74a 100644 --- a/lobes/lobes.h +++ b/lobes/lobes.h @@ -4,7 +4,7 @@ namespace py = pybind11; - +//! (Virtual) Beam model class class BeamModel { public: @@ -14,7 +14,7 @@ public: virtual py::array_t<std::complex<double>> eval(py::EigenDRef<const Eigen::ArrayXd> theta, py::EigenDRef<const Eigen::ArrayXd> phi)=0; }; - +//! Lobes beam model, wrapped with pybind11 class LobesBeamModel : public BeamModel { public: @@ -31,6 +31,7 @@ private: py::array_t<int> m_nms; }; +//! Lobes beam model, not implemented! class HamakerBeamModel : public BeamModel { public: diff --git a/makeresponseimage.cc b/makeresponseimage.cc index 23e079d52f634a6726118f9fc4676801657e6935..c2a662a576ec0f4a3eccd8bafb0d625150da68a0 100644 --- a/makeresponseimage.cc +++ b/makeresponseimage.cc @@ -1,25 +1,25 @@ -//# makeresponseimage.cc: Generate images of the station response for a given -//# MeasurementSet. -//# -//# 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$ +// makeresponseimage.cc: Generate images of the station response for a given +// MeasurementSet. +// +// 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 <lofar_config.h> @@ -73,28 +73,14 @@ namespace { * along with the time for which these ITRF coordinates are valid. */ struct ITRFDirectionMap { - /*! - * \brief The time for which this ITRF direction map is valid (MJD(UTC) - * in seconds). - */ - double_t time0; - - /*! - * \brief Station beam former reference direction expressed in ITRF - * coordinates. - */ - vector3r_t station0; - - /*! - * \brief Tile beam former reference direction expressed in ITRF - * coordinates. - */ - vector3r_t tile0; - - /*! - * \brief ITRF coordinates for a grid of points on the sky. - */ - Matrix<vector3r_t> directions; + double_t time0; //!< The time for which this ITRF direction map is valid + //!< (MJD(UTC) in seconds). + vector3r_t station0; //!< Station beam former reference direction expressed + //!< in ITRF coordinates. + vector3r_t tile0; //!< Tile beam former reference direction expressed in ITRF + //!< coordinates. + Matrix<vector3r_t> + directions; //!< ITRF coordinates for a grid of points on the sky. }; /*! @@ -128,22 +114,14 @@ ITRFDirectionMap makeDirectionMap(const DirectionCoordinate &coordinates, DirectionCoordinate makeCoordinates(const MDirection &reference, unsigned int size, double delta); -/*! - * \brief Convert an ITRF position given as a vector3r_t - * instance to a casacore::MPosition. - */ +//! Convert an ITRF position given as a vector3r_t instance to a +//! casacore::MPosition. MPosition toMPositionITRF(const vector3r_t &position); -/*! - * \brief Convert a casacore::MPosition instance to a - * vector3r_t instance. - */ +//! Convert a casacore::MPosition instance to a vector3r_t instance. vector3r_t fromMPosition(const MPosition &position); -/*! - * \brief Convert a casacore::MDirection instance to a - * vector3r_t instance. - */ +//! Convert a casacore::MDirection instance to a vector3r_t instance. vector3r_t fromMDirection(const MDirection &direction); /*! @@ -247,9 +225,7 @@ template <class T> void store(const Cube<T> &data, const DirectionCoordinate &coordinates, double frequency, const string &name); -/*! - * \brief Convert a string to a CASA Quantity (value with unit). - */ +//! Convert a string to a CASA Quantity (value with unit). Quantity readQuantity(const String &in); /*! @@ -433,8 +409,7 @@ ITRFDirectionMap makeDirectionMap(const DirectionCoordinate &coordinates, Vector<Double> pixel = coordinates.referencePixel(); for (pixel(1) = 0.0; pixel(1) < shape(1); ++pixel(1)) { for (pixel(0) = 0.0; pixel(0) < shape(0); ++pixel(0)) { - // CoordinateSystem::toWorld(): RA range [-pi,pi], DEC range - // [-pi/2,pi/2]. + // CoordinateSystem::toWorld(): RA range [-pi,pi], DEC range [-pi/2,pi/2] if (coordinates.toWorld(world, pixel)) { map.directions(pixel(0), pixel(1)) = fromMDirection(convertor(world)); } diff --git a/oskar/OSKARDatafile.h b/oskar/OSKARDatafile.h index f681d9e59283f8e40d0020da8103ddc8822e1f7a..46de070e86d43716c821eda0280585a54f4be65c 100644 --- a/oskar/OSKARDatafile.h +++ b/oskar/OSKARDatafile.h @@ -10,6 +10,7 @@ #include "OSKARDataset.h" +//! Oskar datafile interface class Datafile { public: Datafile( diff --git a/oskar/OSKARDataset.h b/oskar/OSKARDataset.h index f1a0c1a2fc14387722c219cf937c2520e836572a..614167f02d3298134bd393b72699e37326fc916c 100644 --- a/oskar/OSKARDataset.h +++ b/oskar/OSKARDataset.h @@ -6,8 +6,17 @@ #include <H5Cpp.h> +//! OSKAR dataset class Dataset { public: + + /** + * @brief Construct a new Dataset object given a h5 file and a + * frequency + * + * @param h5_file H5 file (.h5) + * @param freq Frequency to look for (Hz) + */ Dataset( H5::H5File& h5_file, const unsigned int freq); diff --git a/oskar/OSKARElementResponse.h b/oskar/OSKARElementResponse.h index d5f69b1761f5b50fbf593b371d072e315eab2d24..ee8b772dd8e7f921aaaa4c45cce2604dfeb42918 100644 --- a/oskar/OSKARElementResponse.h +++ b/oskar/OSKARElementResponse.h @@ -10,6 +10,7 @@ namespace everybeam { +//! Implementation of the OSKAR dipole response model class OSKARElementResponseDipole : public ElementResponse { public: @@ -26,6 +27,7 @@ public: }; +//! Implementation of the OSKAR spherical wave response model class OSKARElementResponseSphericalWave : public ElementResponse { public: diff --git a/pyeverybeam.cc b/pyeverybeam.cc index 791a5a03af81cf8bd252a3be17e86f9ef5b92fc1..dd96edf04ba694ff3203a937f45d43199f54fe94 100644 --- a/pyeverybeam.cc +++ b/pyeverybeam.cc @@ -1,23 +1,23 @@ -//# pyeverybeam.cc: python module for EveryBeam object. -//# Copyright (C) 2007 -//# 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: pystationresponse.cc 33141 2015-12-16 15:10:19Z dijkema $ +// pyeverybeam.cc: python module for EveryBeam object. +// Copyright (C) 2007 +// 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: pystationresponse.cc 33141 2015-12-16 15:10:19Z dijkema $ #include "ITRFDirection.h" #include "LofarMetaDataUtil.h" @@ -49,22 +49,16 @@ using namespace everybeam; namespace everybeam { namespace { -/*! - * \brief Convert an ITRF position given as a everybeam::vector3r_t - * instance to a casacore::MPosition. - */ + +//! Convert an ITRF position given as a everybeam::vector3r_t instance to a +//! casacore::MPosition. MPosition toMPositionITRF(const vector3r_t &position); -/*! - * \brief Convert a casacore::MPosition instance to a - # everybeam::vector3r_t instance. - */ +//! Convert a casacore::MPosition instance to a everybeam::vector3r_t instance. vector3r_t fromMPosition(const MPosition &position); -/*! - * \brief Convert a casacore::MDirection instance to a - * StationResponse::vector3r_t instance. - */ +//! Convert a casacore::MDirection instance to a StationResponse::vector3r_t +//! instance. vector3r_t fromMDirection(const MDirection &direction); /*! @@ -140,44 +134,79 @@ MDirection readTileReference(const MeasurementSet &ms, unsigned int idField); class PyEveryBeam { public: + /** + * @brief Construct a new Py Every Beam object + * + * @param msName + * @param inverse + * @param useElementResponse + * @param useArrayFactor + * @param useChanFreq + */ PyEveryBeam(const string &msName, bool inverse = false, bool useElementResponse = true, bool useArrayFactor = true, bool useChanFreq = false); - // Get the software version. + //! Get the software version. string version(const string &type) const; - // Set the delay reference direction in radians, J2000. The delay reference - // direction is the direction used by the station beamformer. + /** + * @brief Set the delay reference direction in radians, J2000. The delay + * reference direction is the direction used by the station beamformer. + * + * @param ra Right ascension (H) + * @param dec Declination (rad) + */ void setRefDelay(double ra, double dec); - // Get the delay reference direction in meters, ITRF. The delay reference - // direction is the direction used by the station beamformer. + /** + * @brief Get the delay reference direction in meters, ITRF. The delay + * reference direction is the direction used by the station beamformer. + * + */ ValueHolder getRefDelay(real_t time); - // Set the tile reference direction in radians, J2000. The tile reference - // direction is the direction used by the analog tile beamformer and is - // relevant only for HBA observations. + /** + * @brief Set the tile reference direction in radians, J2000. The tile + * reference direction is the direction used by the analog tile beamformer and + * is relevant only for HBA observations. + * + * @param ra Right ascension (H) + * @param dec Declination (rad) + */ void setRefTile(double ra, double dec); - // Get the tile reference direction in meters, ITRF. The delay reference - // direction is the direction used by the analog tile beamformer and is - // relevant only for HBA observations. + /** + * @brief Get the tile reference direction in meters, ITRF. The delay + * reference direction is the direction used by the analog tile beamformer and + * is relevant only for HBA observations. + * + */ ValueHolder getRefTile(real_t time); - // Set the direction of interest in radians, J2000. Can and often will be - // different than the delay and/or tile reference direction. + /** + * @brief Set the direction of interest in radians, J2000. Can and often will + * be different than the delay and/or tile reference direction. + * + * @param ra Right ascension (H) + * @param dec Declination (rad) + */ void setDirection(double ra, double dec); - // Get the direction of intereset in meters, ITRF. + //! Get the direction of intereset in meters, ITRF. ValueHolder getDirection(real_t time); - // Compute the LOFAR beam Jones matrices for the given time, station, and/or - // channel. + // TODO: needs tightening and give methods more meaningful name! + //! Compute the beam Jones matrices for the given time ValueHolder evaluate0(double time); + //! Compute the beam Jones matrices for the given time and station ValueHolder evaluate1(double time, int station); + //! Compute the beam Jones matrices for the given time, station and channel ValueHolder evaluate2(double time, int station, int channel); + //! Compute the beam Jones matrices for the given time, station and frequency ValueHolder evaluate3(double time, int station, double freq); + //! Compute the beam Jones matrices for the given time, station, frequency and + //! direction ValueHolder evaluate4(double time, int station, double freq, const ValueHolder &direction, const ValueHolder &station0, const ValueHolder &tile0); @@ -196,10 +225,11 @@ class PyEveryBeam { const Vector<Double> &freq, const Vector<Double> &freq0) const; + // Utilities for inverting (diagonal) matrix void invert(matrix22c_t &in) const; void invert(diag22c_t &in) const; - //# Data members. + // Data members. bool itsInverse; bool itsUseElementResponse; bool itsUseArrayFactor; @@ -678,7 +708,6 @@ MDirection readTileReference(const MeasurementSet &ms, unsigned int idField) { return readDelayReference(ms, idField); } } // namespace - } // namespace everybeam // Define the python module itself.