TWHydraBand7 Imaging for CASA 3.3: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Line 168: Line 168:


==Continuum Subtraction and Spectral Line Imaging==
==Continuum Subtraction and Spectral Line Imaging==
<source lang="python">
# In CASA
</source>
#  Make channel plot to get line-free channel ranges. Since the line
#  emission is simple in this case and there are more than enough
#  line-free channels we do not need to be very precise just stay well
#  away from the line and best to chose ranges on either side.
<source lang="python">
# In CASA
split(vis='TWHydra_corrected.ms',outputvis='TWHydra_CO3_2.ms',
      datacolumn='corrected',spw='2')
</source>
<source lang="python">
# In CASA
uvcontsub2(vis='TWHydra_CO3_2.ms',fitorder=1,fitspw='0:20~2000,0:2400~3800')
</source>
<source lang="python">
# In CASA
clean(vis='TWHydra_CO3_2.ms.contsub',imagename='TWHydra_CO3_2line',
      imagermode='csclean',calready=T,spw='',
      imsize=100,cell=['0.3arcsec'],
      mode='velocity',start='-4km/s',width='0.12km/s',nchan=118,
      restfreq='345.79599GHz',outframe='LSRK',
      weighting='briggs',robust=0.5,
      mask='',
      interactive=T,threshold='1mJy',niter=100000)
</source>


<source lang="python">
<source lang="python">
# In CASA
# In CASA
split(vis='TWHydra_corrected.ms',outputvis='TWHydra_HCOplus.ms',
      datacolumn='corrected',spw='0')
</source>


<source lang="python">
# In CASA
uvcontsub2(vis='TWHydra_HCOplus.ms',fitorder=1,fitspw='0:20~1500,0:1900~3800')
</source>
<source lang="python">
# In CASA
clean(vis='TWHydra_HCOplus.ms.contsub',imagename='TWHydra_HCOplusline',
      imagermode='csclean',calready=T,spw='',
      imsize=100,cell=['0.3arcsec'],
      mode='velocity',start='-4km/s',nchan=118,width='0.12km/s',
      restfreq='356.7342GHz',outframe='LSRK',
      weighting='briggs',robust=0.5,
      mask='',
      interactive=T,threshold='1mJy',niter=100000)
</source>
</source>

Revision as of 11:10, 24 May 2011

Prepare Continuum Data for Further Processing

In order to speed up imaging/self-calibration for the continuum data we will average channels together, and then flag the few spectral features. This method works well in the case of only a few spectral lines, while retaining enough channelization to aid in multi-frequency synthesis and being able to remove spectral features in the averaged data. The amount of channel averaging should be adjusted to your particular data. Note for wide bandwidth data it is never a good idea to use the continuum estimate generated by uv-continuum subtraction as your continuum data. This worked OK in the past with the narrow band systems like the VLA and low dynamic range instruments like the SMA, but is not advised for ALMA wide bandwidth, high dynamic range data.

One can also flag the spectral features first but in that case make a backup of the file that is analogous to TWHydra_corrected.ms as you will need it later (unflagged) for spectral line imaging.

# In CASA
split(vis='TWHydra_corrected.ms',outputvis='TWHydra_cont.ms',
       spw='0~3:22~3820',width=100,datacolumn='data')

Now make a plot of amplitude vs. channel to see what needs to be flagged

# In CASA
plotms(vis='TWHydra_cont.ms',spw='0~3',xaxis='channel',yaxis='amp',
      avgtime='1e8',avgscan=T,coloraxis='spw',iteraxis='spw',xselfscale=T)

The CO(3-2) and HCO+(4-3) lines are obvious. The 4th spw; spw=3 also shows an upswing on the highest channels that is problematic, could be a weak atmospheric feature.

# In CASA
flagdata(vis='TWHydra_cont.ms',
         spw=['0:16~16','2:21~21','3:33~37'])

Have a look at the continuum as a function of uv-distance. If the data are flat as a function of uv-distance the source is completely unresolved. If you see structure (in this case decreasing amplitude with uv-distance) the source is resolved.

# In CASA
plotms(vis='TWHydra_cont.ms',spw='',xaxis='uvdist',yaxis='amp',field='',avgchannel='38',
       coloraxis='spw',iteraxis='spw')

Image and Self-Calibrate the Continuum

# In CASA
clean(vis='TWHydra_cont.ms',imagename='TWHydra_contall',
      mode='mfs',calready=T,imagermode='csclean',
      imsize=100,cell=['0.3arcsec'],spw='',
      weighting='briggs',robust=0.5, 
      mask='',
      interactive=T,threshold='1mJy',niter=100000)
# In CASA
gaincal(vis='TWHydra_cont.ms',caltable='self_1.pcal',
        solint='30s',combine='',gaintype='T',
        refant='DV06',spw='',minblperant=4,
        calmode='p',minsnr=2,)


