Introduction to CASA simulations

From CASA Guides
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Last checked on CASA Version 6.5.4

CASA Simulations

This Guide is applicable to CASA version 6.5.4, which can be downloaded here.

Simulating interferometric observations in CASA proceeds in the following steps:

  1. Make a model image. The model image is a representation of the sky brightness distribution that you would like to simulate observing, stored initially as a FITS file. There are several paths to making the FITS file, discussed below.
  2. Generate uv data with the simobserve task.
  3. Image the simulated observation with the simanalyze task.

The simobserve task generates the visibilities that would be measured by observing the specified input model of sky brightness. The user needs to specify a telescope to use for the observation. CASA includes a set of configuration files for ALMA, VLA, VLBA, ATCA, CARMA, SMA, PdBI and WSRT interferometers. A table of configuration files shipped with CASA is available here. The simobserve task can add thermal noise to the visibilities. The simobserve task uses the aatm atmospheric model (based on Juan Pardo's ATM library) to simulate real observing conditions and introduce atmospheric "corruption", i.e. noise and phase delay.

Next, the simanalyze task is used to produce a cleaned image based on the generated visibilities. It can compare the simulated image with your input (convolved with the output clean beam) and then calculate a "fidelity image" that indicates how well the simulated output matches the convolved input image.

For ALMA: the Guide to Simulating ALMA Data gives an introduction to ALMA simulations, and discusses their relevance to ALMA observing proposals. The task simanalyze is available to simplify the process of simulating data that combines the 12-m Main Array and the ACA. The best way to learn simanalyze is to follow the tutorial linked near the bottom of this page.

Generating a Model Image

A "model image" is a FITS file that contains a representation of the sky brightness distribution, and it represents the object to be "observed" in the simulation. The FITS file must contain a realistic set of spatial axes, and a realistic flux density. There are several ways to generate a model image.

  • Starting from an existing FITS image

The simplest option is to begin with an existing FITS image of a millimeter or submillimeter observation. The FITS image can be either a single plane (i.e. one observed frequency channel) or a cube. A common simulation exercise is to begin with a FITS file representing an observation of a target, then scale the spatial axes and the flux to shift the data to what would be observed for a similar target at a different distance. The simobserve task has parameters to set the peak flux density, coordinates on the sky, pixel size, frequency of the center channel, and channel width. See the discussion below.

  • Starting from a component list

It may be useful to simulate observations of an idealized model image consisting, for example, of point sources and Gaussians. The CASA component list tool (cl) allows the user to create a FITS file by specifying a set of point sources, Gaussians, disks, and limb-darkened disks. Each of these is a "component" in the FITS image. This CASA guide provides an example of creating a FITS file from a component list.

  • Starting from a GIF or JPG image

A user may wish to convert a GIF or JPG image to a FITS file for simulation in CASA. The image should be converted to a 32-bit FITS image for use with the CASA sim tools. See this page for an example of using gimp to convert a JPG image to a FITS file. Alternatively, you could use ImageMagik, like so:

convert myfile.jpg myfile.fits

Then proceed to trim and convert the file in CASA like so:

importfits(fitsimage='myfile.fits',imagename='testimage',overwrite=T)
default 'immath'
imagename = 'testimage'
expr = 'IM0'
box = '0,0,299,299'
outfile = 'testimage2'
immath()
exportfits(imagename ='testimage2',fitsimage ='myfile.fits',overwrite=T)

You could also use the parameters in the simobserve task to modify the peak flux density, coordinates on the sky, pixel size, frequency of the center channel, and channel width. See the discussion below.

Generating visibilities with simobserve

The task simobserve takes several steps to generate observed visibilities. The major steps are:

  • Modify Model. If desired, you can modify the header parameters in your data model to mimic different observing targets. For example, if you start with a model of M100 you might wish to scale the axes to simulate an observation of an M100-like galaxy that is 4X more distant. The settable parameters include:
    • inbright: Scaling the model flux densities by setting the peak flux density of the brightest pixel, e.g. "1.2Jy/pixel"
    • indirection: Set the center target coordinates, e.g. "J2000 19h00m00 -40d00m00"
    • incell: Set the angular size of each pixel, e.g. "0.1arcsec"
    • incenter: Set the observed sky frequency. If the model is a spectral cube, this parameter applies to the center channel.
    • inwidth: Set the channel width, e.g. "10MHz"
  • Set Pointings. If the angular size of your model image is comparable or larger than the 12-m primary beam, you can simulate observing the target as a mosaic. In this step, the individual pointings are determined and saved in a text file. You can also generate such a text file yourself.
  • Generate visibilities. The visibilities are determined based on the telescope and configuration specified, and the length in time of the observation. Here is a list of configuration files available in CASA 6.5.4.
  • Add noise. Finally, noise is added to the visibilities.

Transforming to images with simanalyze

The task simanalyze then images the visibility data using CASA's tclean task. It also calculates and displays the difference between the simulates observation and the original model data, and it generates a "fidelity image". Fidelity is defined as I/| I-T |, where I is the observed image intensity and T is the true image intensity, given in this case by the sky model.

  1. Image - Image the visibility data with CASA's tclean task.
  2. Analyze - Calculate and display the difference between output and input, and the fidelity image.

The Simulation Guide for New Users (CASA 4.4) tutorial introduces and explains the individual steps in detail. It is possible to run the steps independently and optionally, as long as you follow the simobserve and simanalyze conventions about filenames.

Example Input Images

Several examples of input model images are showcased here: Sim Inputs. These may be useful for running your own simulation tests, beyond what are presented in the above tutorials.

Ephemeris and Geodesy

Generic ephemeris and geodesy calculations can be done using CASA Python module simutil.py.


Warning: CLEAN Bias

As is the case for real images, cleaning images produced by simobserve can lead to a spurious decrease in object fluxes and noise on the image (an effect known as "clean bias"). This is particularly true for observations with poor coverage of the uv-plane, i.e. using telescopes with small numbers of antennas, such as the ALMA Early Science configurations, and/or in short "snapshot" observations. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5sigma) threshold and boxing bright sources.


User Feedback

We welcome input on developing the CASA simulator. Contact "rindebet at nrao.edu" if you would like to volunteer your input.