diff --git a/CMake/FindBeamModel.cmake b/CMake/FindBeamModel.cmake index ac2e9c19b26f026e62a2032ef33749c98f9183c8..0fe92830973dd413ed8647240ef9c348c4dcb190 100644 --- a/CMake/FindBeamModel.cmake +++ b/CMake/FindBeamModel.cmake @@ -9,7 +9,7 @@ find_package(PackageHandleStandardArgs) find_path( BEAMMODEL_INCLUDE_DIR - NAMES EveryBeam/Station.h + NAMES EveryBeam/station.h HINTS ${BEAMMODEL_ROOT_DIR} PATH_SUFFIXES include ) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index df288d25df17298a9c1b605f0680d1e2bde1eb07..ae820d1df87f75a8c27a94394922c1d7da0b91c9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -9,15 +9,15 @@ add_subdirectory(telescope) #------------------------------------------------------------------------------ add_library(everybeam SHARED - Antenna.cc - ElementResponse.cc - BeamFormer.cc - Element.cc + antenna.cc + element_response.cc + beamformer.cc + element.cc load.cc coords/ITRFConverter.cc coords/ITRFDirection.cc LofarMetaDataUtil.cc - Station.cc + station.cc telescope/lofar.cc gridded_response/lofargrid.cc ) @@ -32,12 +32,12 @@ install ( DESTINATION lib) install (FILES - Antenna.h - BeamFormer.h - Element.h - ElementResponse.h + antenna.h + beamformer.h + element.h + element_response.h LofarMetaDataUtil.h - Station.h + station.h # Related to new API: load.h options.h diff --git a/cpp/LofarMetaDataUtil.cc b/cpp/LofarMetaDataUtil.cc index 4dfe7f0ce79d7cd2116d59703e26d2115f3240aa..55756c046d841624b189a71f9985d8d8cc1fccd5 100644 --- a/cpp/LofarMetaDataUtil.cc +++ b/cpp/LofarMetaDataUtil.cc @@ -22,7 +22,8 @@ // $Id$ #include "LofarMetaDataUtil.h" -#include "common/MathUtil.h" +#include "common/math_utils.h" +#include "common/casa_utils.h" #include <casacore/measures/Measures/MDirection.h> #include <casacore/measures/Measures/MPosition.h> @@ -76,21 +77,11 @@ using namespace casacore; typedef std::array<vector3r_t, 16> TileConfig; -// TODO: can be deprecated in favor of common::hasColumn from CasaUtil.h -bool hasColumn(const Table &table, const string &column) { - return table.tableDesc().isColumn(column); -} - // TODO: utility is not used at all bool hasSubTable(const Table &table, const string &name) { return table.keywordSet().isDefined(name); } -// TODO: can be deprecated in favor of common::getSubTable from CasaUtil.h -Table getSubTable(const Table &table, const string &name) { - return table.keywordSet().asTable(name); -} - TileConfig readTileConfig(const Table &table, unsigned int row) { ROArrayQuantColumn<Double> c_tile_offset(table, "TILE_ELEMENT_OFFSET", "m"); @@ -194,7 +185,7 @@ BeamFormer::Ptr make_tile(unsigned int id, const vector3r_t &position, Antenna::Ptr antenna = Element::Ptr( new Element(antenna_coordinate_system, element_response, id)); - tile->add_antenna(antenna); + tile->AddAntenna(antenna); } return tile; @@ -202,7 +193,8 @@ BeamFormer::Ptr make_tile(unsigned int id, const vector3r_t &position, BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id, ElementResponse::Ptr element_response) { - Antenna::CoordinateSystem coordinate_system = readCoordinateSystem(table, id); + Antenna::CoordinateSystem coordinate_system = + common::readCoordinateSystem(table, id); // std::cout << "coordinate_system: " << std::endl; // std::cout << " axes.p: " << coordinate_system.axes.p[0] << ", " << // coordinate_system.axes.p[1] << ", " << coordinate_system.axes.p[2] << @@ -249,7 +241,7 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id, antenna->m_enabled[0] = !aips_flag(0, i); antenna->m_enabled[1] = !aips_flag(1, i); - beam_former->add_antenna(antenna); + beam_former->AddAntenna(antenna); } return beam_former; } @@ -290,7 +282,7 @@ BeamFormer::Ptr readAntennaFieldAartfaac(const Table &table, vector3r_t readStationPhaseReference(const Table &table, unsigned int id) { vector3r_t phase_reference = {0.0, 0.0, 0.0}; const string columnName("LOFAR_PHASE_REFERENCE"); - if (hasColumn(table, columnName)) { + if (common::hasColumn(table, columnName)) { ROScalarMeasColumn<MPosition> c_reference(table, columnName); MPosition mReference = MPosition::Convert(c_reference(id), MPosition::ITRF)(); @@ -321,22 +313,22 @@ Station::Ptr readStation(const MeasurementSet &ms, unsigned int id, station->setPhaseReference(readStationPhaseReference(ms.antenna(), id)); // Read antenna field information. - ROScalarColumn<String> telescope_name_col(getSubTable(ms, "OBSERVATION"), - "TELESCOPE_NAME"); + ROScalarColumn<String> telescope_name_col( + common::getSubTable(ms, "OBSERVATION"), "TELESCOPE_NAME"); string telescope_name = telescope_name_col(0); if (telescope_name == "LOFAR") { - Table tab_field = getSubTable(ms, "LOFAR_ANTENNA_FIELD"); + Table tab_field = common::getSubTable(ms, "LOFAR_ANTENNA_FIELD"); tab_field = tab_field(tab_field.col("ANTENNA_ID") == static_cast<Int>(id)); // The Station will consist of a BeamFormer that combines the fields // coordinate system is ITRF // phase reference is station position auto beam_former = BeamFormer::Ptr(new BeamFormer( - Antenna::identity_coordinate_system, station->phaseReference())); + Antenna::IdentityCoordinateSystem, station->phaseReference())); for (size_t i = 0; i < tab_field.nrow(); ++i) { - beam_former->add_antenna( + beam_former->AddAntenna( readAntennaField(tab_field, i, station->get_element_response())); } @@ -344,24 +336,24 @@ Station::Ptr readStation(const MeasurementSet &ms, unsigned int id, // If There is only one field, the top level beamformer is not needed // and the station antenna can be set the the beamformer of the field - station->set_antenna(beam_former); + station->SetAntenna(beam_former); size_t field_id = 0; size_t element_id = 0; Antenna::CoordinateSystem coordinate_system = - readCoordinateSystem(tab_field, field_id); + common::readCoordinateSystem(tab_field, field_id); auto model = station->get_element_response(); // TODO: rotate coordinate system for antenna auto element = Element::Ptr(new Element(coordinate_system, model, element_id)); - station->set_element(element); + station->SetElement(element); } else if (telescope_name == "AARTFAAC") { - ROScalarColumn<String> ant_type_col(getSubTable(ms, "OBSERVATION"), + ROScalarColumn<String> ant_type_col(common::getSubTable(ms, "OBSERVATION"), "AARTFAAC_ANTENNA_TYPE"); string ant_type = ant_type_col(0); - Table tab_field = getSubTable(ms, "ANTENNA"); - station->set_antenna(readAntennaFieldAartfaac(tab_field, ant_type, id)); + Table tab_field = common::getSubTable(ms, "ANTENNA"); + station->SetAntenna(readAntennaFieldAartfaac(tab_field, ant_type, id)); } return station; @@ -370,7 +362,7 @@ Station::Ptr readStation(const MeasurementSet &ms, unsigned int id, MDirection readTileBeamDirection(const casacore::MeasurementSet &ms) { MDirection tileBeamDir; - Table fieldTable = getSubTable(ms, "FIELD"); + Table fieldTable = common::getSubTable(ms, "FIELD"); if (fieldTable.nrow() != 1) { throw std::runtime_error( @@ -378,7 +370,7 @@ MDirection readTileBeamDirection(const casacore::MeasurementSet &ms) { "library."); } - if (hasColumn(fieldTable, "LOFAR_TILE_BEAM_DIR")) { + if (common::hasColumn(fieldTable, "LOFAR_TILE_BEAM_DIR")) { ROArrayMeasColumn<MDirection> tileBeamCol(fieldTable, "LOFAR_TILE_BEAM_DIR"); tileBeamDir = *(tileBeamCol(0).data()); diff --git a/cpp/LofarMetaDataUtil.h b/cpp/LofarMetaDataUtil.h index 3975e90d06de0743b4aeb98b3da353bc598e0d39..dd5cce663b923dc9c294dfa60485cddd83b7d2a9 100644 --- a/cpp/LofarMetaDataUtil.h +++ b/cpp/LofarMetaDataUtil.h @@ -28,8 +28,8 @@ // Utility functions to read the meta data relevant for simulating the beam from // LOFAR observations stored in MS format. -#include "Station.h" -#include "ElementResponse.h" +#include "station.h" +#include "element_response.h" #include <casacore/ms/MeasurementSets/MeasurementSet.h> #include <casacore/ms/MeasurementSets/MSAntennaColumns.h> @@ -77,4 +77,4 @@ casacore::MDirection readTileBeamDirection(const casacore::MeasurementSet &ms); } // namespace everybeam -#endif +#endif // EVERYBEAM_LOFARMETADATAUTIL_H diff --git a/cpp/Antenna.cc b/cpp/antenna.cc similarity index 66% rename from cpp/Antenna.cc rename to cpp/antenna.cc index 4d5f7e4c01dd465d1e5889df819edfe762a81797..a9d8777ad5861557c69db8a5317a6ff1e77eaadc 100644 --- a/cpp/Antenna.cc +++ b/cpp/antenna.cc @@ -1,9 +1,9 @@ -#include "Antenna.h" +#include "antenna.h" -#include "common/MathUtil.h" +#include "common/math_utils.h" namespace everybeam { -vector3r_t Antenna::transform_to_local_direction(const vector3r_t &direction) { +vector3r_t Antenna::TransformToLocalDirection(const vector3r_t &direction) { vector3r_t local_direction{ dot(m_coordinate_system.axes.p, direction), dot(m_coordinate_system.axes.q, direction), diff --git a/cpp/Antenna.h b/cpp/antenna.h similarity index 78% rename from cpp/Antenna.h rename to cpp/antenna.h index 5022b6729d8d0f4120fec05509444780fed8d5fe..b4b8ed5483f8af43493a69052d082f476c43f8ac 100644 --- a/cpp/Antenna.h +++ b/cpp/antenna.h @@ -5,13 +5,13 @@ #include <memory> #include <iostream> -#include "common/Types.h" +#include "common/types.h" namespace everybeam { /** * @brief (Virtual) class describing an antenna, and computing the corresponding - * response() and arrayFactor(). + * Response() and ArrayFactor(). * */ class Antenna { @@ -57,7 +57,7 @@ class Antenna { constexpr static vector3r_t zero_origin = {0.0, 0.0, 0.0}; }; - constexpr static CoordinateSystem identity_coordinate_system{ + constexpr static CoordinateSystem IdentityCoordinateSystem{ CoordinateSystem::zero_origin, CoordinateSystem::identity_axes}; typedef std::shared_ptr<Antenna> Ptr; @@ -116,7 +116,7 @@ class Antenna { m_enabled{true, true} {} /** - * @brief Compute the %Antenna response + * @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). @@ -124,20 +124,20 @@ class Antenna { * @param options * @return matrix22c_t Jones matrix */ - matrix22c_t response(real_t time, real_t freq, const vector3r_t &direction, + matrix22c_t Response(real_t time, real_t freq, const vector3r_t &direction, const Options &options = {}) { // Transform direction and directions in options to local coordinatesystem - vector3r_t local_direction = transform_to_local_direction(direction); + vector3r_t local_direction = TransformToLocalDirection(direction); Options local_options = { .freq0 = options.freq0, - .station0 = transform_to_local_direction(options.station0), - .tile0 = transform_to_local_direction(options.tile0), + .station0 = TransformToLocalDirection(options.station0), + .tile0 = TransformToLocalDirection(options.tile0), .rotate = options.rotate, - .east = transform_to_local_direction(options.east), - .north = transform_to_local_direction(options.north)}; - matrix22c_t response = - local_response(time, freq, local_direction, local_options); - return response; + .east = TransformToLocalDirection(options.east), + .north = TransformToLocalDirection(options.north)}; + matrix22c_t Response = + LocalResponse(time, freq, local_direction, local_options); + return Response; } /** @@ -149,15 +149,15 @@ class Antenna { * @param options * @return diag22c_t */ - diag22c_t arrayFactor(real_t time, real_t freq, const vector3r_t &direction, + diag22c_t ArrayFactor(real_t time, real_t freq, const vector3r_t &direction, const Options &options = {}) { // Transform direction and directions in options to local coordinatesystem - vector3r_t local_direction = transform_to_local_direction(direction); + vector3r_t local_direction = TransformToLocalDirection(direction); Options local_options = { .freq0 = options.freq0, - .station0 = transform_to_local_direction(options.station0), - .tile0 = transform_to_local_direction(options.tile0)}; - return local_arrayFactor(time, freq, local_direction, local_options); + .station0 = TransformToLocalDirection(options.station0), + .tile0 = TransformToLocalDirection(options.tile0)}; + return LocalArrayFactor(time, freq, local_direction, local_options); } CoordinateSystem m_coordinate_system; @@ -165,17 +165,17 @@ class Antenna { bool m_enabled[2]; private: - virtual matrix22c_t local_response(real_t time, real_t freq, - const vector3r_t &direction, - const Options &options) const = 0; + virtual matrix22c_t LocalResponse(real_t time, real_t freq, + const vector3r_t &direction, + const Options &options) const = 0; - virtual diag22c_t local_arrayFactor(real_t time, real_t freq, - const vector3r_t &direction, - const Options &options) const { + virtual diag22c_t LocalArrayFactor(real_t time, real_t freq, + const vector3r_t &direction, + const Options &options) const { return {1.0, 1.0}; } - vector3r_t transform_to_local_direction(const vector3r_t &direction); + vector3r_t TransformToLocalDirection(const vector3r_t &direction); }; } // namespace everybeam diff --git a/cpp/BeamFormer.cc b/cpp/beamformer.cc similarity index 61% rename from cpp/BeamFormer.cc rename to cpp/beamformer.cc index c436f057e5a9799a65773358b59efa2bda9c94c8..f9adb94dae0e02257e1d671d88aa1aa5654b5849 100644 --- a/cpp/BeamFormer.cc +++ b/cpp/beamformer.cc @@ -1,12 +1,12 @@ -#include "BeamFormer.h" +#include "beamformer.h" -#include "common/Constants.h" -#include "common/MathUtil.h" +#include "common/constants.h" +#include "common/math_utils.h" #include <cmath> namespace everybeam { -vector3r_t BeamFormer::transform_to_local_position(const vector3r_t &position) { +vector3r_t BeamFormer::TransformToLocalPosition(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], @@ -21,17 +21,17 @@ vector3r_t BeamFormer::transform_to_local_position(const vector3r_t &position) { return local_position; } -std::vector<std::complex<double>> BeamFormer::compute_geometric_response( +std::vector<std::complex<double>> BeamFormer::ComputeGeometricResponse( 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::vector<std::complex<double>> result(antennas_.size()); + for (auto &antenna : antennas_) { const double dl = direction[0] * (antenna->m_phase_reference_position[0] - - m_local_phase_reference_position[0]) + + local_phase_reference_position_[0]) + direction[1] * (antenna->m_phase_reference_position[1] - - m_local_phase_reference_position[1]) + + local_phase_reference_position_[1]) + direction[2] * (antenna->m_phase_reference_position[2] - - m_local_phase_reference_position[2]); + local_phase_reference_position_[2]); double phase = -2 * M_PI * dl / (common::c / freq); result.push_back({std::sin(phase), std::cos(phase)}); @@ -40,28 +40,28 @@ 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 { +BeamFormer::ComputeWeights(const vector3r_t &pointing, double freq) const { // Get geometric response for pointing direction - auto geometric_response = compute_geometric_response(freq, pointing); + auto geometric_response = ComputeGeometricResponse(freq, pointing); // 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(); + for (std::size_t antenna_idx = 0; antenna_idx < antennas_.size(); ++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( - {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]); + {phasor_conj * (1.0 * antennas_[antenna_idx]->m_enabled[0]), + phasor_conj * (1.0 * antennas_[antenna_idx]->m_enabled[1])}); + weight_sum[0] += (1.0 * antennas_[antenna_idx]->m_enabled[0]); + weight_sum[1] += (1.0 * antennas_[antenna_idx]->m_enabled[1]); } // Normalize the weight by the number of antennas - for (std::size_t antenna_idx = 0; antenna_idx < m_antennas.size(); + for (std::size_t antenna_idx = 0; antenna_idx < antennas_.size(); ++antenna_idx) { result[antenna_idx].first /= weight_sum[0]; result[antenna_idx].second /= weight_sum[1]; @@ -70,23 +70,23 @@ BeamFormer::compute_weights(const vector3r_t &pointing, double freq) const { return result; } -matrix22c_t BeamFormer::local_response(real_t time, real_t freq, - const vector3r_t &direction, - const Options &options) const { +matrix22c_t BeamFormer::LocalResponse(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); + auto weights = ComputeWeights(options.station0, options.freq0); // Weights based on direction of interest - auto geometric_response = compute_geometric_response(freq, direction); + auto geometric_response = ComputeGeometricResponse(freq, direction); matrix22c_t result = {0}; - for (unsigned int antenna_idx = 0; antenna_idx < m_antennas.size(); + for (unsigned int antenna_idx = 0; antenna_idx < antennas_.size(); ++antenna_idx) { - auto antenna = m_antennas[antenna_idx]; + auto antenna = antennas_[antenna_idx]; auto antenna_weight = weights[antenna_idx]; auto antenna_geometric_reponse = geometric_response[antenna_idx]; matrix22c_t antenna_response = - antenna->response(time, freq, direction, options); + antenna->Response(time, freq, direction, options); result[0][0] += antenna_weight.first * antenna_geometric_reponse * antenna_response[0][0]; diff --git a/cpp/BeamFormer.h b/cpp/beamformer.h similarity index 60% rename from cpp/BeamFormer.h rename to cpp/beamformer.h index afe7f1e3ee3197a7ed12dae85a7cb4be79802d1c..bef67b3dcfd33451c0aba2d7a86e4f1f89a8ef27 100644 --- a/cpp/BeamFormer.h +++ b/cpp/beamformer.h @@ -4,8 +4,8 @@ #include <complex> #include <vector> -#include "Element.h" -#include "common/Types.h" +#include "element.h" +#include "common/types.h" namespace everybeam { class BeamFormer : public Antenna { @@ -17,8 +17,8 @@ class BeamFormer : public Antenna { * */ BeamFormer() : Antenna() { - m_local_phase_reference_position = - transform_to_local_position(m_phase_reference_position); + local_phase_reference_position_ = + TransformToLocalPosition(m_phase_reference_position); } /** @@ -28,8 +28,8 @@ class BeamFormer : public Antenna { */ BeamFormer(const CoordinateSystem &coordinate_system) : Antenna(coordinate_system) { - m_local_phase_reference_position = - transform_to_local_position(m_phase_reference_position); + local_phase_reference_position_ = + TransformToLocalPosition(m_phase_reference_position); } /** @@ -42,14 +42,14 @@ class BeamFormer : public Antenna { 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); + local_phase_reference_position_ = + TransformToLocalPosition(m_phase_reference_position); } BeamFormer(vector3r_t phase_reference_position) : Antenna(phase_reference_position) { - m_local_phase_reference_position = - transform_to_local_position(m_phase_reference_position); + local_phase_reference_position_ = + TransformToLocalPosition(m_phase_reference_position); } /** @@ -57,44 +57,42 @@ class BeamFormer : public Antenna { * * @param antenna */ - void add_antenna(Antenna::Ptr antenna) { m_antennas.push_back(antenna); } + void AddAntenna(Antenna::Ptr antenna) { antennas_.push_back(antenna); } private: vector3r_t - m_local_phase_reference_position; // in coordinate system of Antenna + 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); + vector3r_t TransformToLocalPosition(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; + virtual matrix22c_t LocalResponse(real_t time, real_t freq, + const vector3r_t &direction, + const Options &options) const override; - // Compute the local arrayFactor, with arrayFactor a vectorial + // Compute the local ArrayFactor, with ArrayFactor a vectorial // "representation" of Jones matrix - virtual diag22c_t local_arrayFactor(real_t time, real_t freq, - const vector3r_t &direction, - const Options &options) const override { + virtual diag22c_t LocalArrayFactor(real_t time, real_t freq, + const vector3r_t &direction, + const Options &options) const override { return {1.0, 1.0}; } // 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( + std::vector<std::complex<double>> ComputeGeometricResponse( 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; + ComputeWeights(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; + std::vector<Antenna::Ptr> antennas_; }; } // namespace everybeam #endif diff --git a/cpp/common/CMakeLists.txt b/cpp/common/CMakeLists.txt index 70d924db3afaae973d189579a1a496ce8c248862..9e3304eca418f1185a454bc46dd0416777ae8657 100644 --- a/cpp/common/CMakeLists.txt +++ b/cpp/common/CMakeLists.txt @@ -1,7 +1,7 @@ install (FILES + constants.h casa_utils.h - Constants.h - MathUtil.h - MutablePtr.h - Types.h + math_utils.h + mutable_ptr.h + types.h DESTINATION "include/${CMAKE_PROJECT_NAME}/common") diff --git a/cpp/common/casa_utils.h b/cpp/common/casa_utils.h index b0390d2940456c1655093664378ad1e0a02fd0f5..e420d91e16906c751d747d5b949100063e15874d 100644 --- a/cpp/common/casa_utils.h +++ b/cpp/common/casa_utils.h @@ -24,8 +24,8 @@ #ifndef EVERYBEAM_COMMON_CASAUTIL_H_ #define EVERYBEAM_COMMON_CASAUTIL_H_ -#include "Types.h" -#include "./../Antenna.h" +#include "types.h" +#include "./../antenna.h" #include <cassert> @@ -49,8 +49,8 @@ namespace common { * @param id Id of the antenna field in the station (int) * @return Antenna::CoordinateSystem */ -Antenna::CoordinateSystem readCoordinateSystem(const casacore::Table &table, - unsigned int id) { +inline Antenna::CoordinateSystem readCoordinateSystem( + const casacore::Table &table, unsigned int id) { casacore::ArrayQuantColumn<casacore::Double> c_position(table, "POSITION", "m"); casacore::ArrayQuantColumn<casacore::Double> c_axes(table, "COORDINATE_AXES", @@ -88,7 +88,7 @@ Antenna::CoordinateSystem readCoordinateSystem(const casacore::Table &table, * @return true If column present * @return false If column not present */ -bool hasColumn(const casacore::Table &table, const string &column) { +inline bool hasColumn(const casacore::Table &table, const string &column) { return table.tableDesc().isColumn(column); } @@ -99,7 +99,8 @@ bool hasColumn(const casacore::Table &table, const string &column) { * @param name Name of sub table (str) * @return Table (casacore::Table) */ -casacore::Table getSubTable(const casacore::Table &table, const string &name) { +inline casacore::Table getSubTable(const casacore::Table &table, + const string &name) { return table.keywordSet().asTable(name); } } // namespace common diff --git a/cpp/common/Constants.h b/cpp/common/constants.h similarity index 94% rename from cpp/common/Constants.h rename to cpp/common/constants.h index 4abe366f69fd383b4916e8fbe2e5587e0b2f13b3..4e874df3f8e647091e75c2d1fd4f2ed75b4a64da 100644 --- a/cpp/common/Constants.h +++ b/cpp/common/constants.h @@ -1,4 +1,4 @@ -// Constants.h: %Constants used in this library. +// constants.h: %Constants used in this library. // // Copyright (C) 2013 // ASTRON (Netherlands Institute for Radio Astronomy) @@ -26,7 +26,7 @@ // \file // %Constants used in this library. -#include "Types.h" +#include "types.h" namespace everybeam { namespace common { diff --git a/cpp/common/MathUtil.h b/cpp/common/math_utils.h similarity index 97% rename from cpp/common/MathUtil.h rename to cpp/common/math_utils.h index 077e01b466b23d7a762b18a713d811cdec36fa75..bcb25d316e2a8d0b384b306ff055aea3882b16b4 100644 --- a/cpp/common/MathUtil.h +++ b/cpp/common/math_utils.h @@ -1,4 +1,4 @@ -// MathUtil.h: Various mathematical operations on vectors and matrices. +// math_utils.h: Various mathematical operations on vectors and matrices. // // Copyright (C) 2013 // ASTRON (Netherlands Institute for Radio Astronomy) @@ -26,7 +26,7 @@ // \file // Various mathematical operations on vectors and matrices. -#include "Types.h" +#include "types.h" namespace everybeam { diff --git a/cpp/common/MutablePtr.h b/cpp/common/mutable_ptr.h similarity index 96% rename from cpp/common/MutablePtr.h rename to cpp/common/mutable_ptr.h index 264f685dc6d7df1f4975f01d6d094d0a5d493a97..1972f641fa966dd9e39adc314da47c37f7e9af60 100644 --- a/cpp/common/MutablePtr.h +++ b/cpp/common/mutable_ptr.h @@ -1,4 +1,4 @@ -// MutablePtr.h: Representation of an LBA antenna field. +// mutableptr.h: Representation of an LBA antenna field. // // Copyright (C) 2013 // ASTRON (Netherlands Institute for Radio Astronomy) @@ -44,7 +44,7 @@ namespace common { * * \code * #include<iostream> - * #include "MutablePtr.h" + * #include "mutable_ptr.h" * * class Msg { * public: diff --git a/cpp/common/Singleton.h b/cpp/common/singleton.h similarity index 91% rename from cpp/common/Singleton.h rename to cpp/common/singleton.h index c5e8897c4d19aa59549755d96ba77bd26a8b877b..b17ba1bc0b6d2363cc45e44cd0363cd134f6ffad 100644 --- a/cpp/common/Singleton.h +++ b/cpp/common/singleton.h @@ -3,7 +3,7 @@ namespace common { template <typename T> class Singleton { public: - static std::shared_ptr<T> getInstance() { + static std::shared_ptr<T> GetInstance() { static std::shared_ptr<T> instance(new T()); // Guaranteed to be destroyed. // Instantiated on first use. return instance; diff --git a/cpp/common/Types.h b/cpp/common/types.h similarity index 98% rename from cpp/common/Types.h rename to cpp/common/types.h index f4298c1d2292f38863758f7c4b1263a6bcaa660c..0384b2ca756aae09eba246203e39f04af461e600 100644 --- a/cpp/common/Types.h +++ b/cpp/common/types.h @@ -1,4 +1,4 @@ -// Types.h: Types used in this library. +// types.h: Types used in this library. // // Copyright (C) 2013 // ASTRON (Netherlands Institute for Radio Astronomy) @@ -102,4 +102,4 @@ std::ostream &operator<<(std::ostream &out, const std::array<T, N> &obj) { } // namespace everybeam -#endif +#endif // EVERYBEAM_TYPES_H diff --git a/cpp/coords/ITRFConverter.h b/cpp/coords/ITRFConverter.h index 78e7c57d5e3d3e739c6323f3f0d9ff6c18a8530d..df7c840cda2ca7d98e5f66166e05ea92aabf456a 100644 --- a/cpp/coords/ITRFConverter.h +++ b/cpp/coords/ITRFConverter.h @@ -6,7 +6,7 @@ // \file // Functor that maps J2000 to an ITRF direction. -#include "./../common/Types.h" +#include "./../common/types.h" #include <casacore/measures/Measures/MeasFrame.h> #include <casacore/measures/Measures/MeasConvert.h> diff --git a/cpp/coords/ITRFDirection.h b/cpp/coords/ITRFDirection.h index 633532fa664ed2c047941af0e514597d6ec994b2..bcec1740c8a6c1a6a96424de8dde1e8098ec19d1 100644 --- a/cpp/coords/ITRFDirection.h +++ b/cpp/coords/ITRFDirection.h @@ -26,7 +26,7 @@ // \file // Functor that maps time to an ITRF direction. -#include "./../common/Types.h" +#include "./../common/types.h" #include <casacore/measures/Measures/MeasFrame.h> #include <casacore/measures/Measures/MeasConvert.h> diff --git a/cpp/coords/coord_utils.h b/cpp/coords/coord_utils.h index 34d6955374b9203c18d11bf688333064dc09f8ad..913abce8764e5c6c8907d3047c67693657e15eef 100644 --- a/cpp/coords/coord_utils.h +++ b/cpp/coords/coord_utils.h @@ -1,7 +1,7 @@ #ifndef EVERYBEAM_COORDS_COORDUTILS_H_ #define EVERYBEAM_COORDS_COORDUTILS_H_ -#include "./../common/Types.h" +#include "./../common/types.h" #include <casacore/measures/Measures/MCDirection.h> namespace everybeam { diff --git a/cpp/Element.cc b/cpp/element.cc similarity index 56% rename from cpp/Element.cc rename to cpp/element.cc index 6b5c640e9d07465dd631133a1772c9540d47e6d9..1f9a7854587167d95bd6866e4a175a52b9e4dedc 100644 --- a/cpp/Element.cc +++ b/cpp/element.cc @@ -1,15 +1,15 @@ -#include "Element.h" -#include "common/MathUtil.h" +#include "element.h" +#include "common/math_utils.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 { +matrix22c_t Element::LocalResponse(real_t time, real_t freq, + const vector3r_t &direction, size_t id, + const Options &options) const { vector2r_t thetaphi = cart2thetaphi(direction); matrix22c_t result; static_assert(sizeof(std::complex<double>[2][2]) == sizeof(matrix22c_t)); - m_element_response->response( + m_element_response->Response( id, freq, thetaphi[0], thetaphi[1], reinterpret_cast<std::complex<double>(&)[2][2]>(result)); @@ -25,9 +25,9 @@ matrix22c_t Element::local_response(real_t time, real_t freq, return result; } -matrix22c_t Element::local_response(real_t time, real_t freq, - const vector3r_t &direction, - const Options &options) const { - return local_response(time, freq, direction, m_id, options); +matrix22c_t Element::LocalResponse(real_t time, real_t freq, + const vector3r_t &direction, + const Options &options) const { + return LocalResponse(time, freq, direction, m_id, options); } } // namespace everybeam diff --git a/cpp/Element.h b/cpp/element.h similarity index 81% rename from cpp/Element.h rename to cpp/element.h index 60af4ac19745cb086ed45af67c4bea92c1d5dec5..4918dbcfa37441ea83e1f03714b00d12a01f615f 100644 --- a/cpp/Element.h +++ b/cpp/element.h @@ -4,9 +4,9 @@ #include <complex> #include <memory> -#include "Antenna.h" -#include "ElementResponse.h" -#include "common/Types.h" +#include "antenna.h" +#include "element_response.h" +#include "common/types.h" namespace everybeam { @@ -42,12 +42,12 @@ class Element : public Antenna { * @param options * @return matrix22c_t */ - matrix22c_t local_response(real_t time, real_t freq, - const vector3r_t &direction, size_t id, - const Options &options) const; + matrix22c_t LocalResponse(real_t time, real_t freq, + const vector3r_t &direction, size_t id, + const Options &options) const; private: - virtual matrix22c_t local_response( + virtual matrix22c_t LocalResponse( real_t time, real_t freq, const vector3r_t &direction, const Options &options) const final override; diff --git a/cpp/ElementResponse.cc b/cpp/element_response.cc similarity index 94% rename from cpp/ElementResponse.cc rename to cpp/element_response.cc index 6e11910608373f655348a7bec69b92a12240dc97..36a3f78c4bc401090fd480e9703e8b2fbd121b0b 100644 --- a/cpp/ElementResponse.cc +++ b/cpp/element_response.cc @@ -1,4 +1,4 @@ -#include "ElementResponse.h" +#include "element_response.h" namespace everybeam { std::ostream& operator<<(std::ostream& os, ElementResponseModel model) { diff --git a/cpp/ElementResponse.h b/cpp/element_response.h similarity index 81% rename from cpp/ElementResponse.h rename to cpp/element_response.h index 3ca690cb05d980121a8f743a6cf0a7d7f183d8fe..a08524e8c7a5c1065b5e8c2dc7a102410b24a7ef 100644 --- a/cpp/ElementResponse.h +++ b/cpp/element_response.h @@ -4,7 +4,7 @@ #include <complex> #include <ostream> -#include "common/MutablePtr.h" +#include "common/mutable_ptr.h" namespace everybeam { @@ -34,18 +34,18 @@ class ElementResponse { Ptr; //!< Pointer to ElementResponse object /** - * @brief Virtual implementation of response method + * @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, + virtual void Response(double freq, double theta, double phi, std::complex<double> (&result)[2][2]) const = 0; /** - * @brief Virtual implementation of response method + * @brief Virtual implementation of Response method * * @param element_id ID of element * @param freq Frequency of the plane wave (Hz). @@ -53,9 +53,9 @@ class ElementResponse { * @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, double theta, double phi, + virtual void Response(int element_id, double freq, double theta, double phi, std::complex<double> (&result)[2][2]) const { - response(freq, theta, phi, result); + Response(freq, theta, phi, result); } }; } // namespace everybeam diff --git a/cpp/hamaker/HamakerCoeff.cc b/cpp/hamaker/HamakerCoeff.cc index 4105ec5076c5ee5d37fb923dd98f77873086dbcc..f60b4ff6effe2c22b3f3aa7abc9784691746a5e4 100644 --- a/cpp/hamaker/HamakerCoeff.cc +++ b/cpp/hamaker/HamakerCoeff.cc @@ -7,16 +7,15 @@ H5::CompType get_complex_double_type() { return complex_type; } -size_t HamakerCoefficients::get_index(const unsigned int n, - const unsigned int t, - const unsigned int f) { - return n * m_nPowerTheta * m_nPowerFreq * m_nInner + - t * m_nPowerFreq * m_nInner + f * m_nInner; +size_t HamakerCoefficients::GetIndex(const unsigned int n, const unsigned int t, + const unsigned int f) { + return n * nPowerTheta_ * nPowerFreq_ * nInner_ + t * nPowerFreq_ * nInner_ + + f * nInner_; } // Constructor for reading coeff from file HamakerCoefficients::HamakerCoefficients(std::string& filename) { - read_coeffs(filename); + ReadCoeffs(filename); }; // Constructor for writing coeff to file @@ -25,88 +24,88 @@ HamakerCoefficients::HamakerCoefficients(const double freq_center, const unsigned int nHarmonics, const unsigned int nPowerTheta, const unsigned int nPowerFreq) - : m_freq_center(freq_center), - m_freq_range(freq_range), - m_nHarmonics(nHarmonics), - m_nPowerTheta(nPowerTheta), - m_nPowerFreq(nPowerFreq), - m_coeff(get_nr_coeffs()) {} - -size_t HamakerCoefficients::get_nr_coeffs() const { - return m_nHarmonics * m_nPowerTheta * m_nPowerFreq * m_nInner; + : freq_center_(freq_center), + freq_range_(freq_range), + nHarmonics_(nHarmonics), + nPowerTheta_(nPowerTheta), + nPowerFreq_(nPowerFreq), + coeff_(GetNumCoeffs()) {} + +size_t HamakerCoefficients::GetNumCoeffs() const { + return nHarmonics_ * nPowerTheta_ * nPowerFreq_ * nInner_; } -void HamakerCoefficients::set_coeff( +void HamakerCoefficients::SetCoeffs( const unsigned int n, const unsigned int t, const unsigned int f, std::pair<std::complex<double>, std::complex<double>> value) { - size_t index = get_index(n, t, f); - m_coeff[index] = value.first; - m_coeff[index + 1] = value.second; + size_t index = GetIndex(n, t, f); + coeff_[index] = value.first; + coeff_[index + 1] = value.second; } -void HamakerCoefficients::set_coeffs(const std::complex<double>* coeff) { - memcpy(m_coeff.data(), coeff, m_coeff.size() * sizeof(std::complex<double>)); +void HamakerCoefficients::SetCoeffs(const std::complex<double>* coeff) { + memcpy(coeff_.data(), coeff, coeff_.size() * sizeof(std::complex<double>)); } -void HamakerCoefficients::set_coeffs( +void HamakerCoefficients::SetCoeffs( const std::vector<std::complex<double>> coeff) { - assert(coeff.size() == m_coeff.size()); - std::copy(coeff.begin(), coeff.end(), m_coeff.begin()); + assert(coeff.size() == coeff_.size()); + std::copy(coeff.begin(), coeff.end(), coeff_.begin()); } std::pair<std::complex<double>, std::complex<double>> HamakerCoefficients::get_coeff(const unsigned int n, const unsigned int t, const unsigned int f) { - size_t index = get_index(n, t, f); + size_t index = GetIndex(n, t, f); std::pair<std::complex<double>, std::complex<double>> value; - value.first = m_coeff[index]; - value.second = m_coeff[index + 1]; + value.first = coeff_[index]; + value.second = coeff_[index + 1]; return value; } -void HamakerCoefficients::read_coeffs(std::string& filename) { +void HamakerCoefficients::ReadCoeffs(std::string& filename) { // Open file H5::H5File file(filename, H5F_ACC_RDONLY); // Read dataset - H5::DataSet dataset = file.openDataSet(m_dataset_name); + H5::DataSet dataset = file.openDataSet(dataset_name_); // Open attribute and read its contents H5::Attribute freq_center_attr = dataset.openAttribute("freq_center"); H5::Attribute freq_range_attr = dataset.openAttribute("freq_range"); - freq_center_attr.read(H5::PredType::NATIVE_DOUBLE, &m_freq_center); - freq_range_attr.read(H5::PredType::NATIVE_DOUBLE, &m_freq_range); + freq_center_attr.read(H5::PredType::NATIVE_DOUBLE, &freq_center_); + freq_range_attr.read(H5::PredType::NATIVE_DOUBLE, &freq_range_); // Read dataset dimensions H5::DataSpace dataspace = dataset.getSpace(); unsigned int rank = dataspace.getSimpleExtentNdims(); - assert(rank == m_dataset_rank); + assert(rank == dataset_rank_); hsize_t dims[rank]; dataspace.getSimpleExtentDims(dims, NULL); - m_nHarmonics = dims[0]; - m_nPowerTheta = dims[1]; - m_nPowerFreq = dims[2]; + nHarmonics_ = dims[0]; + nPowerTheta_ = dims[1]; + nPowerFreq_ = dims[2]; // Read coeffs - m_coeff.resize(get_nr_coeffs()); + coeff_.resize(GetNumCoeffs()); H5::DataType data_type = dataset.getDataType(); assert(data_type.getSize() == sizeof(std::complex<double>)); - dataset.read(m_coeff.data(), data_type, dataspace); + dataset.read(coeff_.data(), data_type, dataspace); } -void HamakerCoefficients::write_coeffs(std::string& filename) { +void HamakerCoefficients::WriteCoeffs(std::string& filename) { // Open file H5::H5File file(filename, H5F_ACC_TRUNC); // Create dataspace const unsigned int rank = 4; - hsize_t dims[rank] = {m_nHarmonics, m_nPowerTheta, m_nPowerFreq, m_nInner}; + hsize_t dims[rank] = {nHarmonics_, nPowerTheta_, nPowerFreq_, nInner_}; H5::DataSpace coeff_dataspace(rank, dims); // Create pointer to coeff - typedef std::complex<double> coeff_type[m_nHarmonics][m_nPowerTheta] - [m_nPowerFreq][m_nInner]; - coeff_type* coeff_ptr = (coeff_type*)m_coeff.data(); + typedef std::complex<double> coeff_type[nHarmonics_][nPowerTheta_] + [nPowerFreq_][nInner_]; + coeff_type* coeff_ptr = (coeff_type*)coeff_.data(); // Create complex type H5::CompType complex_type = get_complex_double_type(); @@ -122,20 +121,20 @@ void HamakerCoefficients::write_coeffs(std::string& filename) { // Write frequency center attribute H5::Attribute freq_center_attr = dataset.createAttribute( "freq_center", H5::PredType::NATIVE_DOUBLE, attr_dataspace); - freq_center_attr.write(H5::PredType::NATIVE_DOUBLE, &m_freq_center); + freq_center_attr.write(H5::PredType::NATIVE_DOUBLE, &freq_center_); // Write frequency range attribute H5::Attribute freq_range_attr = dataset.createAttribute( "freq_range", H5::PredType::NATIVE_DOUBLE, attr_dataspace); - freq_range_attr.write(H5::PredType::NATIVE_DOUBLE, &m_freq_range); + freq_range_attr.write(H5::PredType::NATIVE_DOUBLE, &freq_range_); file.flush(H5F_SCOPE_LOCAL); } -void HamakerCoefficients::print_coeffs() { - for (unsigned int h = 0; h < m_nHarmonics; h++) { - for (unsigned int t = 0; t < m_nPowerTheta; t++) { - for (unsigned int f = 0; f < m_nPowerFreq; f++) { +void HamakerCoefficients::PrintCoeffs() { + for (unsigned int h = 0; h < nHarmonics_; h++) { + for (unsigned int t = 0; t < nPowerTheta_; t++) { + for (unsigned int f = 0; f < nPowerFreq_; f++) { auto coeff = get_coeff(h, t, f); std::cout << coeff.first << ", " << coeff.second << std::endl; } diff --git a/cpp/hamaker/HamakerCoeff.h b/cpp/hamaker/HamakerCoeff.h index 0f15aaefa7d8c6df66fafa5308533285682bbe71..d529d44ead08f524892ccce57edf795e39e1c0a1 100644 --- a/cpp/hamaker/HamakerCoeff.h +++ b/cpp/hamaker/HamakerCoeff.h @@ -33,57 +33,57 @@ class HamakerCoefficients { * @param f * @param value */ - void set_coeff(const unsigned int n, const unsigned int t, + void SetCoeffs(const unsigned int n, const unsigned int t, const unsigned int f, std::pair<std::complex<double>, std::complex<double>> value); - void set_coeffs(const std::complex<double>* coeff); + void SetCoeffs(const std::complex<double>* coeff); - void set_coeffs(const std::vector<std::complex<double>> coeff); + void SetCoeffs(const std::vector<std::complex<double>> coeff); // Get - size_t get_nr_coeffs() const; + size_t GetNumCoeffs() const; - double get_freq_center() const { return m_freq_center; } + double GetFreqCenter() const { return freq_center_; } - double get_freq_range() const { return m_freq_range; } + double GetFreqRange() const { return freq_range_; } - unsigned int get_nHarmonics() const { return m_nHarmonics; } + unsigned int Get_nHarmonics() const { return nHarmonics_; } - unsigned int get_nPowerTheta() const { return m_nPowerTheta; } + unsigned int Get_nPowerTheta() const { return nPowerTheta_; } - unsigned int get_nPowerFreq() const { return m_nPowerFreq; } + unsigned int Get_nPowerFreq() const { return nPowerFreq_; } std::pair<std::complex<double>, std::complex<double>> get_coeff( const unsigned int n, const unsigned int t, const unsigned int f); // HDF5 I/O - void read_coeffs(std::string& filename); + void ReadCoeffs(std::string& filename); - void write_coeffs(std::string& filename); + void WriteCoeffs(std::string& filename); // Debugging - void print_coeffs(); + void PrintCoeffs(); private: // Methods - size_t get_index(const unsigned int n, const unsigned int t, - const unsigned int f); + size_t GetIndex(const unsigned int n, const unsigned int t, + const unsigned int f); // Parameters - double m_freq_center; - double m_freq_range; - unsigned int m_nHarmonics; - unsigned int m_nPowerTheta; - unsigned int m_nPowerFreq; - const unsigned int m_nInner = 2; + double freq_center_; + double freq_range_; + unsigned int nHarmonics_; + unsigned int nPowerTheta_; + unsigned int nPowerFreq_; + const unsigned int nInner_ = 2; // Data - std::vector<std::complex<double>> m_coeff; + std::vector<std::complex<double>> coeff_; // HDF5 - std::string m_dataset_name = "coeff"; - const unsigned int m_dataset_rank = 4; + std::string dataset_name_ = "coeff"; + const unsigned int dataset_rank_ = 4; }; #endif diff --git a/cpp/hamaker/HamakerElementResponse.cc b/cpp/hamaker/HamakerElementResponse.cc index 4b97940b15a6a52d30d26cea09fbefb5cc1e8b01..797d42804d422c010d6a6a1de0b34b647e955c05 100644 --- a/cpp/hamaker/HamakerElementResponse.cc +++ b/cpp/hamaker/HamakerElementResponse.cc @@ -7,31 +7,31 @@ #include "config.h" #include "HamakerElementResponse.h" -#include "../common/Singleton.h" +#include "../common/singleton.h" namespace everybeam { -std::shared_ptr<HamakerElementResponse> HamakerElementResponse::getInstance( +std::shared_ptr<HamakerElementResponse> HamakerElementResponse::GetInstance( const std::string& name) { if (name.find("LBA") != std::string::npos) { - return common::Singleton<HamakerElementResponseLBA>::getInstance(); + return common::Singleton<HamakerElementResponseLBA>::GetInstance(); } if (name.find("HBA") != std::string::npos) { - return common::Singleton<HamakerElementResponseHBA>::getInstance(); + return common::Singleton<HamakerElementResponseHBA>::GetInstance(); } throw std::invalid_argument( - "HamakerElementResponse::getInstance: name should end in either 'LBA' or " + "HamakerElementResponse::GetInstance: name should end in either 'LBA' or " "'HBA'"); } -std::string HamakerElementResponse::get_path(const char* filename) const { +std::string HamakerElementResponse::GetPath(const char* filename) const { std::stringstream ss; ss << EVERYBEAM_DATA_DIR << "/"; ss << filename; return ss.str(); } -void HamakerElementResponse::response( +void HamakerElementResponse::Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const { // Initialize the response to zero. @@ -45,11 +45,11 @@ void HamakerElementResponse::response( return; } - const double freq_center = m_coeffs->get_freq_center(); - const double freq_range = m_coeffs->get_freq_range(); - const unsigned int nHarmonics = m_coeffs->get_nHarmonics(); - const unsigned int nPowerTheta = m_coeffs->get_nPowerTheta(); - const unsigned int nPowerFreq = m_coeffs->get_nPowerFreq(); + const double freq_center = m_coeffs->GetFreqCenter(); + const double freq_range = m_coeffs->GetFreqRange(); + const unsigned int nHarmonics = m_coeffs->Get_nHarmonics(); + const unsigned int nPowerTheta = m_coeffs->Get_nPowerTheta(); + const unsigned int nPowerFreq = m_coeffs->Get_nPowerFreq(); ; // The model is parameterized in terms of a normalized frequency in the @@ -114,12 +114,12 @@ void HamakerElementResponse::response( } HamakerElementResponseHBA::HamakerElementResponseHBA() { - std::string path = get_path("HamakerHBACoeff.h5"); + std::string path = GetPath("HamakerHBACoeff.h5"); m_coeffs.reset(new HamakerCoefficients(path)); } HamakerElementResponseLBA::HamakerElementResponseLBA() { - std::string path = get_path("HamakerLBACoeff.h5"); + std::string path = GetPath("HamakerLBACoeff.h5"); m_coeffs.reset(new HamakerCoefficients(path)); } } // namespace everybeam diff --git a/cpp/hamaker/HamakerElementResponse.h b/cpp/hamaker/HamakerElementResponse.h index 97edaab5d610552aca05f6c92979940a04330028..6ec0e31fbef51aee22f77a5514f11644fb02d772 100644 --- a/cpp/hamaker/HamakerElementResponse.h +++ b/cpp/hamaker/HamakerElementResponse.h @@ -1,7 +1,7 @@ #ifndef HAMAKER_ELEMENTRESPONSE_H #define HAMAKER_ELEMENTRESPONSE_H -#include "../ElementResponse.h" +#include "../element_response.h" #include "HamakerCoeff.h" #include <memory> @@ -11,15 +11,15 @@ namespace everybeam { //! Implementation of the Hamaker response model class HamakerElementResponse : public ElementResponse { public: - virtual void response( + virtual void Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const final override; - static std::shared_ptr<HamakerElementResponse> getInstance( + static std::shared_ptr<HamakerElementResponse> GetInstance( const std::string &name); protected: - std::string get_path(const char *) const; + std::string GetPath(const char *) const; std::unique_ptr<HamakerCoefficients> m_coeffs; }; diff --git a/cpp/lobes/ElementResponse.cc b/cpp/lobes/ElementResponse.cc index 5836334eff06fca24fe7c1309b0bb34fbf89bc04..7cc879c199cc6533ae2466ca8fbfe23783ceb0d7 100644 --- a/cpp/lobes/ElementResponse.cc +++ b/cpp/lobes/ElementResponse.cc @@ -21,7 +21,7 @@ // // $Id$ -#include "ElementResponse.h" +#include "element_response.h" #include <cmath> diff --git a/cpp/lobes/LOBESElementResponse.cc b/cpp/lobes/LOBESElementResponse.cc index 4c628fe0ae42b3647fa236385088ba9043782d6e..de8cc40a27bdc65b10c7aead8253fcc33b10b62a 100644 --- a/cpp/lobes/LOBESElementResponse.cc +++ b/cpp/lobes/LOBESElementResponse.cc @@ -6,11 +6,11 @@ namespace everybeam { LOBESElementResponse::LOBESElementResponse(std::string name) {} -void LOBESElementResponse::response( +void LOBESElementResponse::Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const {} -std::shared_ptr<LOBESElementResponse> LOBESElementResponse::getInstance( +std::shared_ptr<LOBESElementResponse> LOBESElementResponse::GetInstance( std::string name) { static std::map<std::string, std::shared_ptr<LOBESElementResponse>> name_response_map; diff --git a/cpp/lobes/LOBESElementResponse.h b/cpp/lobes/LOBESElementResponse.h index 39bae8884786b1b6086d46e4da1f925d8d28d484..5acb97823345629d63373902e9c253dc24635536 100644 --- a/cpp/lobes/LOBESElementResponse.h +++ b/cpp/lobes/LOBESElementResponse.h @@ -1,7 +1,7 @@ #ifndef LOBES_ELEMENTRESPONSE_H #define LOBES_ELEMENTRESPONSE_H -#include "../ElementResponse.h" +#include "../element_response.h" #include <memory> @@ -12,11 +12,11 @@ class LOBESElementResponse : public ElementResponse { public: LOBESElementResponse(std::string name); - virtual void response( + virtual void Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const final override; - static std::shared_ptr<LOBESElementResponse> getInstance(std::string name); + static std::shared_ptr<LOBESElementResponse> GetInstance(std::string name); }; } // namespace everybeam diff --git a/cpp/makeresponseimage.cc b/cpp/makeresponseimage.cc index c2a662a576ec0f4a3eccd8bafb0d625150da68a0..d33ed498559db0944a0014feda465e4459748cf6 100644 --- a/cpp/makeresponseimage.cc +++ b/cpp/makeresponseimage.cc @@ -348,7 +348,7 @@ int main(int argc, char *argv[]) { for (size_t y = 0; y < size; ++y) { for (size_t x = 0; x < size; ++x) { - matrix22c_t E = station->response( + matrix22c_t E = station->Response( directionMap.time0, refFrequency, directionMap.directions(x, y), refFrequency, directionMap.station0, directionMap.tile0); diff --git a/cpp/oskar/OSKARDataset.cc b/cpp/oskar/OSKARDataset.cc index fdc3e8d7ba56bb806a23d73b8edf26aa22dca41c..152f21b9e3fcda5e052c918ec48f70c1d15a1460 100644 --- a/cpp/oskar/OSKARDataset.cc +++ b/cpp/oskar/OSKARDataset.cc @@ -14,7 +14,7 @@ Dataset::Dataset(H5::H5File& h5_file, const unsigned int freq) { // Read dataset dimensions H5::DataSpace dataspace = dataset.getSpace(); unsigned int rank = dataspace.getSimpleExtentNdims(); - assert(rank == m_dataset_rank); + assert(rank == dataset_rank_); // Get dimensions hsize_t dims[rank]; @@ -62,12 +62,12 @@ Dataset::Dataset(H5::H5File& h5_file, const unsigned int freq) { } } -size_t Dataset::get_index(const unsigned int element) const { +size_t Dataset::GetIndex(const unsigned int element) const { return element * m_nr_coeffs * 4; } -std::complex<double>* Dataset::get_alpha_ptr(const unsigned int element) { +std::complex<double>* Dataset::GetAlphaPtr(const unsigned int element) { assert(element < get_nr_elements()); - size_t index = get_index(element); + size_t index = GetIndex(element); return m_data.data() + index; } diff --git a/cpp/oskar/OSKARDataset.h b/cpp/oskar/OSKARDataset.h index 45a8779621024022e9f914c74d9d8d360ddbfad0..7fc94efa370572db7e3db39579ce282c5e6c1243 100644 --- a/cpp/oskar/OSKARDataset.h +++ b/cpp/oskar/OSKARDataset.h @@ -20,16 +20,16 @@ class Dataset { // Get size_t get_nr_elements() const { return m_nr_elements; }; - size_t get_l_max() const { return m_l_max; }; + size_t GetLMax() const { return m_l_max; }; - std::complex<double>* get_alpha_ptr(const unsigned int element); + std::complex<double>* GetAlphaPtr(const unsigned int element); private: // Methods - size_t get_index(const unsigned int element) const; + size_t GetIndex(const unsigned int element) const; // Constants - const unsigned int m_dataset_rank = 3; + const unsigned int dataset_rank_ = 3; // Members std::vector<std::complex<double>> m_data; diff --git a/cpp/oskar/OSKARElementResponse.cc b/cpp/oskar/OSKARElementResponse.cc index 7604388a1de1d909214d395931f11228b1a118f4..2a365382aadb760133d2186a6d3d2be65aea9e24 100644 --- a/cpp/oskar/OSKARElementResponse.cc +++ b/cpp/oskar/OSKARElementResponse.cc @@ -5,7 +5,7 @@ namespace everybeam { -void OSKARElementResponseDipole::response( +void OSKARElementResponseDipole::Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const { double dipole_length_m = 1; // TODO @@ -20,7 +20,7 @@ void OSKARElementResponseDipole::response( } OSKARElementResponseSphericalWave::OSKARElementResponseSphericalWave() { - std::string path = get_path("oskar.h5"); + std::string path = GetPath("oskar.h5"); m_datafile.reset(new Datafile(path)); } @@ -29,26 +29,26 @@ OSKARElementResponseSphericalWave::OSKARElementResponseSphericalWave( m_datafile.reset(new Datafile(path)); } -void OSKARElementResponseSphericalWave::response( +void OSKARElementResponseSphericalWave::Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const { // This ElementResponse model is element specific, so an element_id is // required to know for what element the response needs to be evaluated A // std::invalid_argument exception is thrown although strictly speaking it are - // not the given arguments that are invalid, but the response(...) method with + // not the given arguments that are invalid, but the Response(...) method with // a different signature should have been called. throw std::invalid_argument( "OSKARElementResponseSphericalWave: missing argument element_id"); } -void OSKARElementResponseSphericalWave::response( +void OSKARElementResponseSphericalWave::Response( int element_id, double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const { auto dataset = m_datafile->get(freq); - auto l_max = dataset->get_l_max(); + auto l_max = dataset->GetLMax(); std::complex<double>* response_ptr = (std::complex<double>*)response; - std::complex<double>* alpha_ptr = dataset->get_alpha_ptr(element_id); + std::complex<double>* alpha_ptr = dataset->GetAlphaPtr(element_id); double phi_x = phi; double phi_y = phi + M_PI_2; @@ -56,7 +56,7 @@ void OSKARElementResponseSphericalWave::response( alpha_ptr, response_ptr); } -std::string OSKARElementResponseSphericalWave::get_path( +std::string OSKARElementResponseSphericalWave::GetPath( const char* filename) const { std::stringstream ss; ss << EVERYBEAM_DATA_DIR << "/"; diff --git a/cpp/oskar/OSKARElementResponse.h b/cpp/oskar/OSKARElementResponse.h index c3113cb07ba3a7382f60b8260f4eaef9ef3bd159..310c5412fbbffb348847004f9e1ba6ef31f69776 100644 --- a/cpp/oskar/OSKARElementResponse.h +++ b/cpp/oskar/OSKARElementResponse.h @@ -1,8 +1,8 @@ #ifndef OSKAR_ELEMENTRESPONSE_H #define OSKAR_ELEMENTRESPONSE_H -#include "../ElementResponse.h" -#include "../common/Singleton.h" +#include "../element_response.h" +#include "../common/singleton.h" #include "OSKARDatafile.h" @@ -13,11 +13,11 @@ namespace everybeam { //! Implementation of the OSKAR dipole response model class OSKARElementResponseDipole : public ElementResponse { public: - static std::shared_ptr<OSKARElementResponseDipole> getInstance() { - return common::Singleton<OSKARElementResponseDipole>::getInstance(); + static std::shared_ptr<OSKARElementResponseDipole> GetInstance() { + return common::Singleton<OSKARElementResponseDipole>::GetInstance(); } - virtual void response( + virtual void Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const final override; }; @@ -31,8 +31,8 @@ class OSKARElementResponseSphericalWave : public ElementResponse { * returns a globally shared instance of the class that is instantiated * in the first call */ - static std::shared_ptr<OSKARElementResponseSphericalWave> getInstance() { - return common::Singleton<OSKARElementResponseSphericalWave>::getInstance(); + static std::shared_ptr<OSKARElementResponseSphericalWave> GetInstance() { + return common::Singleton<OSKARElementResponseSphericalWave>::GetInstance(); } /** Constructor loading the default coefficients file */ @@ -44,16 +44,16 @@ class OSKARElementResponseSphericalWave : public ElementResponse { */ OSKARElementResponseSphericalWave(const std::string &path); - virtual void response( + virtual void Response( double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const final override; - virtual void response( + virtual void Response( int element_id, double freq, double theta, double phi, std::complex<double> (&response)[2][2]) const final override; protected: - std::string get_path(const char *) const; + std::string GetPath(const char *) const; std::unique_ptr<Datafile> m_datafile; }; diff --git a/cpp/Station.cc b/cpp/station.cc similarity index 93% rename from cpp/Station.cc rename to cpp/station.cc index e5f3a22c4af3f4d09324a89a71e6b1c37b6d2b6b..3a936a369af7022f4d3204b38114888ef350c532 100644 --- a/cpp/Station.cc +++ b/cpp/station.cc @@ -20,8 +20,8 @@ // // $Id$ -#include "Station.h" -#include "common/MathUtil.h" +#include "station.h" +#include "common/math_utils.h" #include "hamaker/HamakerElementResponse.h" #include "oskar/OSKARElementResponse.h" @@ -45,16 +45,16 @@ Station::Station(const std::string &name, const vector3r_t &position, void Station::setModel(const ElementResponseModel model) { switch (model) { case Hamaker: - itsElementResponse.set(HamakerElementResponse::getInstance(itsName)); + itsElementResponse.set(HamakerElementResponse::GetInstance(itsName)); break; case OSKARDipole: - itsElementResponse.set(OSKARElementResponseDipole::getInstance()); + itsElementResponse.set(OSKARElementResponseDipole::GetInstance()); break; case OSKARSphericalWave: - itsElementResponse.set(OSKARElementResponseSphericalWave::getInstance()); + itsElementResponse.set(OSKARElementResponseSphericalWave::GetInstance()); break; case LOBES: - itsElementResponse.set(LOBESElementResponse::getInstance(itsName)); + itsElementResponse.set(LOBESElementResponse::GetInstance(itsName)); break; default: std::stringstream message; @@ -89,7 +89,7 @@ matrix22c_t Station::elementResponse(real_t time, real_t freq, options.north = north; } - return itsElement->local_response(time, freq, direction, id, options); + return itsElement->LocalResponse(time, freq, direction, id, options); } matrix22c_t Station::elementResponse(real_t time, real_t freq, @@ -101,10 +101,10 @@ matrix22c_t Station::elementResponse(real_t time, real_t freq, // else // return itsElement->response(time, freq, direction); - return itsElement->response(time, freq, direction); + return itsElement->Response(time, freq, direction); } -matrix22c_t Station::response(real_t time, real_t freq, +matrix22c_t Station::Response(real_t time, real_t freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, @@ -120,7 +120,7 @@ matrix22c_t Station::response(real_t time, real_t freq, options.north = north; } - matrix22c_t response = itsAntenna->response(time, freq, direction, options); + matrix22c_t response = itsAntenna->Response(time, freq, direction, options); // if (rotate) { // std::cout << "rotate" << std::endl; @@ -133,13 +133,13 @@ matrix22c_t Station::response(real_t time, real_t freq, return response; } -diag22c_t Station::arrayFactor(real_t time, real_t freq, +diag22c_t Station::ArrayFactor(real_t time, real_t freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const { Antenna::Options options = { .freq0 = freq0, .station0 = station0, .tile0 = tile0}; - return itsAntenna->arrayFactor(time, freq, direction, options); + return itsAntenna->ArrayFactor(time, freq, direction, options); } matrix22r_t Station::rotation(real_t time, const vector3r_t &direction) const { diff --git a/cpp/Station.h b/cpp/station.h similarity index 92% rename from cpp/Station.h rename to cpp/station.h index 88ff762f284c720a3e35396abf567a487a821c3c..5747b79b992b24bdc4998a269702e03d57099bf3 100644 --- a/cpp/Station.h +++ b/cpp/station.h @@ -1,4 +1,4 @@ -// Station.h: Representation of the station beam former. +// station.h: Representation of the station beam former. // // Copyright (C) 2013 // ASTRON (Netherlands Institute for Radio Astronomy) @@ -27,11 +27,11 @@ // \file // Representation of the station beam former. -#include "ElementResponse.h" -#include "Antenna.h" -#include "BeamFormer.h" +#include "element_response.h" +#include "antenna.h" +#include "beamformer.h" #include "coords/ITRFDirection.h" -#include "common/Types.h" +#include "common/types.h" #include <memory> #include <vector> @@ -142,7 +142,7 @@ class Station { * point \e from the ground \e towards the direction from which the plane * wave arrives. */ - matrix22c_t response(real_t time, real_t freq, const vector3r_t &direction, + matrix22c_t Response(real_t time, real_t freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, const bool rotate = true) const; @@ -175,7 +175,7 @@ class Station { * point \e from the ground \e towards the direction from which the plane * wave arrives. */ - diag22c_t arrayFactor(real_t time, real_t freq, const vector3r_t &direction, + diag22c_t ArrayFactor(real_t time, real_t freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const; @@ -207,7 +207,7 @@ class Station { * real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const */ template <typename T, typename U> - void response(unsigned int count, real_t time, T freq, + void Response(unsigned int count, real_t time, T freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer, const bool rotate = true) const; @@ -228,11 +228,11 @@ class Station { * \param buffer Output iterator with room for \p count instances of type * ::diag22c_t. * - * \see arrayFactor(real_t time, real_t freq, const vector3r_t &direction, + * \see ArrayFactor(real_t time, real_t freq, const vector3r_t &direction, * real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const */ template <typename T, typename U> - void arrayFactor(unsigned int count, real_t time, T freq, + void ArrayFactor(unsigned int count, real_t time, T freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer) const; @@ -258,7 +258,7 @@ class Station { * real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const */ template <typename T, typename U> - void response(unsigned int count, real_t time, T freq, + void Response(unsigned int count, real_t time, T freq, const vector3r_t &direction, T freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer, const bool rotate = true) const; @@ -279,11 +279,11 @@ class Station { * \param buffer Output iterator with room for \p count instances of type * ::diag22c_t. * - * \see arrayFactor(real_t time, real_t freq, const vector3r_t &direction, + * \see ArrayFactor(real_t time, real_t freq, const vector3r_t &direction, * real_t freq0, const vector3r_t &station0, const vector3r_t &tile0) const */ template <typename T, typename U> - void arrayFactor(unsigned int count, real_t time, T freq, + void ArrayFactor(unsigned int count, real_t time, T freq, const vector3r_t &direction, T freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer) const; @@ -326,16 +326,16 @@ class Station { const bool rotate = true) const; //! Specialized implementation of response function. - matrix22c_t response(real_t time, real_t freq, + matrix22c_t Response(real_t time, real_t freq, const vector3r_t &direction) const { - return itsAntenna->response(time, freq, direction); + 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; } + void SetAntenna(Antenna::Ptr antenna) { itsAntenna = antenna; } //! Set Element attribute - void set_element(Element::Ptr element) { itsElement = element; } + void SetElement(Element::Ptr element) { itsElement = element; } private: vector3r_t ncp(real_t time) const; @@ -371,45 +371,45 @@ class Station { // ------------------------------------------------------------------------- // template <typename T, typename U> -void Station::response(unsigned int count, real_t time, T freq, +void Station::Response(unsigned int count, real_t time, T freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer, const bool rotate) const { for (unsigned int i = 0; i < count; ++i) { *buffer++ = - response(time, *freq++, direction, freq0, station0, tile0, rotate); + Response(time, *freq++, direction, freq0, station0, tile0, rotate); } } template <typename T, typename U> -void Station::arrayFactor(unsigned int count, real_t time, T freq, +void Station::ArrayFactor(unsigned int count, real_t time, T freq, const vector3r_t &direction, real_t freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer) const { for (unsigned int i = 0; i < count; ++i) { - *buffer++ = arrayFactor(time, *freq++, direction, freq0, station0, tile0); + *buffer++ = ArrayFactor(time, *freq++, direction, freq0, station0, tile0); } } template <typename T, typename U> -void Station::response(unsigned int count, real_t time, T freq, +void Station::Response(unsigned int count, real_t time, T freq, const vector3r_t &direction, T freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer, const bool rotate) const { for (unsigned int i = 0; i < count; ++i) { *buffer++ = - response(time, *freq++, direction, *freq0++, station0, tile0, rotate); + Response(time, *freq++, direction, *freq0++, station0, tile0, rotate); } } template <typename T, typename U> -void Station::arrayFactor(unsigned int count, real_t time, T freq, +void Station::ArrayFactor(unsigned int count, real_t time, T freq, const vector3r_t &direction, T freq0, const vector3r_t &station0, const vector3r_t &tile0, U buffer) const { for (unsigned int i = 0; i < count; ++i) { *buffer++ = - arrayFactor(time, *freq++, direction, *freq0++, station0, tile0); + ArrayFactor(time, *freq++, direction, *freq0++, station0, tile0); } } } // namespace everybeam diff --git a/cpp/telescope/lofar.cc b/cpp/telescope/lofar.cc index 87900f056f929595fa13615bcb00c8bbb5c588fe..0947cd9d90d4b39f255ed04662062b00a6f806c7 100644 --- a/cpp/telescope/lofar.cc +++ b/cpp/telescope/lofar.cc @@ -1,5 +1,5 @@ #include "lofar.h" -#include "./../common/MathUtil.h" +#include "./../common/math_utils.h" #include "./../common/casa_utils.h" #include <cassert> @@ -94,7 +94,7 @@ BeamFormer::Ptr readAntennaField(const Table &table, std::size_t id, antenna->m_enabled[0] = !aips_flag(0, i); antenna->m_enabled[1] = !aips_flag(1, i); - beam_former->add_antenna(antenna); + beam_former->AddAntenna(antenna); } return beam_former; } @@ -146,17 +146,17 @@ Station::Ptr LOFAR::ReadStation(const MeasurementSet &ms, std::size_t id, // coordinate system is ITRF // phase reference is station position auto beam_former = BeamFormer::Ptr(new BeamFormer( - Antenna::identity_coordinate_system, station->phaseReference())); + Antenna::IdentityCoordinateSystem, station->phaseReference())); for (std::size_t i = 0; i < tab_field.nrow(); ++i) { - beam_former->add_antenna( + beam_former->AddAntenna( readAntennaField(tab_field, i, station->get_element_response())); } // TODO // If There is only one field, the top level beamformer is not needed // and the station antenna can be set the the beamformer of the field - station->set_antenna(beam_former); + station->SetAntenna(beam_former); size_t field_id = 0; size_t element_id = 0; @@ -166,7 +166,7 @@ Station::Ptr LOFAR::ReadStation(const MeasurementSet &ms, std::size_t id, // TODO: rotate coordinate system for antenna auto element = Element::Ptr(new Element( coordinate_system, station->get_element_response(), element_id)); - station->set_element(element); + station->SetElement(element); return station; } \ No newline at end of file diff --git a/cpp/telescope/telescope.h b/cpp/telescope/telescope.h index cf023f55022d2c4d0cc5c64c89c3259cda750753..1782383ff666434867c43f6c1c29572e480b3f65 100644 --- a/cpp/telescope/telescope.h +++ b/cpp/telescope/telescope.h @@ -24,9 +24,9 @@ #ifndef EVERYBEAM_TELESCOPE_TELESCOPE_H_ #define EVERYBEAM_TELESCOPE_TELESCOPE_H_ -#include "./../Station.h" +#include "./../station.h" #include "./../options.h" -#include "./../ElementResponse.h" +#include "./../element_response.h" #include "./../gridded_response/griddedresponse.h" #include <vector> diff --git a/cpp/test/tload_lofar.cc b/cpp/test/tload_lofar.cc index 23898aef60b78d622db53500d363bec99d882f6c..4b9de6eeb94712c8da1f9a72edce581b33400062 100644 --- a/cpp/test/tload_lofar.cc +++ b/cpp/test/tload_lofar.cc @@ -2,7 +2,7 @@ #include "./../load.h" #include "./../options.h" -#include "./../ElementResponse.h" +#include "./../element_response.h" #include "config.h" diff --git a/cpp/test/tstation.cc b/cpp/test/tstation.cc index 4d1198100b79532776e530672111015fe076ad31..8b0581fd1398d133bee0667d1fa7db16f0275de8 100644 --- a/cpp/test/tstation.cc +++ b/cpp/test/tstation.cc @@ -1,4 +1,4 @@ -#include "./../Station.h" +#include "./../station.h" // TODO: make a test out of this int main() { @@ -33,7 +33,7 @@ int main() { double az = M_PI - phi; double el = M_PI_2 - theta; - element_response->response(0, freq, theta, phi, result_arr[i][j]); + element_response->Response(0, freq, theta, phi, result_arr[i][j]); } } return 0; diff --git a/demo/beam-helper.cpp b/demo/beam-helper.cpp index 45eeae300e4b961821a5a1764d91548e0a7296d3..f2e5c444855b91f1d401b4ee202ae6f8bf4a4f9c 100644 --- a/demo/beam-helper.cpp +++ b/demo/beam-helper.cpp @@ -3,7 +3,7 @@ #include <aocommon/imagecoordinates.h> #include <fitsio.h> -#include "./../cpp/common/MathUtil.h" +#include "./../cpp/common/math_utils.h" // #include "./../cpp/coords/ITRFDirection.h" #include "./../cpp/coords/ITRFConverter.h" diff --git a/demo/beam-helper.h b/demo/beam-helper.h index 20b6fd93c9b7a5fa96e0ab1f2cf3f1c58aecde94..8c432cd95506275a36b05313857877a71aa4d7e6 100644 --- a/demo/beam-helper.h +++ b/demo/beam-helper.h @@ -1,5 +1,5 @@ -#include "./../cpp/ElementResponse.h" -#include "./../cpp/Station.h" +#include "./../cpp/element_response.h" +#include "./../cpp/station.h" #include "./../cpp/LofarMetaDataUtil.h" #include "./../cpp/coords/coord_utils.h" diff --git a/demo/comparison-oskar/main.cpp b/demo/comparison-oskar/main.cpp index d81e8361dc533ba17d97d97a8ca5b06d6ea922a7..e765ccf08bd252f9cb1ee144755004af972a8517 100644 --- a/demo/comparison-oskar/main.cpp +++ b/demo/comparison-oskar/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char** argv){ double y = (2.0*j)/(N-1) - 1.0; double theta = asin(sqrt(x*x + y*y)); double phi = atan2(y,x); - element_response.response(0, freq, theta, phi, result_arr[i][j]); + element_response.Response(0, freq, theta, phi, result_arr[i][j]); } } diff --git a/demo/tElementBeamCommon.h b/demo/tElementBeamCommon.h index 8b64c91eadd2eb6a80cdf90bd7922a6e40a0eeab..b76726fa4d4a4c1a19e4eb2906fe12fccbd4ed79 100644 --- a/demo/tElementBeamCommon.h +++ b/demo/tElementBeamCommon.h @@ -26,7 +26,7 @@ void calculateElementBeams(everybeam::Station::Ptr& station, // Compute gain std::complex<double> gainMatrix[2][2] = {0.0}; if (std::isfinite(theta) && std::isfinite(phi)) { - elementResponse->response(a, frequency, theta, phi, gainMatrix); + elementResponse->Response(a, frequency, theta, phi, gainMatrix); } // Store gain diff --git a/demo/tStation.cc b/demo/tStation.cc index e63cf65e72e7fa6c77c34d3ef4cd103917e7f132..84d01ff65dfde98e9eab08e6b586a820e0887344 100644 --- a/demo/tStation.cc +++ b/demo/tStation.cc @@ -1,8 +1,8 @@ #include <iostream> -#include "./../cpp/Station.h" +#include "./../cpp/station.h" #include "./../cpp/LofarMetaDataUtil.h" -#include "./../cpp/common/MathUtil.h" +#include "./../cpp/common/math_utils.h" #include "config.h" @@ -24,19 +24,19 @@ int main() { // Element(station.get_element_response(),0)); auto antenna1 = // Element::Ptr(new Element(station.get_element_response(),1)); // - // station.set_antenna(antenna0); + // station.SetAntenna(antenna0); // // std::cout << response[0][0] << std::endl; // - // response = station.response(time, freq, direction); + // Response = station.Response(time, freq, direction); // // std::cout << response[0][0] << std::endl; // // auto beam_former = BeamFormer::Ptr(new BeamFormer()); - // beam_former->add_antenna(antenna0); - // beam_former->add_antenna(antenna1); - // station.set_antenna(beam_former); - // response = station.response(time, freq, direction); + // beam_former->AddAntenna(antenna0); + // beam_former->AddAntenna(antenna1); + // station.SetAntenna(beam_former); + // Response = station.Response(time, freq, direction); // std::cout << response[0][0] << std::endl; // @@ -61,7 +61,7 @@ int main() { auto d = direction; d[1] = -0.2 + 0.04 * i; d = normalize(d); - response = station->response(time, freq, d, freq_beamformer, + response = station->Response(time, freq, d, freq_beamformer, station_pointing, tile_pointing); std::cout << response[0][0] << " " << response[0][1] << " " << response[1][0] << " " << response[1][1] << " " << std::endl; diff --git a/demo/tStationBeamCommon.h b/demo/tStationBeamCommon.h index c3d8e41c403f55a7a6ad137cc00fbd1c22639e7f..d109cde2f4258630684e47f359c1f58188fd48d8 100644 --- a/demo/tStationBeamCommon.h +++ b/demo/tStationBeamCommon.h @@ -21,7 +21,7 @@ void calculateStationBeams(std::vector<everybeam::Station::Ptr>& stations, auto direction = itrfDirections[y * subgrid_size + x]; auto freq_beamformer = frequency; matrix22c_t gainMatrix = - stations[s]->response(time, frequency, direction, freq_beamformer, + stations[s]->Response(time, frequency, direction, freq_beamformer, stationDirection, tileDirection); std::complex<float>* antBufferPtr = (*data_ptr)[s][y][x];