Skip to content

mkspsf: Telescope PSF Simulator

rubyvanrooyen edited this page May 3, 2017 · 13 revisions

Python package to simulate the PSF for an antenna array using the casacore tools, makems and wsclean:

The tool required antenna positions and a basic pointing direction. Antenna positions can either be in the form of a config file, or a CASA antenna table. MeerKAT antenna positions are assumed by default.

Output will always be to the current working directory.

Required Input

  • The antenna positions provided are in ENU or ITRF coordinates provided as config information
  • A default makems.cfg file that can be used as configuration information for makems
> cat makems.cfg
AntennaTableName=ANTENNAS
NTimes=300
StepTime=86400.
StartFreq=856.0e+06
StepFreq=1671872.0
NFrequencies=512
NBands=1
Declination=-60d00m00.0s
RightAscension=00h00m00.0s
StartTime=2014/01/01/15:00
MSName=makems.MS
MSDesPath=.
NParts=1
WriteImagingColumns=True
WriteAutoCorr=True

Usage

Display available optional parameters:

> mkspsf --help
Usage: mkspsf [options] --cfg <makems.cfg> <ant_pos_file>

Options:
  --version                                show program's version number and exit
  -h, --help                               show this help message and exit
  --cfg=CFG                                Config file for makems
  --table                                  Create a CASA antenna table
  --ant_list=ANT_LIST                      Comma separated list of antenna names

  Telescope Geographic Coordinates:
    --array=ARRAY                          Name of telescope / array (default array='mkat')
    --lat=LAT                              Latitude (default MeerKAT lat='-30:42:47.4')
    --lon=LON                              Longitude (default MeerKAT lon='21:26:38.0')
    --alt=ALT                              Altitude (default MeerKAT alt='1060.0')

  Coordinate Classification:
    --enu                                  Antenna position file giving ENU coordinates using format: E N U dish_diam
                                           station mount  Default if not specified is ITRF coordinates using format: X Y
                                           Z diameter station mount

  Output Options:
    -o, --output                           Save graphs to PNG format
    -v, --verbose                          Display results and all graphs
    --debug                                Display additional debug results

  MAKEMS Simulation Options:
    --ant=TBLNAME                          Antenna table name, else ANTENNA table will be generated
    --ms=MSNAME                            Name of the measurement set to create
    --stime=STIME                          Observation start time YYYY/MM/DD/hh:mm:ss.
    --synthesis=SYNTHESIS                  Total synthesis / integration time in seconds (default snapshot of 5
                                           minutes).
    --dt=DT                                Accumulation time given as nr seconds per dump (default rate 4 seconds per
                                           dump)
    --dtime=DTIME                          Regular separation of simulated integration series (default is a scan every
                                           12 hours.)
    --dec=DECLINATION                      J2000 declination for simulation default -60d00m00.0s
    --ra=RIGHTASCENSION                    J2000 right ascension for simulation default 00h00m00.0s
    --nparts=NPARTS                        Nr of parts into which the measurement set is to be split
    --nbands=NBANDS                        Nr of subbands to use, default=1 and max=4.
    --nfreqs=NFREQS                        Total number of frequencies
    --sfreq=SFREQ                          Comma separated list of length NBands with start frequency per band
    --stepfreq=STEPFREQ                    Comma separated list of length NBands with step frequency per band

  WSCLEAN Simulation Options:
    --weight=WEIGHT                        Weightmode can be: natural, uniform, briggs (default=uniform).  When using
                                           Briggs' weighting, add the robustness parameter
    --robust=ROBUST                        Robustness parameter for briggs weighting (-2 <= x <= 2)
    --superweight=SUPERWEIGHT              Increase the weight gridding box size, similar to Casa's superuniform
                                           weighting scheme (default 1.0). The factor can be rational and can be less
                                           than one for subpixel weighting.
    --taper-gaussian=TAPER_GAUSSIAN        Taper the weights with a Gaussian function ('--taper-gaussian <beamsize>').
                                           This will reduce the contribution of long baselines. The beamsize is by
                                           default in asec, but a unit can be specified ('2amin').
    --taper-tukey=TAPER_TUKEY              Taper the outer weights with a Tukey transition ('--taper-tukey <lambda>').
                                           Lambda specifies the size of the transition; use in combination with option
                                           'maxuv-l'.
    --taper-inner-tukey=TAPER_INNER_TUKEY  Taper the weights with a Tukey transition ('--taper-inner-tukey <lambda>').
                                           Lambda specifies the size of the transition; use in combination with option
                                           'minuv-l'.
    --taper-edge=TAPER_EDGE                Taper the weights with a rectangle, to keep a space of lambda between the
                                           edge and gridded visibilities.
    --taper-edge-tukey=TAPER_EDGE_TUKEY    Taper the edge weights with a Tukey window ('--taper-edge-tukey <lambda>').
                                           Lambda is the size of the Tukey transition. When option 'taper-edge' is also
                                           specified, the Tukey transition starts inside the inner rectangle.
    --maxuv-l=MAXUV_L                      Set the min/max uv distance in lambda (--maxuv-l <lambda>).
    --minuv-l=MINUV_L                      Set the min/max uv distance in lambda (--minuv-l <lambda>).
    --make-psf-only                        Only make the psf, no images are made.

  PSF slice:
    --beamwidth=BEAMWIDTH                  Beamwidth in arcseconds
    --crop                                 Crop the PSF to size

Snap shot PSF models

Basic usage to generate antenna table
mkspsf ../config/mkat_antennas.enu --enu --table

Snap shot image using default setting
mkspsf --cfg ../config/makems.cfg --enu ../config/mkat_antennas.enu --stime 2017/02/15/19:19:00 --crop
MeerKAT antenna positions are provided in ENU coordinates and require the --enu flag
Since the PSF will rotate with hour angle, --stime can be specified to get the shape at some user selected time, else the PSF at local time will be generated
Very narrow beam with the longest baselines, so the PSF output image is cropped, --crop, for better display

  • A CASA ANTENNA table will be generated from the antenna positions provided in the ENU format config file
  • A CASA measurement set will be simulated using default configuration
  • PSF will be simulated and FITS image created
    psf
    slice
    uv

Snap shot image at a range of declinations, using a pre-existing ANTENNA table
mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --dec -90d00m00s --stime 2017/02/15/19:25:00 --crop --weight briggs --robust -0.5 --synthesis 180 --dt 256
declination -90 deg

mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --dec -60d00m00s --stime 2017/02/15/19:25:00 --crop --weight briggs --robust 0.0
declination -60 deg

mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --dec -30d00m00s --stime 2017/02/15/19:25:00 --crop --weight briggs --robust -0.5
declination -30 deg

mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --dec 10d00m00s --stime 2017/02/15/19:25:00 --crop --weight briggs --robust -0.5
declination 10 deg

mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --dec 30d00m00s --stime 2017/02/15/19:25:00 --crop --weight briggs --robust -0.5
declination 30 deg

Longer integration time models

Single long integration
Single 12 hour synthesis scan, dumping every 256 seconds, starting at a specified date, pointing at declination -30 degrees
mkspsf --cfg ../config/makems.cfg --enu ../config/mkat_antennas.enu --synthesis 43200 --dt 256 --dec -30d00m00s --stime 2017/01/01/09:00:00

Concatenated measurement sets
4 hour scan (8 half hour scans 1.5 hours apart)
mkspsf --cfg ../config/makems.cfg --enu ../config/mkat_antennas.enu --synthesis 14400 --dtime 1.5 --dt 256 --stime 2014/01/01/09:00:00 --crop

2 hour scan (4 half hour scans 3 hours apart)
mkspsf --cfg ../config/makems.cfg --enu ../config/mkat_antennas.enu --synthesis 7200 --dtime 3 --dt 256 --stime 2014/01/01/09:00:00 --crop

15 minute scan (2 7.5 minute scans 6 hours apart)
mkspsf --cfg ../config/makems.cfg --enu ../config/mkat_antennas.enu --synthesis 900 --dtime 6 --dt 256 --stime 2014/01/01/09:00:00 --crop

Example

Create a simulated PSF for the following observation setup

Beamformer observation to map the beam shape uses a 10 min drift scan over a target.

Observed: 2017-02-21: 15:27:58.654 SAST 15:37:58.400 SAST
Dump rate / period: 0.25011 Hz / 3.998 s
Antennas: m001,m006,m010,m014,m021,m025,m031,m034
Freq:
- Correlator: 1284.0, 856.0, 4096, 208.984
- Beamformer: 1284.0, 428.0, 2048, 208.984
Az: 155:10:19.4
El: 45:24:03.3 
RA: 04:08:20.37884
Dec: -65:45:09.0806

Since output is to the current working directory, create a temporary work space

mkdir fbf_beamshape
cd fbf_beamshape

[Optional] To prevent accidental removal of work while trying out various options, create a file that will help you remove intermediate output safely:
Use a text editor to create a text file called Makefile
Paste the following:

clean:
	rm -f *.pyc
	rm -f *.log *.last *.loc
	rm -rf *_p0

realclean: clean
	rm -f *.png *.fits

clobber: realclean
	rm -f *.enu *.cfg
	rm -rf *ANTENNA*

Execute using: make [clean/realclean/clobber]

  • make clean will remove temporary files generated in the simulation process
  • make realclean will remove temporary files as well as output images generated by the simulations
  • make clobber will also remove the generated antenna table and other generated configuration files

Simulating the PSF
Generate a custom antenna table (mkat_ANTENNA) for selected antennas in working directory
mkspsf ../config/mkat_antennas.enu --enu --table --ant_list='m001,m006,m010,m014,m021,m025,m031,m034'

Simulate PSF for observation

make realclean
mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --weight uniform --dec -65d45m09.0806s --ra 04h08m20.37884s --stime 2017/02/21/13:27:58
display *.png

make realclean
mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --weight briggs --dec -65d45m09.0806s --ra 04h08m20.37884s --stime 2017/02/21/13:27:58
display *.png

make realclean
mkspsf --cfg ../config/makems.cfg --ant mkat_ANTENNA/ --weight natural --dec -65d45m09.0806s --ra 04h08m20.37884s --stime 2017/02/21/13:27:58
display *.png

Save antenna locations to config file for reuse

make clobber
mksarray --enu ../config/mkat_antennas.enu --ant 'm001,m006,m010,m014,m021,m025,m031,m034' -s -o -v
mv subarray.itrf ../config/mkat_8ant_subarray.itrf