Line data Source code
1 : // -*- C++ -*-
2 : //# ConvFuncDiskCache.cc: Definition of the ConvFuncDiskCache class
3 : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
4 : //# Associated Universities, Inc. Washington DC, USA.
5 : //#
6 : //# This library is free software; you can redistribute it and/or modify it
7 : //# under the terms of the GNU Library General Public License as published by
8 : //# the Free Software Foundation; either version 2 of the License, or (at your
9 : //# option) any later version.
10 : //#
11 : //# This library is distributed in the hope that it will be useful, but WITHOUT
12 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 : //# License for more details.
15 : //#
16 : //# You should have received a copy of the GNU Library General Public License
17 : //# along with this library; if not, write to the Free Software Foundation,
18 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 : //#
20 : //# Correspondence concerning AIPS++ should be addressed as follows:
21 : //# Internet email: aips2-request@nrao.edu.
22 : //# Postal address: AIPS++ Project Office
23 : //# National Radio Astronomy Observatory
24 : //# 520 Edgemont Road
25 : //# Charlottesville, VA 22903-2475 USA
26 : //#
27 : //# $Id$
28 : #ifndef SYNTHESIS_CONVFUNCDISKCACHE_H
29 : #define SYNTHESIS_CONVFUNCDISKCACHE_H
30 :
31 : #include <casacore/casa/Arrays/Matrix.h>
32 : #include <msvis/MSVis/VisBuffer.h>
33 : #include <casacore/images/Images/ImageInterface.h>
34 : #include <casacore/images/Images/PagedImage.h>
35 : #include <casacore/casa/Arrays/Array.h>
36 : #include <casacore/casa/Arrays/Vector.h>
37 : #include <casacore/lattices/Lattices/LatticeCache.h>
38 : #include <casacore/lattices/Lattices/ArrayLattice.h>
39 : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h>
40 : #include <synthesis/TransformMachines/VPSkyJones.h>
41 : // Apparently not required here? (gmoellen 06Nov20)
42 : //#include <synthesis/MeasurementComponents/EPTimeVarVisJones.h>
43 : #include <synthesis/TransformMachines/Utils.h>
44 : namespace casa { //# NAMESPACE CASA - BEGIN
45 : // <summary>
46 : //
47 : // An object to manage the caches of pre-computed convolution
48 : // functions on the disk and in the memory.
49 : //
50 : // </summary>
51 :
52 : // <use visibility=export>
53 :
54 : // <reviewed reviewer="" date="" tests="" demos="">
55 :
56 : // <prerequisite>
57 : // No pre-requisites.
58 : // </prerequisite>
59 : //
60 : // <etymology>
61 : //
62 : // ConvFuncDiskCache is an object, to write convolution
63 : // functions from the memory cache to the disk cache, and
64 : // search/load the disk cache for convolution functions for a give
65 : // Parallactic Angle.
66 : //
67 : //</etymology>
68 : //
69 : // <synopsis>
70 : //
71 : // FTMachines uses pre-computed convolution functions for gridding
72 : // (FTMachine::put()) and prediction (FTMachine::get()). For
73 : // <linkto class=PBWProjectFT>PBWProjectFT</linkto>, the convolution
74 : // function computation is expensive. Once computed, it is
75 : // efficient to cache these functions as a function of Parallactic
76 : // Angle and the value of the w-term (if significant).
77 : //
78 : // ConvFuncDiskCache class provides interface to the disk cache and
79 : // is used in <linkto class=PBWProjectFT>PBWProjectFT</linkto> to
80 : // search and load convolution functions from the disk. If a new
81 : // convolution function is computed in <linkto
82 : // class=PBWProjectFT>PBWProjectFT</linkto>, the disk cache is
83 : // updated using the services of this class as well.
84 : //
85 : // </synopsis>
86 : //
87 : // <example>
88 : // </example>
89 : //
90 : // <motivation>
91 : //
92 : // Factor out the code for managing convolution function caches
93 : // (memory and disk caches) from the FTMachine code. This is a
94 : // specialized service, and has nothing to do with the details of
95 : // gridding and prediction of visibilities (which is the function of
96 : // FTMachines).
97 : //
98 : // </motivation>
99 : //
100 : // <todo asof="2005/07/21">
101 : //
102 : // <ul> Generalize to handle convolution functions for inhomogeneous
103 : // arrays and multi-feed antennas.
104 : //
105 : // </todo>
106 :
107 : class ConvFuncDiskCache
108 : {
109 : public:
110 0 : ConvFuncDiskCache():paList(),XSup(),YSup(), cfPrefix("CF"), aux("aux.dat") {};
111 : ConvFuncDiskCache& operator=(const ConvFuncDiskCache& other);
112 0 : ~ConvFuncDiskCache() {};
113 0 : void setCacheDir(const char *dir) {Dir = dir;}
114 : void initCache();
115 : void cacheConvFunction(casacore::Int which, casacore::Float pa, casacore::Array<casacore::Complex>& cf, casacore::CoordinateSystem& coords,
116 : casacore::CoordinateSystem& ftcoords, casacore::Int& convSize, casacore::Cube<casacore::Int>& convSupport,
117 : casacore::Float convSampling, casacore::String nameQualifier="",casacore::Bool savePA=true);
118 : void cacheWeightsFunction(casacore::Int which, casacore::Float pa, casacore::Array<casacore::Complex>& cfWt, casacore::CoordinateSystem& coords,
119 : casacore::Int& convSize, casacore::Cube<casacore::Int>& convSupport, casacore::Float convSampling);
120 : casacore::Bool searchConvFunction(const VisBuffer& vb, VPSkyJones& vpSJ, casacore::Int& which, casacore::Float &pa);
121 : casacore::Bool searchConvFunction(const VisBuffer& vb, ParAngleChangeDetector& vpSJ,
122 : casacore::Int& which, casacore::Float &pa);
123 : casacore::Bool loadConvFunction(casacore::Int where, casacore::Int Nx, casacore::PtrBlock < casacore::Array<casacore::Complex> *> & convFuncCache,
124 : casacore::Cube<casacore::Int> &convSupport, casacore::Vector<casacore::Float>& convSampling,
125 : casacore::Double& cfRefFreq,casacore::CoordinateSystem& coordys, casacore::String prefix="/CF");
126 : void finalize();
127 : void finalize(casacore::ImageInterface<casacore::Float>& avgPB);
128 : void loadAvgPB(casacore::ImageInterface<casacore::Float>& avgPB);
129 : private:
130 : casacore::Vector<casacore::Float> paList, Sampling;
131 : casacore::Cube<casacore::Int> XSup, YSup;
132 : casacore::String Dir, cfPrefix, aux;
133 : };
134 : }
135 :
136 : #endif
|