# In CASA
applycal(vis='TWHydra_cont.ms',field='',
        gaintable=['self_1.pcal'],calwt=F)


# In CASA
clean(vis='TWHydra_cont.ms',imagename='TWHydra_contall_1pcal',
      mode='mfs',calready=T,imagermode='csclean',
      imsize=100,cell=['0.3arcsec'],spw='',
      weighting='briggs',robust=0.5, 
      mask='TWHydra_contall.mask',
      interactive=T,threshold='1mJy',niter=100000)


# In CASA
gaincal(vis='TWHydra_cont.ms',caltable='self_2.pcal',
        solint='30s',combine='',gaintype='T',
        refant='DV06',spw='',minblperant=4,
        calmode='p',minsnr=2,)


# In CASA
plotcal(caltable='self_2.pcal',xaxis='time',yaxis='phase',
        spw='',field='',antenna='1~8',
        iteration='antenna',subplot=421,plotrange=[0,0,-80,80])


# In CASA
applycal(vis='TWHydra_cont.ms',field='',
        gaintable=['self_2.pcal'],calwt=F)


# In CASA
clean(vis='TWHydra_cont.ms',imagename='TWHydra_contall_2pcal',
      mode='mfs',calready=T,imagermode='csclean',
      imsize=100,cell=['0.3arcsec'],spw='',
      weighting='briggs',robust=0.5, 
      mask='TWHydra_contall_1pcal.mask',
      interactive=T,threshold='1mJy',niter=100000)


# In CASA
gaincal(vis='TWHydra_cont.ms',caltable='self_ap.cal',
        solint='inf',combine='',gaintype='T',
        refant='DV06',spw='',minblperant=4,
        gaintable=['self_2.pcal'],
        calmode='ap',minsnr=2,)


# In CASA
plotcal(caltable='self_ap.cal',xaxis='time',yaxis='phase',
        spw='',field='',antenna='1~8',
        iteration='antenna',subplot=421,plotrange=[0,0,-1,1])


# In CASA
plotcal(caltable='self_ap.cal',xaxis='time',yaxis='amp',
        spw='',field='',antenna='1~8',
        iteration='antenna',subplot=421)


# In CASA
applycal(vis='TWHydra_cont.ms',field='',
        gaintable=['self_2.pcal','self_ap.cal'],calwt=F)


# In CASA
plotms(vis='TWHydra_cont.ms',xaxis='uvdist',yaxis='amp',
       avgchannel='38',ydatacolumn='corrected',iteraxis='spw')


# In CASA
plotms(vis='TWHydra_cont.ms',xaxis='time',yaxis='amp',iteraxis='spw',
       ydatacolumn='corrected')


# In CASA
clean(vis='TWHydra_cont.ms',imagename='TWHydra_contall_apcal',
      mode='mfs',calready=T,imagermode='csclean',
      imsize=100,cell=['0.3arcsec'],spw='',
      weighting='briggs',robust=0.5, 
      mask='TWHydra_contall_2pcal.mask',
      interactive=T,threshold='1mJy',niter=100000)

Continuum Subtraction and Spectral Line Imaging

# In CASA
  1. Make channel plot to get line-free channel ranges. Since the line
  2. emission is simple in this case and there are more than enough
  3. line-free channels we do not need to be very precise just stay well
  4. away from the line and best to chose ranges on either side.
# In CASA
split(vis='TWHydra_corrected.ms',outputvis='TWHydra_CO3_2.ms',
      datacolumn='corrected',spw='2')
# In CASA
uvcontsub2(vis='TWHydra_CO3_2.ms',fitorder=1,fitspw='0:20~2000,0:2400~3800')
# In CASA
clean(vis='TWHydra_CO3_2.ms.contsub',imagename='TWHydra_CO3_2line',
      imagermode='csclean',calready=T,spw='',
      imsize=100,cell=['0.3arcsec'],
      mode='velocity',start='-4km/s',width='0.12km/s',nchan=118,
      restfreq='345.79599GHz',outframe='LSRK',
      weighting='briggs',robust=0.5,
      mask='',
      interactive=T,threshold='1mJy',niter=100000)


# In CASA
split(vis='TWHydra_corrected.ms',outputvis='TWHydra_HCOplus.ms',
      datacolumn='corrected',spw='0')
# In CASA
uvcontsub2(vis='TWHydra_HCOplus.ms',fitorder=1,fitspw='0:20~1500,0:1900~3800')


# In CASA
clean(vis='TWHydra_HCOplus.ms.contsub',imagename='TWHydra_HCOplusline',
      imagermode='csclean',calready=T,spw='',
      imsize=100,cell=['0.3arcsec'],
      mode='velocity',start='-4km/s',nchan=118,width='0.12km/s',
      restfreq='356.7342GHz',outframe='LSRK',
      weighting='briggs',robust=0.5,
      mask='',
      interactive=T,threshold='1mJy',niter=100000)