Skip to content
Snippets Groups Projects
Commit d26377e5 authored by André Offringa's avatar André Offringa
Browse files

Manual merge of Bas' and Bram's changes for HBA fix

parent dfd63d50
Branches
Tags
1 merge request!35Manual merge of Bas' and Bram's changes for HBA fix
Pipeline #2668 passed
...@@ -109,6 +109,12 @@ class Antenna { ...@@ -109,6 +109,12 @@ class Antenna {
m_phase_reference_position(phase_reference_position), m_phase_reference_position(phase_reference_position),
m_enabled{true, true} {} m_enabled{true, true} {}
Antenna(const vector3r_t &phase_reference_position)
: m_coordinate_system({phase_reference_position, // origin
CoordinateSystem::identity_axes}),
m_phase_reference_position(phase_reference_position),
m_enabled{true, true} {}
/** /**
* @brief Compute the %Antenna response * @brief Compute the %Antenna response
* *
......
...@@ -46,6 +46,12 @@ class BeamFormer : public Antenna { ...@@ -46,6 +46,12 @@ class BeamFormer : public Antenna {
transform_to_local_position(m_phase_reference_position); transform_to_local_position(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);
}
/** /**
* @brief Add an antenna to the m_antenna array. * @brief Add an antenna to the m_antenna array.
* *
......
...@@ -180,9 +180,25 @@ Antenna::CoordinateSystem readCoordinateSystem(const Table &table, ...@@ -180,9 +180,25 @@ Antenna::CoordinateSystem readCoordinateSystem(const Table &table,
return coordinate_system; return coordinate_system;
} }
BeamFormer::Ptr make_tile(std::string name, BeamFormer::Ptr make_tile(unsigned int id, const vector3r_t &position,
Antenna::CoordinateSystem coordinate_system, const TileConfig &tile_config,
TileConfig tile_config, ElementResponse::Ptr) {} ElementResponse::Ptr element_response) {
BeamFormer::Ptr tile = BeamFormer::Ptr(new BeamFormer(position));
for (unsigned int id = 0; id < tile_config.size(); id++) {
vector3r_t antenna_position = tile_config[id];
Antenna::CoordinateSystem antenna_coordinate_system;
antenna_coordinate_system.origin = antenna_position;
antenna_coordinate_system.axes = lofar_antenna_orientation;
Antenna::Ptr antenna = Element::Ptr(
new Element(antenna_coordinate_system, element_response, id));
tile->add_antenna(antenna);
}
return tile;
}
BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id, BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id,
ElementResponse::Ptr element_response) { ElementResponse::Ptr element_response) {
...@@ -210,9 +226,9 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id, ...@@ -210,9 +226,9 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id,
Matrix<Bool> aips_flag = c_flag(id); Matrix<Bool> aips_flag = c_flag(id);
assert(aips_flag.shape().isEqual(IPosition(2, 2, aips_offset.ncolumn()))); assert(aips_flag.shape().isEqual(IPosition(2, 2, aips_offset.ncolumn())));
// TileConfig tile_config; TileConfig tile_config;
// if(name != "LBA") readTileConfig(table, id); if (name != "LBA") readTileConfig(table, id);
// transformToFieldCoordinates(tile_config, coordinate_system.axes); transformToFieldCoordinates(tile_config, coordinate_system.axes);
for (size_t i = 0; i < aips_offset.ncolumn(); ++i) { for (size_t i = 0; i < aips_offset.ncolumn(); ++i) {
vector3r_t antenna_position = {aips_offset(0, i).getValue(), vector3r_t antenna_position = {aips_offset(0, i).getValue(),
...@@ -220,9 +236,6 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id, ...@@ -220,9 +236,6 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id,
aips_offset(2, i).getValue()}; aips_offset(2, i).getValue()};
antenna_position = antenna_position =
transformToFieldCoordinates(antenna_position, coordinate_system.axes); transformToFieldCoordinates(antenna_position, coordinate_system.axes);
// std::cout << "antenna_position: " << antenna_position[0] << ", "
// << antenna_position[1] << ", " << antenna_position[2] <<
// std::endl;
Antenna::Ptr antenna; Antenna::Ptr antenna;
Antenna::CoordinateSystem antenna_coordinate_system{ Antenna::CoordinateSystem antenna_coordinate_system{
antenna_position, lofar_antenna_orientation}; antenna_position, lofar_antenna_orientation};
...@@ -230,12 +243,8 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id, ...@@ -230,12 +243,8 @@ BeamFormer::Ptr readAntennaField(const Table &table, unsigned int id,
antenna = Element::Ptr( antenna = Element::Ptr(
new Element(antenna_coordinate_system, element_response, id)); new Element(antenna_coordinate_system, element_response, id));
} else { } else {
antenna = Element::Ptr( // name is HBA, HBA0, HBA1
new Element(antenna_coordinate_system, element_response, id)); antenna = make_tile(id, antenna_position, tile_config, element_response);
// TODO
// HBA, HBA0, HBA1
// antenna = make_tile(name, coordinate_system, tile_config,
// element_response);
} }
antenna->m_enabled[0] = !aips_flag(0, i); antenna->m_enabled[0] = !aips_flag(0, i);
......
...@@ -92,6 +92,8 @@ struct raw_array_factor_t { ...@@ -92,6 +92,8 @@ struct raw_array_factor_t {
diag22r_t weight; diag22r_t weight;
}; };
typedef std::array<vector3r_t, 16> TileConfig;
template <typename T, size_t N> template <typename T, size_t N>
std::ostream &operator<<(std::ostream &out, const std::array<T, N> &obj) { std::ostream &operator<<(std::ostream &out, const std::array<T, N> &obj) {
print(out, obj.begin(), obj.end()); print(out, obj.begin(), obj.end());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment