From CASA Guides
Revision as of 09:53, 11 May 2015 by Rindebet (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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:

Instantiate the simutil tool:

  CASA> from simutil import simutil
  CASA> util = simutil() 

Now create a fixed up casa-happy skymodel image from your existing skymodel image, which could be fits, and could have no WCS information at all:

  CASA> util.modifymodel("my existing skymodel which may not have correct WCS",
                           "name for new skymodel image that's all corrected",

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 split copy of your MS - you're about to overwrite its DATA column. You can only simulate an ms with one spw at a time, so you have to split out one spw. (Yeah, its a bug).

Wrinkle for ACA: you have to modify the observation table to get sm to use the right 7m beam: (Yeah, we know, its another bug):

  CASA> tel=tb.getcol("TELESCOPE_NAME")
  CASA> for i in range(len(tel)):
  CASA> tb.putcol("TELESCOPE_NAME",tel)
  CASA> tb.done()

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

  CASA> sm.openfromms("copy of my MS")
  CASA> sm.setdata(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()