casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RFAMedianClip.h
Go to the documentation of this file.
00001 //# RFAMedianClip.h: this defines RFATimeMedian and RFAFreqMedian
00002 //# Copyright (C) 2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 #ifndef FLAGGING_RFAMEDIANCLIP_H
00028 #define FLAGGING_RFAMEDIANCLIP_H
00029 
00030 #include <flagging/Flagging/RFADiffBase.h> 
00031 #include <scimath/Mathematics/MedianSlider.h> 
00032 
00033 namespace casa { //# NAMESPACE CASA - BEGIN
00034 
00035 // <summary>
00036 // RFATimeMedian: RedFlagger Agent for clipping relative to median over time
00037 // </summary>
00038 
00039 // <use visibility=local>
00040 
00041 // <reviewed reviewer="" date="" tests="" demos="">
00042 // </reviewed>
00043 
00044 // <prerequisite>
00045 //   <li> MedianSlider
00046 //   <li> RFADiffMapBase
00047 // </prerequisite>
00048 //
00049 // <synopsis>
00050 // RFATimeMedian computes a sliding median of some quantity (as established
00051 // in RFADiffMapbase) over time, per each channel. Deviation w/respect to
00052 // the median is passed to RFADiffBase for the actual flagging.
00053 // </synopsis>
00054 //
00055 // <todo asof="2001/04/16">
00056 //   <li> add this feature
00057 //   <li> fix this bug
00058 //   <li> start discussion of this possible extension
00059 // </todo>
00060 
00061 class RFATimeMedian : public RFADiffMapBase
00062 {
00063 public:
00064   RFATimeMedian  ( RFChunkStats &ch,const RecordInterface &parm );
00065   virtual ~RFATimeMedian ();
00066 
00067   virtual Bool newChunk (Int &maxmem);
00068   virtual void endChunk ();
00069   virtual void startData (bool verbose);
00070   virtual IterMode iterTime (uInt itime);
00071   virtual IterMode iterRow  (uInt irow);
00072   virtual IterMode endData  ();
00073   virtual String getDesc ();
00074   static const RecordInterface & getDefaults ();
00075 
00076 protected:
00077   uInt itime;  
00078   MedianSlider & slider (uInt ich,uInt ifr);
00079 
00080   FlagCubeIterator flag_iter;
00081   
00082   uInt halfwin;
00083   MedianSlider *msl;
00084   
00085 };
00086 
00087 inline MedianSlider & RFATimeMedian::slider (uInt ich,uInt ifr)
00088 {
00089   return msl[ ifr*num(CHAN) + ich ];
00090 }
00091 
00092 
00093 // <summary>
00094 // RFAFreqMedian: RedFlagger Agent for clipping relative to median over frequency
00095 // </summary>
00096 
00097 // <use visibility=local>
00098 
00099 // <reviewed reviewer="" date="" tests="" demos="">
00100 // </reviewed>
00101 
00102 // <prerequisite>
00103 //   <li> MedianSlider
00104 //   <li> RFADiffMapBase
00105 // </prerequisite>
00106 //
00107 // <synopsis>
00108 // RFAFreqMedian computes a sliding median of some quantity (as established
00109 // in RFADiffMapbase) over frequency, per each row. Deviation w/respect to
00110 // the median is passed to RFADiffBase for the actual flagging.
00111 // </synopsis>
00112 //
00113 // <todo asof="2001/04/16">
00114 //   <li> add this feature
00115 //   <li> fix this bug
00116 //   <li> start discussion of this possible extension
00117 // </todo>
00118 
00119 class RFAFreqMedian : public RFADiffMapBase
00120 {
00121 public:
00122   RFAFreqMedian  ( RFChunkStats &ch,const RecordInterface &parm );
00123   virtual ~RFAFreqMedian () {};
00124 
00125   virtual Bool newChunk (Int &maxmem);
00126   virtual RFA::IterMode iterRow (uInt irow);
00127   virtual String getDesc ();
00128   static const RecordInterface & getDefaults ();
00129 
00130 protected:
00131   uInt halfwin;
00132 
00133 };
00134 
00135 
00136 } //# NAMESPACE CASA - END
00137 
00138 #endif