UseTemplateMS: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Rindebet (talk | contribs)
No edit summary
Rindebet (talk | contribs)
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:
    
    
  * find simutil.py in your casa installation
First, find simutil.py in your casa installation and load the python code:
   * CASA> execfile("...path.../simutil.py")
   CASA> execfile("...path.../simutil.py")
  * Instantiate the simutil tool:
 
   * CASA> util = simutil()  
Instantiate the simutil tool:
   * CASA> util.modifymodel("my existing skymodel which may not have correct WCS",
   CASA> util = simutil()  
   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",
                             inbright,indirection,incell,
                             inbright,indirection,incell,
                             incenter,inwidth,innchan,
                             incenter,inwidth,innchan,
                             flatimage=False)
                             flatimage=False)
  * See the <tt>simobserve</tt> task help for parameter descriptions.  Just like <tt>simobserve</tt>, simutil::modifymodel() will only change the image parameters that  
See the <tt>simobserve</tt> task help for parameter descriptions.  Just like <tt>simobserve</tt>, simutil::modifymodel() will only change the image parameters that  
     you tell it to - if any of <tt>indirection</tt>, etc are "None", then the function should preserve whatever is already in the input image.  This is useful  
     you tell it to - if any of <tt>indirection</tt>, 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.
     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.
Line 19: Line 20:


3. Open the simulator tool and select the field and spw of interest:
3. Open the simulator tool and select the field and spw of interest:
   * CASA> sm.openfromms("copy of my MS")
   CASA> sm.openfromms("copy of my MS")
   * CASA> sm.setdata(spwid="9",fieldid=["5","6","7"])
   CASA> sm.setdata(spwid="9",fieldid=["5","6","7"])
   * CASA> sm.setvp()
   CASA> sm.setvp()


4. Check that things seem sensible:
4. Check that things seem sensible:
   * CASA> sm.summary()
   CASA> sm.summary()


5. Calculate visibilities from your cleaned up skymodel "newmodel", and, optionally, a componentlist:
5. Calculate visibilities from your cleaned up skymodel "newmodel", and, optionally, a componentlist:
   * CASA> sm.predict(imagename=newmodel,complist=complist)
   CASA> sm.predict(imagename=newmodel,complist=complist)
   * CASA> sm.done()
   CASA> sm.done()

Revision as of 18:22, 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 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()