casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RFANewMedianClip.h
Go to the documentation of this file.
00001 //# RFANewMedianClip.h: this defines RFANewMedianClip
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_RFANEWMEDIANCLIP_H
00028 #define FLAGGING_RFANEWMEDIANCLIP_H
00029 
00030 #include <flagging/Flagging/RFAFlagCubeBase.h> 
00031 #include <flagging/Flagging/RFDataMapper.h> 
00032 #include <flagging/Flagging/RFFlagCube.h> 
00033 #include <flagging/Flagging/RFFloatLattice.h> 
00034 #include <flagging/Flagging/RFRowClipper.h> 
00035 #include <scimath/Mathematics/MedianSlider.h> 
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 // <summary>
00040 // RFANewMedianClip:RedFlagger Agent;clips relative to median over time slots
00041 // </summary>
00042 
00043 // <use visibility=local>
00044 
00045 // <reviewed reviewer="" date="" tests="" demos="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> MedianSlider
00050 //   <li> RFAFlagCubeBase
00051 // </prerequisite>
00052 //
00053 // <synopsis>
00054 // RFANewMedianClip computes a median of some quantity over time slots, 
00055 // per each channel. Deviation w/respect to the median is computed for 
00056 // the actual flagging.
00057 // </synopsis>
00058 //
00059 // <todo asof="2004/04/21">
00060 //   <li> add this feature
00061 //   <li> fix this bug
00062 //   <li> start discussion of this possible extension
00063 // </todo>
00064 
00065 class RFANewMedianClip : public RFAFlagCubeBase, public RFDataMapper
00066 {
00067 public:
00068   RFANewMedianClip  ( RFChunkStats &ch, const RecordInterface &parm );
00069   virtual ~RFANewMedianClip ();
00070 
00071   virtual uInt estimateMemoryUse ();
00072   virtual Bool newChunk (Int &maxmem);
00073   virtual void endChunk ();
00074   virtual void startData (bool verbose);
00075   virtual void startDry (bool verbose); // add
00076   virtual IterMode iterTime (uInt itime);
00077   virtual IterMode iterRow  (uInt irow);
00078   virtual IterMode iterDry  (uInt it);
00079   virtual IterMode endData  ();
00080   virtual IterMode endDry  ();
00081  
00082   virtual String getDesc ();
00083   static const RecordInterface & getDefaults ();
00084 
00085 protected:
00086   MedianSlider & slider (uInt ich,uInt ifr);
00087   MedianSlider globalmed;
00088 
00089   FlagCubeIterator * pflagiter; 
00090   FlagCubeIterator flag_iter;
00091   Double  threshold;  
00092 
00093   MedianSlider * msl;
00094 
00095   // lattice of evaluated values [NCH,NIFR,NTIME]
00096   RFFloatLattice evalue;
00097   // matrix of standard deviation [NCH,NIFR]
00098   Matrix<Float> stdev;
00099   Bool stdeved;
00100   Double globalsigma;
00101 };
00102 
00103 
00104 inline MedianSlider & RFANewMedianClip::slider (uInt ich,uInt ifr)
00105 {
00106   return msl[ ifr*num(CHAN) + ich ];
00107 }
00108 
00109 
00110 } //# NAMESPACE CASA - END
00111 
00112 #endif