VisibilityIterator.h
Classes
- ROVisibilityIterator -- ROVisibilityIterator iterates through one or more readonly MeasurementSets (full description)
- VisibilityIterator -- VisibilityIterator iterates through one or more writable MeasurementSets (full description)
Types
- Circular = 0
-
Circular polarization
- Linear = 1
-
Linear polarization
- Observed = 0
-
Observed data
- Model
-
Model data
- Corrected
-
Corrected data
Interface
- Public Members
- ROVisibilityIterator()
- ROVisibilityIterator(const MeasurementSet& ms, const Block<Int>& sortColumns, Double timeInterval=0)
- ROVisibilityIterator(const Block<MeasurementSet>& mss, const Block<Int>& sortColumns, Double timeInterval=0)
- ROVisibilityIterator(const ROVisibilityIterator & other)
- ROVisibilityIterator & operator=(const ROVisibilityIterator &other)
- virtual ~ROVisibilityIterator()
- void origin()
- void originChunks()
- void setInterval(Double timeInterval)
- void setRowBlocking(Int nRows=0)
- Bool more() const
- ROVisibilityIterator & operator++(int)
- ROVisibilityIterator & operator++()
- Bool moreChunks() const
- Bool newMS() const
- Int msId() const
- ROVisibilityIterator& nextChunk()
- Vector<Int>& antenna1(Vector<Int>& ant1) const
- Vector<Int>& antenna2(Vector<Int>& ant2) const
- Vector<Int>& feed1(Vector<Int>& fd1) const
- Vector<Int>& feed2(Vector<Int>& fd2) const
- Vector<Int>& channel(Vector<Int>& chan) const
- Vector<SquareMatrix<Complex,2> >& CJones(Vector<SquareMatrix<Complex,2> >& cjones) const
- const Cube<Double>& receptorAngles() const
- const Vector<String>& antennaMounts() const
- const Cube<RigidVector<Double, 2> >& getBeamOffsets() const
- Bool allBeamOffsetsZero() const
- const Vector<Float>& feed_pa(Double time) const
- const Vector<MDirection>& azel(Double time) const
- Int fieldId() const
- Int arrayId() const
- String fieldName() const
- String sourceName() const
- Cube<Bool>& flag(Cube<Bool>& flags) const
- Matrix<Bool>& flag(Matrix<Bool>& flags) const
- Vector<Bool>& flagRow(Vector<Bool>& rowflags) const
- Vector<Int>& scan(Vector<Int>& scans) const
- Vector<Double>& frequency(Vector<Double>& freq) const
- Vector<Double>& lsrFrequency(Vector<Double>& freq) const
- const MDirection& phaseCenter() const
- Int polFrame() const
- Vector<Int>& corrType(Vector<Int>& corrTypes) const
- Vector<Float>& sigma(Vector<Float>& sig) const
- Int spectralWindow() const
- Int polarizationId() const
- Vector<Double>& time(Vector<Double>& t) const
- Vector<Double>& timeInterval(Vector<Double>& t) const
- Cube<Complex>& visibility(Cube<Complex>& vis, DataColumn whichOne) const
- Matrix<CStokesVector>& visibility(Matrix<CStokesVector>& vis, DataColumn whichOne) const
- IPosition visibilityShape() const
- Vector<RigidVector<Double,3> >& uvw(Vector<RigidVector<Double,3> >& uvwvec) const
- Vector<Float>& weight(Vector<Float>& wt) const
- Matrix<Float>& imagingWeight(Matrix<Float>& wt) const
- Bool newFieldId() const
- Bool newArrayId() const
- Bool newSpectralWindow() const
- Int channelIndex() const
- Int channelGroupSize() const
- Int nRow() const
- Int nRowChunk() const
- Int nSubInterval() const
- ROVisibilityIterator& selectVelocity(Int nChan, const MVRadialVelocity& vStart, const MVRadialVelocity& vInc, MRadialVelocity::Types rvType = MRadialVelocity::LSR, MDoppler::Types dType = MDoppler::RADIO, Bool precise=False)
- ROVisibilityIterator& velInterpolation(const String& type)
- ROVisibilityIterator& selectChannel(Int nGroup=1, Int start=0, Int width=0, Int increment=0, Int spectralWindow=-1)
- ROVisibilityIterator& selectChannel(Block< Vector<Int> >& blockNGroup, Block< Vector<Int> >& blockStart, Block< Vector<Int> >& blockWidth, Block< Vector<Int> >& blockIncr, Block< Vector<Int> >& blockSpw)
- void attachVisBuffer(VisBuffer& vb)
- void detachVisBuffer(VisBuffer& vb)
- const ROMSColumns& msColumns() const
- void allSelectedSpectralWindows(Vector<Int>& spws, Vector<Int>& nvischan)
- void lsrFrequency(const Int& spw, Vector<Double>& freq, Bool& convert)
- Protected Members
- void advance()
- void setSelTable()
- void setState()
- void getTopoFreqs()
- void updateSlicer()
- virtual void attachColumns()
- void getInterpolatedVisFlagWeight(DataColumn whichOne) const
- void getDataColumn(DataColumn whichOne, const Slicer& slicer, Cube<Complex>& data) const
- void getDataColumn(DataColumn whichOne, Cube<Complex>& data) const
- void doChannelSelection()
Review Status
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
Etymology
The ROVisibilityIterator is a readonly iterator returning visibilities
Synopsis
ROVisibilityIterator provides iteration with various sort orders
for one or more MSs. It has member functions to retrieve the fields
commonly needed in synthesis calibration and imaging.
One should use VisBuffer
to access chunks of data.
Example
//
Motivation
For imaging and calibration you need to access an MS in some consistent
order (by field, spectralwindow, time interval etc.). This class provides
that access.
Thrown Exceptions
To Do
- cleanup the currently dual interface for visibilities and flags
- sort out what to do with weights when interpolating
Member Description
Default constructor - useful only to assign another iterator later
Construct from MS and a Block of MS column enums specifying the
iteration order, if none are specified, time iteration is implicit.
An optional timeInterval can be given to iterate through chunks of time.
The default interval of 0 groups all times together.
Every 'chunk' of data contains all data within a certain time interval
and with identical values of the other iteration columns (e.g.
SPECTRAL_WINDOW_ID and FIELD_ID).
Using selectChannel(), a number of groups of channels can be requested.
At present the channel group iteration will always occur before the
interval iteration.
Same as previous constructor, but with multiple MSs to iterate over.
Copy construct. This calls the assigment operator.
ROVisibilityIterator & operator=(const ROVisibilityIterator &other)
Assigment. Any attached VisBuffers are lost in the assign.
Destructor
Members
Reset iterator to origin/start of data (of current chunk)
Reset iterator to true start of data (first chunk)
void setInterval(Double timeInterval)
Set or reset the time interval to use for iteration.
You should call originChunks() to reset the iteration after
calling this.
Set the 'blocking' size for returning data.
With the default (0) only a single integration is returned at a time, this
is what is currently required for the calibration software. With blocking
set, up to nRows can be returned in one go. The chunk
size determines the actual maximum.
Bool more() const
Return False if no more data (in current chunk)
ROVisibilityIterator & operator++(int)
Advance iterator through data
ROVisibilityIterator & operator++()
Return False if no more 'Chunks' of data left
Bool newMS() const
Check if ms has change since last iteration
Int msId() const
ROVisibilityIterator& nextChunk()
Advance to the next Chunk of data
Return antenna1
Return antenna2
Return feed1
Return feed2
Return channel numbers in selected VisSet spectrum
(i.e. disregarding possible selection on the iterator, but
including the selection set when creating the VisSet)
Return feed configuration matrix for specified antenna
Return receptor angles for all antennae and feeds
First axis of the cube is a receptor number,
2nd is antennaId, 3rd is feedId
Note: the method is intended to provide an access to MSIter::receptorAngles
for VisBuffer in the multi-feed case. It may be worth to change the
interface of feed_pa to return the information for all feeds.
return a string mount identifier for each antenna
Return a cube containing pairs of coordinate offsets for each
receptor of each feed (values are in radians, coordinate system is fixed
with antenna and is the same one as used to define the BEAM_OFFSET
parameter in the feed table). The cube axes are receptor, antenna, feed.
True if all elements of the cube returned by getBeamOffsets are zero
const Vector<Float>& feed_pa(Double time) const
Return feed parallactic angles Vector(nant) (1 feed/ant)
Return the antenna AZ/EL Vector(nant)
Return the current FieldId
Return the current ArrayId
Return the current Field Name
Return the current Source Name
Cube<Bool>& flag(Cube<Bool>& flags) const
Return flag for each polarization, channel and row
Return flag for each channel & row
Return row flag
Return scan number
Return current frequencies
Return frequencies in selected velocity frame,
returns the same as frequency() if there is no vel selection active.
Return the current phase center as an MDirection
Return frame for polarization (returns PolFrame enum)
Return the correlation type (returns Stokes enums)
Return sigma
Return current SpectralWindow
Return current Polarization Id
Return MJD
Return MJD time interval
Cube<Complex>& visibility(Cube<Complex>& vis, DataColumn whichOne) const
Return the visibilities as found in the MS, Cube(npol,nchan,nrow).
Return the visibility 4-vector of polarizations for each channel.
If the MS doesn't contain all polarizations, it is assumed it
contains one or two parallel hand polarizations.
Return the shape of the visibility Cube
Vector<RigidVector<Double,3> >& uvw(Vector<RigidVector<Double,3> >& uvwvec) const
Return u,v and w (in meters)
Return weight
Return imaging weight (a weight for each channel)
Return True if FieldId/Source has changed since last iteration
Return True if arrayID has changed since last iteration
Return True if SpectralWindow has changed since last iteration
Return the index of the first channel of the current channel group
in the total (selected) spectrum.
Return the width of the current group of channels, i.e.,
the number of channels returned by visibility() and frequency().
Int nRow() const
Return the number of rows in the current iteration
Return the numbers of rows in the current chunk
Return the number of sub-intervals in the current chunk
Velocity selection - specify the output channels in velocity:
nChan - number of output channels, vStart - start velocity,
vInc - velocity increment. So channel i will have velocity
vStart + i*vInc (i=0,nChan-1).
Specify velocities as in e.g., MVRadialVelocity(Quantity(2001.,"km/s")).
The reference type and velocity definition are specified separately.
Note that no averaging is performed, the visibilities will be interpolated
and sampled at the specified velocities, it's up to you to choose a vInc
appropriate to the channel width.
The REST_FREQUENCY column in the SPECTRAL_WINDOW subtable is used to
determine the velocity-frequency conversion.
By default calculations are done for a single velocity with offsets
applied for the others (ok for non-rel velocities with RADIO defn),
set precise to True to do a full conversion for each output channel.(NYI)
Select the velocity interpolation scheme.
At present the choice is limited to : nearest and linear, linear
is the default.
TODO: add cubic, spline and possibly FFT
ROVisibilityIterator& selectChannel(Int nGroup=1, Int start=0, Int width=0, Int increment=0, Int spectralWindow=-1)
Channel selection - only the selected channels will be returned by the
access functions. The default spectralWindow is the current one (or 0)
This allows selection of the input channels, producing
nGroup groups of width output channels. Default is to return all channels
in a single group.
Same as above except when multiple ms's are to be accessed
Attach a VisBuffer object.
Note that while more than one VisBuffer may be attached, only the
last one is actively updated. A Stack is kept internally, so after
a detach, the previous VisBuffer becomes active again.
Detach a VisBuffer object.
If the object detached is not the last one attached an exception
is thrown.
Access the current ROMSColumns object in MSIter
get back the selected spectral windows and spectral channels for
current ms
void lsrFrequency(const Int& spw, Vector<Double>& freq, Bool& convert)
Convert the frequency from the observe frame to lsr frame.
Returns True in convert if given spw was not observed
in the LSRK frame
advance the iteration
set the currently selected table
set the iteration state
get the TOPO frequencies from the selected velocities and the obs. vel.
update the DATA slicer
attach the column objects to the currently selected table
get the (velocity selected) interpolated visibilities, flags and weights
get the visibility data (observed, corrected or model);
deals with Float and Complex observed data (DATA or FLOAT_DATA)
Re-Do the channel selection in multi ms case
Interface
Public Members
- VisibilityIterator()
- VisibilityIterator(MeasurementSet & ms, const Block<Int>& sortColumns, Double timeInterval=0)
- VisibilityIterator(Block<MeasurementSet>& mss, const Block<Int>& sortColumns, Double timeInterval=0)
- VisibilityIterator(const VisibilityIterator & MSI)
- VisibilityIterator & operator=(const VisibilityIterator &MSI)
- virtual ~VisibilityIterator()
- VisibilityIterator & operator++(int)
- VisibilityIterator & operator++()
- void setFlag(const Matrix<Bool>& flag)
- void setFlag(const Cube<Bool>& flag)
- void setFlagRow(const Vector<Bool>& rowflags)
- void setVis(const Matrix<CStokesVector>& vis, DataColumn whichOne)
- void setVis(const Cube<Complex>& vis, DataColumn whichOne)
- void setVisAndFlag(const Cube<Complex>& vis, const Cube<Bool>& flag, DataColumn whichOne)
- void setWeight(const Vector<Float>& wt)
- void setSigma(const Vector<Float>& sig)
- void setImagingWeight(const Matrix<Float>& wt)
Protected Members
- virtual void attachColumns()
- void setInterpolatedVisFlag(const Cube<Complex>& vis, const Cube<Bool>& flag)
- void setInterpolatedWeight(const Matrix<Float>& wt)
- void putDataColumn(DataColumn whichOne, const Slicer& slicer, const Cube<Complex>& data)
- void putDataColumn(DataColumn whichOne, const Cube<Complex>& data)
Review Status
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
Etymology
The VisibilityIterator is a read/write iterator returning visibilities
Synopsis
VisibilityIterator provides iteration with various sort orders
for one or more MSs. It has member functions to retrieve the fields
commonly needed in synthesis calibration and imaging. It is
derived from the read-only iterator
ROVisibilityIterator.
One should use VisBuffer
to access chunks of data.
Example
//
Motivation
For imaging and calibration you need to access an MS in some consistent
order (by field, spectralwindow, time interval etc.). This class provides
that access.
#
Thrown Exceptions
To Do
- cleanup the currently dual interface for visibilities and flags
- sort out what to do with weights when interpolating
Member Description
Constructors.
Note: The VisibilityIterator is not initialized correctly by default, you
need to call origin() before using it to iterate.
Same as previous constructor, but with multiple MSs to iterate over.
VisibilityIterator & operator=(const VisibilityIterator &MSI)
Destructor
VisibilityIterator & operator++(int)
Members
Advance iterator through data
VisibilityIterator & operator++()
Set/modify the flags in the data.
This will flag all channels in the original data that contributed to
the output channel in the case of channel averaging.
All polarizations have the same flag value.
void setFlag(const Cube<Bool>& flag)
Set/modify the flags in the data.
This sets the flags as found in the MS, Cube(npol,nchan,nrow),
where nrow is the number of rows in the current iteration (given by
nRow()).
Set/modify the flag row column; dimension Vector(nrow)
Set/modify the visibilities.
This is possibly only for a 'reference' MS which has a new DATA column.
The first axis of the matrix should equal the selected number of channels
in the original MS.
If the MS does not contain all polarizations, only the parallel
hand polarizations are used.
void setVis(const Cube<Complex>& vis, DataColumn whichOne)
Set/modify the visibilities
This sets the data as found in the MS, Cube(npol,nchan,nrow).
void setVisAndFlag(const Cube<Complex>& vis, const Cube<Bool>& flag, DataColumn whichOne)
Set the visibility and flags, and interpolate from velocities if needed
Set/modify the weights
Set/modify the Sigma
Set/modify the imaging weights
Write the data column (observed, model or corrected);
deals with Float or Complex observed data (DATA and FLOAT_DATA).