casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalSet.h
Go to the documentation of this file.
1 //# CalSet.h: Definition for Calibration parameter cache
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
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 
28 #ifndef CALTABLES_CALSET_H
29 #define CALTABLES_CALSET_H
30 #include <casa/aips.h>
31 #include <casa/BasicSL/Constants.h>
32 #include <casa/BasicSL/Complex.h>
33 #include <casa/Arrays.h>
34 #include <casa/OS/File.h>
36 #include <casa/Logging/LogSink.h>
41 //#include <synthesis/CalTables/BaseCalSet.h>
42 
43 // #include <synthesis/MeasurementComponents/VisJones.h>
44 // #include <synthesis/MeasurementEquations/VisEquation.h>
45 
46 namespace casa { //# NAMESPACE CASA - BEGIN
47 
48 
49 template<class T>
50 class CalSet
51 {
52 public:
53 
54  // Null ctor does nothing
55  CalSet() {};
56 
57  // Minimal, knows only how many potential spws
58  // (solve context)
59  CalSet(const casacore::Int& nSpw);
60 
61  // From full shape
62  CalSet(const casacore::Int& nSpw,
63  const casacore::Int& nPar,
65  const casacore::Int& nElem,
67 
68 
69  // From existing CalTable
70  // (apply context)
71  // (for now, we will verify that filled solutions match nPar,nElem,nSpw)
72  CalSet(const casacore::String& calTableName,
73  const casacore::String& select,
74  const casacore::Int& nSpw,
75  const casacore::Int& nPar,
76  const casacore::Int& nElem);
77 
78  // Copy
79  CalSet(const CalSet& other);
80 
81  // Assignment
82  // virtual CalSet& operator=(const CalSet& other);
83 
84  // Destructor
85  virtual ~CalSet();
86 
87  // Resize caches
88  void resize(const casacore::Int& nPar,
90  const casacore::Int& nElem,
92 
93  // Access to shape info:
94  casacore::Int& nSpw() { return nSpw_; };
95  casacore::Int& nPar() { return nPar_; };
97  casacore::Int& nChan(const casacore::Int& spw) { return nChan_(spw); };
98  casacore::Int& nElem() { return nElem_; };
100  casacore::Int& nTime(const casacore::Int& spw) { return nTime_(spw); };
101 
102  // casacore::IPosition& shape(const casacore::Int& spw) { return casacore::IPosition(4,nPar(),nChan(spw),nElem(),nTime(spw)); };
104 
105  // Set up spwOK according to solution availability
106  inline void setSpwOK() { spwOK_ = (nTime()!=0); };
107 
108  // Report if solutions available for specified spw
110 
111  // Freq list per spw
113 
114  // Temporary method to support current conventions in SVJ
117 
118  // Access to whole solution caches
125  casacore::Array<T>& par(const casacore::Int& spw) { return *par_[spw]; };
129 
130  // Statistics
131  // casacore::Matrix<casacore::Bool>& iSolutionOK(const casacore::Int& spw) { return *iSolutionOK_[spw]; };
135  casacore::Vector<casacore::Float>& fit(const casacore::Int& spw) { return *fit_[spw]; };
137 
138  // Store/Retrieve solutions to/from a table.
139  // (will evolve to use table iteration)
140  virtual void initCalTableDesc(const casacore::String& type, const casacore::Int& parType);
141  virtual void attach();
142  virtual void store(const casacore::String& file, const casacore::String& type, const casacore::Bool& append,
143  const casacore::String& msname="");
144 // virtual void store(const casacore::String& file, const casacore::String& type,
145 // const casacore::String& msname, const casacore::Bool& append);
146  virtual void load(const casacore::String& file, const casacore::String& select);
147 
148 protected:
149 
150 
151 private:
152 
153  // new/delete of cache
154  void inflate();
155  void deflate();
156 
157 
158  // casacore::Table name
160 
161  // Number of Spectral windows
163 
164  // Number of parameters describing this calibration component
166 
167  // Number of channels
168  casacore::Vector<casacore::Int> nChan_; // (nSpw_) number of _soln_ channels per spw
169 
170  // Number of elements (ants or baselines)
172 
173  // Number of time slots
174  casacore::Vector<casacore::Int> nTime_; // (nSpw_) number of slots per spw
175 
176  // Spw OK?
178 
179  // Channel frequencies, etc.
180  casacore::Vector<casacore::Int> startChan_; // (nSpw_) start data channel per spw
182 
183  // Per spw, per slot Meta information
190 
191  // Per spw, per channel, per element, per slot solution generic PARAMETER storage
192  casacore::PtrBlock<casacore::Array<T>*> par_; // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
193  casacore::PtrBlock<casacore::Array<casacore::Bool>*> parOK_; // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
194  casacore::PtrBlock<casacore::Array<casacore::Float>*> parErr_; // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
195  casacore::PtrBlock<casacore::Array<casacore::Float>*> parSNR_; // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
196 
197  // Statistics
198  // casacore::PtrBlock<casacore::Matrix<casacore::Bool>*> iSolutionOK_; // [nSpw_](nElem_,nSlots_)
201 
205 
208 
212 
213 };
214 
215 // Globals
216 
217 // casacore::Smooth the solutions in a CalSet
219  const casacore::String& smtype,
220  const casacore::Double& smtime,
222 
223 } //# NAMESPACE CASA - END
224 
225 #ifndef AIPS_NO_TEMPLATE_SRC
226 #include <synthesis/CalTables/CalSet.tcc>
227 #endif
228 
229 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::Array< casacore::Bool > & parOK(const casacore::Int &spw)
Definition: CalSet.h:126
casacore::Int & nTime(const casacore::Int &spw)
Definition: CalSet.h:100
CalTableDesc2 * calTabDesc_
Definition: CalSet.h:207
int Int
Definition: aipstype.h:50
casacore::Array< casacore::Float > & parErr(const casacore::Int &spw)
Definition: CalSet.h:127
casacore::PtrBlock< casacore::Vector< casacore::Int > * > fieldId_
Definition: CalSet.h:187
CalSet()
Null ctor does nothing.
Definition: CalSet.h:55
virtual void load(const casacore::String &file, const casacore::String &select)
virtual void store(const casacore::String&amp; file, const casacore::String&amp; type, const casacore::String...
casacore::Array< casacore::Float > & parSNR(const casacore::Int &spw)
Definition: CalSet.h:128
void resize(const casacore::Int &nPar, const casacore::Vector< casacore::Int > &nChan, const casacore::Int &nElem, const casacore::Vector< casacore::Int > &nTime)
Resize caches.
casacore::Vector< casacore::String > & sourceName(const casacore::Int &spw)
Definition: CalSet.h:124
casacore::PtrBlock< casacore::Vector< casacore::String > * > sourceName_
Definition: CalSet.h:189
virtual Type type()
Return the type enum.
SolvableCalSetMCol: RW SolvableCalSet cal_main column access.
casacore::Vector< casacore::Int > & fieldId(const casacore::Int &spw)
Definition: CalSet.h:122
casacore::Array< T > & par(const casacore::Int &spw)
Definition: CalSet.h:125
casacore::PtrBlock< casacore::Vector< casacore::Double > * > MJDTimeStamp_
Definition: CalSet.h:186
casacore::PtrBlock< casacore::Array< casacore::Bool > * > parOK_
Definition: CalSet.h:193
CalTable: Calibration table access and creation.
Definition: CalTable2.h:81
casacore::Vector< casacore::Double > & startTime(const casacore::Int &spw)
Access to whole solution caches.
Definition: CalSet.h:119
casacore::PtrBlock< casacore::Vector< casacore::Double > * > MJDStart_
Per spw, per slot Meta information.
Definition: CalSet.h:184
casacore::Vector< casacore::Bool > & solutionOK(const casacore::Int &spw)
Definition: CalSet.h:134
void inflate()
new/delete of cache
casacore::Vector< casacore::String > & fieldName(const casacore::Int &spw)
Definition: CalSet.h:123
casacore::PtrBlock< casacore::Array< casacore::Float > * > parSNR_
Definition: CalSet.h:195
SolvableCalSetMCol< T > * svjmcol_
Definition: CalSet.h:211
casacore::Int & nChan(const casacore::Int &spw)
Definition: CalSet.h:97
casacore::PtrBlock< casacore::Vector< casacore::Float > * > fitwt_
Definition: CalSet.h:204
void deflate()
casacore::PtrBlock< casacore::Vector< casacore::String > * > fieldName_
Definition: CalSet.h:188
casacore::Vector< casacore::Int > & startChan()
Definition: CalSet.h:116
casacore::Vector< casacore::Double > & stopTime(const casacore::Int &spw)
Definition: CalSet.h:120
virtual void initCalTableDesc(const casacore::String &type, const casacore::Int &parType)
Store/Retrieve solutions to/from a table.
casacore::Vector< casacore::Int > startChan_
Channel frequencies, etc.
Definition: CalSet.h:180
casacore::PtrBlock< casacore::Vector< casacore::Double > * > MJDStop_
Definition: CalSet.h:185
casacore::Vector< casacore::Float > & fit(const casacore::Int &spw)
Definition: CalSet.h:135
casacore::Vector< casacore::Float > & fitwt(const casacore::Int &spw)
Definition: CalSet.h:136
casacore::Int & nSpw()
Access to shape info:
Definition: CalSet.h:94
void setStartChan(const casacore::Vector< casacore::Int > &startChan)
Temporary method to support current conventions in SVJ.
Definition: CalSet.h:115
casacore::Int nElem_
Number of elements (ants or baselines)
Definition: CalSet.h:171
double Double
Definition: aipstype.h:55
casacore::Int nSpw_
Number of Spectral windows.
Definition: CalSet.h:162
void smooth(CalSet< casacore::Complex > &cs, const casacore::String &smtype, const casacore::Double &smtime, casacore::Vector< casacore::Int > selfields)
Globals.
casacore::IPosition shape(const casacore::Int &spw)
casacore::IPosition&amp; shape(const casacore::Int&amp; spw) { return casacore::IPosition(4,nPar(),nChan(spw),nElem(),nTime(spw)); };
Definition: CalSet.h:103
virtual void attach()
casacore::Vector< casacore::Int > nChan_
Number of channels.
Definition: CalSet.h:168
casacore::Int nPar_
Number of parameters describing this calibration component.
Definition: CalSet.h:165
casacore::Vector< casacore::Int > & nChan()
Definition: CalSet.h:96
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::String calTableName_
casacore::Table name
Definition: CalSet.h:159
casacore::PtrBlock< casacore::Array< T > * > par_
Per spw, per channel, per element, per slot solution generic PARAMETER storage.
Definition: CalSet.h:192
casacore::PtrBlock< casacore::Matrix< casacore::Float > * > iFitwt_
Definition: CalSet.h:200
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
casacore::Matrix< casacore::Float > & iFitwt(const casacore::Int &spw)
Definition: CalSet.h:133
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
casacore::PtrBlock< casacore::Matrix< casacore::Float > * > iFit_
Statistics casacore::PtrBlock&lt;casacore::Matrix&lt;casacore::Bool&gt;*&gt; iSolutionOK_; // [nSpw_](nElem_...
Definition: CalSet.h:199
casacore::Int & nPar()
Definition: CalSet.h:95
virtual ~CalSet()
Assignment virtual CalSet&amp; operator=(const CalSet&amp; other);.
casacore::Vector< casacore::Bool > spwOK()
Report if solutions available for specified spw.
Definition: CalSet.h:109
casacore::Vector< casacore::Int > & nTime()
Definition: CalSet.h:99
casacore::Vector< casacore::Double > & frequencies(const casacore::Int &spw)
Freq list per spw.
Definition: CalSet.h:112
void setSpwOK()
Set up spwOK according to solution availability.
Definition: CalSet.h:106
casacore::LogSink & logSink()
Definition: CalSet.h:207
casacore::PtrBlock< casacore::Vector< casacore::Bool > * > solutionOK_
Definition: CalSet.h:202
casacore::PtrBlock< casacore::Array< casacore::Float > * > parErr_
Definition: CalSet.h:194
Distribute LogMessages to their destination(s)
Definition: LogSink.h:141
virtual void store(const casacore::String &file, const casacore::String &type, const casacore::Bool &append, const casacore::String &msname="")
casacore::PtrBlock< casacore::Vector< casacore::Float > * > fit_
Definition: CalSet.h:203
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Matrix< casacore::Float > & iFit(const casacore::Int &spw)
Statistics casacore::Matrix&lt;casacore::Bool&gt;&amp; iSolutionOK(const casacore::Int&amp; spw) { return *iSolutio...
Definition: CalSet.h:132
casacore::LogSink logSink_p
Definition: CalSet.h:206
CalTable2 * calTab_
Definition: CalSet.h:210
casacore::Int & nElem()
Definition: CalSet.h:98
casacore::Vector< casacore::Bool > spwOK_
Spw OK?
Definition: CalSet.h:177
casacore::Vector< casacore::Double > & time(const casacore::Int &spw)
Definition: CalSet.h:121
casacore::Vector< casacore::Int > nTime_
Number of time slots.
Definition: CalSet.h:174
casacore::PtrBlock< casacore::Vector< casacore::Double > * > freq_
Definition: CalSet.h:181
CalTableDesc: Define the format of calibration tables.
Definition: CalTableDesc2.h:84
Defines nreal time structures used by the VLA table filler.
Definition: nreal.h:100