|NRAO Home > CASA > CASA Toolkit Reference Manual||
image.addnoise - Function
1.1.1 Add noise to the image
This function adds noise to the image. You may zero the image first before the noise is added if you wish.
The noise can be drawn from one of many distributions.
For each distribution, you must supply the type via the type argument (minimum match is active) and parameters via the pars argument. Briefly:
- binomial – the binomial distribution models successfully drawing items from a pool. Specify two parameters, n and p, respectively. n is the number of items in the pool, and p, is the probability of each item being successfully drawn. It is required that n > 0 and 0 ≤ p ≤ 1.
- discreteuniform – models a uniform random variable over the closed interval. Specify two parameters, the low and high values, respectively. The low parameter is the lowest possible return value and the high parameter is the highest. It is required that low < high.
- erlang – Specify two parameters, the mean and variance, respectively. It is required that the mean is non-zero and the variance is positive.
- geometric – Specify one parameter, the probability. It is required that 0 ≤ probability < 1.
- hypergeometric – Specify two parameters, the mean and the variance. It is required that the variance is positive and that the mean is non-zero and not bigger than the square-root of the variance.
- normal – Specify two parameters, the mean and the variance. It is required that the variance is positive.
- lognormal – Specify two parameters, the mean and the variance. It is required that the supplied variance is positive and that the mean is non-zero.
- negativeexponential – Supply one parameter, the mean.
- poisson – Specify one parameter, the mean. It is required that the mean is non-negative.
- uniform – Model a uniform random variable over a closed interval. Specify two parameters, the low and high values. The low parameter is the lowest possible return value and the high parameter can never be returned. It is required that low < high.
The random number generator seeds may be specified as an array of integers. Only the first two values are used. If none or a single value is provided, the necessary remaining value(s) are generated based on the current time, using the algorithmseedBase = 1e7*MJD
seed = (Int)seedBase;
# and if seed is also not supplied
seed = (Int)((1e7*(seedBase - seed)))
where MJD is the Modidfied Julian Day.
Type of distribution, normal
Parameters of distribution
Region selection. See ”help par.region” for details. Default is to use the full image.
Zero image first?
Seeds to use for the random number generator. If not specified, seeds are created based on the current time.
ia.addnoise(type=’normal’, pars=[0.5, 1], zero=T, seeds=[1,2])
A test image is created, zeroed, and noise of mean 0.5 and variance 1
from a normal distribution added. Specifying the same combination of seeds
ensures the same random number sequence is created each time addnoise is called.
To have different sequences created during the same casapy session, use the default
value (which is an empty list).
More information about CASA may be found at the CASA web page
Copyright © 2016 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense