Skip to content
Snippets Groups Projects
Commit ade8b013 authored by Jakob Maljaars's avatar Jakob Maljaars
Browse files

Merge branch 'random-fixes' into 'master'

Random fixes

See merge request !124
parents 12c56e0f 8dcddadb
No related branches found
No related tags found
1 merge request!124Random fixes
Pipeline #11122 passed
...@@ -36,7 +36,7 @@ class ATermBeam : public ATermBase { ...@@ -36,7 +36,7 @@ class ATermBeam : public ATermBase {
last_field_id_ = 0; last_field_id_ = 0;
} }
double AverageUpdateTime() const override { return update_interval_; } double AverageUpdateTime() const final override { return update_interval_; }
protected: protected:
virtual bool CalculateBeam(std::complex<float>* buffer, double time, virtual bool CalculateBeam(std::complex<float>* buffer, double time,
......
...@@ -48,7 +48,7 @@ class ATermConfig : public ATermBase { ...@@ -48,7 +48,7 @@ class ATermConfig : public ATermBase {
size_t fieldId, const double* uvwInM) final override; size_t fieldId, const double* uvwInM) final override;
/** Reimplemented from ATermBase */ /** Reimplemented from ATermBase */
double AverageUpdateTime() const override { double AverageUpdateTime() const final override {
double avgTime = aterms_.front()->AverageUpdateTime(); double avgTime = aterms_.front()->AverageUpdateTime();
for (size_t i = 1; i < aterms_.size(); ++i) for (size_t i = 1; i < aterms_.size(); ++i)
avgTime = std::min(avgTime, aterms_[i]->AverageUpdateTime()); avgTime = std::min(avgTime, aterms_[i]->AverageUpdateTime());
......
...@@ -25,7 +25,7 @@ class DLDMATerm final : public FitsATermBase { ...@@ -25,7 +25,7 @@ class DLDMATerm final : public FitsATermBase {
update_interval_ = updateInterval; update_interval_ = updateInterval;
} }
double AverageUpdateTime() const override { double AverageUpdateTime() const final override {
return std::min(FitsATermBase::AverageUpdateTime(), update_interval_); return std::min(FitsATermBase::AverageUpdateTime(), update_interval_);
} }
......
...@@ -198,7 +198,7 @@ class H5ParmATerm final : public ATermBase { ...@@ -198,7 +198,7 @@ class H5ParmATerm final : public ATermBase {
} }
// Get average update time, fixed value for h5parm aterm // Get average update time, fixed value for h5parm aterm
double AverageUpdateTime() const override final { return update_interval_; } double AverageUpdateTime() const final override { return update_interval_; }
private: private:
// Expand complex exponential from amplitude and phase as // Expand complex exponential from amplitude and phase as
......
...@@ -31,7 +31,7 @@ class PAFBeamTerm final : public ATermBase { ...@@ -31,7 +31,7 @@ class PAFBeamTerm final : public ATermBase {
update_interval_ = update_interval; update_interval_ = update_interval;
} }
double AverageUpdateTime() const override { return update_interval_; } double AverageUpdateTime() const final override { return update_interval_; }
void Open(const std::string& filename_template, void Open(const std::string& filename_template,
const std::vector<std::string>& antenna_map, const std::vector<std::string>& antenna_map,
......
// constants.h: %Constants used in this library. // constants.h: Constants used in this library.
// //
// Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy) // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#define EVERYBEAM_CONSTANTS_H #define EVERYBEAM_CONSTANTS_H
// \file // \file
// %Constants used in this library. // Constants used in this library.
#include "types.h" #include "types.h"
......
...@@ -20,8 +20,7 @@ inline real_t dot(const vector3r_t &arg0, const vector3r_t &arg1) { ...@@ -20,8 +20,7 @@ inline real_t dot(const vector3r_t &arg0, const vector3r_t &arg1) {
inline double norm(const vector3r_t &arg0) { return sqrt(dot(arg0, arg0)); } inline double norm(const vector3r_t &arg0) { return sqrt(dot(arg0, arg0)); }
inline vector3r_t operator*(real_t arg0, const vector3r_t arg1) { inline vector3r_t operator*(real_t arg0, const vector3r_t arg1) {
vector3r_t result = {{arg0 * arg1[0], arg0 * arg1[1], arg0 * arg1[2]}}; return vector3r_t{arg0 * arg1[0], arg0 * arg1[1], arg0 * arg1[2]};
return result;
} }
inline vector3r_t normalize(const vector3r_t &arg0) { inline vector3r_t normalize(const vector3r_t &arg0) {
...@@ -30,34 +29,25 @@ inline vector3r_t normalize(const vector3r_t &arg0) { ...@@ -30,34 +29,25 @@ inline vector3r_t normalize(const vector3r_t &arg0) {
inline vector2r_t cart2thetaphi(const vector3r_t &cart) { inline vector2r_t cart2thetaphi(const vector3r_t &cart) {
real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]); real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]);
vector2r_t thetaphi = {{M_PI_2 - atan2(cart[2], r), atan2(cart[1], cart[0])}}; return vector2r_t{M_PI_2 - atan2(cart[2], r), atan2(cart[1], cart[0])};
return thetaphi;
} }
inline vector3r_t thetaphi2cart(const vector2r_t &thetaphi) { inline vector3r_t thetaphi2cart(const vector2r_t &thetaphi) {
real_t r = sin(thetaphi[0]); real_t r = sin(thetaphi[0]);
vector3r_t cart = { return vector3r_t{r * cos(thetaphi[1]), r * sin(thetaphi[1]),
{r * cos(thetaphi[1]), r * sin(thetaphi[1]), cos(thetaphi[0])}}; cos(thetaphi[0])};
return cart;
} }
// returns az, el, r. // returns az, el, r.
inline vector3r_t cart2sph(const vector3r_t &cart) { inline vector3r_t cart2sph(const vector3r_t &cart) {
real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]); real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]);
return vector3r_t{atan2(cart[1], cart[0]), atan2(cart[2], r), norm(cart)};
vector3r_t sph;
sph[0] = atan2(cart[1], cart[0]);
sph[1] = atan2(cart[2], r);
sph[2] = norm(cart);
return sph;
} }
// expects az, el, r. // expects az, el, r.
inline vector3r_t sph2cart(const vector3r_t &sph) { inline vector3r_t sph2cart(const vector3r_t &sph) {
vector3r_t cart = {{sph[2] * cos(sph[1]) * cos(sph[0]), return vector3r_t{sph[2] * cos(sph[1]) * cos(sph[0]),
sph[2] * cos(sph[1]) * sin(sph[0]), sph[2] * cos(sph[1]) * sin(sph[0]), sph[2] * sin(sph[1])};
sph[2] * sin(sph[1])}};
return cart;
} }
inline matrix22c_t operator*(const matrix22c_t &arg0, const matrix22r_t &arg1) { inline matrix22c_t operator*(const matrix22c_t &arg0, const matrix22r_t &arg1) {
...@@ -70,23 +60,17 @@ inline matrix22c_t operator*(const matrix22c_t &arg0, const matrix22r_t &arg1) { ...@@ -70,23 +60,17 @@ inline matrix22c_t operator*(const matrix22c_t &arg0, const matrix22r_t &arg1) {
} }
inline vector3r_t cross(const vector3r_t &arg0, const vector3r_t &arg1) { inline vector3r_t cross(const vector3r_t &arg0, const vector3r_t &arg1) {
vector3r_t result; return vector3r_t{arg0[1] * arg1[2] - arg0[2] * arg1[1],
result[0] = arg0[1] * arg1[2] - arg0[2] * arg1[1]; arg0[2] * arg1[0] - arg0[0] * arg1[2],
result[1] = arg0[2] * arg1[0] - arg0[0] * arg1[2]; arg0[0] * arg1[1] - arg0[1] * arg1[0]};
result[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0];
return result;
} }
inline vector3r_t operator+(const vector3r_t &arg0, const vector3r_t &arg1) { inline vector3r_t operator+(const vector3r_t &arg0, const vector3r_t &arg1) {
vector3r_t result = { return vector3r_t{arg0[0] + arg1[0], arg0[1] + arg1[1], arg0[2] + arg1[2]};
{arg0[0] + arg1[0], arg0[1] + arg1[1], arg0[2] + arg1[2]}};
return result;
} }
inline vector3r_t operator-(const vector3r_t &arg0, const vector3r_t &arg1) { inline vector3r_t operator-(const vector3r_t &arg0, const vector3r_t &arg1) {
vector3r_t result = { return vector3r_t{arg0[0] - arg1[0], arg0[1] - arg1[1], arg0[2] - arg1[2]};
{arg0[0] - arg1[0], arg0[1] - arg1[1], arg0[2] - arg1[2]}};
return result;
} }
inline matrix22c_t normalize(const raw_response_t &raw) { inline matrix22c_t normalize(const raw_response_t &raw) {
...@@ -118,7 +102,5 @@ inline diag22c_t normalize(const raw_array_factor_t &raw) { ...@@ -118,7 +102,5 @@ inline diag22c_t normalize(const raw_array_factor_t &raw) {
return af; return af;
} }
} // namespace everybeam } // namespace everybeam
#endif // EVERYBEAM_MATHUTIL_H
#endif
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
#ifndef EVERYBEAM_TYPES_H #ifndef EVERYBEAM_TYPES_H
#define EVERYBEAM_TYPES_H #define EVERYBEAM_TYPES_H
// \file
// Types used in this library.
#include <array> #include <array>
#include <cstring> #include <cstring>
#include <ostream> #include <ostream>
......
...@@ -61,7 +61,7 @@ ITRFDirection::ITRFDirection(const vector3r_t &direction) ...@@ -61,7 +61,7 @@ ITRFDirection::ITRFDirection(const vector3r_t &direction)
} }
vector3r_t ITRFDirection::at(real_t time) const { vector3r_t ITRFDirection::at(real_t time) const {
std::lock_guard<std::mutex> lock(itsMutex); std::lock_guard<std::mutex> lock(mutex_);
// Cannot use MeasFrame::resetEpoch(Double), because that assumes the // Cannot use MeasFrame::resetEpoch(Double), because that assumes the
// argument is UTC in (fractional) days (MJD). // argument is UTC in (fractional) days (MJD).
...@@ -70,8 +70,7 @@ vector3r_t ITRFDirection::at(real_t time) const { ...@@ -70,8 +70,7 @@ vector3r_t ITRFDirection::at(real_t time) const {
const casacore::MDirection &m_ITRF = converter_(); const casacore::MDirection &m_ITRF = converter_();
const casacore::MVDirection &mv_ITRF = m_ITRF.getValue(); const casacore::MVDirection &mv_ITRF = m_ITRF.getValue();
vector3r_t itrf = {{mv_ITRF(0), mv_ITRF(1), mv_ITRF(2)}}; return vector3r_t{mv_ITRF(0), mv_ITRF(1), mv_ITRF(2)};
return itrf;
} }
} // namespace coords } // namespace coords
} // namespace everybeam } // namespace everybeam
\ No newline at end of file
...@@ -40,7 +40,7 @@ class ITRFDirection { ...@@ -40,7 +40,7 @@ class ITRFDirection {
mutable casacore::MeasFrame frame_; mutable casacore::MeasFrame frame_;
mutable casacore::MDirection::Convert converter_; mutable casacore::MDirection::Convert converter_;
mutable std::mutex itsMutex; mutable std::mutex mutex_;
}; };
} // namespace coords } // namespace coords
} // namespace everybeam } // namespace everybeam
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment