New LOFAR LBA array factor
The new interface can calculate a batch of array factors. This demo illustrates in a step-by-step manner a minimal example of doing this for LOFAR-LBA. Feel free to edit this example to suit your needs by requesting the response from multiple stations at the same time for example. The complete code is shown at the bottom of this page.
It all starts with including the the required header files, this is the bare minimum you will need.
#include <EveryBeam/facade/load.h>
#include <EveryBeam/facade/response.h>
#include <casacore/ms/MeasurementSets.h>
#include <xtensor.hpp>
#include <aocommon/matrix2x2diag.h>
Then, use casacore to load the measurement set.
const casacore::MeasurementSet ms(LOFARLBA_MS_PATH);
The telescope can now be loaded using the everybeam::facade::Load function.
std::unique_ptr<everybeam::facade::Telescope> lofar_telescope = everybeam::facade::Load(ms);
In order to calculate the response, some parameters must be given. Feel free to change these to suit your
needs. In this case the directions are given in J2000, but ITRF is supported as well using everybeam::vector3r_t.
std::vector<int> stations({0});
std::vector<double> freqs({57812500.0});
std::vector<std::pair<double, double>> directions({{-1.44194878, 0.85078091}});
std::vector<double> time({4.92183348e+09});
The final step is calling the everybeam::facade::ArrayFactor function in order to calculate the responses.
xt::xtensor<aocommon::MC2x2diag, 3> array_factor = everybeam::facade::ArrayFactor(
*lofar_telescope, stations, freqs, directions, time);
A complete overview of the code is shown below:
#include <EveryBeam/facade/load.h>
#include <EveryBeam/facade/response.h>
#include <casacore/ms/MeasurementSets.h>
#include <xtensor.hpp>
#include <aocommon/matrix2x2diag.h>
int main() {
const casacore::MeasurementSet ms(LOFARLBA_MS_PATH);
std::unique_ptr<everybeam::facade::Telescope> lofar_telescope =
everybeam::facade::Load(ms);
std::vector<int> stations({0});
std::vector<double> freqs({57812500.0});
std::vector<std::pair<double, double>> directions({{-1.44194878, 0.85078091}});
std::vector<double> time({4.92183348e+09});
xt::xtensor<aocommon::MC2x2diag, 3> array_factor = everybeam::facade::ArrayFactor(
*lofar_telescope, stations, freqs, directions, time);
}