casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef LATTICES_LATTICEADDNOISE_H
27#define LATTICES_LATTICEADDNOISE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/BasicMath/Random.h>
33#include <casacore/casa/BasicSL/Complex.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38
39template <class T>
40class MaskedLattice;
41template <class T>
42class Lattice;
43
44// <summary>
45// Add noise from specified distribution to a lattice
46// </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
51// </reviewed>
52
53// <prerequisite>
54// <li> <linkto class="Lattice">Lattice</linkto>
55// <li> <linkto class="Random">Random</linkto>
56// </prerequisite>
57
58// <synopsis>
59// This class allows you to add noise from one of many enumerated
60// types to a Lattice. If the Lattice is Complex, then the noise
61// is added to real and imaginary separately.
62// </synopsis>
63
64// <example>
65// <srcblock>
66// Vector<Double> pars(2):
67// pars(0) = 0.5; // Mean
68// pars(1) = 0.2; // Variance
69// LatticeAddNoise lan(Random::NORMAL, pars);
70// ArrayLattice<Float> lat(IPosition(2,100,100));
71// lan.add(lat);
72// </srcblock>
73// </example>
74
75// # <todo asof="yyyy/mm/dd">
76// # </todo>
77
79 public:
80 // Default constructor
82
83 // Constructor. An exception will occur if we cannot generate
84 // the distribution (e.g. illegal parameters). seed1 and seed2
85 // are used to seed the MLCG object.
86 LatticeAddNoise(Random::Types type, const Vector<Double>& parameters, Int seed1 = 0,
87 Int seed2 = 1);
88
89 // Copy constructor (copy semantics)
91
92 // Assignment (copy semantics)
94
95 // Destructor
97
98 // Set a new distribution. An exception will occur if we cannot generate
99 // the distribution (e.g. illegal parameters).
100 void set(Random::Types type, const Vector<Double>& parameters);
101
102 // Add noise of given type to lattice. For complex types, the
103 // noise is added to real and imaginary separately.
104 // Any mask is ignored when adding the noise. I.e.
105 // noise is added to masked pixels.
106 // <group>
107 template <class T>
108 void add(Lattice<T>& lattice);
109 template <class T>
110 void add(MaskedLattice<T>& lattice);
111 // </group>
112 private:
117
118 // Add noise to array. For Complex, noise is added to
119 // real and imaginary separately.
120 // <group>
125 // </group>
126
127 // Make noise generator
129};
130
131} // namespace casacore
132
133#ifndef CASACORE_NO_AUTO_TEMPLATES
134#include <casacore/lattices/LatticeMath/LatticeAddNoise2.tcc>
135#endif // # CASACORE_NO_AUTO_TEMPLATES
136
137#endif
void add(MaskedLattice< T > &lattice)
LatticeAddNoise()
Default constructor.
void makeDistribution()
Make noise generator.
Vector< Double > itsParameters
void addNoiseToArray(Array< Complex > &data)
LatticeAddNoise(const LatticeAddNoise &other)
Copy constructor (copy semantics).
LatticeAddNoise(Random::Types type, const Vector< Double > &parameters, Int seed1=0, Int seed2=1)
Constructor.
void add(Lattice< T > &lattice)
Add noise of given type to lattice.
void addNoiseToArray(Array< Double > &data)
void addNoiseToArray(Array< Float > &data)
Add noise to array.
void addNoiseToArray(Array< DComplex > &data)
LatticeAddNoise & operator=(const LatticeAddNoise &other)
Assignment (copy semantics).
void set(Random::Types type, const Vector< Double > &parameters)
Set a new distribution.
~LatticeAddNoise()
Destructor.
Multiplicative linear congruential generator.
Definition Random.h:303
Base class for random number distributions.
Definition Random.h:414
Types
This enumerator lists all the predefined random number distributions.
Definition Random.h:417
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
int Int
Definition aipstype.h:48