casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
casa::FlagAgentTimeFreqCrop Class Reference

#include <FlagAgentTimeFreqCrop.h>

Inheritance diagram for casa::FlagAgentTimeFreqCrop:
casa::FlagAgentBase casa::async::Thread

Public Member Functions

 FlagAgentTimeFreqCrop (FlagDataHandler *dh, casacore::Record config, casacore::Bool writePrivateFlagCube=false, casacore::Bool flag=true)
 
 ~FlagAgentTimeFreqCrop ()
 
- Public Member Functions inherited from casa::FlagAgentBase
 FlagAgentBase (FlagDataHandler *dh, casacore::Record config, casacore::uShort iterationApproach, casacore::Bool writePrivateFlagCube=false, casacore::Bool flag=true)
 
virtual ~FlagAgentBase ()
 
void start ()
 
void terminate ()
 
void queueProcess ()
 
void chunkSummary ()
 
void tableSummary ()
 
void completeProcess ()
 
void * run ()
 
void setProfiling (bool enable)
 Set function to activate profiling. More...
 
void setCheckMode (bool enable)
 Set function to activate check mode. More...
 
virtual FlagReport getReport ()
 Get a report casacore::Record from the agent, at the end of the run The report returned by getReport() can be of multiple types – a single report of type "none" : FlagReport("none",agentName_p) – a single report of type "plot" : FlagReport("plot",agentName_p) – a list of reports : FlagReport repList("list"); repList.addReport(FlagReport("plot",agentName_p)); repList.addReport(FlagReport("plot",agentName_p));. More...
 
- Public Member Functions inherited from casa::async::Thread
 Thread ()
 
virtual ~Thread ()
 
pthread_t getId () const
 
pid_t gettid () const
 
bool isTerminationRequested () const
 
void * join ()
 
void startThread ()
 

Protected Member Functions

bool computeAntennaPairFlags (const vi::VisBuffer2 &visBuffer, VisMapper &visibilities, FlagMapper &flags, casacore::Int antenna1, casacore::Int antenna2, std::vector< casacore::uInt > &rows)
 Compute flags for a given (time,freq) map. More...
 
void setAgentParameters (casacore::Record config)
 Parse configuration parameters. More...
 
- Protected Member Functions inherited from casa::FlagAgentBase
void initialize ()
 
void runCore ()
 Convenience function to be shared by parallel/non-parallel mode. More...
 
void setDataSelection (casacore::Record config)
 
casacore::String sanitizeCorrExpression (casacore::String corrExpression, std::vector< casacore::String > *corrProducts)
 Method to sanitize correlation expression and keep going. More...
 
void generateAllIndex ()
 
void generateRowsIndex (casacore::uInt nRows)
 
void generateChannelIndex (casacore::uInt nChannels)
 
void generatePolarizationIndex (casacore::uInt nPolarizations)
 
std::vector< casacore::uInt > * generateAntennaPairRowsIndex (casacore::Int antenna1, casacore::Int antenna2)
 
void indigen (std::vector< casacore::uInt > &index, casacore::uInt size)
 Generate index for all rows. More...
 
bool find (const casacore::Vector< casacore::Int > &validRange, casacore::Int element)
 For checking ids. More...
 
bool find (const casacore::Matrix< casacore::Double > &validRange, casacore::Double element)
 For checking ranges. More...
 
bool find (const casacore::Matrix< casacore::Int > &validPairs, casacore::Int element1, casacore::Int element2)
 For checking pairs. More...
 
bool find (const casacore::Block< int > &columns, int col)
 For checking columns. More...
 
bool isNaN (casacore::Double number)
 Check if a given number is nan (for visibilities,gains and Tsys primarily) More...
 
bool isNaN (casacore::Float number)
 
bool isZero (casacore::Double number)
 
bool isZero (casacore::Float number)
 
bool isNaNOrZero (casacore::Float number)
 
bool isNaNOrZero (casacore::Double number)
 
bool checkIfProcessBuffer ()
 Check if buffer has to be processed. More...
 
virtual void preProcessBuffer (const vi::VisBuffer2 &visBuffer)
 Common functionality for each visBuffer (don't repeat at the row level) More...
 
void iterateRows ()
 Iterate trough list of rows. More...
 
void iterateInRows ()
 Iterate trough visibilities mapper. More...
 
void iterateAntennaPairs ()
 Iterate trough list of antenna pairs. More...
 
void iterateAntennaPairsFlags ()
 Iterate trough list of antenna pairs w/o loading visibilities. More...
 
void processAntennaPair (casacore::Int antenna1, casacore::Int antenna2)
 Methods to interactively iterate trough list of antenna pairs. More...
 
virtual void iterateAntennaPairsInteractive (antennaPairMap *antennaPairMap_ptr)
 
virtual void passIntermediate (const vi::VisBuffer2 &visBuffer)
 Iter-passes method. More...
 
virtual void passFinal (const vi::VisBuffer2 &visBuffer)
 
void setVisibilitiesMap (std::vector< casacore::uInt > *rows, VisMapper *visMap)
 Mapping functions (abs, real, imag, etc.) as requested by Urvashi. More...
 
void setFlagsMap (std::vector< casacore::uInt > *rows, FlagMapper *flagMap)
 
casacore::Bool checkVisExpression (polarizationMap *polMap)
 
virtual bool computeRowFlags (const vi::VisBuffer2 &visBuffer, FlagMapper &flags, casacore::uInt row)
 Compute flags for a given visibilities point. More...
 
virtual bool computeInRowFlags (const vi::VisBuffer2 &visBuffer, VisMapper &visibilities, FlagMapper &flags, casacore::uInt row)
 Compute flags for a given visibilities point. More...
 
virtual bool computeAntennaPairFlags (const vi::VisBuffer2 &visBuffer, FlagMapper &flags, casacore::Int antenna1, casacore::Int antenna2, std::vector< casacore::uInt > &rows)
 Compute flags for a given (time,freq) antenna pair map w/o using visibilities. More...
 
- Protected Member Functions inherited from casa::async::Thread
bool isStarted () const
 

Private Member Functions

void fitBaseAndFlag (casacore::String fittype, casacore::String direction, VisMapper &visibilities, FlagMapper &flags)
 Read original flags or not. More...
 
casacore::Float calcMean (casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag)
 Calculate Mean, Variance, Stddev while accounting for flags. More...
 
casacore::Float calcVar (casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit)
 
casacore::Float calcStd (casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit)
 
casacore::Float calcStd (casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag, casacore::Float mean)
 
void fitPiecewisePoly (casacore::Vector< casacore::Float > &data, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit, casacore::uInt maxnpieces, casacore::uInt maxdeg)
 Fit a piece-wise polynomial according to the supplied specs. More...
 
void polyFit (casacore::Vector< casacore::Float > &data, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit, casacore::uInt lim1, casacore::uInt lim2, casacore::uInt deg)
 Fit a polynomial of specified degree to a range of data points. More...
 
void lineFit (casacore::Vector< casacore::Float > &data, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit, casacore::uInt lim1, casacore::uInt lim2)
 Fit a line to a range of data points. More...
 

Private Attributes

casacore::Double time_cutoff_p
 casacore::Input parameters /// More...
 
casacore::Double freq_cutoff_p
 Flag threshold in frequency. More...
 
casacore::Int maxNPieces_p
 Maximum number of pieces to allow in the piecewise-polynomial fits (1-9) More...
 
casacore::String timeFitType_p
 Fitting function for the time direction ('line' or 'poly') More...
 
casacore::String freqFitType_p
 Fitting function for the frequency direction ('line' or 'poly') More...
 
casacore::String flagDimension_p
 Choose the directions along which to perform flagging ('time', 'freq', 'timefreq', 'freqtime') More...
 
casacore::Int halfWin_p
 Half width of sliding window to use with 'usewindowstats' (1,2,3 for 3-point, 5-point or 7-point window sizes) More...
 
casacore::String winStats_p
 Use sliding-window statistics to find additional flags ('none', 'sum', 'std', 'both') More...
 

Additional Inherited Members

- Public Types inherited from casa::FlagAgentBase
enum  datacolumn {
  DATA,
  CORRECTED,
  MODEL,
  RESIDUAL,
  RESIDUAL_DATA,
  FPARAM,
  CPARAM,
  PARAMERR,
  SNR,
  WEIGHT_SPECTRUM,
  FLOAT_DATA
}
 
enum  iteration {
  ROWS,
  ROWS_PREPROCESS_BUFFER,
  IN_ROWS,
  IN_ROWS_PREPROCESS_BUFFER,
  ANTENNA_PAIRS,
  ANTENNA_PAIRS_FLAGS,
  ANTENNA_PAIRS_INTERACTIVE,
  ANTENNA_PAIRS_PREPROCESS_BUFFER
}
 
- Public Types inherited from casa::async::Thread
typedef void *(* ThreadFunction )(void *)
 
- Static Public Member Functions inherited from casa::FlagAgentBase
static FlagAgentBasecreate (FlagDataHandler *dh, casacore::Record config)
 
- Public Attributes inherited from casa::FlagAgentBase
casacore::Bool backgroundMode_p
 Externally visible configuration. More...
 
casacore::LogIO::Command logLevel_p
 
casacore::Bool apply_p
 
casacore::Bool flag_p
 
- Static Protected Member Functions inherited from casa::async::Thread
static void * threadFunction (void *)
 
- Protected Attributes inherited from casa::FlagAgentBase
FlagDataHandlerflagDataHandler_p
 Common used members that must be accessible to derived classes. More...
 
std::unique_ptr< casacore::LogIOlogger_p
 
casacore::String agentName_p
 
casacore::String summaryName_p
 
casacore::String mode_p
 
casacore::uInt64 chunkFlags_p
 Flag counters. More...
 
casacore::uInt64 chunkNaNs_p
 
casacore::uInt64 tableFlags_p
 
casacore::uInt64 tableNaNs_p
 
casacore::uInt64 visBufferFlags_p
 
bool flagRow_p
 
casacore::Bool multiThreading_p
 Multithreading configuration and agent id. More...
 
casacore::Int nThreads_p
 
casacore::Int threadId_p
 
casacore::Bool prepass_p
 Running configuration. More...
 
std::vector< casacore::uIntrowsIndex_p
 Lists of elements to process jagonzal (CAS-4312): We need channelIndex_p available for the Rflag agent, in order to take into account channel selection for the frequency mapping. More...
 
std::vector< casacore::uIntchannelIndex_p
 
std::vector< casacore::uIntpolarizationIndex_p
 
casacore::String dataColumn_p
 Needed to be protected for timeavg in clip. More...
 
casacore::Bool timeavg_p
 Pre-averaging parameters. More...
 
casacore::Double timebin_p
 
casacore::Bool channelavg_p
 
casacore::Vector< casacore::Intchanbin_p
 

Detailed Description

Definition at line 30 of file FlagAgentTimeFreqCrop.h.

Constructor & Destructor Documentation

casa::FlagAgentTimeFreqCrop::FlagAgentTimeFreqCrop ( FlagDataHandler dh,
casacore::Record  config,
casacore::Bool  writePrivateFlagCube = false,
casacore::Bool  flag = true 
)
casa::FlagAgentTimeFreqCrop::~FlagAgentTimeFreqCrop ( )

Member Function Documentation

casacore::Float casa::FlagAgentTimeFreqCrop::calcMean ( casacore::Vector< casacore::Float > &  vect,
casacore::Vector< casacore::Bool > &  flag 
)
private

Calculate Mean, Variance, Stddev while accounting for flags.

casacore::Float casa::FlagAgentTimeFreqCrop::calcStd ( casacore::Vector< casacore::Float > &  vect,
casacore::Vector< casacore::Bool > &  flag,
casacore::Vector< casacore::Float > &  fit 
)
private
casacore::Float casa::FlagAgentTimeFreqCrop::calcStd ( casacore::Vector< casacore::Float > &  vect,
casacore::Vector< casacore::Bool > &  flag,
casacore::Float  mean 
)
private
casacore::Float casa::FlagAgentTimeFreqCrop::calcVar ( casacore::Vector< casacore::Float > &  vect,
casacore::Vector< casacore::Bool > &  flag,
casacore::Vector< casacore::Float > &  fit 
)
private
bool casa::FlagAgentTimeFreqCrop::computeAntennaPairFlags ( const vi::VisBuffer2 visBuffer,
VisMapper visibilities,
FlagMapper flags,
casacore::Int  antenna1,
casacore::Int  antenna2,
std::vector< casacore::uInt > &  rows 
)
protectedvirtual

Compute flags for a given (time,freq) map.

Reimplemented from casa::FlagAgentBase.

void casa::FlagAgentTimeFreqCrop::fitBaseAndFlag ( casacore::String  fittype,
casacore::String  direction,
VisMapper visibilities,
FlagMapper flags 
)
private

Read original flags or not.

Note : original flags are those in the casacore::MS (and not those generated by agents) true/false casacore::Bool usePreFlags_p;

/// TFCROP functions

Average the data, fit a piecewise polynomial, divide it out, flag outliers.

void casa::FlagAgentTimeFreqCrop::fitPiecewisePoly ( casacore::Vector< casacore::Float > &  data,
casacore::Vector< casacore::Bool > &  flag,
casacore::Vector< casacore::Float > &  fit,
casacore::uInt  maxnpieces,
casacore::uInt  maxdeg 
)
private

Fit a piece-wise polynomial according to the supplied specs.

void casa::FlagAgentTimeFreqCrop::lineFit ( casacore::Vector< casacore::Float > &  data,
casacore::Vector< casacore::Bool > &  flag,
casacore::Vector< casacore::Float > &  fit,
casacore::uInt  lim1,
casacore::uInt  lim2 
)
private

Fit a line to a range of data points.

void casa::FlagAgentTimeFreqCrop::polyFit ( casacore::Vector< casacore::Float > &  data,
casacore::Vector< casacore::Bool > &  flag,
casacore::Vector< casacore::Float > &  fit,
casacore::uInt  lim1,
casacore::uInt  lim2,
casacore::uInt  deg 
)
private

Fit a polynomial of specified degree to a range of data points.

void casa::FlagAgentTimeFreqCrop::setAgentParameters ( casacore::Record  config)
protectedvirtual

Parse configuration parameters.

Reimplemented from casa::FlagAgentBase.

Member Data Documentation

casacore::String casa::FlagAgentTimeFreqCrop::flagDimension_p
private

Choose the directions along which to perform flagging ('time', 'freq', 'timefreq', 'freqtime')

Definition at line 63 of file FlagAgentTimeFreqCrop.h.

casacore::Double casa::FlagAgentTimeFreqCrop::freq_cutoff_p
private

Flag threshold in frequency.

(flag all data-points further than N-stddev from the fit).

Definition at line 54 of file FlagAgentTimeFreqCrop.h.

casacore::String casa::FlagAgentTimeFreqCrop::freqFitType_p
private

Fitting function for the frequency direction ('line' or 'poly')

Definition at line 60 of file FlagAgentTimeFreqCrop.h.

casacore::Int casa::FlagAgentTimeFreqCrop::halfWin_p
private

Half width of sliding window to use with 'usewindowstats' (1,2,3 for 3-point, 5-point or 7-point window sizes)

Definition at line 66 of file FlagAgentTimeFreqCrop.h.

casacore::Int casa::FlagAgentTimeFreqCrop::maxNPieces_p
private

Maximum number of pieces to allow in the piecewise-polynomial fits (1-9)

Definition at line 56 of file FlagAgentTimeFreqCrop.h.

casacore::Double casa::FlagAgentTimeFreqCrop::time_cutoff_p
private

casacore::Input parameters ///

Flag threshold in time. (flag all data-points further than N-stddev from the fit).

Definition at line 51 of file FlagAgentTimeFreqCrop.h.

casacore::String casa::FlagAgentTimeFreqCrop::timeFitType_p
private

Fitting function for the time direction ('line' or 'poly')

Definition at line 58 of file FlagAgentTimeFreqCrop.h.

casacore::String casa::FlagAgentTimeFreqCrop::winStats_p
private

Use sliding-window statistics to find additional flags ('none', 'sum', 'std', 'both')

Definition at line 69 of file FlagAgentTimeFreqCrop.h.


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