PBMath1D.h

Classes

PBMath1D -- base class for 1D PBMath objects (full description)

class PBMath1D : public PBMathInterface

Interface

Public Members
PBMath1D(Quantity maximumRadius, Quantity refFreq, Bool isThisVP, BeamSquint squint, Bool useSymmetricBeam)
virtual ~PBMath1D() = 0
void viewPB(Vector<Float>& r, Vector<Float>& PB, Int n_elements)
virtual void summary(Int nValues=0)
virtual Bool ok()
ImageRegion* extent (const ImageInterface<Complex>& in, const Complex& pointing, const Int irow, const Float fPad, const Int iChan, const MDirection::SizeType sizeType)
ImageRegion* extent (const ImageInterface<Float>& in, const MDirection& pointing, const Int irow, const Float fPad, const Int iChan, const MDirection::SizeType sizeType)
Protected Members
PBMath1D()
void extentguts (const CoordinateSystem& coords, const MDirection& pointing, const Float fPad, const Int iChan, Vector<Float> &blc, Vector<Float>& trc)
void refineSize(Vector<Float>& blc, Vector<Float>& trc, const IPosition& shape, SkyJones::SizeType)
ImageInterface<Float>& apply(const ImageInterface<Float>& in, ImageInterface<Float>& out, const MDirection& sp, const Quantity parAngle, const BeamSquint::SquintType doSquint, Float cutoff)
virtual void fillPBArray()=0
void symmetrizeSquintedBeam()

Description

Prerequisite

Etymology

PBMath types do the mathematical operations of the PB's or VP's. This is the base class for the 1D (ie, rotationally symmetric) PB's.

Synopsis

PBMath1D, the virtual base class for 1D PBMath objects, is derived from PBMathInterface. Its cousin, PBMath2D, can deal with inherently 2D voltage patterns or primary beams. PBMath1D can deal with beam squint, (ie, the offset of the LL and RR beams on opposite sides of the pointing center) which rotates on the sky with parallactic angle.

The 1D PB philosophy is to specify the Voltage pattern or Primary Beam via a small number of parameters via one of the derived types (PBMath1DGauss, for example). The derived type knows how to instantiate itself from a row in a beam subTable, and how to convert itself into a lookup vector. The lookup vector is fine enough that no interpolation need be done when finding the nearest PB or VP value for a particular pixel (currently, there are 1e+4 elements in the lookup vector, so on average, an error on order of 1e-4 is made when applying the primary beam).

There are two ways of creating the derived PB types: 1) explicitly create one of the babies. You have control over the details such as PB size and total extent, the reference frequency at which this size is true (the size scales inversely with wavelength), the squint orientation, and whether a mean symmetrized beam will be calculated from the squinted beam. (Nice defaults can reduce the arguments in most cases.)

Example

  PBMath1DGauss myPB  (Quantity(1.0, "'"), Quantity(3.0, "'"), Quantity(1.0, "GHz"),
                       False,   // these are PB parameters, not VP
                       BeamSquint(MDirection(Quantity(2.0, "\""),
                                                      Quantity(0.0, "\""),
                                                      MDirection::Ref(MDirection::AZEL)),
                                  Quantity(2.0, "GHz")),
                       False);
  PBMath1DGauss myPB2  (Quantity(1.0, "'"), Quantity(3.0, "'"), Quantity(1.0, "GHz"));
 
2) via the envelope class PBMath's enumerated CommonPB type. This is much simpler, and will deal with a majority of the cases required:

Example

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

The main thing you want to do with a primary beam or voltage pattern is to apply it to an image. The top level "apply" methods are defined in PBMathInterface. They are applyPB, applyPB2, applyVP. These top level apply's then call a lower level private polymorphic apply, which are defined in PBMath1D and in PBMath2D. These two different apply's deal with the different details of 1D and 2D primary beam application.

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

Motivation

All of the 1-D PB types have everything in common except for the details of their parameterization.

lower level helping apply methods: reduce code by this bundling

Thrown Exceptions

To Do

Member Description

PBMath1D(Quantity maximumRadius, Quantity refFreq, Bool isThisVP, BeamSquint squint, Bool useSymmetricBeam)

virtual ~PBMath1D() = 0

void viewPB(Vector<Float>& r, Vector<Float>& PB, Int n_elements)

Get the PB in a vector to look at Concerning n_elements: they are evenly spaced between 0 and maxradius. r is in units of arcminutes at 1 GHz

virtual void summary(Int nValues=0)

Summarize the Voltage Pattern; For PBMath1D, list nValues worth of the VP array

virtual Bool ok()

Is state of PBMath OK?

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

Get the ImageRegion of the primary beam on an Image for a given pointing Note: ImageRegion is 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, beyond Primary Beam 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

Potential problem: this ImageRegion includes all Stokes and Frequency Channels present in the input image.

ImageRegion* extent (const ImageInterface<Float>& in, const MDirection& pointing, const Int irow, const Float fPad, const Int iChan, const MDirection::SizeType sizeType)

PBMath1D()

Protect default constructor: this will do you no good

void extentguts (const CoordinateSystem& coords, const MDirection& pointing, const Float fPad, const Int iChan, Vector<Float> &blc, Vector<Float>& trc)

calculate the limited box of the Primary Beam model's support, return in blc and trc (which are NOT contrained to be inside the image

void refineSize(Vector<Float>& blc, Vector<Float>& trc, const IPosition& shape, SkyJones::SizeType)

push blc lower, trc higher such that they define an image which is a power of 2 in size.

Adjust blc and trc such that they are within the image and such that they create an image with power of 2 (SkyJones::POWEROF2) shape or composite number (SkyJones::COMPOSITE) shape

ImageInterface<Float>& apply(const ImageInterface<Float>& in, ImageInterface<Float>& out, const MDirection& sp, const Quantity parAngle, const BeamSquint::SquintType doSquint, Float cutoff)

virtual void fillPBArray()=0

Fill in PB_p array from construction parameters, rescale construction parameters to the 1 GHz internal reference frequency Eventually: create it as its needed; we've got 4 arrays to fill; only create and store as they are required Right now: just construct all arrays

void symmetrizeSquintedBeam()

Helper method to fit a circularly symmetric beam to the squinted RR + LL beam. Called upon construction. Build this later. PB' = azimuthal fit to: ( VP(x+s)**2 + VP(x-s)**2 )/2 VP' = sqrt(PB')