UseTemplateMS

From CASA Guides
Revision as of 18:22, 8 May 2015 by Rindebet (talk | contribs)
Jump to navigationJump to search

You have a model image, and an interferometric dataset. You would like to calculate exactly how your model would be observed if it had been the sky during the observation, i.e. you want to calculate the visibilities at the exact uvw values in your MS.

1. Your model needs to be a casa image, with 4 dimensions (space, spectral, stokes, possibly single-valued in spectral and stokes), at the correct sky position, frequency, and angular pixel scale. If your model is not that, don't despair, routines were written for the simobserve task that can help you:

First, find simutil.py in your casa installation and load the python code:

  CASA> execfile("...path.../simutil.py")

Instantiate the simutil tool:

  CASA> util = simutil() 
  CASA> util.modifymodel("my existing skymodel which may not have correct WCS",
                           "name for new skymodel image that's all corrected",
                            inbright,indirection,incell,
                            incenter,inwidth,innchan,
                            flatimage=False)

See the simobserve task help for parameter descriptions. Just like simobserve, simutil::modifymodel() will only change the image parameters that

    you tell it to - if any of indirection, etc are "None", then the function should preserve whatever is already in the input image.  This is useful 
    if your skymodel image is mostly correct, e.g. has the right frequency and pixel scale, but the wrong position, and you want to just change its position on the sky.

2. Now make a copy of your MS - you're about to overwrite its DATA column.

3. Open the simulator tool and select the field and spw of interest:

  CASA> sm.openfromms("copy of my MS")
  CASA> sm.setdata(spwid="9",fieldid=["5","6","7"])
  CASA> sm.setvp()

4. Check that things seem sensible:

  CASA> sm.summary()

5. Calculate visibilities from your cleaned up skymodel "newmodel", and, optionally, a componentlist:

  CASA> sm.predict(imagename=newmodel,complist=complist)
  CASA> sm.done()