everybeam::aterms

namespace aterms
class ATermBase
#include <atermbase.h>

Subclassed by ATermBeam, ATermConfig, FitsATermBase, FourierFittingATerm, H5ParmATerm, KlFittingATerm, PAFBeamTerm

Public Functions

inline ATermBase()
inline virtual ~ATermBase()
virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t fieldId, const double *uvwInM) = 0

Calculate the a-terms for the given time and frequency, for all stations.

Parameters:
  • buffer – A buffer of size 4 x width x height x nstation, in that order.

  • time – The time corresponding to the currently gridded visibilities to which the aterm will be applied.

  • frequency – Frequency of currently gridded visibilities.

  • fieldId – Field that these visibilities belong to. Different fields might requires different beams.

  • uvwInM – The UVW of the antennas, referenced to antenna 0.

Returns:

True when new aterms are calculated. If these aterms are the same as for the previous call to Calculate(), false can be returned and the output buffer does not need to be updated. The gridder will then make sure to use the previous aterms, and not reserve extra memory for it etc.

virtual double AverageUpdateTime() const = 0
void StoreATermsEigenvalues(const std::string &filename, const std::complex<float> *buffer, size_t n_stations, size_t width, size_t height)
void StoreATermsReal(const std::string &filename, const std::complex<float> *buffer, size_t n_stations, size_t width, size_t height)
inline void SetSaveATerms(bool save_aterms, const std::string &prefix)

Set whether a fits image with the a-terms should be written to disk every time they are calculated.

Parameters:

save_aterms – Fits images are saved when set to true.

class ATermBeam : public ATermBase
#include <atermbeam.h>

Subclassed by EveryBeamATerm

Public Functions

inline ATermBeam()
inline virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t field_id, const double*) final override

Calculate the a-terms for the given time and frequency, for all stations.

Parameters:
  • buffer – A buffer of size 4 x width x height x nstation, in that order.

  • time – The time corresponding to the currently gridded visibilities to which the aterm will be applied.

  • frequency – Frequency of currently gridded visibilities.

  • fieldId – Field that these visibilities belong to. Different fields might requires different beams.

  • uvwInM – The UVW of the antennas, referenced to antenna 0.

Returns:

True when new aterms are calculated. If these aterms are the same as for the previous call to Calculate(), false can be returned and the output buffer does not need to be updated. The gridder will then make sure to use the previous aterms, and not reserve extra memory for it etc.

inline void SetUpdateInterval(double update_interval)
inline virtual double AverageUpdateTime() const final override
class ATermConfig : public ATermBase
#include <atermconfig.h>

Public Functions

inline ATermConfig(size_t n_antennas, const aocommon::CoordinateSystem &coordinate_system, const everybeam::ATermSettings &settings)
void Read(const casacore::MeasurementSet &ms, const ParsetProvider &reader, const std::string &ms_filename = "")

Read parset information.

Parameters:
  • ms – Measurement set

  • reader – Implementation of ParsetProvider

  • ms_filename – ms filename, only relevant for paf-type aterm

virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t fieldId, const double *uvwInM) override

Reimplemented from ATermBase

inline virtual double AverageUpdateTime() const override

Reimplemented from ATermBase

Public Static Functions

static std::unique_ptr<ATermBeam> GetATermBeam(const casacore::MeasurementSet &ms, const aocommon::CoordinateSystem &coordinate_system, const ATermSettings &settings, bool frequency_interpolation, const std::string &beam_normalisation_mode, bool use_channel_frequency, const std::string &element_response_model, const std::string &beam_mode = "full")

Static method for constructing an (EveryBeam)ATerm.

Parameters:
  • ms – Measurement set

  • coordinate_system – struct with image settings

  • settings – aterm specific settings

  • frequency_interpolation – Interpolate between frequencies? Relevant for MWA only.

  • beam_normalisation_mode – What type of normalisation will be applied?

  • use_channel_frequency – Use channel frequency

  • element_response_model – Element response model

Returns:

std::unique_ptr<ATermBeam>

static everybeam::Options ConvertToEBOptions(const casacore::MeasurementSet &ms, const ATermSettings &settings, bool frequency_interpolation, const std::string &beam_normalisation_mode, bool use_channel_frequency, const std::string &element_response_model, const std::string &beam_mode = "full")

Static method to construct an everybeam::Options struct from user-settings.

