casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSUtil.h
Go to the documentation of this file.
1 //# MSUtil.h: Definitions for casacore::MS utilities
2 //# Copyright (C) 2011
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 adressed 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 //#
27 //# $Id$
28 
29 #ifndef MSVIS_MSUTIL_H
30 #define MSVIS_MSUTIL_H
31 #include <casa/aips.h>
35 namespace casa { //# NAMESPACE CASA - BEGIN
36 
37  class MSUtil{
38 
39  public:
40  //Empty Constructor if needed
41  MSUtil();
42  //This method gives you the channels (and spws) that will cover the
43  //freq range provided in the frame the user stated.
44  //The conversion from the data frame will be done properly for finding this
45  //spw, start, nchan will be resized appropriately
48  const casacore::MeasurementSet& ms,
49  const casacore::Double freqStart,
50  const casacore::Double freqEnd,
51  const casacore::Double freqStep,
53  const casacore::Int fieldId=0);
54 
55  //A version of the above for all the fields in the MS
58  const casacore::MeasurementSet& ms,
59  const casacore::Double freqStart,
60  const casacore::Double freqEnd,
61  const casacore::Double freqStep,
63  //Get the channel range in a spw and a given frequency range in given frame
65  casacore::Int& nchan,
66  const casacore::MeasurementSet& ms,
67  const casacore::Int spw,
68  const casacore::Double freqStart,
69  const casacore::Double freqEnd,
70  const casacore::Double freqStep,
72  // The following wil provide the range of frequency convered in the frame requested by the spw, channel selection
73 
75  casacore::Double& freqEnd,
79  const casacore::MeasurementSet& ms,
81  const casacore::Int fieldId=0, const casacore::Bool edge=true );
84  casacore::Double& freqEnd,
88  const casacore::MeasurementSet& ms,
90  const casacore::Bool edge=true );
91 
92  //if useFieldInMS=True fieldids are ignored
94  casacore::Double& freqEnd,
98  const casacore::MeasurementSet& ms,
99  const casacore::MFrequency::Types freqframe,
100  const casacore::Vector<casacore::Int>& fieldId, const casacore::Bool edge=true, const casacore::Bool useFieldsInMS=false );
101  //This version gets the range of frequency in SOURCE frame for an ephem source
102  //either trackDIr should be a known planet or ephemPath should not be an
103  //empty string. Also return a systemic velocity w.r.t TOPO at the closest time in
104  // the ms of the reference epoch provided
106  casacore::Double& freqEnd,
107  casacore::Quantity& sysvel,
108  const casacore::MEpoch& refEp,
110  const casacore::Vector<casacore::Int>& start,
111  const casacore::Vector<casacore::Int>& nchan,
112  const casacore::MeasurementSet& ms,
113 
114  const casacore::String& ephemPath=casacore::String(""),
116  const casacore::Bool fromEdge=true);
117 
118  //Return all the selected SPW types selected in the selected casacore::MS if the input ms
119  //is a reference MS. Else it will return all the types in the SPW table
121 
123  private:
125 
126  };
127 } //# NAMESPACE CASA - END
128 #endif
static void getSpwInFreqRange(casacore::Vector< casacore::Int > &spw, casacore::Vector< casacore::Int > &start, casacore::Vector< casacore::Int > &nchan, const casacore::MeasurementSet &ms, const casacore::Double freqStart, const casacore::Double freqEnd, const casacore::Double freqStep, const casacore::MFrequency::Types freqframe=casacore::MFrequency::LSRK, const casacore::Int fieldId=0)
This method gives you the channels (and spws) that will cover the freq range provided in the frame th...
A Measure: astronomical direction.
Definition: MDirection.h:174
static void rejectConsecutive(const casacore::Vector< casacore::Double > &t, casacore::Vector< casacore::Double > &retval, casacore::Vector< casacore::Int > &indx)
static void getChannelRangeFromFreqRange(casacore::Int &start, casacore::Int &nchan, const casacore::MeasurementSet &ms, const casacore::Int spw, const casacore::Double freqStart, const casacore::Double freqEnd, const casacore::Double freqStep, const casacore::MFrequency::Types freqframe=casacore::MFrequency::LSRK)
Get the channel range in a spw and a given frequency range in given frame.
int Int
Definition: aipstype.h:50
static void getIndexCombination(const casacore::ROMSColumns &mscol, casacore::Matrix< casacore::Int > &retval)
static casacore::Vector< casacore::String > getSpectralFrames(casacore::Vector< casacore::MFrequency::Types > &types, const casacore::MeasurementSet &ms)
Return all the selected SPW types selected in the selected casacore::MS if the input ms is a referenc...
static casacore::Bool getFreqRangeInSpw(casacore::Double &freqStart, casacore::Double &freqEnd, const casacore::Vector< casacore::Int > &spw, const casacore::Vector< casacore::Int > &start, const casacore::Vector< casacore::Int > &nchan, const casacore::MeasurementSet &ms, const casacore::MFrequency::Types freqframe=casacore::MFrequency::LSRK, const casacore::Int fieldId=0, const casacore::Bool edge=true)
The following wil provide the range of frequency convered in the frame requested by the spw...
A Measure: instant in time.
Definition: MEpoch.h:104
double Double
Definition: aipstype.h:55
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
static casacore::Bool getFreqRangeAndRefFreqShift(casacore::Double &freqStart, casacore::Double &freqEnd, casacore::Quantity &sysvel, const casacore::MEpoch &refEp, const casacore::Vector< casacore::Int > &spw, const casacore::Vector< casacore::Int > &start, const casacore::Vector< casacore::Int > &nchan, const casacore::MeasurementSet &ms, const casacore::String &ephemPath=casacore::String(""), const casacore::MDirection &trackDir=casacore::MDirection(casacore::MDirection::APP), const casacore::Bool fromEdge=true)
This version gets the range of frequency in SOURCE frame for an ephem source either trackDIr should b...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A Table intended to hold astronomical data (a set of Measurements).
String: the storage and methods of handling collections of characters.
Definition: String.h:223
MSUtil()
Empty Constructor if needed.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
static void getSpwInFreqRangeAllFields(casacore::Vector< casacore::Int > &spw, casacore::Vector< casacore::Int > &start, casacore::Vector< casacore::Int > &nchan, const casacore::MeasurementSet &ms, const casacore::Double freqStart, const casacore::Double freqEnd, const casacore::Double freqStep, const casacore::MFrequency::Types freqframe=casacore::MFrequency::LSRK)
A version of the above for all the fields in the MS.