Skip to content

Instantly share code, notes, and snippets.

@SpheMakh
Last active April 25, 2017 12:34
Show Gist options
  • Save SpheMakh/ae2bce862ddfb0786bc4b6f95aaa9ba3 to your computer and use it in GitHub Desktop.
Save SpheMakh/ae2bce862ddfb0786bc4b6f95aaa9ba3 to your computer and use it in GitHub Desktop.
Predict visibilities from a FITS image
import stimela
INPUT = 'input'
OUTPUT = 'output'
MSDIR = 'msdir'
MODEL = 'skylens.fits'
MS = 'test_predict_with_custom_fits.ms'
PREFIX = MS[:-3]
recipe = stimela.Recipe('Test lwimger predict', ms_dir=MSDIR)
recipe.add('cab/simms', 'create_empty_ms', {
"msname" : MS,
"synthesis" : 6, # length of observation in hours
"dtime" : 2, # integration time in seconds
"telescope" : 'ska1mid197',
"direction" : 'J2000,0deg,-30deg',
# This frequency information will be
# imposed when FITS image is simulated into
# MS
"freq0" : '1.400GHz',
"nchan" : 1, # If your FITS image has multiple frequency planes, then make this value match that
"dfreq" : '1MHz',
},
input=INPUT,
output=OUTPUT,
label='make_ms:: Make empty MS')
recipe.add('cab/lwimager', 'predict', {
"msname" : MS,
"simulate_fits" : MODEL,
"column" : 'DATA', # data will simulated into this column
"cellsize" : "0.2arcsec",
# If not specified will use appropriate
# CDELT value in FITS header if its there,
# else assumes 1arcsec
},
input=INPUT,
output=OUTPUT,
label='predict:: Predict from FITS')
recipe.add('cab/simulator', 'addnoise', {
"msname" : MS,
"addnoise" : True,
"sefd" : 386,
"mode" : 'add', # add simulated to noise to the column specified bellow
"input-column" : 'DATA'
"column" : 'DATA',
},
input=INPUT,
output=OUTPUT,
label='addnoise:: Add noise')
recipe.add('cab/wsclean', 'make_image', {
"msname" : MS,
"column" : 'DATA',
"prefix" : PREFIX,
"npix" : 1500,
"weight" : "briggs -2",
"niter" : 100000,
"auto-threshold": 5, # stop at 5sigma
"mgain" : 0.9,
"cellsize" : "0.2arcsec",
},
input=INPUT,
output=OUTPUT,
label="make_image:: Make image")
recipe.run()
#recipe.run(['make_ms','predict', 'addnoise','make_image'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment