NewSimVisJones.h

Classes

NewSimVisJones -- Model multiplicative gain errors for the VisEquation (full description)
SimAntGainCache -- A container for antenna gains (full description)
NewSimTimeDepVisJones -- Model multiplicative gain errors for the VisEquation (full description)
NewSimGJones -- Model multiplicative gain errors for the VisEquation (full description)
NewSimDJones -- Model multiplicative gain errors for the VisEquation (full description)

class NewSimVisJones : public VisJones

Types

enum Distribution

ideal
a delta-function (i.e. zero-noise) distribution. This distribution type should be used when a random component is not desired.
normal
the normal distribution. The random component will vary according to a normal (Gaussian) distribution.
uniform
the uniform distribution. The random component will vary uniformily over a given range.

enum Component

amp
phase

Interface

Public Members
NewSimVisJones(Int typeseed=0, Int seed=0)
NewSimVisJones(uInt nants, uInt nfeeds, uInt nspw, Int typeseed=0, Int seed=0)
NewSimVisJones(const NewSimVisJones& other)
virtual ~NewSimVisJones()
uInt getAntennaCount() const
uInt getFeedCount() const
uInt getSpWinCount() const
virtual void setShape(Int nants, Int nfeeds, Int nspwins)
virtual void setNoise(Int antenna, Int receptor, Component comp, Double width, Int feed=-1, Int spwin=-1, Distribution type=normal)
virtual Distribution getNoiseType(uInt antenna, uInt feed, uInt spw, uInt receptor, Component comp) const
virtual Double getNoiseWidth(uInt antenna, uInt feed, uInt spw, uInt receptor, Component comp) const
void reseed(Int seed)
virtual void store(const String& file, MeasurementSet &ms, Bool append) = 0
Bool applyNoise(SquareMatrix<Float, 2> &gains, uInt antenna, uInt feed, uInt spw) const
virtual VisBuffer& applyGradient(VisBuffer & vb, const Vector<int> &, Int, Int, Int)
virtual void addGradients(const VisBuffer&, Int, const Antenna&, const Vector<Float>&, const Vector<Float>&, const Vector<mjJones2>&, const Vector<mjJones2F>&)
virtual Bool solve(VisEquation &ve)
Protected Members
virtual NewSimVisJones& operator=(const NewSimVisJones& other)
void resizeNoiseConfig(uInt nants, uInt nfeeds, uInt nspw)
static Bool polznSwitch(const VisBuffer& vb)
static void polznMap(CStokesVector& vis)
static void polznUnmap(CStokesVector& vis)

Description

Prerequisite

Etymology

SimVisJones describes random multiplicative gains to be used in the VisEquation.

Synopsis

See VisEquation for definition of the Visibility Measurement Equation. See VisJones for how SimVisJones is to be used.

Motivation

The properties of an additive component must be described for the VisEquation.

To Do

Member Description

enum Distribution

Supported distributions for the random component of the gain variation

enum Component

identifiers for the two components of a gain

NewSimVisJones(Int typeseed=0, Int seed=0)

create and initiallize a Jones matrix with no noise added.

NewSimVisJones(uInt nants, uInt nfeeds, uInt nspw, Int typeseed=0, Int seed=0)

create a Jones matrix for a given number of antennae and feeds.

NewSimVisJones(const NewSimVisJones& other)

Create a copy of another SimVisJones.

virtual ~NewSimVisJones()

delete this SimVisJones

uInt getAntennaCount() const

return the number of antennae this matrix is configured for.

uInt getFeedCount() const

return the number of feeds this matrix is configured for.

uInt getSpWinCount() const

return the number of feeds this matrix is configured for.

virtual void setShape(Int nants, Int nfeeds, Int nspwins)

set the number of antennae, feeds, and spectral windows this Jones is configured to handle. This needs to be called before any real calculations can be done--that is, prior to any call to apply() or applyInv or any of the set...() routines. This usually allows this object to set its internal storage appropriately.

virtual void setNoise(Int antenna, Int receptor, Component comp, Double width, Int feed=-1, Int spwin=-1, Distribution type=normal)

set the parameters for the random component of the gain variation. antenna is the (zero-based) index of the antenna set the noise for or a negative value to set the noise for all antennae. receptor is the (zero-based) index of the receptor to set the noise for or negative to set all receptors simultaneously; since only 2x2 Jones matrices are currently supported, this should be less than 2. comp is either SimVisJones::amp or SimVisJones::phase to indicate which component of the gain noise should be applied to. width is the full characteristic width of the distribution. If the distribution is normal, the width is twice the root-mean-square of the distribution (i.e. 2*sigma). A width of zero is equivalent type=ideal. If comp is phase, the width is taken as a phase in radians; if comp is amp, the width is taken to be a gain magnitude. feed is the (zero-based) index of the feed to set the noise for or negative to set all the feeds simultaneously. spwin is the (zero-based) ID of the spectral window to set the noise for or negative to set all windows simultaneously. type is the type of noise distribution as one of the identifiers given in the Distribution enumeration (ideal, normal, or uniform); use ideal to prevent a random component from being added to the gains.

virtual Distribution getNoiseType(uInt antenna, uInt feed, uInt spw, uInt receptor, Component comp) const

return the type of random distribution associated with a given gain component

virtual Double getNoiseWidth(uInt antenna, uInt feed, uInt spw, uInt receptor, Component comp) const

return the width of the randome distribution associated with a given gain component. Zero is returned if the distribution is ideal.

void reseed(Int seed)

reseed the random number generator used to produce noise. seed1 is the primary seed, and

virtual void store(const String& file, MeasurementSet &ms, Bool append) = 0

internally cache the antenna gains according to the current parameter settings. This makes them accessible to getGains() without having to actually apply them to the MeasurmentSet. If the gain parameters change, the gain cache will be appropriately invalidated. vi is the vis iterator associated with the MeasreumentSent; it will be set to origin and then advanced to the end of the set. virtual void cacheGains(VisSet& vi) = 0;

write out the gains that would be applied to a given Measurement Set. file is the name of the calibration table to write. ms is the MeasurementSet which will be read through to discover the proper times and telescope configurations; it will be resorted, but otherwise it is not modified.

Bool applyNoise(SquareMatrix<Float, 2> &gains, uInt antenna, uInt feed, uInt spw) const

add the noise for a given antenna and feed to the given gains. gains is a 2x2 matrix containing actual gains (presumably for the antenna and feed specified). Each row contains a gain for one polarization; the columns give the amplitude and phase of the gains. antenna is the (zero-based) index of the antenna to apply the noise for. feed is the (zero-based) index of the receptor to apply the noise for.

virtual VisBuffer& applyGradient(VisBuffer & vb, const Vector<int> &, Int, Int, Int)

Apply the Gradients to the visibilities Since this Jones is not solvable, this default implementation does nothing.

virtual void addGradients(const VisBuffer&, Int, const Antenna&, const Vector<Float>&, const Vector<Float>&, const Vector<mjJones2>&, const Vector<mjJones2F>&)

add data to the running sums used to form the gradient. Since this Jones is not solvable, this default implementation does nothing.

virtual Bool solve(VisEquation &ve)

solve for the gains using the calculated gradients Since this Jones is not solvable, this default implementation does always returns False.

virtual NewSimVisJones& operator=(const NewSimVisJones& other)

Assignment. This is made protected because we don't want to be able to set, say, a BJones to a GJones.

void resizeNoiseConfig(uInt nants, uInt nfeeds, uInt nspw)

resize the noise configuration containers. Obviously, this should be called whenever the number of antennae or feeds change.

static Bool polznSwitch(const VisBuffer& vb)

Return true if polarization re-sequencing required

static void polznMap(CStokesVector& vis)

Re-sequence to (XX,XY,YX,YY) or (RR,RL,LR,LL)

static void polznUnmap(CStokesVector& vis)

Re-sequence to (XX,YY,XY,YX) or (RR,LL,RL,LR)


class SimAntGainCache

Interface

Public Members
SimAntGainCache() : cache_p()
SimAntGainCache(Int nants, Int nfeeds, Int spwins) : cache_p(nants, nfeeds, spwins), def_p(Complex(0.0, 0.0))
~SimAntGainCache()
void resize(Int nants, Int nfeeds, Int spwins)
Bool isDefined(Int ant, Int feed, Int spw, Double time)
mjJones2& getGain(Int ant, Int feed, Int spw, Double time)
mjJones2& operator()(Int ant, Int feed, Int spw, Double time)
void invalidate(Int ant, Int feed, Int spw)
void clear()
Private Members
void clearMap(OrderedMap<Double, mjJones2*> &map)

Description

Etymology

This class caches antenna gains for use by the SimVis classes.

Synopsis

This class assumes that

Motivation

AIPS++ containers can be tricky when managing complex types; it helps to manage the memory in a separate type

To Do

Member Description

SimAntGainCache() : cache_p()

SimAntGainCache(Int nants, Int nfeeds, Int spwins) : cache_p(nants, nfeeds, spwins), def_p(Complex(0.0, 0.0))

~SimAntGainCache()

void resize(Int nants, Int nfeeds, Int spwins)

reshape the cache. Any previously stored gains will be cleared

Bool isDefined(Int ant, Int feed, Int spw, Double time)

return True if a gain matrix has been cached for a given time.

mjJones2& getGain(Int ant, Int feed, Int spw, Double time)

return the cached gain matrix for the given time. If no matrix is found for this time, the default matrix is returned. By updating the values in this matrix implicitly sets the gain in the cache.

mjJones2& operator()(Int ant, Int feed, Int spw, Double time)

return the cached gain matrix for the given time. If no matrix is found for this time, the default matrix is returned

void invalidate(Int ant, Int feed, Int spw)

void clear()

clear the entire contents of the cache

void clearMap(OrderedMap<Double, mjJones2*> &map)


class NewSimTimeDepVisJones : public NewSimVisJones

Interface

Public Members
NewSimTimeDepVisJones(Int typeseed=0, Int seed=0)
NewSimTimeDepVisJones(uInt nants, uInt nfeeds, uInt nspw, Double starttime, Int typeseed=0, Int seed=0)
NewSimTimeDepVisJones(const NewSimTimeDepVisJones& other)
NewSimTimeDepVisJones(VisSet& vs, Int typeseed=0, Int seed=0, Double slotintv=0)
virtual ~NewSimTimeDepVisJones()
virtual void setShape(Int nants, Int nfeeds, Int nspwins)
virtual void setRefTime(Double reftime)
void setTimeDep(Int antenna, Int receptor, Component comp, const Function1D<Float>& func, Int feed=-1, Int spw=-1)
void removeTimeDep(Int antenna, Int receptor, Component comp, Int feed=-1, Int spw=-1)
virtual Bool freqDep()
virtual VisBuffer& apply(VisBuffer& vb)
virtual VisBuffer& applyInv(VisBuffer& vb)
virtual void store(const String& file, MeasurementSet &ms, Bool append)
Protected Members
virtual NewSimTimeDepVisJones& operator=(const NewSimTimeDepVisJones& other)
void invalidateCache(uInt ant, uInt feed, uInt spwin)
void clearCache()
void checkIntCacheTime(Double time)
const mjJones2& getAntGain(Int ant, Int feed, Int spw, Double time)
const mjJones4& getIntGain(Int ant1, Int feed1, Int ant2, Int feed2, Int spw, Double time)
const mjJones4& getIntInvGain(Int ant1, Int feed1, Int ant2, Int feed2, Int spw, Double time)
virtual mjJones2& calcAntGain(mjJones2 &jones, uInt ant, uInt feed, uInt spw, Double time) = 0
IPosition& settdi(uInt ant, uInt feed, uInt spw, uInt rec, uInt comp)
Private Members
static uInt numberFeeds(VisSet &vs)
void initFromVisSet(VisSet &vs, Double slotintv)
IPosition& setigi(uInt ant1, uInt ant2, uInt feed1, uInt feed2)
const mjJones2& cacheAntGain(uInt ant, uInt feed, uInt spw, Double time)

Description

Prerequisite

Etymology

SimGJones describes random multiplicative gains to be used in the VisEquation. The Jones matrices are diagonal.

Synopsis

See VisEquation for definition of the Visibility Measurement Equation. See VisJones for how SimVisJones is to be used.

