synthesisutils

class synthesisutils[source]

tool for synthesis imaging

synthesisutils is an tool that contains helper functions for synthesisimager

Methods Summary

advisechansel

It is a helper function, for cube imaging, that allows you to determine the spectral window data selection you may need to cover a given range of frequencies.

checkgridparams

Check and Fix Gridding/FTM Parameters for one field

checkimageparams

Check and Fix Imaging Parameters for one field

checkselectionparams

Check and Fix Selection Parameters for one MS

contdatapartition

Partition data selection parameters for continuum imaging

cubedataimagepartition

Partition data/image cube parameters for CUBE deconvolution

cubedatapartition

returns a dictionary with data spectral parttiion that maps data to nparts of the input range frequency.

cubeimagepartition

Partition image cube parameters for CUBE deconvolution

done

Close the tool

fitPsfBeam

Fit a restoring beam to the PSF, and save it in the PSF image.

getOptimumSize

Get Optimum Image size

synthesisutils

This is used to construct synthesisutils tool.

updateimpars

check the consistency between the csys record and other impars and update/modify impars if necessary

advisechansel(freqstart='1.0e6', freqend='1.1e6', freqstep='100.0', freqframe='LSRK', ephemtable='', msname='', fieldid=0, getfreqrange=False, spwselection='')[source]

It is a helper function, for cube imaging, that allows you to determine the spectral window data selection you may need to cover a given range of frequencies.

In the mode with getfreqrange=False, the freqstep can be used (i.e., set to the channel width) to achieve the extra padding needed for data selection at the beginning and end of the desired cube range in order to retrieve all channels that will potentially contribute to the edge channels of the cube (to maximize S/N). If freqstep is not specified, it is taken as zero, and the output channel range will typically be slightly smaller.

The meaning of freqframe parameter is dependent on the value of getfreqrange. When getfreqrange=False, frequency parameters are considered as input parameters that are known to be in the frame specified by freqframe; but when getfreqrange=True, the frequency parameters are output parameters that will be determined in the frame specified by freqframe. In the former case, the frequencies will be converted to the frame of the data as a function of time in order to locate which channels match.

You need to specify the field_id for which this calculation is being done.

If the parameter getfreqrange=True then the reverse is requested. You set spwselection to be the range of data selection you want to use and you’ll get the range of frequency covered in the frame you set. The freqstart and freqend output values correspond to the frequency of the extreme edges of the requested channel range. Inputs —————- freqstart Begining of frequency range allowed: double, string, quantity example: freqstart=’1.0GHz’ Default: —————- freqend End of frequency range allowed: double, string, quantity example: freqend=’2.0GHz’ Default:” —————– freqstep spectral channel resolution of intended image allowed: double, string, quantity example: freqstep=’1.0MHz’ Default:” —————– freqframe frame in which frequency is being expressed in other parameters. For solar system moving sources if the frame of the source is intended then this parameter can be ’SOURCE’ allowed : one of the following strings ’LSRK’, ’LSRD’, ’BARY’, ’GEO’, ’TOPO’, ’GALACTO’, ’LGROUP’,’CMB’, ’SOURCE’ Default: ’LSRK’ —————- msname name of a valid measurement set. allowed: string Default: ” —————– ephemtable when freqframe=’SOURCE’ this parameter is used name of a valid ephemeris table or ’TRACKFIELD’ to use the ephemeris table attached to the FIELD subtable of the ms or one of the following solar system object: ’MERCURY’, ’VENUS’, ’MARS’, ’JUPITER’, ’SATURN’, ’URANUS’, ’NEPTUNE’, ’PLUTO’, ’SUN’, ’MOON’ allowed: string Default: ” —————– fieldid fieldid to use (needed to get the direction on the sky for any spectral frame conversion) allowed: integer Default: 0 ——————- getfreqrange if set then freqrange is returned in the frame requested for the data selected allowed: bool Default: False —————– spwselection if getfreqrange=True then this is needed to find the range of frequency in the frame requested. It should have the spectral window selection syntax as defined in the msselection (Casa memo 3) allowed: string Default: ”

Parameters

  • freqstart (variant='1.0e6') - Begining of frequency range in Hz

  • freqend (variant='1.1e6') - End of frequency range in Hz

  • freqstep (variant='100.0') - spectral channel resolution of intended image in Hz

  • freqframe (string='LSRK') - frame in which frequency is being expressed in other parameters

  • ephemtable (string='') - valid ephemeris table name or TRACKFIELD (use ephemeris in FIELD subtable) if freqframe is SOURCE

  • msname (string='') - name of an ms, if empty string it will use the ms’s used in selectvis

  • fieldid (int=0) - fieldid to use when msname is not empty otherwise ignored and field selected in selectvis is used

  • getfreqrange (bool=False) - if set then freqrange is returned in the frame requested for the data selected

  • spwselection (string='') - if getfreqrange=True then this is needed to find the range of frequency in the frame requested

Returns

record

Examples

Example 1
In this example, we are interested in an image cube which span 20.0682GHz to 20.1982 in LSRK  which will have a channel resolution of 3.9MHz. The field we are interested the one with fieldid=4  

############################# 
>>> from casatools import synthesisutils
>>> syut=synthesisutils()
>>> syut.advisechansel(freqstart="20.0682GHz", freqend="20.1982GHz", freqstep="3.9kHz", freqframe="LSRK", msname="test1.ms")
{"nchan": array([109,  23], dtype=int32),  "spw": array([4, 5], dtype=int32),  
          "start": array([19,  0], dtype=int32)}
# implies 108 channels of spw 4 starting channel 19 and 23 channels of spw 5 starting at channel 0 would contribute data to the frequency range under consideration
#############################