Parameters:
  • ms – Measurement set

  • settingsATermSettings

  • frequency_interpolation – Interpolate between frequencies? Relevant for MWA only.

  • beam_normalisation_mode – What type of normalisation will be applied?

  • use_channel_frequency – Use channel frequency?

  • element_response_model – Element response model

Returns:

everybeam::Options

class ATermResampler
#include <atermresampler.h>

Public Functions

ATermResampler(const aocommon::CoordinateSystem &coordinate_system, size_t max_support)
~ATermResampler()
void ReadAndResample(aocommon::FitsReader &reader, size_t file_index, aocommon::UVector<float> &scratch, aocommon::UVector<float> &output, double stretch_factor)
Parameters:
inline void SetTukeyWindow(double padding)
inline void SetWindow(aocommon::WindowFunction::Type window)
inline void SetDownSample(bool downsample)
inline size_t AllocatedWidth() const
inline size_t AllocatedHeight() const
inline size_t ScratchASize() const
size_t ScratchBSize(const aocommon::FitsReader &reader) const
inline void OverrideFitsPhaseCentre(double ra, double dec)
class Cache
#include <cache.h>

A simple a-term cache that stores aterms for all frequencies in a single timestep. Since each timestep will have the same frequency values, the cache maintains buffers for each frequency value, and once all frequencies have been stored at least once, no more allocations are performed.

Used by the FitsATerm class.

Public Functions

inline Cache()

Construct the cache.

inline Cache(size_t aterm_size)
Cache(const Cache&) = delete
Cache(Cache&&) = default
Cache &operator=(const Cache&) = delete
Cache &operator=(Cache&&) = default
inline void Reset()

Clears all stored values, such that e.g. the cache is ready for a new timestep. After this call, Find() will always return kNotFound .

inline size_t Find(double frequency) const

Returns the index of the frequency, or kNotFound if not found.

inline void Get(size_t index, std::complex<float> *destination) const

Retrieve a buffer given a frequency index (as returned by Find() ).

Parameters:

destination – Array with ATermSize() elements.

inline void Store(double frequency, const std::complex<float> *data)

Store the data for the given frequency in the cache. The data array should be an array with ATermSize() elements.

inline size_t ATermSize() const

Size of one aterm buffer (in number of complex float values).

Public Static Attributes

static const size_t kNotFound = std::numeric_limits<size_t>::max()
class DLDMATerm : public FitsATermBase
#include <dldmaterm.h>

Public Functions

DLDMATerm(size_t n_antenna, const aocommon::CoordinateSystem &coordinate_system, size_t max_support)
void Open(const std::vector<std::string> &filenames)
virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t fieldId, const double *uvwInM) override

Calculate the a-terms for the given time and frequency, for all stations.

Parameters:
  • buffer – A buffer of size 4 x width x height x nstation, in that order.

  • time – The time corresponding to the currently gridded visibilities to which the aterm will be applied.

  • frequency – Frequency of currently gridded visibilities.

  • fieldId – Field that these visibilities belong to. Different fields might requires different beams.

  • uvwInM – The UVW of the antennas, referenced to antenna 0.

Returns:

True when new aterms are calculated. If these aterms are the same as for the previous call to Calculate(), false can be returned and the output buffer does not need to be updated. The gridder will then make sure to use the previous aterms, and not reserve extra memory for it etc.

inline void SetUpdateInterval(double updateInterval)
inline virtual double AverageUpdateTime() const final override
class EveryBeamATerm : public ATermBeam
#include <everybeamaterm.h>

Wraps the EveryBeam::Telescope classes for computing the gridded beam response.

Public Functions

EveryBeamATerm(const casacore::MeasurementSet &ms, const aocommon::CoordinateSystem &coordinate_system, const everybeam::Options &settings)
class FitsATerm : public FitsATermBase
#include <fitsaterm.h>

Class that reads in FITS images and resamples them onto aterm grids. The fits file is supposed to have a TIME, FREQ and ANTENNA axis.

Public Functions

FitsATerm(size_t n_antennas, const aocommon::CoordinateSystem &coordinate_system, size_t max_support)
~FitsATerm() override
void OpenTECFiles(const std::vector<std::string> &filenames)
void OpenDiagGainFiles(const std::vector<std::string> &filenames)
virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t field_id, const double *uvw_in_m) override

Calculate the a-terms for the given time and frequency, for all stations.

Parameters:
  • buffer – A buffer of size 4 x width x height x nstation, in that order.

  • time – The time corresponding to the currently gridded visibilities to which the aterm will be applied.

  • frequency – Frequency of currently gridded visibilities.

  • fieldId – Field that these visibilities belong to. Different fields might requires different beams.

  • uvwInM – The UVW of the antennas, referenced to antenna 0.

Returns:

True when new aterms are calculated. If these aterms are the same as for the previous call to Calculate(), false can be returned and the output buffer does not need to be updated. The gridder will then make sure to use the previous aterms, and not reserve extra memory for it etc.

class FitsATermBase : public ATermBase
#include <fitsatermbase.h>

Subclassed by DLDMATerm, FitsATerm

Public Functions

FitsATermBase(size_t n_antennas, const aocommon::CoordinateSystem &coordinate_system, size_t max_support)
~FitsATermBase() override
virtual double AverageUpdateTime() const override
inline void SetTukeyWindow(double padding)
inline void SetWindow(aocommon::WindowFunction::Type window)
inline void SetDownSample(bool downsample)
class FourierFitter
#include <fourierfitter.h>

Public Functions

FourierFitter(std::size_t subgrid_size, std::size_t support, const std::vector<std::pair<float, float>> &directions)
void Evaluate(const std::vector<std::complex<float>> &solutions, std::complex<float> *buffer) const
class FourierFittingATerm : public ATermBase
#include <fourierfittingaterm.h>

Class that reads in H5Parm solution files and fits Fourier base functions to them, leading to aterms that have both limited support and an exact reconstruction at the points of interest.

Public Functions

FourierFittingATerm(const std::vector<std::string> &station_names_ms, const aocommon::CoordinateSystem &coordinate_system, int support)

Constructs FourierFittingATerm.

Parameters:
  • station_names_ms – vector of station names to compute aterms for

  • coordinate_system – coordinate system of the aterms

  • support – support of the aterm in the Fourier domain

~FourierFittingATerm()
void Open(const std::string &filename)

Read h5parm file given a path. Subsequent Calculate() calls will use the parameters in the h5parm file for aterm calculation.

Parameters:

filename – path to h5parm file

virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t field_id, const double *uvw_in_m) override

Calculate aterms and write the result into buffer.

Parameters:
  • buffer – Buffer

  • time – Time, modified Julian date, UTC, in seconds (MJD(UTC), s)

  • frequency – Freq (Hz) - not used at the moment

  • field_id – Irrelevant for fourierfitting aterms

  • uvw_in_m – Irrelevant for fourierfitting aterms

Returns:

true Results are updated

Returns:

false No need to update the result, cached result can be used

inline void SetUpdateInterval(double update_interval)

Set the update interval.

Parameters:

update_interval – Update interval (in s)

inline virtual double AverageUpdateTime() const final override

Get average update time, fixed value as set by SetUpdateInterval()

Returns:

double

class H5ParmATerm : public ATermBase
#include <h5parmaterm.h>

Class that reads in H5Parm coefficient files and evaluates the underlying polynomial on a prescribed image. The H5Parm file(s) are supposed to have an “amplitude_coefficients” and a “phase_coefficients” solution table, where each solution table has at least the following axes (“ant”, “time”, “dir”). The polynomial coefficients are stored along the “dir” axis

Public Functions

H5ParmATerm(const std::vector<std::string> &station_names_ms, const aocommon::CoordinateSystem &coordinate_system)
void Open(const std::vector<std::string> &filenames)

Read h5parm files given a vector of paths.

Parameters:

filenames

virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t field_id, const double *uvw_in_m) final override
Parameters:
  • buffer – Buffer

  • time – Time, modified Julian date, UTC, in seconds (MJD(UTC), s)

  • frequency – Freq (Hz) - not used at the moment

  • field_id – Irrelevant for h5parm aterms

  • uvw_in_m – Irrelevant for h5parm aterms

Returns:

true Results are updated

Returns:

false No need to update the result, cached result can be used

inline void SetUpdateInterval(double update_interval)

Set the update interval.

Parameters:

update_interval – Update interval (in s)

inline virtual double AverageUpdateTime() const final override
class KlFitter
#include <klfitter.h>

Public Functions

KlFitter(std::size_t subgrid_size, int order, const std::vector<std::pair<float, float>> &directions)
void Evaluate(const std::vector<float> &solutions, float *buffer) const
class KlFittingATerm : public ATermBase
#include <klfittingaterm.h>

Class that reads in H5Parm solution files and fits Karhunen-Loève base functions to them\

Public Functions

KlFittingATerm(const std::vector<std::string> &station_names_ms, const aocommon::CoordinateSystem &coordinate_system, int order, bool use_phasor_fit = true)
~KlFittingATerm()
void Open(const std::string &filename)

Read h5parm file given a path. Subsequent Calculate() calls will use the parameters in the h5parm file for aterm calculation.

Parameters:

filename – path to h5parm file

virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t field_id, const double *uvw_in_m) override
Parameters:
  • buffer – Buffer

  • time – Time, modified Julian date, UTC, in seconds (MJD(UTC), s)

  • frequency – Freq (Hz)

  • field_id

  • uvw_in_m

Returns:

true Results are updated

Returns:

false No need to update the result, cached result can be used

inline void SetUpdateInterval(double update_interval)

Set the update interval.

Parameters:

update_interval – Update interval (in s)

inline virtual double AverageUpdateTime() const final override

Get average update time, fixed value as set by SetUpdateInterval()

Returns:

double

class LagrangePolynomial
#include <h5parmaterm.h>

Convenience class for efficiently evaluating a Lagrange binomial (i.e. polynomial in 2D)

Public Functions

LagrangePolynomial(size_t nr_coeffs, const std::vector<double> &l, const std::vector<double> &m)

Construct a new Lagrange Polynomial object.

Parameters:
  • nr_coeffs

  • l

  • m

void Evaluate(const double *coeffs, int stride, double *output)
inline size_t GetOrder() const
inline size_t GetNrCoeffs() const

Public Static Functions

static size_t ComputeOrder(size_t nr_coeffs)

Compute polynomial order, given the total number of coefficients.

Parameters:

nr_coeffs – Number of coefficients

Returns:

size_t Polynomial order

static size_t ComputeNrCoeffs(size_t order)

Compute number of coeffs, given the polynomial order.

Parameters:

order – polynomial order

Returns:

size_t number of terms

class PAFBeamTerm : public ATermBase
#include <pafbeamterm.h>

Class for reading fits files as they are used in “Phased-array feed” such as Apertif.

Public Functions

PAFBeamTerm(const aocommon::CoordinateSystem &coordinate_system, size_t max_support)
virtual bool Calculate(std::complex<float> *buffer, double time, double frequency, size_t fieldId, const double *uvw_in_m) override

Calculate the a-terms for the given time and frequency, for all stations.

Parameters:
  • buffer – A buffer of size 4 x width x height x nstation, in that order.

  • time – The time corresponding to the currently gridded visibilities to which the aterm will be applied.

  • frequency – Frequency of currently gridded visibilities.

  • fieldId – Field that these visibilities belong to. Different fields might requires different beams.

  • uvwInM – The UVW of the antennas, referenced to antenna 0.

Returns:

True when new aterms are calculated. If these aterms are the same as for the previous call to Calculate(), false can be returned and the output buffer does not need to be updated. The gridder will then make sure to use the previous aterms, and not reserve extra memory for it etc.

inline void SetUpdateInterval(double update_interval)
inline virtual double AverageUpdateTime() const final override
void Open(const std::string &filename_template, const std::vector<std::string> &antenna_map, const std::string &beam_name, double beam_ra, double beam_dec)
inline void SetTukeyWindow(double padding)
inline void SetWindow(aocommon::WindowFunction::Type window)
inline void SetDownSample(bool downsample)
inline void SetCorrectForFrequencyOffset(bool correct)
inline void SetReferenceFrequency(double ref_frequency)
class ParsetProvider
#include <parsetprovider.h>

Abstract class that can be used to interface the parset (DP3) or configuration file (wsclean) settings for the aterms.

Public Functions

inline virtual ~ParsetProvider()
virtual std::string GetString(const std::string &key) const = 0
virtual std::string GetStringOr(const std::string &key, const std::string &or_value) const = 0
virtual std::vector<std::string> GetStringList(const std::string &key) const = 0
inline std::vector<std::string> GetNonEmptyStringList(const std::string &key) const
virtual double GetDoubleOr(const std::string &key, double or_value) const = 0
virtual bool GetBool(const std::string &key) const = 0
virtual bool GetBoolOr(const std::string &key, bool or_value) const = 0