casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeAddNoise.h
Go to the documentation of this file.
1 //# LatticeAddNoise.h: add noise to a Lattice
2 //# Copyright (C) 1997,1998,1999,2000,2001
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 addressed 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: LatticeAddNoise.h 21549 2015-01-28 10:01:12Z gervandiepen $
28 
29 #ifndef LATTICES_LATTICEADDNOISE_H
30 #define LATTICES_LATTICEADDNOISE_H
31 
32 
33 //# Includes
34 #include <casacore/casa/aips.h>
37 
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# Forward Declarations
42 
43 template <class T> class MaskedLattice;
44 template <class T> class Lattice;
45 
46 
47 // <summary>
48 // Add noise from specified distribution to a lattice
49 // </summary>
50 
51 // <use visibility=export>
52 
53 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
54 // </reviewed>
55 
56 // <prerequisite>
57 // <li> <linkto class="Lattice">Lattice</linkto>
58 // <li> <linkto class="Random">Random</linkto>
59 // </prerequisite>
60 
61 // <synopsis>
62 // This class allows you to add noise from one of many enumerated
63 // types to a Lattice. If the Lattice is Complex, then the noise
64 // is added to real and imaginary separately.
65 // </synopsis>
66 
67 // <example>
68 // <srcblock>
69 // Vector<Double> pars(2):
70 // pars(0) = 0.5; // Mean
71 // pars(1) = 0.2; // Variance
72 // LatticeAddNoise lan(Random::NORMAL, pars);
73 // ArrayLattice<Float> lat(IPosition(2,100,100));
74 // lan.add(lat);
75 // </srcblock>
76 // </example>
77 
78 
79 //# <todo asof="yyyy/mm/dd">
80 //# </todo>
81 
83 {
84 public:
85 // Default constructor
87 
88 // Constructor. An exception will occur if we cannot generate
89 // the distribution (e.g. illegal parameters). seed1 and seed2
90  // are used to seed the MLCG object.
93  const Vector<Double>& parameters,
94  Int seed1=0, Int seed2=1
95  );
96 
97 // Copy constructor (copy semantics)
98  LatticeAddNoise (const LatticeAddNoise& other);
99 
100 // Assignment (copy semantics)
102 
103 // Destructor
105 
106 // Set a new distribution. An exception will occur if we cannot generate
107 // the distribution (e.g. illegal parameters).
108  void set (Random::Types type,
109  const Vector<Double>& parameters);
110 
111 // Add noise of given type to lattice. For complex types, the
112 // noise is added to real and imaginary separately.
113 // Any mask is ignored when adding the noise. I.e.
114 // noise is added to masked pixels.
115 // <group>
116  template <class T> void add (Lattice<T>& lattice);
117  template <class T> void add (MaskedLattice<T>& lattice);
118 // </group>
119 private:
120 
125 
126 // Add noise to array. For Complex, noise is added to
127 // real and imaginary separately.
128 // <group>
133 // </group>
134 
135 // Make noise generator
136  void makeDistribution ();
137 };
138 
139 
140 } //# NAMESPACE CASACORE - END
141 
142 #ifndef CASACORE_NO_AUTO_TEMPLATES
143 #include <casacore/lattices/LatticeMath/LatticeAddNoise2.tcc>
144 #endif //# CASACORE_NO_AUTO_TEMPLATES
145 
146 #endif
int Int
Definition: aipstype.h:50
void makeDistribution()
Make noise generator.
~LatticeAddNoise()
Destructor.
void set(Random::Types type, const Vector< Double > &parameters)
Set a new distribution.
Types
This enumerator lists all the predefined random number distributions.
Definition: Random.h:429
void add(Lattice< T > &lattice)
Add noise of given type to lattice.
A templated, abstract base class for array-like objects with masks.
virtual casacore::String type() const
Implements RegionShape::type.
Definition: RegionShapes.h:548
Base class for random number distributions.
Definition: Random.h:425
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
LatticeAddNoise()
Default constructor.
void addNoiseToArray(Array< Float > &data)
Add noise to array.
A templated, abstract base class for array-like objects.
LatticeAddNoise & operator=(const LatticeAddNoise &other)
Assignment (copy semantics)
Vector< Double > itsParameters
Add noise from specified distribution to a lattice.
Multiplicative linear congruential generator.
Definition: Random.h:305
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42