UseTemplateMS: Difference between revisions

From CASA Guides
Jump to navigationJump to search
No edit summary
No edit summary
Line 3: Line 3:
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 <tt>simobserve</tt> task that can help you:
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 <tt>simobserve</tt> task that can help you:
    
    
First, find simutil.py in your casa installation and load the python code:
First, find simutil.py in your casa installation and instantiate the simutil tool:
   CASA> execfile("...path.../simutil.py")
   CASA> execfile("...path.../simutil.py")
  CASA> util = simutil()


Instantiate the simutil tool:
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 = simutil()
   CASA> util.modifymodel("my existing skymodel which may not have correct WCS",
   CASA> util.modifymodel("my existing skymodel which may not have correct WCS",
                             "name for new skymodel image that's all corrected",
                             "name for new skymodel image that's all corrected",

Revision as of 14:24, 8 May 2015

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 instantiate the simutil tool:

  CASA> execfile("...path.../simutil.py")
  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",
                            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()