Line data Source code
1 : //# RFANewMedianClip.h: this defines RFANewMedianClip 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_RFANEWMEDIANCLIP_H 28 : #define FLAGGING_RFANEWMEDIANCLIP_H 29 : 30 : #include <flagging/Flagging/RFAFlagCubeBase.h> 31 : #include <flagging/Flagging/RFDataMapper.h> 32 : #include <flagging/Flagging/RFFlagCube.h> 33 : #include <flagging/Flagging/RFFloatLattice.h> 34 : #include <flagging/Flagging/RFRowClipper.h> 35 : #include <casacore/scimath/Mathematics/MedianSlider.h> 36 : 37 : namespace casa { //# NAMESPACE CASA - BEGIN 38 : 39 : // <summary> 40 : // RFANewMedianClip:RedFlagger Agent;clips relative to median over time slots 41 : // </summary> 42 : 43 : // <use visibility=local> 44 : 45 : // <reviewed reviewer="" date="" tests="" demos=""> 46 : // </reviewed> 47 : 48 : // <prerequisite> 49 : // <li> MedianSlider 50 : // <li> RFAFlagCubeBase 51 : // </prerequisite> 52 : // 53 : // <synopsis> 54 : // RFANewMedianClip computes a median of some quantity over time slots, 55 : // per each channel. Deviation w/respect to the median is computed for 56 : // the actual flagging. 57 : // </synopsis> 58 : // 59 : // <todo asof="2004/04/21"> 60 : // <li> add this feature 61 : // <li> fix this bug 62 : // <li> start discussion of this possible extension 63 : // </todo> 64 : 65 : class RFANewMedianClip : public RFAFlagCubeBase, public RFDataMapper 66 : { 67 : public: 68 : RFANewMedianClip ( RFChunkStats &ch, const casacore::RecordInterface &parm ); 69 : virtual ~RFANewMedianClip (); 70 : 71 : virtual casacore::uInt estimateMemoryUse (); 72 : virtual casacore::Bool newChunk (casacore::Int &maxmem); 73 : virtual void endChunk (); 74 : virtual void startData (bool verbose); 75 : virtual void startDry (bool verbose); // add 76 : virtual IterMode iterTime (casacore::uInt itime); 77 : virtual IterMode iterRow (casacore::uInt irow); 78 : virtual IterMode iterDry (casacore::uInt it); 79 : virtual IterMode endData (); 80 : virtual IterMode endDry (); 81 : 82 : virtual casacore::String getDesc (); 83 : static const casacore::RecordInterface & getDefaults (); 84 : 85 : protected: 86 : casacore::MedianSlider & slider (casacore::uInt ich,casacore::uInt ifr); 87 : casacore::MedianSlider globalmed; 88 : 89 : FlagCubeIterator * pflagiter; 90 : FlagCubeIterator flag_iter; 91 : casacore::Double threshold; 92 : 93 : casacore::MedianSlider * msl; 94 : 95 : // lattice of evaluated values [NCH,NIFR,NTIME] 96 : RFFloatLattice evalue; 97 : // matrix of standard deviation [NCH,NIFR] 98 : casacore::Matrix<casacore::Float> stdev; 99 : casacore::Bool stdeved; 100 : casacore::Double globalsigma; 101 : }; 102 : 103 : 104 0 : inline casacore::MedianSlider & RFANewMedianClip::slider (casacore::uInt ich,casacore::uInt ifr) 105 : { 106 0 : return msl[ ifr*num(CHAN) + ich ]; 107 : } 108 : 109 : 110 : } //# NAMESPACE CASA - END 111 : 112 : #endif