Simulating Observations in CASA 5.1: Difference between revisions

From CASA Guides
Jump to navigationJump to search
No edit summary
No edit summary
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category: Simulations]]  
[[Category: Simulations]]  
== '''Introduction''' ==
== '''Introduction''' ==


''This Guide is applicable to '''CASA version 5.1''', which can be downloaded [http://casa.nrao.edu/casa_obtaining.shtml here]. For older versions of CASA please see [[Simulating Observations in CASA 4.4]].''
This page contains tutorials on how to simulate data in CASA. The two main CASA tasks that are used for this are {{simobserve}} and {{simanalyze}}. CASA includes [http://casaguides.nrao.edu/index.php?title=Antenna_Configurations_Models_in_CASA_Cycle5 configuration files] for a large number of interferometers (ALMA, VLA, VLBA, ATCA, CARMA, SMA, PdBI and WSRT).


Simulating interferometric observations in CASA proceeds in the following steps:
For ALMA, the [[Guide_To_Simulating_ALMA_Data | Guide to Simulating ALMA Data]] gives an introduction to ALMA simulations, and discusses their relevance to ALMA observing proposals. The task {{simalma}} is available to simplify the process of simulating data that combines the 12-m Main Array and the ACA.


# 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.
If you are a new user of CASA, take a look at the [http://casa.nrao.edu/casadocs CASA Docs] (the official CASA Documentation).
# Generate uv data with the {{simobserve}} task.  
# 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 [http://casaguides.nrao.edu/index.php?title=Antenna_Configurations_Models_in_CASA here].  The {{simobserve}} task can add thermal noise to the visibilities.  The {{simobserve}} task uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model (based on Juan Pardo's [http://cab.inta-csic.es/users/jrpardo/class_atm.html ATM] library) to simulate real observing conditions and introduce atmospheric "corruption", i.e. noise and phase delay.
If you are new to CASAguides, start with [https://casaguides.nrao.edu/index.php/How_To_Use_A_CASAGuide How to use these CASA Tutorials].  


Next, the {{simanalyze}} task is used to produce a cleaned image based on the generated visibilitiesIt 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.
'''''Disclaimer:''' The CASA Simulations pages were overhauled for CASA 5.1. For previous CASA versions, please see:
[https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_4.4 Simulation pages in CASA 4.4].
[https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_4.3 Simulation pages in CASA 4.3].
[https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_4.2 Simulation pages in CASA 4.2].
[https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_4.1 Simulation pages in CASA 4.1].
[https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_4.0 Simulation pages in CASA 4.0].
[https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_3.4 Simulation pages in CASA 3.4].
  [https://casaguides.nrao.edu/index.php/Simulating_Observations_in_CASA_3.3 Simulation pages in CASA 3.3].


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


=== Generating a Model Image ===
<br>


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.
== '''General introduction to CASA simulations''' ==


* '''Starting from an existing FITS image'''
Simulating interferometric observations in CASA proceeds in the following steps:


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.
# 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.
 
# Generate uv data with the {{simobserve}} task.  
* '''Starting from a component list'''
# Image the simulated observation with the {{simanalyze}} task.
 
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 (<tt>cl</tt>) 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.  [http://casaguides.nrao.edu/index.php?title=Simulation_Guide_Component_Lists_%28CASA_4.1%29 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 CASAThe image should be converted to a 32-bit FITS image for use with the CASA sim tools.  See [http://casaguides.nrao.edu/index.php?title=Convert_jpg_to_fits this page] for an example of using <tt>gimp</tt> 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''' ===
This page on [https://casaguides.nrao.edu/index.php/Introduction_to_CASA_simulations "Introduction to CASA simulations"] provides a detailed introduction on how to simulate interferometric data in CASA.


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 [[Antenna_Configurations_Models_in_CASA| list of configuration files available in CASA 4.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 {{clean}} 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.
# Image - Image the visibility data with CASA's {{clean}} task.
# Analyze - Calculate and display the difference between output and input, and the fidelity image.
The [http://casaguides.nrao.edu/index.php?title=Simulation_Guide_for_New_Users_(CASA_4.4) Simulation Guide for New Users] 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. 
<u>Taskname History</u>
* In CASA 3.3 {{simobserve}} and {{simanalyze}} were named sim_observe and sim_analyze, respectively. 
* In CASA 3.4 and earlier, the functionality of both tasks was contained in task simdata, which is now obsolete.
* In CASA 4.1, the task {{simalma}} was introduced.  This task simplifies simulation of 12 m interferometric + 7 m interferometric + total power ALMA observations.
<p>
<br>
<br>


Line 97: Line 56:
|- -->
|- -->


! [[Simulation Guide Component Lists (CASA 4.4)]]
! [[Simulation Guide Component Lists (CASA 5.1)]]
| rowspan=2; style="border-bottom:1px solid black;" | [[File:Analyze_fits_list.jpg|100px]]
| rowspan=2; style="border-bottom:1px solid black;" | [[File:Analyze_fits_list.jpg|100px]]
|-
|-
Line 134: Line 93:
|-
|-
| style="border-bottom:1px solid black;" | A sky model with a lightly annotated script that simulates a protoplanetary disk.  Uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star.  This is another fairly generic simulation - if you're short on time, you probably don't need to go through this one and the New Users guide, but it can be useful to go through multiple examples.
| style="border-bottom:1px solid black;" | A sky model with a lightly annotated script that simulates a protoplanetary disk.  Uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star.  This is another fairly generic simulation - if you're short on time, you probably don't need to go through this one and the New Users guide, but it can be useful to go through multiple examples.
|-
! [[Protoplanetary Disk Simulation - VLA]] (CASA 5.4.)
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:VLAsim-psim4mfstclean.png|100px]]
|-
| style="border-bottom:1px solid black;" | This tutorial explains the steps for simulating VLA observations using the same protoplanetary disk sky model that was used for the analogous ALMA tutorial. Observational and analysis parameters are changed step by step and the results are compared to the VLA exposure calculator.
|-
|-


Line 143: Line 108:
|}
|}


=== 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.
<!-- == Advanced CASA Simulation == -->
<!-- === Under the Hood: The sm Tool === -->
<!-- {{simobserve}} calls methods in the '''[https://casa.nrao.edu/docs/CasaRef/CasaRef.html simulator]''' tool.  For advanced CASA users, the '[https://casa.nrao.edu/docs/CasaRef/CasaRef.html simulator]' tool has methods that can add to simulated data: phase delay variations, gain fluctuations and drift, cross-polarization, and bandpass and pointing errors.  '[https://casa.nrao.edu/docs/CasaRef/CasaRef.html simulator]' also has more flexibility than {{simobserve}} in adding thermal noise.  The tutorials linked from this page describe the simulation of data using the task interface only.  To learn more about the '[https://casa.nrao.edu/docs/CasaRef/CasaRef.html simulator]' tool, see the [http://casa.nrao.edu/docs/CasaRef/CasaRef.html CASA Toolkit Reference Manual]. An examples of advanced techniques for corrupting a simulated MeasurementSet can be found in this "[[Corrupt]]" CASA Guide. -->
=== Ephemeris and Geodesy ===
Generic ephemeris and geodesy calculations can be done using CASA Python module [[simutil.py]].
<p>
<br>
<br>
== '''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.


<p>
<br>
== '''User Feedback''' ==
== '''User Feedback''' ==


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

Revision as of 11:59, 6 December 2018


Introduction

This page contains tutorials on how to simulate data in CASA. The two main CASA tasks that are used for this are simobserve and simanalyze. CASA includes configuration files for a large number of interferometers (ALMA, VLA, VLBA, ATCA, CARMA, SMA, PdBI and WSRT).

For ALMA, the Guide to Simulating ALMA Data gives an introduction to ALMA simulations, and discusses their relevance to ALMA observing proposals. The task simalma is available to simplify the process of simulating data that combines the 12-m Main Array and the ACA.

If you are a new user of CASA, take a look at the CASA Docs (the official CASA Documentation).

If you are new to CASAguides, start with How to use these CASA Tutorials.

Disclaimer: The CASA Simulations pages were overhauled for CASA 5.1. For previous CASA versions, please see:

Simulation pages in CASA 4.4.
Simulation pages in CASA 4.3.
Simulation pages in CASA 4.2.
Simulation pages in CASA 4.1.
Simulation pages in CASA 4.0.
Simulation pages in CASA 3.4.
Simulation pages in CASA 3.3.


General introduction to CASA simulations

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.

This page on "Introduction to CASA simulations" provides a detailed introduction on how to simulate interferometric data in CASA.


Tutorials

A detailed overview of how to simulate data in CASA is given in the "Simulation" pages of the CASA Docs documentation. The following tutorials provide additional examples:

Simulation Guide Component Lists (CASA 5.1) Analyze fits list.jpg
Tutorial for simulating data based on multiple sources (using both a FITS image and a component list). If you are interested in simulating from a list of simple sources (point, Gaussian, disk), rather than or in addition to a sky model image, then read the considerations here.
ACA Simulation (CASA 5.1) M51c.ALMA 0.5arcsec.skymodel.png
A tutorial for simulating ALMA observations that use multiple configurations or use the 12-meter array in combination with the ALMA Compact Array. This tutorial demonstrates combining data from each ALMA component "by hand". This guide is of particular interest to those wishing to explore using the 12-m array in combination with the ACA, and those interested in combining data from multiple 12-m array configurations.
Simalma (CASA 5.1) M51c.ALMA 0.5arcsec.skymodel.png
This tutorial demonstrates how to use simalma, a task that simplifies simulations that include the main 12-m array plus the ACA. Like the previous guide, this one is of particular interest to those wishing to explore multi-component ALMA observations.
Protoplanetary Disk Simulation (CASA 5.1) Psimthumb.png
A sky model with a lightly annotated script that simulates a protoplanetary disk. Uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. This is another fairly generic simulation - if you're short on time, you probably don't need to go through this one and the New Users guide, but it can be useful to go through multiple examples.
Protoplanetary Disk Simulation - VLA (CASA 5.4.) VLAsim-psim4mfstclean.png
This tutorial explains the steps for simulating VLA observations using the same protoplanetary disk sky model that was used for the analogous ALMA tutorial. Observational and analysis parameters are changed step by step and the results are compared to the VLA exposure calculator.
Advanced: Corrupting Simulated Data (Simulator Tool)
simobserve calls methods in the simulator tool. For advanced CASA users, the 'simulator' tool has methods that can add to simulated data: phase delay variations, gain fluctuations and drift, cross-polarization, and bandpass and pointing errors. 'simulator' also has more flexibility than simobserve in adding thermal noise. The tutorial linked from this page describes the simulation of data using the task interface only. To learn more about the 'simulator' tool, see the CASA Toolkit Reference Manual. An examples of advanced techniques for corrupting a simulated MeasurementSet can be found in this CASA Guide on Corrupting Simulated Data (Simulator Tool).


User Feedback

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