Example 2

To determine what is the frequency range in a given frame is covered by a given spwselection of the ms

##############
>>> syut.advisechansel(msname="test3.ms", freqframe="LSRK", getfreqrange=True, spwselection="0:20~210")

{"freqend": {"unit": "Hz", "value": 362746224619.3091}, "freqstart": {"unit": "Hz", "value": 362512788988.5036}}

##############

Example 3:

Same as Example 1 but with a solar system moving source and the frequency range provided is in the frame of the source. We are using the ephemeris table attached to the FIELD subtable of the ms.

##########
>>> syut.advisechansel(msname="uid___A002_Xc05f54_X142a_target.spw31.contsub.ms", freqstart="362.5145206GHz", freqend="362.7476643GHz", freqstep="122.064714kHz", fieldid=3, freqframe="SOURCE", ephemtable="TRACKFIELD")
###########
Now one can do the same with a valid ephemeris table
###########
>>> syut.advisechansel(msname="uid___A002_Xc05f54_X142a_target.spw31.contsub.ms", freqstart="362.5145206GHz", freqend="362.7476643GHz", freqstep="122.064714kHz", fieldid=3, freqframe="SOURCE", ephemtable="EPHEM0_Titan_57889.1.tab")
###########

Or if we want it in the frame of a solar system source known by casa, e.g "SATURN"
############
>>> syut.advisechansel(msname="uid___A002_Xc05f54_X142a_target.spw31.contsub.ms", freqstart="362.5145206GHz", freqend="362.7476643GHz", freqstep="122.064714kHz", fieldid=3, freqframe="SOURCE", ephemtable="SATURN")
############

Example 4:

Same as Example 2  but with a solar system moving source and the frequency range we want to find is in the frame of the source.

############
>>> syut.advisechansel(msname="uid___A002_Xc05f54_X142a_target.spw31.contsub.ms", fieldid=3, freqframe="SOURCE", ephemtable="TRACKFIELD", getfreqrange=True, spwselection="31:9~1919")
#############
similarly if we want it in the frame of a solar system source known casa e.g saturn
#############
>>> syut.advisechansel(msname="uid___A002_Xc05f54_X142a_target.spw31.contsub.ms", fieldid=3, freqframe="SOURCE", ephemtable="SATURN", getfreqrange=True, spwselection="31:9~1919")
#############
checkgridparams(gridpars='')[source]

Check and Fix Gridding/FTM Parameters for one field

Parameters

  • gridpars (record='') - All gridding/ftm parameters for one image-field

Returns

record

checkimageparams(impars='')[source]

Check and Fix Imaging Parameters for one field

Parameters

  • impars (record='') - All imaging parameters for one image-field

Returns

record

checkselectionparams(selpars='')[source]

Check and Fix Selection Parameters for one MS

Parameters

  • selpars (record='') - All selection parameters for one MS

Returns

record

contdatapartition(selpars='', npart=1)[source]

Partition data selection parameters for continuum imaging

Parameters

  • selpars (record='') - All selection parameters for one or more MSs

  • npart (int=1) - Number of partitions

Returns

record

cubedataimagepartition(selpars='', incsys='', npart=1, nchannel=1)[source]

Partition data/image cube parameters for CUBE deconvolution

Parameters

  • selpars (record='') - All selection parameters for one or more MSs

  • incsys (record='') - input coordinate system

  • npart (int=1) - Number of partitions

  • nchannel (int=1) - Number of channels

Returns

record

cubedatapartition(selpars='', npart=1, fstart='1GHz', fend='1.5GHz', frame='LSRK')[source]

returns a dictionary with data spectral parttiion that maps data to nparts of the input range frequency… usually to be used for doing data selection when imaging a cube from fstart to fend in npart subcubes

Parameters

  • selpars (record='') - All selection parameters for one or more MSs

  • npart (int=1) - Number of partitions

  • fstart (variant='1GHz') - start frequency of cube image

  • fend (variant='1.5GHz') - end frequency of cube image

  • frame (string='LSRK') - frame of fstart and fend

Returns

record

Examples

##make a synthesisutils tool
siu=casac.synthesisutils()
### define first ms parameters
msrec={"msname":"ngc5921.ms.contsub", "field":"0", "spw":"0"}
pars={"ms0":msrec}
##  can add ms1, ms2 etc for multiple ms  into dictionary pars

##now get the data selections for 20 subpart of a cube that 
## spans from 1.412787GHz to 1.413287GHz
siu.cubedatapartition(selprs=pars, npart=20, fstart="1.412787GHz", fend="1.413287GHz", frame="LSRK")
cubeimagepartition(impars='', npart=1)[source]

Partition image cube parameters for CUBE deconvolution

Parameters

  • impars (record='') - All imaging parameters for one or more image fields

  • npart (int=1) - Number of partitions

Returns

record

done()[source]

Close the tool

fitPsfBeam(imagename='', nterms=1, psfcutoff=0.35)[source]

Fit a restoring beam to the PSF, and save it in the PSF image.

Parameters

  • imagename (string='') - Image Prefix name

  • nterms (int=1) - Single or Multi-Term (to pick namng conventions)

  • psfcutoff (float=0.35) - A fractional cut-off level to determine what part of the PSF is sent to the beam fitter

Returns

bool

getOptimumSize(size=100)[source]

Get Optimum Image size

Parameters

  • size (int=100) - Input size

Returns

int

synthesisutils()[source]

This is used to construct synthesisutils tool.

updateimpars(impars='')[source]

check the consistency between the csys record and other impars and update/modify impars if necessary

Parameters

  • impars (record='') - All image parameters of one image-field

Returns

record