Motivation

The properties of a multiplicative component must be described for the VisEquation.

To Do

Member Description

NewSimTimeDepVisJones(Int typeseed=0, Int seed=0)

create and initiallize a Jones matrix with no noise added.

NewSimTimeDepVisJones(uInt nants, uInt nfeeds, uInt nspw, Double starttime, Int typeseed=0, Int seed=0)

create a Jones matrix for a given number of antennae, feeds, and spectral windows. The reftime should be in seconds in the frame used by the VisBuffer; this time is used as "time0", the starting time, when applying functions set via setTimeDep().

NewSimTimeDepVisJones(const NewSimTimeDepVisJones& other)

Create a copy of another SimVisJones.

NewSimTimeDepVisJones(VisSet& vs, Int typeseed=0, Int seed=0, Double slotintv=0)

Construct a Jones matrix ready to apply unity gains to a given VisibilitySet. That is, the gain amplitude will be 1, and the phase shift, 0. Clients should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. vs is the VisSet to initialize to. seed is used to seed the random number generator used to create noise (if noise is added later). slotintv is an interval of time (in seconds) over which the gain is considered constant. If <= 0, no such interval is assumed, and gains are integrated over the integration time. slotintv is a somewhat artificial constraint but might be helpful in calibration testing as it mirrors the practice of binning time into slots.

virtual ~NewSimTimeDepVisJones()

delete this SimVisJones

virtual void setShape(Int nants, Int nfeeds, Int nspwins)

set the number of antennae, feeds, and spectral windows this Jones is configured to handle. This needs to be called before any real calculations can be done--that is, prior to any call to apply() or applyInv or any of the set...() routines. This usually allows this object to set its internal storage appropriately.

virtual void setRefTime(Double reftime)

reset the reference time. reftime should be in seconds in the frame used by the VisBuffer; this time is used as "t=0", the starting time, when applying functions set via setTimeDep().

void setTimeDep(Int antenna, Int receptor, Component comp, const Function1D<Float>& func, Int feed=-1, Int spw=-1)

set the function that will control the systematic variation of the gains as a function of Time. This overrides any constant gain set during construction. antenna is the (zero-based) index of the antenna to update or a negative value to update all antennae. receptor is the (zero-based) index of the receptor to update or negative to update all receptors simultaneously; since only 2x2 Jones matrices are currently supported, this should be less than 2. comp is either SimGJones::amp or SimGJones::phase (defined in parent class, SimVisJones) to indicate which component of the gain should be made to vary. func is the function that should be used to calculate the gain as a function of time. feed is the (zero-based) index of the feed to update or negative to update all the feeds simultaneously.

void removeTimeDep(Int antenna, Int receptor, Component comp, Int feed=-1, Int spw=-1)

remove the systematic time dependence of a component of the gain. antenna is the (zero-based) index of the antenna to update or a negative value to update all antennae. receptor is the (zero-based) index of the receptor to update or negative to update all receptors simultaneously; since only 2x2 Jones matrices are currently supported, this should be less than 2. comp is either SimGJones::amp or SimGJones::phase (defined in parent class, SimVisJones) to indicate which component of the varying gain should be removed. feed is the (zero-based) index of the feed to update or negative to update all the feeds simultaneously.

virtual Bool freqDep()

Returns true if a delay error (a frequency-dependent effect) has been set

virtual VisBuffer& apply(VisBuffer& vb)

Apply this Jones to some visibility data. vb is the buffer containing the data; that same buffer is returned.

virtual VisBuffer& applyInv(VisBuffer& vb)

Apply the inverse of this Jones to some visibility data. vb is the buffer containing the data; that same buffer is returned.

virtual void store(const String& file, MeasurementSet &ms, Bool append)

write out the gains that would be applied to a given Measurement Set. file is the name of the calibration table to write. ms is the MeasurementSet which will be read through to discover the proper times and telescope configurations; it will be resorted, but otherwise, it is not modified.

virtual NewSimTimeDepVisJones& operator=(const NewSimTimeDepVisJones& other)

Assignment. This is made protected because we don't want to be able to set, say, a BJones to a GJones.

void invalidateCache(uInt ant, uInt feed, uInt spwin)

