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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/BasicMath/Random.h>
34#include <casacore/casa/BasicSL/Complex.h>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# Forward Declarations
39
40template <class T> class MaskedLattice;
41template <class T> class Lattice;
42
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
76//# <todo asof="yyyy/mm/dd">
77//# </todo>
78
80{
81public:
82// Default constructor
84
85// Constructor. An exception will occur if we cannot generate
86// the distribution (e.g. illegal parameters). seed1 and seed2
87 // are used to seed the MLCG object.
89 Random::Types type,
90 const Vector<Double>& parameters,
91 Int seed1=0, Int seed2=1
92 );
93
94// Copy constructor (copy semantics)
96
97// Assignment (copy semantics)
99
100// Destructor
102
103// Set a new distribution. An exception will occur if we cannot generate
104// the distribution (e.g. illegal parameters).
105 void set (Random::Types type,
106 const Vector<Double>& parameters);
107
108// Add noise of given type to lattice. For complex types, the
109// noise is added to real and imaginary separately.
110// Any mask is ignored when adding the noise. I.e.
111// noise is added to masked pixels.
112// <group>
113 template <class T> void add (Lattice<T>& lattice);
114 template <class T> void add (MaskedLattice<T>& lattice);
115// </group>
116private:
117
122
123// Add noise to array. For Complex, noise is added to
124// real and imaginary separately.
125// <group>
130// </group>
131
132// Make noise generator
134};
135
136
137} //# NAMESPACE CASACORE - END
138
139#ifndef CASACORE_NO_AUTO_TEMPLATES
140#include <casacore/lattices/LatticeMath/LatticeAddNoise2.tcc>
141#endif //# CASACORE_NO_AUTO_TEMPLATES
142
143#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:304
Base class for random number distributions.
Definition Random.h:424
Types
This enumerator lists all the predefined random number distributions.
Definition Random.h:428
this file contains all the compiler specific defines
Definition mainpage.dox:28
int Int
Definition aipstype.h:48