MirFiller Class Reference

BIMA MIRIAD dataset to MeasurementSet2 filler. More...

#include <MirFiller.h>

Inheritance diagram for MirFiller:
MirVarHandler

List of all members.

Public Member Functions

 MirFiller (const String &mirfile, Bool scan=True, Int dbg=0)
 create the filler, attaching it to a Miriad dataset.
virtual ~MirFiller ()
 destruct this filler
void setDebugLevel (Int level)
 set the debugging level which controls the amount of debugging messages that are printed to the terminal (as opposed to the logger).
Int getDebugLevel () const
 set the debugging level which controls the amount of debugging messages that are printed to the terminal.
Bool Debug (Int level)
 return true if the debugging level is at least as high as a given level.
Bool verbose ()
 return true if this filler should be verbose in its messages.
void fill (const String &msfile)
 return basic characteristics of the input dataset as a GlishRecord.
void selectSpectra (const Vector< Int > &wideChans, const Vector< Int > &narrowWins)
 select spectral data from the input Miriad dataset.
void selectPols (ConstMirPolSetup &polsel)
 throw(UnavailableMiriadDataSelectionError);
void setOptions (const Record &opts)
 set the options for filling.
Record getOptions ()
 get the current filling options
virtual void updateIntTime (FillMetadata &fm, Double time)
 handle an update to the integration time; this is a callback routine that is part of the MirVarHandler interface which must be implemented.
virtual void updateObservatory (FillMetadata &fm, Double time)
 handle an update to the observatory; this is a callback routine that is part of the MirVarHandler interface which must be implemented.
virtual void updateArray (FillMetadata &fm, Double time)
 handle an update to the array configuration; this is a callback routine that is part of the MirVarHandler interface which must be implemented
virtual void updateSourceModel (FillMetadata &fm, Double time)
 handle an update to the SOURCE_MODEL column of the SOURCE subtable.
virtual void updatePolSetup (FillMetadata &fm, Double time)
 handle an update to the array configuration; this is a callback routine that is part of the MirVarHandler interface which must be implemented
virtual void updateSource (FillMetadata &fm, Double time)
 handle an update to the source; this is a callback routine that is part of the MirVarHandler interface which must be implemented
virtual void updateField (FillMetadata &fm, Double time)
 handle an update to the observing field; this is a callback routine that is part of the MirVarHandler interface which must be implemented
virtual void updateFreqSetup (FillMetadata &fm, Double time)
 handle an update to the frequency setup; this is a callback routine that is part of the MirVarHandler interface which must be implemented
virtual void updateTsys (FillMetadata &fm, Double time)
 handle an update to system temperatures this is a callback routine that is part of the MirVarHandler interface which must be implemented

Private Types

enum  wideConventions {
  NONE,
  BIMA,
  MIRIAD,
  NCONV
}

Private Member Functions

MeasurementSet * setupMS (const String &msfile, Int tileSize=0, Bool needSrcModel=True)
 open and setup the output MS.
void initMS (::FillMetadata &fm)
 initialize the output MS.
void noJoinFill (const String &msfile)
void joinFill (const String &msfile)
Bool nearAbs (Double a, Double b, Double tol)
void flushObsRecord (FillMetadata &fm, Double time)
 add the current observation information as a new record to the output ms's OBSERVATION subtable
void flushFeedRecords (FillMetadata &fm, Double time)
 add the records to the FEED subtable for the current set of antennas and polarizations
void flushMovingFields (FillMetadata &fm, Double time)
 check for moving objects in source list and adjust FIELD subtable accordingly
void flushPointingRecords (FillMetadata &fm, Double time)
 add the records to the POINTING subtable for the current set of antennas
void addAntennaPositions (FillMetadata &fm, Double time)
 add a new set of antenna positions
uInt addSource (FillMetadata &fm, double time)
 add the current source to the SOURCE subtable
void addField (FillMetadata &fm, double time)
 add the current field to the FIELD subtable
void addCorrelatorSetup (FillMetadata &fm, double time)
 add subtable records for the current correlator setup
void addPolarization (FillMetadata &fm, Bool addCurrentOnly=False)
 add a POLARIZATION record for the current polarization type.
void addDataDesc (FillMetadata &fm)
 add DATA_DESCRIPTION records for the current polarization and frequency setup
void flushHistory (FillMetadata &fm)
 write out the miriad history into the HISTORY table
void copyHistoryFrom (FillMetadata &fm, String tablename)
 copy the history from a given HISTORY table
void addProcessor (FillMetadata &fm)
 add a processor record for the current frequency setup
