https://casaguides.nrao.edu/index.php?title=Corrupting_Simulated_Data_(Simulator_Tool)&feed=atom&action=historyCorrupting Simulated Data (Simulator Tool) - Revision history2024-03-28T09:58:55ZRevision history for this page on the wikiMediaWiki 1.38.6https://casaguides.nrao.edu/index.php?title=Corrupting_Simulated_Data_(Simulator_Tool)&diff=23241&oldid=prevBemonts: Created page with "{{Simulations Intro}} Category: Simulations For even more detail than is contained in this wiki page, please read this [https://safe.nrao.edu/wiki/pub/ALMA/SimulatorCookb..."2018-01-23T19:36:13Z<p>Created page with "{{Simulations Intro}} <a href="/index.php?title=Category:Simulations" title="Category:Simulations">Category: Simulations</a> For even more detail than is contained in this wiki page, please read this [https://safe.nrao.edu/wiki/pub/ALMA/SimulatorCookb..."</p>
<p><b>New page</b></p><div>{{Simulations Intro}}<br />
[[Category: Simulations]]<br />
<br />
For even more detail than is contained in this wiki page, please read this [https://safe.nrao.edu/wiki/pub/ALMA/SimulatorCookbook/corruptguide.pdf pdf explanation of how this is all done]<br />
<br />
== Thermal noise ==<br />
<br />
The <tt>simobserve</tt> task allows you to add thermal noise from the atmosphere and from the ALMA receivers according to current ALMA specifications according to observing band. <tt>simobserve</tt> knows the receiver temperature specifications for ALMA and the VLA, and a little about the altitude and pressure at the ALMA site. <br />
<br />
For interferometric simulation, one can select '''thermalnoise''' = ''tsys-manual'' or ''tsys-atm''. For single dish simulation, only ''tsys-manual'' is currently available. The manual method requires specifying '''t_ground''', i.e. spillover temperature, '''t_sky''' the physical temperature in the atmosphere, and '''tau0''' the zenith opacity in the center of the simulated band. ''tsys-atm'' constructs an ATM atmospheric model from the site characteristics and the user specified Precipitable Water Vapor ''user_pwv'', and the user must still specify '''t_ground'''.<br />
<br />
<font color="green">NOTE: adding noise can be slow</font> (you have to generate a random number for every visibility). For purposes of learning the software, and doing zeroeth order parameter studies, consider increasing the integration time. In particular, choose a very large integration time so that you can explore the simulated parameter space, even though the integration time may be unreasonable large for a real observation. See [[Etime study]] for details.<br />
<br />
For more flexibility and control, one can use the <tt>sm</tt> tool. Start by running <tt>simobserve</tt> ''without'' noise to create a noise-free measurement set, and then do the following:<br />
<br />
<source lang="python"><br />
sm.openfromms("my.ms")<br />
sm.setnoise( ... options ... )<br />
sm.corrupt()<br />
sm.done()<br />
</source><br />
<br />
<tt>sm.setnoise</tt> takes as arguments the atmospheric and ground/ambient temperatures, antenna efficiencies, site characteristics, etc. There are three modes:<br />
* '''simple''': specify '''simplenoise'''="1Jy" to get random Gaussian noise with 1Jy RMS<br />
* '''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<br />
* '''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. <br />
<br />
* see the [https://safe.nrao.edu/wiki/pub/ALMA/SimulatorCookbook/corruptguide.pdf pdf] mentioned above for the precise equations used<br />
<br />
<font color="green">For any of the <tt>sm</tt> corruption methods, an actual calibration table can be written out, and plotted with <tt>plotcal</tt> to make sure you're introducing the magnitude and type of corruption that you desire.</font><br />
<br />
== Atmospheric Phase Noise ==<br />
<br />
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 <tt>'''sm.settrop'''</tt> to corrupt your measurement set with phase noise in two different ways:<br />
<br />
<font color="red">Full corruption will make your data look worse than real ALMA data should look</font>. ALMA will use Water Vapor Radiometers (WVRs) to correct for the atmospheric phase delay in real time during the observation. Once the full hardware and software system is operational, the residual phase errors should be small (a few microns of equivalent PWV variation), roughly Gaussian, and independent on each antenna, so a more realistic portrayal of that may be to use <tt>sm.setgain</tt> with the real part of the gain equal to zero, or to use '''mode'''="individual" below. <br />
The full phase screen treatment is interesting to explore the full uncorrected corruption, to test other telescopes, and to test heuristics for WVR calculations. For more information, please see ALMA memos [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs587.html 587], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs582.html 582],<br />
[http://www.alma.nrao.edu/memos/html-memos/abstracts/abs573.html 573], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs568.html 568], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs535.html 535], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs523.html 523], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs515.html 515], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs496.html 496], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs495.html 495], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs491.html 491], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs490.html 490], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs451.html 451], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs415.html 415], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs404.html 404], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs361.html 361], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs332.html 332], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs262.html 252], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs210.html 210], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs209.html 209], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs176.html 176] ...<br />
<br />
For more information about the atmosphere at Chajnantor, see memos [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs542.html 542], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs529.html 529], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs521.html 521], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs517.html 517], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs512.html 512], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs500.html 500], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs497.html 497], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs459.html 459], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs384.html 384], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs365.html 365], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs363.html 363], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs345.html 345], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs334.html 334], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs238.html 238], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs237.html 237], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs187.html 187], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs186.html 186] ...<br />
<br />
* '''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. <br />
* '''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.<br />
<br />
<!--<br />
old method, unsupported, YMMV: <font color="lightgrey">Rob Reid wrote a python script to add phase noise, <br />
[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<br />
between two antennas increases with baseline length.<br><br />
* note that noisify_alma.py also does thermal noise. don't add twice as much as you intended.</font><br />
--><br />
<br />
== Gain ==<br />
<br />
* <tt>sm.setgain</tt><br />
* '''mode'''="random" generates random Gaussian complex gains with the given real and imaginary RMS<br />
* '''mode'''="fbm" generates a fractional Brownian Motion complex gain drift or time-dependent variation, independently for each antenna<br />
<br />
note also alma memos [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs466.html 466], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs301.html 301]<br />
<br />
== Leakage a.k.a. Cross-polarization ==<br />
<br />
* <tt>sm.setleakage</tt><br />
* random Gaussian (time-independent) complex cross-polarization leakage terms, with specified real and imaginary amplitudes, and an optional systematic offset from zero<br />
* <font color="green">at time of writing, sm and simdata only calculate cross-polarization in the linear approximation</font> (i.e. your cross-hands will change but Stokes I should not). Full treatment will be added in the future.<br />
<br />
see also alma memo [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs288.html 288]<br />
<br />
== Bandpass and Pointing ==<br />
<br />
TBD. see alma memo [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs388.html 388], and <br />
[http://www.alma.nrao.edu/memos/html-memos/abstracts/abs178.html 178], [http://www.alma.nrao.edu/memos/html-memos/abstracts/abs160.html 160]</div>Bemonts