UseTemplateMS: Difference between revisions
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
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: | ||
Instantiate the simutil tool: | |||
CASA> | CASA> from simutil import simutil | ||
CASA> util = simutil() | CASA> util = simutil() | ||
Line 10: | Line 10: | ||
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", | ||
inbright,indirection,incell, | inbright,indirection,incell,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 | |||
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 <tt>sm</tt> to use the right 7m beam: (Yeah, we know, its another bug): | |||
CASA> tb.open("test.split.ms/OBSERVATION",nomodify=False) | |||
CASA> tel=tb.getcol("TELESCOPE_NAME") | |||
CASA> for i in range(len(tel)): | |||
tel[i]="ACA" | |||
CASA> | |||
CASA> tb.putcol("TELESCOPE_NAME",tel) | |||
CASA> tb.done() | |||
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( | CASA> sm.setdata(fieldid=[5,6,7]) | ||
CASA> sm.setvp() | CASA> sm.setvp() | ||
Latest revision as of 14:53, 11 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:
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", 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 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> tb.open("test.split.ms/OBSERVATION",nomodify=False) CASA> tel=tb.getcol("TELESCOPE_NAME") CASA> for i in range(len(tel)): tel[i]="ACA" CASA> 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()