void addHistoryMessage (FillMetadata &fm, String priority, String origin, String msg)
 add a filler message to the HISTORY table
void addTsysRecords (FillMetadata &fm, Double time, Cube< Float > &tsys)
 add a record to the SysCal table
void initState (FillMetadata &fm)
 initialize the STATE table
Bool fitskymotion (Matrix< Double > &dirfit, const Vector< Double > &time, const Vector< Double > &ra, const Vector< Double > &dec)
 create a polynomial fit for the direction to a moving source PJT

Private Attributes

uInt debug
MirVisReader rdr_p
 info that doesn't change during life of filler
LogIO log_p
Vector< Bool > widesel_p
 selection info
Vector< Bool > winsel_p
Int nwinsel_p
Int nwidesel_p
ConstMirPolSetupdefpolsel_p
String histbl_p
 options
Double scanlim_p
Double obslim_p
Int tilesize_p
Int planetfit_p
Bool verbose_p
Bool joinpol_p
Bool tsyswt_p
Bool movfield_p
Bool compress_p
wideConventions wideconv_p
Double updmodelint_p

Static Private Attributes

static String wideconvnames []

Detailed Description

BIMA MIRIAD dataset to MeasurementSet2 filler.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

MirFiller is the successor to the BimaFiller (class and application). It attempts to be more general in its filling of Miriad data while still retaining special functionality for BIMA data specifically.

Synopsis

MirFiller converts an input Miriad dataset into an output MeasurementSet (ver. 2). It is attached to its Miriad dataset at construction; it can subsequently be used to fill several output MSes, perhaps with different data from the input dataset, in sequence (i.e. it is not thread-safe).

Default use of this class would be to construct an instance attached to a Miriad dataset, and then call its fill() method, passing it the output measurement set name. This will load all data found in the input dataset into the measurement set. Restricting the filling to specific spectral windows can be controled via the select() function.

Miriad Dataset Spectral Layout and its Mapping to the Measurement Set

Each record in a Miriad dataset organizes its correlation data by spectral windows and so-called wideband channels. Each Miriad spectral window contains data from a band of frequencies, broken up into some number of channels. (Because each channel, then, is fairly narrow in bandwidth, these correlations are often referred to as "narrow-band" data.) The wideband channels, in general, contain single correlations, averaged over some band at potentially arbitrary frequencies; that is, they are bolometer-like measurements.

With BIMA Miriad datasets, the wideband channels are used to store wide-band averages of the spectral windows. More specifically, the first wideband channel contains the average of all spectral windows channels associated with the lower sideband (the first Nwin/2 windows), and the second wideband channel contains the average of the upper sideband windows. The remaining wideband channels contain the averages of each of the spectral windows (in the same order). Thus, if the BIMA Miriad dataset contains Nwin spectral windows, there will be Nwin+2 wideband channels. The first Nwin/2 windows will be from the lower sideband, and the rest, from the upper sideband.

When the Miriad data is converted to an MS, each spectral window and each wideband channel is loaded into a separate MS spectral window. Thus, for a BIMA dataset with Nwin windows, the output MS (by default) will contain Nwin*2+2 spectral windows. The select() function can be used to restrict the windows that get written.

Polarization

Miriad datasets stores correlations for different polarizations in separate records, even if they were observed simultaneously. (Thus, it is up to the Miriad I/O software to properly combine records to form new Stokes correlations.) This is in contrast to AIPS++ which can store polarizations observed at the same time in the same record. Furthermore, BIMA can only observe one polarization at a time. Thus, how polarizations should be loaded from a Miriad dataset into an AIPS++ Measurment Set depends in part on whether the polarizations were (effectively) observed simultaneously. It might also depend on whether polarization calibration is needed and how it should be done.

The standard recipe for handling raw BIMA polarization data calls for the sampling of the polarizations to be loaded into separate records. This makes time-based editing easier. Once the polarization gains are applied, one usually time-averages the data over several polarization switching cycles; in effect, then, one can consider the polarizations as having been observed simultaneously. Thus, in this time-averaging step, one collapses the different polarizations into single records for standard handling by the imaging tools. (Note: the software to support this operation is still in development as of this writing.)

The "joinpol" option (set with setOptions()) allows one to control whether an attempt is made to load polarizations into the same record. If joinpol is false, all polarizations are loaded into different records; each record will point to a different polarization setup in the POLARIZATION table (with each setup containing only one correlation type). If joinpol is true, then fill() will look for polarizations with the same time stamp and load them into the same record; the POLARIZATION table will then only have one setup containing all correlations. Any polarizations that are not found are set to zero. Thus, for a raw BIMA data containing multiple polarizations, joinpol equal to true will produce a much large dataset than joinpol equal to false because of all the extra zero visibilities that get loaded in.

Example

 // open Miriad dataset 3c273 for filling
 MirFiller filler('3c273');
 
 // if needed, set some options
 Record opts = filler.getOptions();
 RecordFieldPtr<Double>(opts, "scanlim").define(600);
 RecordFieldPtr<Bool>(opts, "verbose").define(True);
 filler.setOptions(opts);
 
 // if desired, chose the windows to write
 Vector<Int> wide(0)    // do not write out any wideband channels
 Vector<Int> splwin(filler.nspect());
 for(Int i=0; i < splwin.nelements(); i++) splwin(i) = i;
 filler.select(wide, splwin);
 
 // fill the output MS
 filler.fill('3c273.ms');

Motivation

The important features of this class are:

Thrown Exceptions

To Do

Definition at line 225 of file MirFiller.h.


Member Enumeration Documentation

Enumerator:
NONE 
BIMA 
MIRIAD 
NCONV 

Definition at line 503 of file MirFiller.h.


Constructor & Destructor Documentation

MirFiller::MirFiller ( const String &  mirfile,
Bool  scan = True,
Int  dbg = 0 
)

create the filler, attaching it to a Miriad dataset.

mirfile is the dataset filename, and dbg is the debug level (see <tt>setDebugLevel()</tt> ).

virtual MirFiller::~MirFiller (  )  [virtual]

destruct this filler


Member Function Documentation

void MirFiller::addAntennaPositions ( FillMetadata fm,
Double  time 
) [private]

add a new set of antenna positions

void MirFiller::addCorrelatorSetup ( FillMetadata fm,
double  time 
) [private]

add subtable records for the current correlator setup

void MirFiller::addDataDesc ( FillMetadata fm  )  [private]

add DATA_DESCRIPTION records for the current polarization and frequency setup

void MirFiller::addField ( FillMetadata fm,
double  time 
) [private]

add the current field to the FIELD subtable

void MirFiller::addHistoryMessage ( FillMetadata fm,
String  priority,
String  origin,
String  msg 
) [private]

add a filler message to the HISTORY table

void MirFiller::addPolarization ( FillMetadata fm,
Bool  addCurrentOnly = False 
) [private]

add a POLARIZATION record for the current polarization type.

void MirFiller::addProcessor ( FillMetadata fm  )  [private]

add a processor record for the current frequency setup

uInt MirFiller::addSource ( FillMetadata fm,
double  time 
) [private]

add the current source to the SOURCE subtable

void MirFiller::addTsysRecords ( FillMetadata fm,
Double  time,
Cube< Float > &  tsys 
) [private]

add a record to the SysCal table

void MirFiller::copyHistoryFrom ( FillMetadata fm,
String  tablename 
) [private]

copy the history from a given HISTORY table

Bool MirFiller::Debug ( Int  level  )  [inline]

return true if the debugging level is at least as high as a given level.

Definition at line 256 of file MirFiller.h.

References debug.

void MirFiller::fill ( const String &  msfile  )  [inline]

return basic characteristics of the input dataset as a GlishRecord.

If scan is True (the default), the entire file will be (re-) scanned using the current values for the obslim and scanlim options. If verbose is true (the default), send a description to the logger. GlishRecord summary(Bool verbose=True, Bool scan=True);

fill the output MS according to the current selections and options msfile is the output name to use; it should not already exist.

Definition at line 272 of file MirFiller.h.

References joinFill(), joinpol_p, and noJoinFill().

Referenced by mirfiller::fill().

Bool MirFiller::fitskymotion ( Matrix< Double > &  dirfit,
const Vector< Double > &  time,
const Vector< Double > &  ra,
const Vector< Double > &  dec 
) [private]

create a polynomial fit for the direction to a moving source PJT

void MirFiller::flushFeedRecords ( FillMetadata fm,
Double  time 
) [private]

add the records to the FEED subtable for the current set of antennas and polarizations

void MirFiller::flushHistory ( FillMetadata fm  )  [private]

write out the miriad history into the HISTORY table

void MirFiller::flushMovingFields ( FillMetadata fm,
Double  time 
) [private]

check for moving objects in source list and adjust FIELD subtable accordingly

void MirFiller::flushObsRecord ( FillMetadata fm,
Double  time 
) [private]

add the current observation information as a new record to the output ms's OBSERVATION subtable

void MirFiller::flushPointingRecords ( FillMetadata fm,
Double  time 
) [private]

add the records to the POINTING subtable for the current set of antennas

Int MirFiller::getDebugLevel (  )  const [inline]

set the debugging level which controls the amount of debugging messages that are printed to the terminal.

A value of zero or less means that no extra messages will be printed; increasing values will increase the amount of messages.

Definition at line 252 of file MirFiller.h.

References debug.

Record MirFiller::getOptions (  ) 

get the current filling options

Referenced by mirfiller::getoptions().

void MirFiller::initMS ( ::FillMetadata fm  )  [private]

initialize the output MS.

This is called after the first input record is read in from the input Miriad dataset. It will initialize certain subtables (currently, POINTING, PROCESSOR, HISTORY, FEED, and POLARIZATION) based on static or otherwise non-tracked variable information.

void MirFiller::initState ( FillMetadata fm  )  [private]

initialize the STATE table

void MirFiller::joinFill ( const String &  msfile  )  [private]

Referenced by fill().

Bool MirFiller::nearAbs ( Double  a,
Double  b,
Double  tol 
) [inline, private]

Definition at line 426 of file MirFiller.h.

References casacore::abs().

void MirFiller::noJoinFill ( const String &  msfile  )  [private]

Referenced by fill().

void MirFiller::selectPols ( ConstMirPolSetup polsel  ) 

throw(UnavailableMiriadDataSelectionError);

select the polarizations to load. An empty setup means by default take all polarizations found in the dataset.

void MirFiller::selectSpectra ( const Vector< Int > &  wideChans,
const Vector< Int > &  narrowWins 
)

select spectral data from the input Miriad dataset.

wideChans is a list of one-based channel indices. narrowWins is a list of one-based window indices. The default is to choose all available wide channels and windows. polsel is a polarization selection: only the correlation types present will be loaded; a NULL value means take all polarizations found. (See also the joinpol option under setOptions().)

Referenced by mirfiller::selectspectra().

void MirFiller::setDebugLevel ( Int  level  )  [inline]

set the debugging level which controls the amount of debugging messages that are printed to the terminal (as opposed to the logger).

A value of zero or less will cause no extra messages to be printed; increasing values will increase the amount of messages.

Definition at line 243 of file MirFiller.h.

References debug, rdr_p, and MirVisReader::setDebugLevel().

void MirFiller::setOptions ( const Record &  opts  ) 

set the options for filling.

The options are set via a Record object for which the following keys are recognized:

 scanlim  the scan time jump limit, in seconds.  If the jump in
 time between two consecutive Miriad records is greater 
 than this limit the scan number that gets written out
 for that record will be incremented.  A change in source
 will always increment the scan number unless scanlim is
 negative; in this case, all records are forced to have
 the same scan number.  The default is 5 minutes.
 obslim   the observation ID time jump limit, in seconds.  The 
 observation ID is meant to delimit two tracks that might
 appear in the same file.  If the jump in time 
 between two consecutive Miriad records is greater than 
 this limit the scan number that gets written out for 
 that record will be incremented.  The ID will always be
 incremented if there is a change in telescope or array
 configuration unless obslim is negative, in which case,
 all records will be forced to have the same observation
 ID.  The default is 4 hours.
 tilesize the tiling size to use (in channels?) for storing data
 in the MS using the TiledStorageManager.  If the value 
 is <= 0, the standard (non-tiled) storage manager will
 be used.  The default is 32.
 wideconv the convention to use for interpreting the wideband channels.
 The allowed values are "bima" and "none".  In the "bima" 
 convention, the first two wideband channels are the lower & 
 upper sideband averages and the remaining channels represent 
 averages of each of the spectral line windows.  Currently,
 this option only affects the writing out of window 
 associations: if wideconv="bima", the associations linking 
 wideband windows to spectral line windows will be written
 according to the convention.
 joinpol  If true, multiple polarizations are loaded as a single 
 polarization setup.  Which polarizations are included
 depend on the polarization selections.  If false (the 
 default), each polarization is loaded as a separate setup.
 tsyswt   If true (the default), the SIGMA and WEIGHT columns will
 be filled with values based on the system temperatures, if 
 found.  If false, these columns will be filled with values=1.
 The SYSCAL table will be filled if system temperatures are
 present, regardless of the value of this option.
 planetfit  The maximum fit order to use when fitting the direction of a 
 planet-tracking field.  The actual order used may be less than
 this if there is insufficient data.  The default is 3.
 updmodelint  This is the amount of time to wait before updating the
 model.  By default this is 8 hours.
 movfield if true, exact field positions tracking a moving object will
 be written to subtable called BIMA_MOVING_FIELDS.
 compress if true, selected columns will be compressed using scaled
 integers.  This limits the dynamic range to about 65000:1.
 The default is true.
 verbose  if true, send extra messages to the logger
 

Referenced by mirfiller::setoptions().

MeasurementSet* MirFiller::setupMS ( const String &  msfile,
Int  tileSize = 0,
Bool  needSrcModel = True 
) [private]

open and setup the output MS.

This includes all initialization that can be done without reading any data from the input Miriad dataset.

virtual void MirFiller::updateArray ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the array configuration; this is a callback routine that is part of the MirVarHandler interface which must be implemented

Implements MirVarHandler.

virtual void MirFiller::updateField ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the observing field; this is a callback routine that is part of the MirVarHandler interface which must be implemented

Implements MirVarHandler.

virtual void MirFiller::updateFreqSetup ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the frequency setup; this is a callback routine that is part of the MirVarHandler interface which must be implemented

Implements MirVarHandler.

virtual void MirFiller::updateIntTime ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the integration time; this is a callback routine that is part of the MirVarHandler interface which must be implemented.

This implementation does nothing.

Implements MirVarHandler.

virtual void MirFiller::updateObservatory ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the observatory; this is a callback routine that is part of the MirVarHandler interface which must be implemented.

This implementation flushes records for the FEED subtable for the last observatory, and adds a PROCESSOR subtable record for the next table.

Implements MirVarHandler.

virtual void MirFiller::updatePolSetup ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the array configuration; this is a callback routine that is part of the MirVarHandler interface which must be implemented

Implements MirVarHandler.

virtual void MirFiller::updateSource ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the source; this is a callback routine that is part of the MirVarHandler interface which must be implemented

Implements MirVarHandler.

virtual void MirFiller::updateSourceModel ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to the SOURCE_MODEL column of the SOURCE subtable.

Maybe that this gets incorporated into updateSource at sometime, have to examine logistics. REWRITEME. dgoscha

Implements MirVarHandler.

virtual void MirFiller::updateTsys ( FillMetadata fm,
Double  time 
) [virtual]

handle an update to system temperatures this is a callback routine that is part of the MirVarHandler interface which must be implemented

Implements MirVarHandler.

Bool MirFiller::verbose (  )  [inline]

return true if this filler should be verbose in its messages.

This will be true if the verbose option is enabled or the debug level is greater than 1.

Definition at line 261 of file MirFiller.h.

References debug, and verbose_p.


Member Data Documentation

Bool MirFiller::compress_p [private]

Definition at line 501 of file MirFiller.h.

uInt MirFiller::debug [private]

Definition at line 227 of file MirFiller.h.

Referenced by Debug(), getDebugLevel(), setDebugLevel(), and verbose().

Definition at line 495 of file MirFiller.h.

String MirFiller::histbl_p [private]

options

Definition at line 498 of file MirFiller.h.

Bool MirFiller::joinpol_p [private]

Definition at line 501 of file MirFiller.h.

Referenced by fill().

LogIO MirFiller::log_p [private]

Definition at line 490 of file MirFiller.h.

Bool MirFiller::movfield_p [private]

Definition at line 501 of file MirFiller.h.

Int MirFiller::nwidesel_p [private]

Definition at line 494 of file MirFiller.h.

Int MirFiller::nwinsel_p [private]

Definition at line 494 of file MirFiller.h.

Double MirFiller::obslim_p [private]

Definition at line 499 of file MirFiller.h.

Int MirFiller::planetfit_p [private]

Definition at line 500 of file MirFiller.h.

info that doesn't change during life of filler

Definition at line 489 of file MirFiller.h.

Referenced by setDebugLevel().

Double MirFiller::scanlim_p [private]

Definition at line 499 of file MirFiller.h.

Int MirFiller::tilesize_p [private]

Definition at line 500 of file MirFiller.h.

Bool MirFiller::tsyswt_p [private]

Definition at line 501 of file MirFiller.h.

Double MirFiller::updmodelint_p [private]

Definition at line 507 of file MirFiller.h.

Bool MirFiller::verbose_p [private]

Definition at line 501 of file MirFiller.h.

Referenced by verbose().

Definition at line 505 of file MirFiller.h.

String MirFiller::wideconvnames[] [static, private]

Definition at line 504 of file MirFiller.h.

Vector<Bool> MirFiller::widesel_p [private]

selection info

Definition at line 493 of file MirFiller.h.

Vector<Bool> MirFiller::winsel_p [private]

Definition at line 493 of file MirFiller.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1