casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSContinuumSubtractor.h
Go to the documentation of this file.
00001 //# MSContinuumSubtractor.h: Fit & subtract continuum from spectral line data
00002 //# Copyright (C) 2004
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 //#
00028 #ifndef MS_MSCONTINUUMSUBTRACTOR_H
00029 #define MS_MSCONTINUUMSUBTRACTOR_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/BasicSL/String.h>
00033 #include <ms/MeasurementSets/MSColumns.h>
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class MeasurementSet;
00037 class LogIO;
00038 
00039 // <summary>Fits and subtracts or models the continuum in spectra</summary>
00040 // <use visibility=export>
00041 // 
00042 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00043 // </reviewed>
00044 // 
00045 // <prerequisite>
00046 //   <li> <linkto class=MeasurementSet>MeasurementSet</linkto>
00047 // </prerequisite>
00048 //
00049 // <etymology>
00050 // This class's main aim is to subtract the continuum from spectral line data.
00051 // </etymology>
00052 //
00053 // <synopsis>
00054 // Spectral line observations often contain continuum emission which is
00055 // present in all channels (often with small slope across band). This
00056 // class fits this continuum and subtracts it, replacing either the
00057 // corrected data or the model data column.
00058 // </synopsis>
00059 //
00060 // <example>
00061 // <srcBlock>
00062 //     MS inMS(fileName);
00063 //     MSContinuumSubtractor mssub(inMS);
00064 //     mssub.setDataDescriptionIds(ddIds);
00065 //     mssub.setFields(fieldIds);
00066 //     mssub.setSolutionInterval(10.0);
00067 //     mssub.setMode("subtract");
00068 //     mssub.subtract();
00069 // </srcBlock>
00070 // A <src>MSContinuumSubtractor</src> object is constructed 
00071 // and the continuum is subtracted with a 10.0s averaging time for the fit.
00072 // </example>
00073 //
00074 // <motivation>
00075 // This class replaces existing functionality at the glish level, in an
00076 // attempt to speed up the continuum subtraction process.
00077 // </motivation>
00078 //
00079 // <todo asof="">
00080 // </todo>
00081  
00082 
00083 class MSContinuumSubtractor
00084 {
00085 public:
00086 // Constructor
00087    MSContinuumSubtractor (MeasurementSet& ms);
00088 
00089 // Assignment (only copies reference to MS, need to reset selection etc)
00090   MSContinuumSubtractor& operator=(MSContinuumSubtractor& other);
00091 
00092 // Destructor
00093   ~MSContinuumSubtractor();
00094 
00095 // Set the required field Ids
00096    void setField(const String& field);
00097    void setFields(const Vector<Int>& fieldIds);
00098 
00099 // Set the channels to use in the fit
00100    void setFitSpw(const String& fitspw);
00101    void setSubSpw(const String& subspw);
00102 // Set the required spws (ddids)
00103    void setDataDescriptionIds(const Vector<Int>& ddIds);
00104 
00105 // Set the solution interval in seconds, the value zero implies scan averaging
00106    void setSolutionInterval(Float solInt);
00107 
00108 // Set the solution interval in seconds, the value zero implies scan averaging
00109    void setSolutionInterval(String solInt);
00110 
00111 // Set the order of the fit (1=linear)
00112    void setOrder(Int order);
00113 
00114 // Set the processing mode: subtract, model or replace
00115    void setMode(const String& mode);
00116 
00117 // Do the subtraction (or save the model)
00118    void subtract();
00119 
00120 private:
00121 // Pointer to MS
00122    MeasurementSet* ms_p;
00123 // DataDescription Ids to process
00124    Vector<Int> itsDDIds;
00125 // Field Ids to process
00126    Vector<Int> itsFieldIds;
00127 // Channels to use in fit
00128    Matrix<Int> itsFitChans;
00129 // Channels to subtract from
00130    Matrix<Int> itsSubChans;
00131 // Solution interval for fit
00132    Float itsSolInt;
00133 // Order of the fit
00134    Int itsOrder;
00135 // Processing mode
00136    String itsMode;
00137 // Number of spws
00138    Int nSpw_;
00139 
00140 
00141 };
00142 
00143 
00144 } //# NAMESPACE CASA - END
00145 
00146 #endif