casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFRowClipper.h
Go to the documentation of this file.
1 //# RFRowClipper.h: this defines RFRowClipper
2 //# Copyright (C) 2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 #ifndef FLAGGING_RFROWCLIPPER_H
28 #define FLAGGING_RFROWCLIPPER_H
29 
31 #include <casa/Arrays/Vector.h>
32 #include <casa/Arrays/Matrix.h>
33 
34 namespace casa { //# NAMESPACE CASA - BEGIN
35 
36 class RFFlagCube;
37 class RFChunkStats;
38 
39 // <summary>
40 // RFRowClipper: flags rows based on their noise level
41 // </summary>
42 
43 // <use visibility=local>
44 
45 // <reviewed reviewer="" date="" tests="" demos="">
46 // </reviewed>
47 
48 // <synopsis>
49 // RFRowClipper accumulates per-row noise estimates in an [NIFR,NTIME] matrix.
50 // After each pass it performs flagging of rows with excessive noise (w/respect
51 // to a sliding median per IFR, over time).
52 // </synopsis>
53 //
54 // <motivation>
55 // Several flagging agents produce per-row noise estimates and can flag based
56 // on them. Hence, a commmon implementation was desired.
57 // </motivation>
58 //
59 // <todo asof="2001/04/16">
60 // <li> add this feature
61 // <li> fix this bug
62 // <li> start discussion of this possible extension
63 // </todo>
64 
65 class RFRowClipper : public FlaggerEnums
66 {
67 public:
68  // construct from a chunk accessor and flag cube. Clip is the clipping
69  // level, HW is the sliding median window half-width, MAXP is maximum
70  // iterative passes.
72  // destructor
73  ~RFRowClipper () {};
74 
75  // initialize for an [NI,NT] matrix
76  void init ( casacore::uInt ni,casacore::uInt nt );
77  // deallocate matrices
78  void cleanup ();
79  // reset at start of pass
80  void reset ();
81 
82  // returns the current noise estimate
84  // sets a new noise estimate
86  // marks a noise estimate as updated without changing it
87  void markSigma ( casacore::uInt ifr );
88 
89  // recompute updated estimates and optionally do row flagging
90  casacore::Float updateSigma (casacore::uInt &ifrmax,casacore::uInt &itmax,casacore::Bool flagrows = true, bool clear_flags = true );
91 
92 private:
97 
101 
103 };
104 
106 {
107  return sig0(it,ifr);
108 }
109 
111 {
112  sig(it,ifr) = level;
113  sigupdated(ifr) = true;
114 }
115 
117 {
118  sigupdated(ifr) = true;
119 }
120 
121 
122 } //# NAMESPACE CASA - END
123 
124 #endif
void markSigma(casacore::uInt ifr)
marks a noise estimate as updated without changing it
Definition: RFRowClipper.h:116
casacore::uInt nifr
Definition: RFRowClipper.h:98
casacore::Matrix< casacore::Float > sig0
Definition: RFRowClipper.h:99
casacore::Float updateSigma(casacore::uInt &ifrmax, casacore::uInt &itmax, casacore::Bool flagrows=true, bool clear_flags=true)
recompute updated estimates and optionally do row flagging
casacore::Float sigma0(casacore::uInt ifr, casacore::uInt it)
returns the current noise estimate
Definition: RFRowClipper.h:105
RFRowClipper: flags rows based on their noise level.
Definition: RFRowClipper.h:65
RFChunkStats & chunk
Definition: RFRowClipper.h:93
ostream-like interface to creating log messages.
Definition: LogIO.h:167
casacore::uInt maxpass
Definition: RFRowClipper.h:96
RFFlagCube: a cube of flags.
Definition: RFFlagCube.h:91
casacore::Matrix< casacore::Float > sig
Definition: RFRowClipper.h:99
casacore::LogIO & os
Definition: RFRowClipper.h:102
void init(casacore::uInt ni, casacore::uInt nt)
initialize for an [NI,NT] matrix
RFRowClipper(RFChunkStats &chunk, RFFlagCube &flag, casacore::Float clip, casacore::uInt hw=6, casacore::uInt maxp=5)
construct from a chunk accessor and flag cube.
void cleanup()
deallocate matrices
casacore::Vector< casacore::Bool > sigupdated
Definition: RFRowClipper.h:100
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void reset()
reset at start of pass
casacore::uInt halfwin
Definition: RFRowClipper.h:96
RFFlagCube & flag
Definition: RFRowClipper.h:94
float Float
Definition: aipstype.h:54
casacore::Float clip_level
Definition: RFRowClipper.h:95
FlaggerEnums: collection of enums for various flagger classes.
Definition: RFCommon.h:126
casacore::uInt ntime
Definition: RFRowClipper.h:98
~RFRowClipper()
destructor
Definition: RFRowClipper.h:73
RFChunkStats: vital information and flagging stats for a visibility chunk.
Definition: RFChunkStats.h:89
void setSigma(casacore::uInt ifr, casacore::uInt it, casacore::Float level)
sets a new noise estimate
Definition: RFRowClipper.h:110
unsigned int uInt
Definition: aipstype.h:51