NRAO Home > CASA > CASA Toolkit Reference Manual

1.1.1 Add noise to the image

Description

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.
• weibull – Specify two parameters, alpha and beta. It is required that the alpha parameter is not zero.

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 algorithm

seedBase = 1e7*MJD
seed[1] = (Int)seedBase;
# and if seed[0] is also not supplied
seed[0] = (Int)((1e7*(seedBase - seed[1])))

where MJD is the Modidfied Julian Day.

Arguments

 Inputs type Type of distribution, normal allowed: string Default: normal pars Parameters of distribution allowed: doubleArray Default: 0.0 1.0 region Region selection. See ”help par.region” for details. Default is to use the full image. allowed: any Default: variant zero Zero image first? allowed: bool Default: false seeds Seeds to use for the random number generator. If not specified, seeds are created based on the current time. allowed: intArray Default:
Returns
bool

Example

"""
ia.maketestimage()
ia.statistics()
ia.close()
"""

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).

__________________________________________________________________