Skip to content

Instantly share code, notes, and snippets.

@SpheMakh
Last active April 14, 2017 13:19
Show Gist options
  • Save SpheMakh/cb6c20cdfb75e1824976d5407cda4421 to your computer and use it in GitHub Desktop.
Save SpheMakh/cb6c20cdfb75e1824976d5407cda4421 to your computer and use it in GitHub Desktop.
# import stimela package
import stimela
# Recipe I/O configuration
INPUT = "input-ska1mid" # This folder must exist
OUTPUT = "output-ska1mid"
MSDIR = "msdir-ska1mid"
PREFIX = "ska1mid-example" # Prefix for output images
# MS name
MS = 'ska1mid_simulation_example.ms'
# Use the NVSS skymodel. This is natively available
LSM = 'ska1mid-skymodel.txt'
# Start stimela Recipe instance
pipeline = stimela.Recipe("SKA1MID Simulation Example", # Recipe name
ms_dir=MSDIR) # Folder in which to find MSs
# 1: Make empty MS
pipeline.add("cab/simms", # This is the module/cab that creates an empty visibility set
"simms_example", # prefix (alpha-numeric) for name of docker container that will be created to run this cab
{
# dictionary of options to be parsed to cab
"msname" : MS,
"telescope" : 'ska1mid197', # Telescope name
"direction" : 'J2000,0deg,-30deg', # Phase tracking centre of observation
"synthesis" : 0.125, # Synthesis time of observation
"dtime" : 4, # Integration time in seconds
"freq0" : '750MHz', # Start frequency of observation
"dfreq" : '1MHz', # Channel width
"nchan" : 1, # Number of channels
},
input=INPUT, # Folder where the cab expects to find input files
output=OUTPUT, # Folder where outputs and logs will be place
label='Creating MS') # Label for this task (optional)
# 2: Simulate visibilities into it
pipeline.add('cab/simulator',
'simulator_example',
{
"msname" : MS,
"skymodel" : LSM, # Sky model to simulate into MS
"addnoise" : True, # Add thermal noise to visibilities
"column" : 'CORRECTED_DATA',
"sefd" : 831, # Compute noise from this SEFD
"recenter" : True, # Recentre sky model to phase tracking centre of MS
},
input=INPUT,
output=OUTPUT,
label='Simulating visibilities')
## 3: Image
pipeline.add('cab/wsclean',
'imager_example',
{
"msname" : MS,
"weight" : 'briggs -2', # uv-weighting
"name" : PREFIX, # prefix for output images
"npix" : 3000, # image size in pixels
"cellsize" : 0.2, # pixel size in arcsec
"niter" : 1000, # number of clean iterations
"mgain" : 0.9, # 1 - major loop gain
},
input=INPUT,
output=OUTPUT,
label='Imaging MS')
# Run recipe. The 'steps' added above will be executed in the sequence that they were adde. The 'steps' added above will be
# executed in the sequence that they were added
pipeline.run()
@SpheMakh
Copy link
Author

The sky model file (ska1mid-skymodel.txt) is at https://gist.github.com/SpheMakh/28e86fa813711ff1a430b1aa1ed55b06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment