Skip to content
Snippets Groups Projects
Select Git revision
  • eda5263ee4a267769d0e14b3eedbc7503d12a0c4
  • master default protected
  • rtd-ubuntu24-plucky
  • ast-1644-temp-fix
  • ast-1600-fix-beam-for-meerkat-ska-mid
  • readthedocs-c++17
  • mwa_python_wrapper
  • ast-1384-remove-element-index-argument
  • ast-1509-fix-polarization-orientation-in-gridded-response
  • add-test-for-squared-mueller-matrices
  • 1493-extend-python-bindings
  • ast-1493-implement-response-dishpoint-1
  • ast-1325-prototype-ska-beam-model-interface
  • ast-1416-oskar-ska-sdp-func-1
  • ast-1386-create-default-element
  • ast-1384-fix-sorted-frequencies-check-sphericalharmonicsresponse-1
  • ast-1111-add-vector-bindings
  • ast-973-add-test-for-lobes-coefficients
  • ast-645-add-beam-normalisation-mode-preapplied
  • disable-element-beam-1
  • just-testing
  • v0.7.2
  • v0.7.1
  • v0.7.0
  • v0.6.2
  • v0.6.1
  • v0.6.0
  • v0.5.8
  • v0.5.7
  • v0.5.6
  • v0.5.5
  • v0.5.4
  • v0.5.3
  • v0.5.2
  • v0.5.1
  • v0.4.0
  • v0.3.1
  • v0.3.0
  • v0.2.0
  • v0.1.3
  • v0.1.2
41 results

beam-helper.cpp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    PointSource.h 2.16 KiB
    // PointSource.h: Point source model component with optional spectral index and
    // rotation measure.
    //
    // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
    // SPDX-License-Identifier: GPL-3.0-or-later
    
    #ifndef DPPP_POINTSOURCE_H
    #define DPPP_POINTSOURCE_H
    
    #include "Direction.h"
    #include "Spectrum.h"
    #include "Stokes.h"
    #include <memory>
    #include <set>
    namespace dp3 {
    namespace base {
    
    /// \brief Point source model component with optional spectral index and
    /// rotation measure.
    
    /// @{
    
    class PointSource {
    public:
      typedef std::shared_ptr<PointSource> Ptr;
      typedef std::shared_ptr<const PointSource> ConstPtr;
    
      PointSource(const Direction &direction, const Stokes &stokes,
                  const size_t beam_id = 0);
      PointSource(const Direction &direction, const Spectrum &stokes,
                  const size_t beam_id = 0);
    
      const Direction &GetDirection() const { return direction_; }
      void SetDirection(const Direction &position);
    
      void ComputeSpectrum(const xt::xtensor<double, 1> &frequencies,
                           xt::xtensor<std::complex<double>, 2> &result) const;
      const Spectrum &GetSpectrum() const { return spectrum_; }
    
      Stokes GetStokes(double freq) const;
      const Stokes &GetStokes() const { return spectrum_.GetReferenceFlux(); }
    
      const size_t &GetBeamId() const { return beam_id_; }
      void SetBeamId(size_t beam_id) { beam_id_ = beam_id; }
    
      template <typename T>
      void SetSpectralTerms(double refFreq, bool isLogarithmic, T first, T last);
    
      void SetRotationMeasure(double fraction, double angle, double rm);
    
      bool HasRotationMeasure() const;
      bool HasSpectralTerms() const;
    
    protected:
      Direction direction_;
      Spectrum spectrum_;
      size_t beam_id_;
    };
    
    /// @}
    
    template <typename T>
    void PointSource::SetSpectralTerms(double refFreq, bool isLogarithmic, T first,
                                       T last) {
      // FIXME: the following four statements can be removed later.
      // They are not needed anymore, but are kept for
      // backward compatibility for the tests.
    
      spectrum_.SetSpectralTerms(refFreq, isLogarithmic,
                                 xt::adapt(std::vector<double>(first, last)));
    };
    } // namespace base
    } // namespace dp3
    
    #endif