00001 //# MSSelUtil2.h: templated helper function for MSSelector 00002 //# Copyright (C) 1997,1999,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 //# 00027 //# $Id: HostInfoDarwin.h 21521 2014-12-10 08:06:42Z gervandiepen $ 00028 00029 #ifndef MS_MSSELUTIL2_H 00030 #define MS_MSSELUTIL2_H 00031 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/casa/Arrays/Matrix.h> 00034 #include <casacore/casa/BasicSL/Complex.h> 00035 00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00037 template <class T> class MSSelUtil2 00038 { 00039 public: 00040 // reorder data from 3d (corr,chan,row) to 4d (corr,chan,ifr,time) 00041 static void reorderData(Array<T>& data, 00042 const Vector<Int>& ifrSlot, 00043 Int nIfr, 00044 const Vector<Int>& timeSlot, 00045 Int nTime, 00046 const T& defvalue); 00047 00048 // reorder data from 4d (corr,chan,ifr,time) to 3d (corr,chan,row) 00049 static void reorderData(Array<T>& data, 00050 const Matrix<Int>& rowIndex, 00051 Int nRow); 00052 00053 // average data (with flags & weights applied) over it's last axis (time or 00054 // row), return in data (overwritten), dataFlag gives new flags. 00055 static void timeAverage(Array<Bool>& dataFlag, Array<T>& data, 00056 const Array<Bool>& flag, const Array<Float>& weight); 00057 00058 }; 00059 } //# NAMESPACE CASACORE - END 00060 00061 #ifndef CASACORE_NO_AUTO_TEMPLATES 00062 #include <casacore/ms/MSSel/MSSelUtil2.tcc> 00063 #endif //# CASACORE_NO_AUTO_TEMPLATES 00064 #endif