|
3 | 3 | import os |
4 | 4 |
|
5 | 5 | # Recipe I/O configuration |
6 | | -INPUT = "input" # This folder must exist |
| 6 | +INPUT = "input" # This folder must exist |
7 | 7 | OUTPUT = "output" |
8 | 8 | MSDIR = "msdir" |
9 | 9 | PREFIX = "stimela-example" # Prefix for output images |
10 | 10 | try: |
11 | 11 | SINGULARTITY_IMAGE_DIR = os.environ["STIMELA_SINGULARTITY_IMAGE_DIR"] |
12 | 12 | except KeyError: |
13 | 13 | SINGULARTITY_IMAGE_DIR = None |
14 | | - |
| 14 | + |
15 | 15 |
|
16 | 16 | # MS name |
17 | 17 | MS = "meerkat_simulation_example.ms" |
|
22 | 22 |
|
23 | 23 | # Start stimela Recipe instance |
24 | 24 | pipeline = stimela.Recipe("Simulation Example", # Recipe name |
25 | | - ms_dir=MSDIR, |
26 | | - singularity_image_dir=SINGULARTITY_IMAGE_DIR, |
27 | | - log_dir = os.path.join(OUTPUT, "logs") |
28 | | - ) |
| 25 | + ms_dir=MSDIR, |
| 26 | + singularity_image_dir=SINGULARTITY_IMAGE_DIR, |
| 27 | + log_dir=os.path.join(OUTPUT, "logs") |
| 28 | + ) |
29 | 29 |
|
30 | | -pipeline.JOB_TYPE = "udocker" |
| 30 | +pipeline.JOB_TYPE = "docker" |
31 | 31 |
|
32 | | -# 1: Make empty MS |
33 | | -pipeline.add("cab/simms", # Executor image to start container from |
| 32 | +# 1: Make empty MS |
| 33 | +pipeline.add("cab/simms", # Executor image to start container from |
34 | 34 | "simms_example", # Container name |
35 | | - { # Parameters to parse to executor container |
36 | | - "msname" : MS, |
37 | | - "telescope" : "meerkat", # Telescope name |
38 | | - "direction" : "J2000,0deg,-30deg", # Phase tracking centre of observation |
39 | | - "synthesis" : 0.128, # Synthesis time of observation |
40 | | - "dtime" : 10, # Integration time in seconds |
41 | | - "freq0" : "750MHz", # Start frequency of observation |
42 | | - "dfreq" : "1MHz", # Channel width |
43 | | - "nchan" : 1 # Number of channels |
| 35 | + { # Parameters to parse to executor container |
| 36 | + "msname": MS, |
| 37 | + "telescope": "meerkat", # Telescope name |
| 38 | + "direction": "J2000,0deg,-30deg", # Phase tracking centre of observation |
| 39 | + "synthesis": 0.128, # Synthesis time of observation |
| 40 | + "dtime": 10, # Integration time in seconds |
| 41 | + "freq0": "750MHz", # Start frequency of observation |
| 42 | + "dfreq": "1MHz", # Channel width |
| 43 | + "nchan": 1 # Number of channels |
44 | 44 | }, |
45 | 45 | input=INPUT, # Input folder |
46 | 46 | output=OUTPUT, # Output folder |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 | # 2: Simulate visibilities into it |
53 | | -pipeline.add("cab/simulator", |
| 53 | +pipeline.add("cab/simulator", |
54 | 54 | "simulator_example", |
55 | 55 | { |
56 | | - "msname" : MS, |
57 | | - "skymodel" : LSM, # Sky model to simulate into MS |
58 | | - "addnoise" : True, # Add thermal noise to visibilities |
59 | | - "column" : "CORRECTED_DATA", # Simulated data will be saved in this column |
60 | | - "sefd" : 831, # Compute noise from this SEFD |
61 | | - "recenter" : True, # Recentre sky model to phase tracking centre of MS |
62 | | - "tile-size" : 64, |
63 | | - "threads" : 4, |
| 56 | + "msname": MS, |
| 57 | + "skymodel": LSM, # Sky model to simulate into MS |
| 58 | + "addnoise": True, # Add thermal noise to visibilities |
| 59 | + "column": "CORRECTED_DATA", # Simulated data will be saved in this column |
| 60 | + "sefd": 831, # Compute noise from this SEFD |
| 61 | + # Recentre sky model to phase tracking centre of MS |
| 62 | + "recenter": True, |
| 63 | + "tile-size": 64, |
| 64 | + "threads": 4, |
| 65 | + }, |
| 66 | + input=INPUT, output=OUTPUT, |
| 67 | + label="Simulating visibilities") |
| 68 | + |
| 69 | + |
| 70 | +pipeline.add('cab/casa_plotms', |
| 71 | + 'plot_vis', |
| 72 | + { |
| 73 | + "vis": MS, |
| 74 | + "xaxis": 'uvdist', |
| 75 | + "yaxis": 'amp', |
| 76 | + "xdatacolumn": 'corrected', |
| 77 | + "ydatacolumn": 'corrected', |
| 78 | + "plotfile": PREFIX+'-amp_uvdist.png', |
| 79 | + "overwrite": True, |
64 | 80 | }, |
65 | | - input=INPUT, output=OUTPUT, |
66 | | - label="Simulating visibilities") |
67 | | - |
68 | | - |
69 | | -pipeline.add('cab/casa_plotms', |
70 | | - 'plot_vis', |
71 | | - { |
72 | | - "vis" : MS, |
73 | | - "xaxis" : 'uvdist', |
74 | | - "yaxis" : 'amp', |
75 | | - "xdatacolumn" : 'corrected', |
76 | | - "ydatacolumn" : 'corrected', |
77 | | - "plotfile" : PREFIX+'-amp_uvdist.png', |
78 | | - "overwrite" : True, |
79 | | - }, |
80 | | - input=INPUT, |
81 | | - output=OUTPUT, |
82 | | - label='plot_amp_uvdist:: Plot amplitude vs uv-distance') |
83 | | - |
84 | | -## 3: Image |
85 | | -# Make things a bit interesting by imaging with different weights |
| 81 | + input=INPUT, |
| 82 | + output=OUTPUT, |
| 83 | + label='plot_amp_uvdist:: Plot amplitude vs uv-distance') |
| 84 | + |
| 85 | +# 3: Image |
| 86 | +# Make things a bit interesting by imaging with different weights |
86 | 87 | # Briggs robust values to use for each image |
87 | 88 | briggs_robust = 2, 0, -2 |
88 | 89 |
|
89 | 90 | for i, robust in enumerate(briggs_robust): |
90 | 91 |
|
91 | 92 | pipeline.add("cab/wsclean", |
92 | | - "imager_example_robust_{:d}".format(i), |
| 93 | + "imager_example_robust_{:d}".format(i), |
93 | 94 | { |
94 | | - "msname" : MS, |
95 | | - "weight" : "briggs {:d}".format(i), |
96 | | - "prefix" : "{:s}_robust-{:d}".format(PREFIX, robust), |
97 | | - "npix" : 2048, # Image size in pixels |
98 | | - "cellsize" : 2, # Size of each square pixel |
99 | | - "clean_iterations" : 1000, # Perform 1000 iterarions of clean (Deconvolution) |
| 95 | + "msname": MS, |
| 96 | + "weight": "briggs {:d}".format(robust), |
| 97 | + "prefix": "{:s}_robust-{:d}".format(PREFIX, robust), |
| 98 | + "npix": 2048, # Image size in pixels |
| 99 | + "cellsize": 2, # Size of each square pixel |
| 100 | + # Perform 1000 iterarions of clean (Deconvolution) |
| 101 | + "clean_iterations": 1000, |
100 | 102 | }, |
101 | | - input=INPUT, |
102 | | - output=OUTPUT, |
103 | | - label="Imaging MS, robust={:d}".format(robust), |
| 103 | + input=INPUT, |
| 104 | + output=OUTPUT, |
| 105 | + label="Imaging MS, robust={:d}".format(robust), |
104 | 106 | cpus=2, |
105 | 107 | memory_limit="2gb") |
106 | 108 |
|
107 | 109 | pipeline.add("cab/casa_rmtables", "delete_ms", { |
108 | | - "tablenames" : MS + ":msfile", |
109 | | - }, |
110 | | - input=INPUT, |
111 | | - output=OUTPUT, |
112 | | - label="Remove MS") |
113 | | - |
| 110 | + "tablenames": MS + ":msfile", |
| 111 | +}, |
| 112 | + input=INPUT, |
| 113 | + output=OUTPUT, |
| 114 | + label="Remove MS") |
114 | 115 |
|
115 | 116 |
|
116 | 117 | # Run recipe. The 'steps' added above will be executed in the sequence that they were adde. The 'steps' added above will be |
117 | 118 | # executed in the sequence that they were added |
118 | 119 | pipeline.run() |
119 | | - |
0 commit comments