Difference between revisions of "ACA Simulation"

From CASA Guides
Jump to: navigation, search
Line 34: Line 34:
 
* We'll place the source in the southern hemisphere with the indirection parameter,  
 
* We'll place the source in the southern hemisphere with the indirection parameter,  
 
* set the pixel size to 0.1arcsec, effectively moving the galaxy further away (M51 itself would require a quite large mosaic, and in any case we need for the input model pixels to be significantly smaller than the synthesized beam that we'll be simulating, or else we won't be learning anything)
 
* set the pixel size to 0.1arcsec, effectively moving the galaxy further away (M51 itself would require a quite large mosaic, and in any case we need for the input model pixels to be significantly smaller than the synthesized beam that we'll be simulating, or else we won't be learning anything)
 +
* consistent with simulating a more distant source, we'll set the peak brightness to 0.004 Jy/pixel
 
* set the frequency to 330GHz, and since its a 2D image we'll set the single "channel" width to be 50MHz, and peak brightness of 0.004 Jy/pixel - parameters plausible for observing an emission line in a galaxy.
 
* set the frequency to 330GHz, and since its a 2D image we'll set the single "channel" width to be 50MHz, and peak brightness of 0.004 Jy/pixel - parameters plausible for observing an emission line in a galaxy.
 
<source lang="python">
 
<source lang="python">
Line 52: Line 53:
 
# have sim_observe calculate mosaic pointing locations:
 
# have sim_observe calculate mosaic pointing locations:
 
setpointings      =  True
 
setpointings      =  True
 +
integration        =  "10s"
 
mapsize            =  "1arcmin"
 
mapsize            =  "1arcmin"
 
maptype            =  "hex"
 
maptype            =  "hex"
Line 65: Line 67:
 
</source>
 
</source>
  
 +
run sim_observe, displaying graphics to screen and file
  
 +
<source lang="python">
 +
graphics          =  "both"
 +
go
 +
</source>
 +
 +
 +
 +
====Simulate 12m total power observation====
 +
Next we'll simulate a total power raster map of the same area, but on a more realistic square grid.  CASA simulation tools can not simulate
 +
true on-the-fly mapping (with smearing on timescales smaller than an integration time), but a square grid with a short integration time
 +
will provide a very accurate approximation.
 +
 +
By virtue of CASA's global parameters, we already have project and image world coordinate system parameters set correctly. 
 +
 +
We need to change the pointing calculation to make it square and a bit larger than the interferometric map.
 +
<source lang="python">
 +
integration        =  "10s"
 +
mapsize            =  "1.3arcmin"
 +
maptype            =  "square"
 +
</source>
 +
 +
We'll observe on a different day (this doesn't really matter, but if you choose to simulate two different 12m ALMA configurations and combine them, if they're simulated on the same day with the same antenna names you will have issues concatenating the datasets, so its a good habit to change the day)
 +
 +
<source lang="python">
 +
sdantlist          = "aca.tp.cfg"
 +
sdant              = 0
 +
refdate            = "2012/12/01"
 +
# SET interferometric antennalist to default, or else we'll redo the interferometric simulation too
 +
antennalist        =  ""
 +
totaltime          =  "2h"
 +
</source>
 +
 +
run sim_observe, displaying graphics to screen and file
  
 +
<source lang="python">
 +
go
 +
</source>
  
  

Revision as of 08:59, 3 November 2011

Simulating Observations in CASA

To create a script of the Python code on this page see Extracting scripts from these tutorials.

ALMA 12m + ACA + Total Power

Multiple configurations, or an observation in one 12m configuration plus one ACA observation, or other combinations, can be simulated by running sim_observe for each, and then combining the Measurement Sets to run sim_analyze. Total power observations can be simulated either in an independent run of sim_observe, or along with an interferometric simulation. Note that if you simulate total power and an interferometric observation simultaneously with sim_observe, they must have the same set of pointing centers and the same integration and total time, which is probably not realistic. (For example it is generally recommended to observe a larger area by 1/2 primary beam in total power mode to combine with a 12m ALMA mosaic).

  • Simdata version for CASA 3.3


Explanation of the script

Set sim_observe as current task

Reset all parameters to default, and then set the project name to m51c

# Set sim_observe to default parameters
default("sim_observe")
# Our project name will be m51c, and all simulation products will be placed in a subdirectory m51c/
project="m51c"
Specify sky model image

