DP3
Public Member Functions | Static Public Member Functions | List of all members
dp3::steps::MsReader Class Reference

DP3 step reading from an MS. More...

#include <MsReader.h>

Inheritance diagram for dp3::steps::MsReader:
dp3::steps::InputStep dp3::steps::Step

Public Member Functions

 MsReader (const casacore::MeasurementSet &ms, const common::ParameterSet &parset, const std::string &prefix, bool allow_missing_data=false)
 
void addToMS (const std::string &) override
 
bool AutoWeight () const
 
const std::string & BaselineSelection () const
 Get the baseline selection. More...
 
const std::vector< std::string > & ExtraDataColumnNames () const
 Get the names of the extra data columns that are also read. More...
 
void finish () override
 Finish the processing of this step and subsequent steps. More...
 
void getUVW (const casacore::RefRows &rowNrs, double time, base::DPBuffer &)
 Read the UVW at the given row numbers into the buffer. More...
 
bool MissingData () const
 Is the data column missing? More...
 
std::string msName () const override
 Get the name of the MS. More...
 
bool process (std::unique_ptr< base::DPBuffer > buffer) override
 
void show (std::ostream &) const override
 Show the step parameters. More...
 
void showCounts (std::ostream &) const override
 If needed, show the flag counts. More...
 
void showTimings (std::ostream &, double duration) const override
 Show the timings. More...
 
const casacore::Table & table () const override
 Get the main MS table. More...
 
void updateInfo (const base::DPInfo &) override
 Do nothing, since MsReader sets its info in the constructor. More...
 
- Public Member Functions inherited from dp3::steps::InputStep
 ~InputStep () override
 
const dp3::common::FieldsgetFieldsToRead () const
 Get which fields must be read. More...
 
common::Fields getProvidedFields () const override
 
common::Fields getRequiredFields () const override
 Get the fields required by the current step. More...
 
virtual void setFieldsToRead (const dp3::common::Fields &fields)
 Set which fields must be read. More...
 
- Public Member Functions inherited from dp3::steps::Step
 Step ()
 
virtual ~Step ()
 
virtual bool accepts (MsType dt) const
 Boolean if this step can process this type of data. More...
 
const base::DPInfogetInfoIn () const
 Get access to the info of the input. More...
 
const base::DPInfogetInfoOut () const
 Get access to the info of the output. More...
 
const Step::ShPtrgetNextStep () const
 Get the next step. More...
 
StepgetPrevStep () const
 Get the previous step. More...
 
virtual MsType outputs () const
 Return which datatype this step outputs. More...
 
virtual bool process (std::unique_ptr< base::BdaBuffer >)
 
void setInfo (const base::DPInfo &)
 
virtual void setNextStep (Step::ShPtr nextStep)
 Set the next step. More...
 
void setPrevStep (Step *prevStep)
 Set the previous step. More...
 

Static Public Member Functions

static void FlagInfinityNan (base::DPBuffer &buffer, base::FlagCounter &flagCounter)
 Flags infinite and Not-a-Number values. More...
 
static std::pair< unsigned int, unsigned int > ParseChannelSelection (const std::string &start_channel_string, const std::string &n_channels_string, unsigned int n_channels)
 
- Static Public Member Functions inherited from dp3::steps::InputStep
static std::unique_ptr< InputStepCreateReader (const common::ParameterSet &)
 
static bool HasBda (const casacore::MeasurementSet &ms)
 
- Static Public Member Functions inherited from dp3::steps::Step
static void SetThreadingIsInitialized ()
 

Additional Inherited Members

- Public Types inherited from dp3::steps::Step
enum class  MsType { kRegular , kBda }
 To check compatibility between steps before running. More...
 
typedef std::shared_ptr< StepShPtr
 
- Static Public Attributes inherited from dp3::steps::Step
static constexpr dp3::common::Fields kDataField
 
static constexpr dp3::common::Fields kFlagsField
 
static constexpr dp3::common::Fields kUvwField
 
static constexpr dp3::common::Fields kWeightsField
 
- Protected Member Functions inherited from dp3::steps::Step
base::DPInfoGetWritableInfoOut ()
 

Detailed Description

DP3 step reading from an MS.

This class is an InputStep step reading the data from a MeasurementSet. At the beginning it finds out the shape of the data; i.e., the number of correlations, channels, baselines, and time slots. It requires the data to be regularly shaped.

The object is constructed from the 'msin' keywords in the parset file. Currently the following can be given:

If a time slot is missing, it inserts flagged data set to zero, i.e. it inserts dummy data that is marked invalid. Missing time slots can also be detected at the beginning or end of the MS by giving the correct starttime and endtime. The correct UVW coordinates are calculated for inserted time slots.

