casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SkyModel.h
Go to the documentation of this file.
1 //# SkyModel.h: Definition for SkyModel
2 //# Copyright (C) 1996,1997,1998,1999,2000,2002
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 SYNTHESIS_SKYMODEL_H
30 #define SYNTHESIS_SKYMODEL_H
31 
32 #include <casa/aips.h>
37 #include <casa/BasicSL/String.h>
38 
39 namespace casa { //# NAMESPACE CASA - BEGIN
40 
41 //forward declarations
42 class SkyEquation;
43 
44 // <summary>
45 // Sky Model: Model the Sky Brightness for the SkyEquation
46 // </summary>
47 
48 // <use visibility=export>
49 
50 // <reviewed reviewer="" date="" tests="" demos="">
51 
52 // <prerequisite>
53 // <li> casacore::Matrix module
54 // <li> casacore::Vector module
55 // <li> MeasurementComponents module
56 // <li> VisSet module
57 // </prerequisite>
58 //
59 // <etymology>
60 // SkyModel describes an interface for Models to be used in
61 // the SkyEquation. It is an Abstract Base Class: most methods
62 // must be defined in derived classes.
63 // </etymology>
64 //
65 // <synopsis>
66 // A SkyModel contains a number of separate models. The interface to
67 // SkyEquation is via an image per model. SkyEquation uses this image to
68 // calculate Fourier transforms, etc. Some (most) SkyModels are
69 // solvable: the SkyEquation can be used by the SkyModel to return
70 // gradients with respect to itself (via the image interface). Thus
71 // for a SkyModel to solve for itself, it calls the SkyEquation
72 // methods to get gradients of chi-squared with respect to the
73 // image pixel values (thus returning an image: basically a residual
74 // image). The SkyModel then uses these gradients as appropriate to
75 // update itself.
76 //
77 // The following examples illustrate how a SkyModel can be
78 // used:
79 // <ul>
80 // <li> Simple cleaning: one model. The gradient gives the
81 // residual image. A special method gives a PSF.
82 // <li> Cleaning with visibility-based subtraction: one model. The
83 // gradient can be calculated as needed (using the SkyEquation)
84 // to produce the correct residual image.
85 // <li> Wide-field imaging: one model per patch of the sky
86 // that is to be imaged.
87 // <li> Non-coplanar baselines imaging: one model per facet of
88 // the polyhedron. At the end of processing all facets are combined
89 // into one overall image.
90 // <li> Mosaicing: one model per primary beam pointing. Each model
91 // is derived (as needed) by cutting out a patch from the full-field
92 // mosaic.
93 // </ul>
94 // </synopsis>
95 //
96 // <example>
97 // <srcblock>
98 // // Read the VisSet from disk
99 // VisSet vs("3c84.MS");
100 //
101 // // Create an ImageSkyModel from an image on disk
102 // ImageSkyModel ism(casacore::PagedImage<casacore::Float>("3c84.modelImage"));
103 //
104 // // Make an FTMachine: here we use a simple Grid and FT.
105 // GridFT ft;
106 //
107 // SkyEquation se(ism, vs, ft);
108 //
109 // // Predict the visibility set
110 // se.predict();
111 //
112 // // Make a Clean Image and write it out
113 // HogbomCleanImageSkyModel csm(ism);
114 // if (csm.solve()) {
115 // casacore::PagedImage<casacore::Float> cleanImage=csm.image(0);
116 // cleanImage.setName("3c84.cleanImage");
117 // }
118 //
119 // </srcblock>
120 // </example>
121 //
122 // <motivation>
123 // The properties of a model of the sky must be described
124 // for the SkyEquation.
125 // </motivation>
126 //
127 // <todo asof="97/10/01">
128 // <li> Multiple images in SkyModel
129 // <li> ComponentModel
130 // </todo>
131 
132 class SkyModel : public Iterate {
133 
134 public:
135 
136  enum PolRep {
139  };
140 
142 
143  // Number of models contained
144  virtual casacore::Int numberOfModels() = 0;
145 
146  // MFS : Number of taylor terms per model
147  virtual casacore::Int numberOfTaylorTerms() = 0;
148 
149  // MFS : Reference Frequency
151 
152  // MFS : Index of Taylor term in array of nmodels x ntaylorterms
153  virtual casacore::Int getTaylorIndex(casacore::Int index=0) = 0;
154 
155  // Is this SkyModel solveable?
156  virtual casacore::Bool isSolveable(casacore::Int model=0) = 0;
157 
158  // Is there a flux scale image associated with this model?
159  virtual casacore::Bool doFluxScale(casacore::Int model=0) = 0;
160 
161  // Initialize for gradient search
162  virtual void initializeGradients() = 0;
163 
164  // Finalize for gradient search
165  virtual void finalizeGradients() = 0;
166 
167  // Return the component list
168  virtual ComponentList& componentList() = 0;
169 
170  // Return the component list
171  virtual casacore::Bool hasComponentList() = 0;
172 
173  // Image interface for this model (casacore::Stokes representation)
175 
176  // Increment in the image
178 
179  // casacore::Complex image (needed for e.g. RR,RL,LR,LL)
181 
182  // casacore::Complex XFR
184  virtual casacore::Bool hasXFR(casacore::Int model=0) = 0;
185 
186  // PSF
188 
189  // Gradient of chi-squared wrt pixels
191 
192  // Grad Grad chi-squared wrt pixels (diagonal elements only)
194 
195  // FluxScale image: image * fluxScale => true brightness distribution
197 
198  // Work image
200 
201  // Add to Sum weights, Chi-Squared
202  virtual void addStatistics(casacore::Float sumwt, casacore::Float chisq) = 0;
203 
204  // Weight per model (channels, polarizations)
206 
207  // Solve for this SkyModel
208  virtual casacore::Bool solve (SkyEquation& se) = 0;
209 
210  // Is this model empty
211  virtual casacore::Bool isEmpty(casacore::Int model=0) = 0;
212 
213  virtual casacore::Int getModelIndex(casacore::uInt field=0, casacore::uInt taylor=0) = 0;
214 
215  //set Algorithm (e.g clean, mem, nnls)
216  void setAlgorithm(const casacore::String& alg) {itsAlgorithm = alg;}
217 
218  // get Algorithm
220 
221  // set Sub Algorithm
223 
224  // get Sub Algorithm
226 
227  // Set the imageregion that will be used for the next XFR generation
228  // <group>
230  // use the default shape
232  // </group>
233 
236 
237  //set and get memory usage model
238  virtual void setMemoryUse(casacore::Bool memuse)=0;
239  virtual casacore::Bool getMemoryUse()=0;
240 
241 protected:
244  // this casacore::ImageRegion is used to suggest the shape for the
245  // XFR. If null, then just use the shape of image(model)
248 
249 private:
250 };
251 
252 
253 } //# NAMESPACE CASA - END
254 
255 #endif
virtual void finalizeGradients()=0
Finalize for gradient search.
virtual casacore::Bool hasXFR(casacore::Int model=0)=0
int Int
Definition: aipstype.h:50
virtual casacore::ImageInterface< casacore::Float > & ggS(casacore::Int model=0)=0
Grad Grad chi-squared wrt pixels (diagonal elements only)
casacore::Bool isImageNormalized()
Definition: SkyModel.h:235
void setAlgorithm(const casacore::String &alg)
set Algorithm (e.g clean, mem, nnls)
Definition: SkyModel.h:216
const casacore::String getAlgorithm()
get Algorithm
Definition: SkyModel.h:219
virtual casacore::ImageInterface< casacore::Float > & deltaImage(casacore::Int model=0)=0
Increment in the image.
virtual casacore::Matrix< casacore::Float > & weight(casacore::Int model=0)=0
Weight per model (channels, polarizations)
virtual casacore::ImageInterface< casacore::Float > & fluxScale(casacore::Int model=0)=0
FluxScale image: image * fluxScale =&gt; true brightness distribution.
virtual ComponentList & componentList()=0
Return the component list.
virtual void initializeGradients()=0
Initialize for gradient search.
virtual casacore::ImageInterface< casacore::Float > & work(casacore::Int model=0)=0
Work image.
virtual casacore::Bool hasComponentList()=0
Return the component list.
virtual casacore::ImageInterface< casacore::Float > & gS(casacore::Int model=0)=0
Gradient of chi-squared wrt pixels.
virtual casacore::Int numberOfModels()=0
Number of models contained.
virtual void addStatistics(casacore::Float sumwt, casacore::Float chisq)=0
Add to Sum weights, Chi-Squared.
casacore::String itsAlgorithm
Definition: SkyModel.h:242
virtual void setMemoryUse(casacore::Bool memuse)=0
set and get memory usage model
virtual casacore::Bool solve(SkyEquation &se)=0
Solve for this SkyModel.
double Double
Definition: aipstype.h:55
virtual casacore::Double getReferenceFrequency()=0
MFS : Reference Frequency.
casacore::String itsSubAlgorithm
Definition: SkyModel.h:243
virtual casacore::ImageInterface< casacore::Float > & PSF(casacore::Int model=0)=0
PSF.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Bool isSolveable(casacore::Int model=0)=0
Is this SkyModel solveable?
virtual casacore::Bool doFluxScale(casacore::Int model=0)=0
Is there a flux scale image associated with this model?
casacore::ImageRegion * imageRegion_p
this casacore::ImageRegion is used to suggest the shape for the XFR.
Definition: SkyModel.h:246
virtual casacore::Bool getMemoryUse()=0
float Float
Definition: aipstype.h:54
virtual casacore::ImageInterface< casacore::Complex > & cImage(casacore::Int model=0)=0
casacore::Complex image (needed for e.g.
void setImageRegion(casacore::ImageRegion &ir)
Set the imageregion that will be used for the next XFR generation.
Definition: SkyModel.h:229
virtual casacore::Int numberOfTaylorTerms()=0
MFS : Number of taylor terms per model.
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
virtual casacore::Int getModelIndex(casacore::uInt field=0, casacore::uInt taylor=0)=0
Sky Model: Model the Sky Brightness for the SkyEquation.
Definition: SkyModel.h:132
void unsetImageRegion()
use the default shape
Definition: SkyModel.h:231
void setSubAlgorithm(const casacore::String &alg)
set Sub Algorithm
Definition: SkyModel.h:222
virtual casacore::ImageInterface< casacore::Complex > & XFR(casacore::Int model=0, casacore::Int numXFR=0)=0
casacore::Complex XFR
void setImageNormalization(casacore::Bool val)
Definition: SkyModel.h:234
virtual casacore::Bool isEmpty(casacore::Int model=0)=0
Is this model empty.
A class for manipulating groups of components.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Base class for Iteration.
Definition: Iterate.h:40
casacore::Bool isImageNormalized_p
Definition: SkyModel.h:247
const casacore::String getSubAlgorithm()
get Sub Algorithm
Definition: SkyModel.h:225
virtual casacore::Int getTaylorIndex(casacore::Int index=0)=0
MFS : Index of Taylor term in array of nmodels x ntaylorterms.
virtual casacore::ImageInterface< casacore::Float > & image(casacore::Int model=0)=0
Image interface for this model (casacore::Stokes representation)
unsigned int uInt
Definition: aipstype.h:51