We'll use an Halpha image of M51 as an example model sky. Download File:M51ha.fits.txt and place in your working directory.

sim_observe will make a copy m51c/m51c.skymodel, and not modify your input image.

# Model sky = Halpha image of M51 
modelimage         =  "m51ha.fits"

Although the image has a world coordinate system, we want to override most of the parameters.

  • We'll place the source in the southern hemisphere with the indirection parameter,
  • set the pixel size to 0.1arcsec, effectively moving the galaxy further away (M51 itself would require a quite large mosaic, and in any case we need for the input model pixels to be significantly smaller than the synthesized beam that we'll be simulating, or else we won't be learning anything)
  • consistent with simulating a more distant source, we'll set the peak brightness to 0.004 Jy/pixel
  • set the frequency to 330GHz, and since its a 2D image we'll set the single "channel" width to be 50MHz, and peak brightness of 0.004 Jy/pixel - parameters plausible for observing an emission line in a galaxy.
# Set model image parameters:
indirection="B1950 23h59m59.96s -34d59m59.50s"
incell="0.1arcsec"
inbright="0.004"
incenter="330.076GHz"
inwidth="50MHz"
Simulate 12m interferometric observation

We'll begin with the 12m ALMA array observation, and have sim_observe calculate a hexagonal mosaic of pointings.

The default interface for sim_observe provides an integration parameter, which is the dwell time at each mosaic pointing -- we'll set that to 10s. A real observation would integrate a scan of ~5 min at each mosaic pointing; we could set integration="5min" but then for data volume and speed, sim_observe would only generate one measurement per 5min scan. While thermal noise levels would be scaled correctly, corruption of the data with a phase screen (see XXX for a guide), or the details of uv coverage, would not be realistic. Rotating through the mosaic more rapidly than a real simulation will result in more representative uv coverage. If you wish to simulate the more realistic case such as 5 min scans with 5s integrations, please see XXX for a guide to doing that with sim_observe (Its not hard, it just takes two calls to the task instead of one).

# have sim_observe calculate mosaic pointing locations:
setpointings       =  True
integration        =  "10s"
mapsize            =  "1arcmin"
maptype            =  "hex"
pointingspacing    =  "9arcsec"      # this could also be specified in units of the primary beam e.g. "0.5PB"
Calculate Visibilities

sim_observe can determine what array configuration to use, if you provide a desired resolution or synthesized beam size.

observe            =  True
antennalist        =  "ALMA;0.5arcsec"
totaltime          =  "3600s"

run sim_observe, displaying graphics to screen and file

graphics           =  "both"
go


Simulate 12m total power observation

Next we'll simulate a total power raster map of the same area, but on a more realistic square grid. CASA simulation tools can not simulate true on-the-fly mapping (with smearing on timescales smaller than an integration time), but a square grid with a short integration time will provide a very accurate approximation.

By virtue of CASA's global parameters, we already have project and image world coordinate system parameters set correctly.

We need to change the pointing calculation to make it square and a bit larger than the interferometric map.

integration        =  "10s"
mapsize            =  "1.3arcmin"
maptype            =  "square"

We'll observe on a different day (this doesn't really matter, but if you choose to simulate two different 12m ALMA configurations and combine them, if they're simulated on the same day with the same antenna names you will have issues concatenating the datasets, so its a good habit to change the day)

sdantlist          = "aca.tp.cfg"
sdant              = 0
refdate            = "2012/12/01"
# SET interferometric antennalist to default, or else we'll redo the interferometric simulation too
antennalist        =  ""
totaltime          =  "2h"

run sim_observe, displaying graphics to screen and file

go



Deconvolve the visibilities back into an image
image              =  True
vis                =  "$project.ms"
imsize             =  [192, 192]
Specify number of iteration of cleaning task with proper threshold and weighting
niter              =  10000
threshold          =  "1e-7Jy"
weighting          =  "natural"
We'd like to calculate a difference and fidelity image, and see some diagnostics:
analyze            =  True
And see the array but not the UV coverage:
showarray          =  True
showuv             =  False
Plot both to the screen and the png files with lots of messages:
graphics           =  "both"
verbose            =  True
overwrite = True

Run simdata

# This commands CASA to execute simdata
simdata()


  • Output results:


Input:
Psim2.skymodel.png
Predict:
Psim2.predict.png
Image:
Psim2.image.png
Analyze:
Psim2.analysis.png

Simulating Observations in CASA