# Difference between revisions of "Corrupting Observation simdata1"

(Created page with 'the descriptions on this page are rather anemic at the moment, so please read this [https://safe.nrao.edu/wiki/pub/ALMA/SimulatorCookbook/corruptguide.pdf pdf explanation of how …') |
(→Atmospheric Phase Noise) |
||

Line 37: | Line 37: | ||

− | <font color="red">old method, YMMV | + | <font color="red">old method, YMMV</font>: Rob Reid wrote a python script to add phase noise, |

− | + | [http://www.cv.nrao.edu/~rreid/ppdisksims/noisify_alma.py noisify_alma.py]. noisify_alma gets its parameters from the ALMA specifications where it can, and an approximate Komolgorov model of the atmosphere such that the phase difference | |

between two antennas increases with baseline length.<br> | between two antennas increases with baseline length.<br> | ||

* note that noisify_alma.py also does thermal noise. don't add twice as much as you intended. | * note that noisify_alma.py also does thermal noise. don't add twice as much as you intended. | ||

− | |||

− | |||

== Gain == | == Gain == |

## Revision as of 15:12, 3 December 2009

the descriptions on this page are rather anemic at the moment, so please read this pdf explanation of how this is all done

## Thermal noise

**noise_thermal**, **t_sky**, and **tau0** allow you to add thermal noise from the atmosphere and from the
ALMA receivers according to current ALMA specifications according to observing band.
At time of writing, `simdata` knows the receiver temperature specifications for ALMA and EVLA, and a little about the altitude and pressure at the ALMa site.

For more flexibility and control, use the `sm` tool. run simdata *without* noise, and niter=0 to not produce a clean image. Optionally make a copy of the noise-free measurement set, and then do the following:

`
`

- CASA <1> sm.openfromms("my.ms")
- CASA <2> sm.setnoise( ... options ... )
- CASA <3> sm.corrupt()
- CASA <4> sm.done()

`
`

`sm.setnoise` takes as arguments the atmospheric and ground/ambient temperatures, antenna efficiencies, site characteristics, etc. There are three modes:

**simple**: specify**simplenoise**="1Jy" to get random Gaussian noise with 1Jy RMS**tsys-atm**: use environment temperatures, antenna parameters, and the aatm library to create a model of the troposphere and add random noise of the appropriate magnitude to the visibilities**tsys-manual**: specify atmospheric brightness temperature and optical depth yourself (rather than let aatm calculate it for you) and apply noise of the corresponding magnitude.

- see the pdf mentioned above for the precise equations used

For any of the `sm` corruption methods, an actual calibration table can be written out, and plotted with `plotcal` to make sure you're introducing the magnitude and type of corruption that you desire.

## Atmospheric Phase Noise

The troposphere is refractive, so introduces a phase delay, and is not uniform, so that phase delay differs between antennas. Excessive phase noise decorrelates the signal. In CASA, you can use `sm.settrop` to corrupt your measurement set with phase noise in two different ways:

**mode**="individual": the delay varies with time according to fractional Brownian Motion (fBM), or generalized 1/f noise. This mathematical description is very good for many natural stochastic processes, and used very widely for e.g. CGI simulations of fractal landscapes, turbulent motions and structures in clouds and water, electronic gain drift, etc.**mode**="screen": a 2-dimensional phase screen is generated with the same fBM mathematical model, and blows across the array at the specified wind speed. This creates much more realistic correlations in time and space between antennas. In practice, what is created is a fluctuation of precipitable water vapor (PWV) screen, and then the aatm library and tropospheric model is used to calculate the corresponding phase delay as a function of frequency.

old method, YMMV: Rob Reid wrote a python script to add phase noise,
noisify_alma.py. noisify_alma gets its parameters from the ALMA specifications where it can, and an approximate Komolgorov model of the atmosphere such that the phase difference
between two antennas increases with baseline length.

- note that noisify_alma.py also does thermal noise. don't add twice as much as you intended.

## Gain

`sm.setgain`**mode**="random" generates random Gaussian complex gains with the given real and imaginary RMS**mode**="fbm" generates a fractional Brownian Motion complex gain drift or time-dependent variation, independently for each antenna

## Leakage a.k.a. Cross-polarization

`sm.setleakage`- random Gaussian (time-independent) complex cross-polarization leakage terms, with specified real and imaginary amplitudes, and an optional systematic offset from zero
- at time of writing, CASA only calculates cross-polarization in the linear approximation. Full treatment will be added in the future.