casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlagAgentTimeFreqCrop.h
Go to the documentation of this file.
1 //# FlagAgentTimeFreqCrop.h: This file contains the interface definition of the FlagAgentTimeFreqCrop class.
2 //#
3 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
4 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
5 //# Copyright (C) European Southern Observatory, 2011, All rights reserved.
6 //#
7 //# This library is free software; you can redistribute it and/or
8 //# modify it under the terms of the GNU Lesser General Public
9 //# License as published by the Free software Foundation; either
10 //# version 2.1 of the License, or (at your option) any later version.
11 //#
12 //# This library is distributed in the hope that it will be useful,
13 //# but WITHOUT ANY WARRANTY, without even the implied warranty of
14 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 //# Lesser General Public License for more details.
16 //#
17 //# You should have received a copy of the GNU Lesser General Public
18 //# License along with this library; if not, write to the Free Software
19 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 //# MA 02111-1307 USA
21 //# $Id: $
22 
23 #ifndef FlagAgentTimeFreqCrop_H_
24 #define FlagAgentTimeFreqCrop_H_
25 
27 
28 namespace casa { //# NAMESPACE CASA - BEGIN
29 
31 
32 public:
33 
34  FlagAgentTimeFreqCrop(FlagDataHandler *dh, casacore::Record config, casacore::Bool writePrivateFlagCube = false, casacore::Bool flag = true);
36 
37 protected:
38 
39  // Compute flags for a given (time,freq) map
40  bool computeAntennaPairFlags(const vi::VisBuffer2 &visBuffer, VisMapper &visibilities,FlagMapper &flags,casacore::Int antenna1,casacore::Int antenna2,std::vector<casacore::uInt> &rows);
41 
42  // Parse configuration parameters
44 
45 private:
46 
48 
49  // Flag threshold in time.
50  // (flag all data-points further than N-stddev from the fit).
52  // Flag threshold in frequency.
53  // (flag all data-points further than N-stddev from the fit).
55  // Maximum number of pieces to allow in the piecewise-polynomial fits (1-9)
57  // Fitting function for the time direction ('line' or 'poly')
59  // Fitting function for the frequency direction ('line' or 'poly')
61  // Choose the directions along which to perform flagging
62  // ('time', 'freq', 'timefreq', 'freqtime')
64  // Half width of sliding window to use with 'usewindowstats'
65  // (1,2,3 for 3-point, 5-point or 7-point window sizes)
67  // Use sliding-window statistics to find additional flags
68  // ('none', 'sum', 'std', 'both' )
70  // Read original flags or not.
71  // Note : original flags are those in the casacore::MS (and not those generated by agents)
72  // true/false
73  // casacore::Bool usePreFlags_p;
74 
75 
77 
78  // Average the data, fit a piecewise polynomial, divide it out, flag outliers.
79  void fitBaseAndFlag(casacore::String fittype, casacore::String direction, VisMapper &visibilities,FlagMapper &flags);
80 
81  // Calculate Mean, Variance, Stddev while accounting for flags
86 
87  // Fit a piece-wise polynomial according to the supplied specs
89 
90  // Fit a polynomial of specified degree to a range of data points
92 
93  // Fit a line to a range of data points
95 
96 
97 
98 };
99 
100 
101 } //# NAMESPACE CASA - END
102 
103 #endif /* FlagAgentTimeFreqCrop_H_ */
104 
int Int
Definition: aipstype.h:50
void fitBaseAndFlag(casacore::String fittype, casacore::String direction, VisMapper &visibilities, FlagMapper &flags)
Read original flags or not.
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.
A top level class defining the data handling interface for the flagging module.
casacore::String winStats_p
Use sliding-window statistics to find additional flags (&#39;none&#39;, &#39;sum&#39;, &#39;std&#39;, &#39;both&#39;) ...
casacore::Int halfWin_p
Half width of sliding window to use with &#39;usewindowstats&#39; (1,2,3 for 3-point, 5-point or 7-point wind...
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.
casacore::String freqFitType_p
Fitting function for the frequency direction (&#39;line&#39; or &#39;poly&#39;)
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
casacore::String flagDimension_p
Choose the directions along which to perform flagging (&#39;time&#39;, &#39;freq&#39;, &#39;timefreq&#39;, &#39;freqtime&#39;)
A top level class defining the interface for flagging agents.
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.
double Double
Definition: aipstype.h:55
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::String timeFitType_p
Fitting function for the time direction (&#39;line&#39; or &#39;poly&#39;)
float Float
Definition: aipstype.h:54
casacore::Float calcVar(casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit)
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.
casacore::Double time_cutoff_p
casacore::Input parameters ///
casacore::Double freq_cutoff_p
Flag threshold in frequency.
casacore::Float calcMean(casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag)
Calculate Mean, Variance, Stddev while accounting for flags.
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
LatticeExprNode mean(const LatticeExprNode &expr)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Float calcStd(casacore::Vector< casacore::Float > &vect, casacore::Vector< casacore::Bool > &flag, casacore::Vector< casacore::Float > &fit)
void setAgentParameters(casacore::Record config)
Parse configuration parameters.
unsigned int uInt
Definition: aipstype.h:51
casacore::Int maxNPieces_p
Maximum number of pieces to allow in the piecewise-polynomial fits (1-9)
FlagAgentTimeFreqCrop(FlagDataHandler *dh, casacore::Record config, casacore::Bool writePrivateFlagCube=false, casacore::Bool flag=true)