The process function reads the fields needed by the chain of steps which can be obtained calling getFieldsToRead(). In this way only the necessary data is kept in memory.

The data columns are handled in the following way:

TIME The time slot center of the current data (in MJD seconds). It is assumed that all data have the same interval, which is used to find missing time slots.
DATA The visibility data as [ncorr,nchan,nbaseline]. Only the part given by startchan and nchan is read. If a time slot is inserted, all its data are zero.
FLAG The data flags as [ncorr,nchan,nbaseline] (True is bad). They are read from the FLAG column. If a FLAG_ROW is set, all flags for that baseline will be set. Also the flag of data containing NaN or infinite numbers will be set. All flags of an inserted time slot are set.
WEIGHT The data weights as [ncorr,nchan,nbaseline]. Column WEIGHT_SPECTRUM is used if present and containing valid data, otherwise column WEIGHT is used. The weights of an inserted time slot are set to 0. If autoweight is on, the autocorrelations are used to calculate proper weights.
UVW The UVW coordinates in meters as [3,nbaseline]. They are calculated for a missing time slot.

Constructor & Destructor Documentation

◆ MsReader()

dp3::steps::MsReader::MsReader ( const casacore::MeasurementSet &  ms,
const common::ParameterSet parset,
const std::string &  prefix,
bool  allow_missing_data = false 
)

Construct the object for the given MS. Parameters are obtained from the parset using the given prefix. The allow_missing_data argument is for MultiMsReader.

Member Function Documentation

◆ addToMS()

void dp3::steps::MsReader::addToMS ( const std::string &  )
inlineoverridevirtual

Add some data to the MeasurementSet written/updated. Do nothing.

Reimplemented from dp3::steps::Step.

◆ AutoWeight()

bool dp3::steps::MsReader::AutoWeight ( ) const
inline

◆ BaselineSelection()

const std::string& dp3::steps::MsReader::BaselineSelection ( ) const
inline

Get the baseline selection.

◆ ExtraDataColumnNames()

const std::vector<std::string>& dp3::steps::MsReader::ExtraDataColumnNames ( ) const
inline

Get the names of the extra data columns that are also read.

◆ finish()

void dp3::steps::MsReader::finish ( )
overridevirtual

Finish the processing of this step and subsequent steps.

Implements dp3::steps::Step.

◆ FlagInfinityNan()

static void dp3::steps::MsReader::FlagInfinityNan ( base::DPBuffer buffer,
base::FlagCounter flagCounter 
)
static

Flags infinite and Not-a-Number values.

◆ getUVW()

void dp3::steps::MsReader::getUVW ( const casacore::RefRows &  rowNrs,
double  time,
base::DPBuffer  
)

Read the UVW at the given row numbers into the buffer.

◆ MissingData()

bool dp3::steps::MsReader::MissingData ( ) const
inline

Is the data column missing?

◆ msName()

std::string dp3::steps::MsReader::msName ( ) const
overridevirtual

Get the name of the MS.

Reimplemented from dp3::steps::InputStep.

◆ ParseChannelSelection()

static std::pair<unsigned int, unsigned int> dp3::steps::MsReader::ParseChannelSelection ( const std::string &  start_channel_string,
const std::string &  n_channels_string,
unsigned int  n_channels 
)
static

Parse the expressions for the start channel and number of channels. The total number of channels can be used as 'nchan' in both expressions.

◆ process()

bool dp3::steps::MsReader::process ( std::unique_ptr< base::DPBuffer buffer)
overridevirtual

Process the next data chunk. It returns false when at the end.

Reimplemented from dp3::steps::Step.

◆ show()

void dp3::steps::MsReader::show ( std::ostream &  ) const
overridevirtual

Show the step parameters.

Implements dp3::steps::Step.

◆ showCounts()

void dp3::steps::MsReader::showCounts ( std::ostream &  ) const
overridevirtual

If needed, show the flag counts.

Reimplemented from dp3::steps::Step.

◆ showTimings()

void dp3::steps::MsReader::showTimings ( std::ostream &  ,
double  duration 
) const
overridevirtual

Show the timings.

Reimplemented from dp3::steps::Step.

◆ table()

const casacore::Table& dp3::steps::MsReader::table ( ) const
inlineoverridevirtual

Get the main MS table.

Reimplemented from dp3::steps::InputStep.

◆ updateInfo()

void dp3::steps::MsReader::updateInfo ( const base::DPInfo )
inlineoverridevirtual

Do nothing, since MsReader sets its info in the constructor.

Reimplemented from dp3::steps::Step.


The documentation for this class was generated from the following file: