PBMath.h

Classes

PBMath -- Primary beam envelope class, derived from PBMathInterface (full description)

class PBMath

Types

enum CommonPB

UNKNOWN
DEFAULT
ATCA_L1
ATCA_L2
ATCA_L3
ATCA_S
ATCA_C
ATCA_X
GBT
GMRT
HATCREEK
NRAO12M
NRAO140FT
OVRO
VLA
VLA_INVERSE
VLA_NVSS
VLA_2NULL
VLA_4
VLA_P
VLA_L
VLA_C
VLA_X
VLA_U
VLA_K
VLA_Q
WSRT
WSRT_LOW
ALMA
ALMASD
ACA
NONE
IRAMPDB
IRAM30M

enum

NumberOfCommonPB = 34

Interface

Public Members
PBMath()
explicit PBMath(PBMath::CommonPB myPBType, Bool useSymmetricBeam=False)
PBMath(String& telescopeName, Bool useSymmetricBeam=False, Quantity freq=Quantity(0.0, "Hz"))
explicit PBMath(const RecordInterface& myrec)
PBMath(PBMathInterface::PBClass theclass, Quantity halfWidth, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(MDirection(Quantity(0.0, "deg"), Quantity(0.0, "deg"), MDirection::Ref(MDirection::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)
PBMath(PBMathInterface::PBClass theclass, const Vector<Double>& coeff, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(maxRad(Quantity(0.0, "deg"), Quantity(0.0, "deg"), maxRad::Ref(maxRad::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)
PBMath(PBMathInterface::PBClass theclass, const Vector<Float>& coeff, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(maxRad(Quantity(0.0, "deg"), Quantity(0.0, "deg"), maxRad::Ref(maxRad::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)
PBMath(PBMathInterface::PBClass theclass, const Vector<Double>& coeff, const Vector<Double>& scale, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(MDirection(Quantity(0.0, "deg"), Quantity(0.0, "deg"), MDirection::Ref(MDirection::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)
PBMath(PBMathInterface::PBClass theclass, Quantity dishDiam, Quantity blockageDiam, Quantity maxRad, Quantity refFreq, BeamSquint squint=BeamSquint(blockageDiam(Quantity(0.0, "deg"), Quantity(0.0, "deg"), blockageDiam::Ref(blockageDiam::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)
PBMath(PBMathInterface::PBClass theclass, ImageInterface<Float>& reJones)
PBMath(PBMathInterface::PBClass theclass, ImageInterface<Float>& reJones, ImageInterface<Float>& imJones)
PBMath(const PBMath &other)
~PBMath()
PBMath& operator=(const PBMath& other)
Bool operator==(const PBMath& other) const
Bool operator!=(const PBMath& other) const
ImageInterface<Complex>& applyVP(const ImageInterface<Complex>& in, ImageInterface<Complex>& out, const in& sp, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Bool conjugate = False, Float cutoff = 0.01, Bool forward=True)
ImageInterface<Complex>& applyPB(const ImageInterface<Complex>& in, ImageInterface<Complex>& out, const in& sp, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Float cutoff = 0.01, Bool forward = True)
ImageInterface<Float>& applyPB2(const ImageInterface<Float>& in, ImageInterface<Float>& out, const MDirection& sp, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Float cutoff=0.01)
SkyComponent& applyVP(SkyComponent& in, SkyComponent& out, const out& sp, const Quantity frequency, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Bool conjugate = False, Float cutoff = 0.01, Bool forward = True)
SkyComponent& applyPB(SkyComponent& in, SkyComponent& out, const out& sp, const Quantity frequency, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Float cutoff = 0.01, Bool forward = True)
SkyComponent& applyPB2(SkyComponent& in, SkyComponent& out, const out& sp, const Quantity frequency, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE)
void setUseSymmetric(Bool useSym=True)
Bool getUseSymmetric()
PBMathInterface::PBClass whichPBClass()
void summary(Int nValues=0)
Bool ok() const
ImageRegion* extent (const ImageInterface<Complex>& im, const Complex& pointing, const Int row, const Float fPad, const Int iChan, const MDirection::SizeType)
ImageRegion* extent (const ImageInterface<Float>& im, const MDirection& pointing, const Int row, const Float fPad, const Int iChan, const MDirection::SizeType)
static void whichCommonPBtoUse (String &telescope, Quantity &freq, String &band, PBMath::CommonPB &whichPB, String &pbName)
static void nameCommonPB(const PBMath::CommonPB iPB, String & str)
static void enumerateCommonPB(const String & str, PBMath::CommonPB &ipb)
void namePBClass(String & name)
Private Members
Bool getQuantity(const RecordInterface& rec, const String& item, Quantity& returnedQuantity) const
Bool getMDirection(const RecordInterface& rec, const String& item, String& returnedMDirection) const
void initByTelescope(PBMath::CommonPB myPBType, Bool useSymmetricBeam=False, Double frequency=0.0)

Description

Prerequisite

Etymology

PBMath types do the mathematical operations of the Primary Beamss or Voltage patterns. This envelope class's name was designed for simplicity.

Synopsis

PBMath is an envelope class for the various types of 1D and 2D primary beam/voltage pattern objects. They all have a common interface defined by PBMathInterface. The PBMath object has a counted pointer to the actual PB type; hence, the PBMath object is lightweight and can be passed around by value in other classes.

Construct a PBMath via PBMath's enumerated CommonPB type.

Example

    PBMath wsrtPB(PBMath::WSRT);
    PBMath vla_LPB(PBMath::VLA_L);  // has L band squint built in
    

A PBMath can also be constructed by the complete argument list for the type of PB it holds. Since different PB types can have the same argument list (PBMath1DPoly and PBMath1DIPoly, for example), the exact type also needs to be specified via the PBMathInterface::PBClass.

The main thing you want to do with a primary beam or voltage pattern is to apply it to an image. The PBMath object forwards its low level "apply" calls to the letter class's "apply" calls.

Example


    PagedImage<Float> in;
    PagedImage<Complex> out;
    MDirection pointingDir(Quantity(135.0, "deg"), Quantity(60.0, "deg"), 
                           MDirection::Ref(MDirection::J2000));
    Quantity parallacticAngle(26.5, "deg");
    PBMath wsrtPB(PBMath::WSRT_LOW);
    wsrtPB.applyPB(in, out, pointingDir);   // multiply by primary beam
    wsrtPB.applyPB(in, out, pointingDir, parallacticAngle, BeamSquint::GOFIGURE, 
                   True, 0.02); // divide by primary beam
    wsrtPB.applyVP(in, out, pointingDir);   // multiply by voltage pattern
 
 </synopsis> 


 <motivation>
 This Envelope class allows the user to create a PBMath object which
 can display all the polymorphic traits of PBMath1D classes or
 PBMath2D classes.
 </motivation>

 <todo asof="98/010/21">
 </todo>


Member Description

enum CommonPB

This enumeration provides a simple way to instantiate the common primary beam models. They are each represented by one of the more fundamental PBMath1D types

New CommonPB Types must go to the end

enum

PBMath()

Default constructor, required for Block

explicit PBMath(PBMath::CommonPB myPBType, Bool useSymmetricBeam=False)

Make a PB of common type

PBMath(String& telescopeName, Bool useSymmetricBeam=False, Quantity freq=Quantity(0.0, "Hz"))

Make a PB from a telescopename and frequency

explicit PBMath(const RecordInterface& myrec)

Make a PB from a RecordInterface

PBMath(PBMathInterface::PBClass theclass, Quantity halfWidth, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(MDirection(Quantity(0.0, "deg"), Quantity(0.0, "deg"), MDirection::Ref(MDirection::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)

Make a Gaussian Primary beam

PBMath(PBMathInterface::PBClass theclass, const Vector<Double>& coeff, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(maxRad(Quantity(0.0, "deg"), Quantity(0.0, "deg"), maxRad::Ref(maxRad::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)

Make a Polynomial, Inverse Polynomial, or Numeric Primary beam (These three have identical calling signatures, they can only be distinguished by the PBClass enumeration)

PBMath(PBMathInterface::PBClass theclass, const Vector<Float>& coeff, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(maxRad(Quantity(0.0, "deg"), Quantity(0.0, "deg"), maxRad::Ref(maxRad::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)

Make a Numeric Primary beam (FLOAT!)

PBMath(PBMathInterface::PBClass theclass, const Vector<Double>& coeff, const Vector<Double>& scale, Quantity maxRad, Quantity refFreq, Bool isThisVP=False, BeamSquint squint=BeamSquint(MDirection(Quantity(0.0, "deg"), Quantity(0.0, "deg"), MDirection::Ref(MDirection::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)

Make a CosPolynomial beam type

PBMath(PBMathInterface::PBClass theclass, Quantity dishDiam, Quantity blockageDiam, Quantity maxRad, Quantity refFreq, BeamSquint squint=BeamSquint(blockageDiam(Quantity(0.0, "deg"), Quantity(0.0, "deg"), blockageDiam::Ref(blockageDiam::AZEL)), Quantity(1.0, "GHz")), Bool useSymmetricBeam=False)

Make an Airy beam type

PBMath(PBMathInterface::PBClass theclass, ImageInterface<Float>& reJones)

Make an Image-based beam

PBMath(PBMathInterface::PBClass theclass, ImageInterface<Float>& reJones, ImageInterface<Float>& imJones)

PBMath(const PBMath &other)

Instantiate from a Table PBMath(const Table& theTable, Int row);

copy ctor: copies the reference counted pointer

~PBMath()

destructor

PBMath& operator=(const PBMath& other)

operator= returns a reference to the PBMath; reference counted pointer

Bool operator==(const PBMath& other) const

comparison operator: just checks that the objects are same (could have two different objects with identical data, these are treated as !=)

Bool operator!=(const PBMath& other) const

comparison operator: just checks that the objects are different (could have two different objects with identical data, these are treated as !=)

ImageInterface<Complex>& applyVP(const ImageInterface<Complex>& in, ImageInterface<Complex>& out, const in& sp, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Bool conjugate = False, Float cutoff = 0.01, Bool forward=True)
ImageInterface<Complex>& applyPB(const ImageInterface<Complex>& in, ImageInterface<Complex>& out, const in& sp, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Float cutoff = 0.01, Bool forward = True)
ImageInterface<Float>& applyPB2(const ImageInterface<Float>& in, ImageInterface<Float>& out, const MDirection& sp, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Float cutoff=0.01)

copy() returns a copy of the PBMath PBMath copy() const;

Apply Jones matrix to an image (and adjoint)

SkyComponent& applyVP(SkyComponent& in, SkyComponent& out, const out& sp, const Quantity frequency, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Bool conjugate = False, Float cutoff = 0.01, Bool forward = True)
SkyComponent& applyPB(SkyComponent& in, SkyComponent& out, const out& sp, const Quantity frequency, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE, Bool inverse = False, Float cutoff = 0.01, Bool forward = True)
SkyComponent& applyPB2(SkyComponent& in, SkyComponent& out, const out& sp, const Quantity frequency, const Quantity parAngle = Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint = BeamSquint::NONE)

Apply Jones matrix to a sky component (and adjoint)

void setUseSymmetric(Bool useSym=True)

Fit an azimuthally symmetric beam to the squinted or otherwise 2-D beam for Stokes I?

Bool getUseSymmetric()

Get value of useSymmetric

PBMathInterface::PBClass whichPBClass()

Get the type of PB this is

void summary(Int nValues=0)

Summarize the Voltage Pattern;

Bool ok() const

Is the state of the PBMath OK?

ImageRegion* extent (const ImageInterface<Complex>& im, const Complex& pointing, const Int row, const Float fPad, const Int iChan, const MDirection::SizeType)

Get the BLC, TRC of the primary beam on an Image for a given pointing Note: BLC and TRC are not necesarily constrained to lie within the image region (for example, if the pointing center is near the edge of the image). fPad: extra fractional padding above PB support (note: we do not properly treat squint yet, this will cover it for now) iChan: frequency channel to take: lowest frequency channel is safe for all

ImageRegion* extent (const ImageInterface<Float>& im, const MDirection& pointing, const Int row, const Float fPad, const Int iChan, const MDirection::SizeType)

static void whichCommonPBtoUse (String &telescope, Quantity &freq, String &band, PBMath::CommonPB &whichPB, String &pbName)

given the Telescope name and the frequency, guess the most approrpiate CommonPB primary beam type and the band

static void nameCommonPB(const PBMath::CommonPB iPB, String & str)

converts the enumrated type into a string

static void enumerateCommonPB(const String & str, PBMath::CommonPB &ipb)

converts the PB String into an enumrated type

void namePBClass(String & name)

gives the name of the PB Class that has been used

void initByTelescope(PBMath::CommonPB myPBType, Bool useSymmetricBeam=False, Double frequency=0.0)

These should probably move to RecordInterface when we are happy with their performance

Function to initialize the state of the tool

Bool getQuantity(const RecordInterface& rec, const String& item, Quantity& returnedQuantity) const
Bool getMDirection(const RecordInterface& rec, const String& item, String& returnedMDirection) const

These should probably move to RecordInterface when we are happy with their performance