void clearCache()

void checkIntCacheTime(Double time)

const mjJones2& getAntGain(Int ant, Int feed, Int spw, Double time)

return a gain for a given antenna, feed, and spectral window

const mjJones4& getIntGain(Int ant1, Int feed1, Int ant2, Int feed2, Int spw, Double time)

return a gain for a given interferometer. This calls cacheAntGain().

const mjJones4& getIntInvGain(Int ant1, Int feed1, Int ant2, Int feed2, Int spw, Double time)

return the inverse of the gain for a given interferometer. This calls cacheAntGain().

virtual mjJones2& calcAntGain(mjJones2 &jones, uInt ant, uInt feed, uInt spw, Double time) = 0

calculate and cache Gains for a given antenna at a given time

IPosition& settdi(uInt ant, uInt feed, uInt spw, uInt rec, uInt comp)

return an IPosition to use as an Array index for retreiving the time dependence function.

static uInt numberFeeds(VisSet &vs)

void initFromVisSet(VisSet &vs, Double slotintv)

IPosition& setigi(uInt ant1, uInt ant2, uInt feed1, uInt feed2)

const mjJones2& cacheAntGain(uInt ant, uInt feed, uInt spw, Double time)


class NewSimGJones : public NewSimTimeDepVisJones

Interface

Public Members
NewSimGJones(Int seed=0)
NewSimGJones(uInt nants, uInt nfeeds, uInt spw, Double reftime, Int seed=0)
NewSimGJones(VisSet& vs, Int seed=0, Double slotintv=0)
NewSimGJones(VisSet& vs, Double amp0, Double phase0, Double amp1, Double phase1, Int seed=0, Double slotintv=0)
NewSimGJones(const NewSimGJones &other)
virtual NewSimGJones& operator=(const NewSimGJones &other)
virtual ~NewSimGJones()
virtual Type type()
Protected Members
virtual mjJones2& calcAntGain(mjJones2 &jones, uInt ant, uInt feed, uInt spw, Double time)
Private Members
void setdefgains(Double amp0, Double phase0, Double amp1, Double phase1)

Description

Prerequisite

Etymology

SimGJones describes random multiplicative gains to be used in the VisEquation. The Jones matrices are diagonal.

Synopsis

See VisEquation for definition of the Visibility Measurement Equation. See VisJones for how SimVisJones is to be used.

Motivation

The properties of a multiplicative component must be described for the VisEquation.

To Do

Member Description

NewSimGJones(Int seed=0)

NewSimGJones(uInt nants, uInt nfeeds, uInt spw, Double reftime, Int seed=0)

Construct a Jones matrix that applies unity gain. That is, gain amplitude is 1, and the phase shift is 0. Clients should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. nants is the number of antennae to support, nfeeds is the number of feeds per antenna, and spw is the number of spectral windows. seed is an optional seed for the noise generator.

NewSimGJones(VisSet& vs, Int seed=0, Double slotintv=0)

Construct a Jones matrix ready to apply unity gains to a given VisibilitySet. That is, the gain amplitude will be 1, and the phase shift, 0. Clients should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. vs is the VisSet to initialize to. seed is used to seed the random number generator used to create noise (if noise is added later). slotintv is an interval of time (in seconds) over which the gain is considered constant. If <= 0, no such interval is assumed, and gains are integrated over the integration time. slotintv is a somewhat artificial constraint but might be helpful in calibration testing as it mirrors the practice of binning time into slots.

NewSimGJones(VisSet& vs, Double amp0, Double phase0, Double amp1, Double phase1, Int seed=0, Double slotintv=0)

Construct a Jones matrix ready to apply a constant gain to a given VisibilitySet. The gains set with this constructor will apply to all antennae and feeds. Applications should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. vs is the VisSet to initialize to. The gain amplitude for the first receptor is given by amp0, and its corresponding phase shift is given by phase0. amp1 and phase1 similarly set the gain for the second receptor. seed is used to seed the random number generator used to create noise (if noise is added later). slotintv is an interval of time (in seconds) over which the gain is considered constant. If <= 0, no such interval is assumed, and gains are integrated over the integration time. slotintv is a somewhat artificial constraint but might be helpful in calibration testing as it mirrors the practice of binning time into slots.

NewSimGJones(const NewSimGJones &other)

virtual NewSimGJones& operator=(const NewSimGJones &other)

virtual ~NewSimGJones()

delete this Jones matrix

virtual Type type()

return G as the type of this Jones matrix.

virtual mjJones2& calcAntGain(mjJones2 &jones, uInt ant, uInt feed, uInt spw, Double time)

calculate and cache Gains for a given antenna at a given time

void setdefgains(Double amp0, Double phase0, Double amp1, Double phase1)


class NewSimDJones : public NewSimTimeDepVisJones

Interface

Public Members
NewSimDJones(Int seed=0)
NewSimDJones(uInt nants, uInt nfeeds, uInt spw, Double reftime, Int seed=0)
NewSimDJones(VisSet& vs, Int seed=0, Double slotintv=0)
NewSimDJones(VisSet& vs, Double amp0, Double phase0, Double amp1, Double phase1, Int seed=0, Double slotintv=0)
NewSimDJones(const NewSimDJones &other)
virtual NewSimDJones& operator=(const NewSimDJones &other)
virtual ~NewSimDJones()
virtual Type type()
Protected Members
virtual mjJones2& calcAntGain(mjJones2 &jones, uInt ant, uInt feed, uInt spw, Double time)
Private Members
void setdefgains(Double amp0, Double phase0, Double amp1, Double phase1)

Description

Prerequisite

Etymology

SimGJones describes random multiplicative gains to be used in the VisEquation. The Jones matrices are diagonal.

Synopsis

See VisEquation for definition of the Visibility Measurement Equation. See VisJones for how SimVisJones is to be used.

Motivation

The properties of a multiplicative component must be described for the VisEquation.

To Do

Member Description

NewSimDJones(Int seed=0)

NewSimDJones(uInt nants, uInt nfeeds, uInt spw, Double reftime, Int seed=0)

Construct a Jones matrix that applies unity gain. That is, gain amplitude is 1, and the phase shift is 0. Clients should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. nants is the number of antennae to support, nfeeds is the number of feeds per antenna, and spw is the number of spectral windows. seed is an optional seed for the noise generator.

NewSimDJones(VisSet& vs, Int seed=0, Double slotintv=0)

Construct a Jones matrix ready to apply unity gains to a given VisibilitySet. That is, the gain amplitude will be 1, and the phase shift, 0. Clients should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. vs is the VisSet to initialize to. seed is used to seed the random number generator used to create noise (if noise is added later). slotintv is an interval of time (in seconds) over which the gain is considered constant. If <= 0, no such interval is assumed, and gains are integrated over the integration time. slotintv is a somewhat artificial constraint but might be helpful in calibration testing as it mirrors the practice of binning time into slots.

NewSimDJones(VisSet& vs, Double amp0, Double phase0, Double amp1, Double phase1, Int seed=0, Double slotintv=0)

Construct a Jones matrix ready to apply a constant gain to a given VisibilitySet. The gains set with this constructor will apply to all antennae and feeds. Applications should use setTimeDep(), setNoise(), and setDelayError() to vary the gain. vs is the VisSet to initialize to. The gain amplitude for the first receptor is given by amp0, and its corresponding phase shift is given by phase0. amp1 and phase1 similarly set the gain for the second receptor. seed is used to seed the random number generator used to create noise (if noise is added later). slotintv is an interval of time (in seconds) over which the gain is considered constant. If <= 0, no such interval is assumed, and gains are integrated over the integration time. slotintv is a somewhat artificial constraint but might be helpful in calibration testing as it mirrors the practice of binning time into slots.

NewSimDJones(const NewSimDJones &other)

virtual NewSimDJones& operator=(const NewSimDJones &other)

virtual ~NewSimDJones()

delete this Jones matrix

virtual Type type()

return G as the type of this Jones matrix.

virtual mjJones2& calcAntGain(mjJones2 &jones, uInt ant, uInt feed, uInt spw, Double time)

calculate and cache Gains for a given antenna at a given time

void setdefgains(Double amp0, Double phase0, Double amp1, Double phase1)