Skip to content

Commit 743c98d

Browse files
committed
PAN-78 Small refactor. Interface for custom telescope arrays has been moved into the yaml configs. Custom code has been moved out of reports.py
1 parent bc65b19 commit 743c98d

7 files changed

+419
-232
lines changed

data/yaml/all_custom_options.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,19 @@ Tint_out: 1.4
114114
# DPrepD: Tint_min
115115

116116
tRCAL_G: 10.0
117-
# Real time solution interval for antenna gains
117+
# Real time solution interval for antenna gains *s*
118118

119119

120120
tICAL_G: 1.0
121-
# Solution interval for antenna gains
121+
# Solution interval for antenna gains *s*
122122

123123

124124
tICAL_B: 3600.0
125-
# Solution interval for Bandpass
125+
# Solution interval for Bandpass *s*
126126

127127

128128
tICAL_I: 10.0
129-
# Solution interval for Ionosphere
129+
# Solution interval for Ionosphere *s*
130130

131131

132132
NIpatches: 1
@@ -186,6 +186,9 @@ Ntiedbeam: 1500
186186
# SKA_Low: 500
187187
# PST: 16
188188

189+
Qfov: 2.7
190+
# Field of view quotient
191+
189192

190193
on_the_fly: False
191194

@@ -257,3 +260,11 @@ Npatch: 4097 # Number of pixels in clean patch
257260
Tsolve: 600 # Calibration solution process frequency (task granularity)
258261
Tsnap_min: 0.1
259262
Tsnap: 600
263+
264+
265+
array_config_file: '../data/layouts/SKA1_Mid_rev_05_prop.txt'
266+
# If specified, baseline_bins and baseline_bin_distribution will be overwritten. If specified, array_config_bins nust also be specified
267+
268+
array_config_bins: 12
269+
# Number of baseline bins to be used when calculating the histogram of baselines.
270+
# Increasing the number of bins slows down the parametric model

data/yaml/hpso_max_mid_band1_ICal.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'max_mid_band1'
22
telescope: 'SKA1_Mid'
33
band: 'Mid1'
44
pipeline: 'ICAL' # One of ['Ingest', 'RCAL', 'FastImg', 'ICAL', 'DPrepA', 'DPrepA_Image', 'DPrepB', 'DPrepC', 'DPrepD', 'PSS', 'PST', 'SinglePulse']
5-
Bmax: 150000 # Actually constructed max baseline in *m*
5+
Bmax: 149000.0 # Actually constructed max baseline in *m*
66
Ds: 13.5 # dish diameter in metres, assume 13.5 as this matches the MeerKAT dishes
77
Na: 197 # number of dishes (sum of MeerKAT and new dishes)
88
Nbeam: 1 # number of beams
@@ -18,7 +18,7 @@ Texp: 21600
1818
# Baseline length distribution calculated from layout in
1919
# SKA-TEL-SKO-0000422, Rev 03 (corresponding to ECP-170049),
2020
# see Absolute_Baseline_length_distribution.ipynb
21-
baseline_bins: [5000.0, 7500.0, 10000.0, 15000.0, 25000.0, 35000.0, 55000.0, 75000.0, 90000.0, 110000.0, 130000.0, 150000.0]
21+
baseline_bins: [1.0, 7500.0, 10000.0, 15000.0, 25000.0, 35000.0, 55000.0, 75000.0, 90000.0, 110000.0, 130000.0, 150000.0]
2222
baseline_bin_distribution: [61.3646961, 5.16553546, 2.87031760, 4.98937879,
2323
6.32609709, 4.63706544, 5.73545412, 5.50230558,
2424
1.80301539, 1.45070204, 0.108802653, 0.0466297083]
@@ -30,4 +30,11 @@ tICAL_G: 1.0 # Solution interval for Antenna gains
3030
tICAL_B: 3600.0 # Solution interval for Bandpass
3131
tICAL_I: 10.0 # Solution interval for Ionosphere
3232
NIpatches: 1 # Number of ionospheric patches to solve
33-
Qfov: 2.7
33+
Qfov: 2.7
34+
35+
array_config_file: '../data/layouts/SKA1_Mid_rev_02.txt'
36+
# If specified, baseline_bins and baseline_bin_distribution will be overwritten. If specified, array_config_bins nust also be specified
37+
38+
array_config_bins: 10
39+
# Number of baseline bins to be used when calculating the histogram of baselines.
40+
# Increasing the number of bins slows down the parametric model

notebooks/SKA1_Export.ipynb

+9-25
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"metadata": {},
8383
"outputs": [],
8484
"source": [
85-
"yml_path = os.path.join('..','data','yaml','')\n",
85+
"yml_path = os.path.join('..', 'data','yaml','')\n",
8686
"\n",
8787
"# Change to get date+git version, etc\n",
8888
"outfile = csv_path + 'custom_pipelines.csv'\n",
@@ -93,9 +93,8 @@
9393
"for infile in infile_names:\n",
9494
" infile_paths.append(yml_path + infile)\n",
9595
"\n",
96-
"custom_arrays = [False, False, False, False]\n",
9796
"\n",
98-
"reports.write_csv_custom(infile_paths, outfile, custom_arrays, parallel=parallel, verbose=False)\n"
97+
"reports.write_csv_custom(infile_paths, outfile, parallel=parallel, verbose=False)\n"
9998
]
10099
},
101100
{
@@ -111,19 +110,10 @@
111110
"infile_names = ['all_custom_options.yml', 'hpso_max_mid_band1_ICal.yml', 'hpso01_DPrepD.yml', 'hpso01_ICal.yml']\n",
112111
"\n",
113112
"infile_paths = []\n",
114-
"custom_arrays = []\n",
115113
"for infile in infile_names:\n",
116114
" infile_paths.append(yml_path + infile)\n",
117115
"\n",
118-
"custom_arrays = [True, False, False, False]\n",
119-
"\n",
120-
"# array_configs and list_num_bins:\n",
121-
"# Must be the same length as len(np.where(custom_arrays)[0])\n",
122-
"# Must be ordered (ie first array_config corresponds to the first infile with custom_array == True\n",
123-
"array_configs = ['SKA1_Mid_rev_05_prop.txt']\n",
124-
"list_num_bins = [12]\n",
125-
"\n",
126-
"reports.write_csv_custom(infile_paths, outfile, custom_arrays, array_configs, list_num_bins, parallel=parallel, verbose=False)\n"
116+
"reports.write_csv_custom(infile_paths, outfile, parallel=parallel, verbose=False)\n"
127117
]
128118
},
129119
{
@@ -137,7 +127,7 @@
137127
"# Change to get date+git version, etc\n",
138128
"outfile = csv_path + 'custom_max_mid_band1.csv'\n",
139129
"prefix = 'reduced_max_mid_band1/hpso_max_mid_band1_'\n",
140-
"pipelines = ['Ingest', 'RCal', 'FastImg', 'ICal', 'DPrepA', 'DPrepB', 'DPrepC']\n",
130+
"pipelines = ['Ingest', 'RCAL', 'FastImg', 'ICAL', 'DPrepA', 'DPrepB', 'DPrepC']\n",
141131
"suffix = '.yml'\n",
142132
"\n",
143133
"infile_names = []\n",
@@ -146,13 +136,11 @@
146136
" infile_names.append(prefix + pipeline + suffix)\n",
147137
"\n",
148138
"infile_paths = []\n",
149-
"custom_arrays = []\n",
150139
"\n",
151140
"for infile in infile_names:\n",
152141
" infile_paths.append(yml_path + infile)\n",
153-
" custom_arrays.append(False)\n",
154142
"\n",
155-
"reports.write_csv_custom(infile_paths, outfile, custom_arrays, parallel=parallel, verbose=False)"
143+
"reports.write_csv_custom(infile_paths, outfile, parallel=parallel, verbose=False)"
156144
]
157145
},
158146
{
@@ -166,7 +154,7 @@
166154
"# Change to get date+git version, etc\n",
167155
"outfile = csv_path + 'max_mid_band1.csv'\n",
168156
"prefix = 'max_mid_band1/hpso_max_mid_band1_'\n",
169-
"pipelines = ['Ingest', 'RCal', 'FastImg', 'ICal', 'DPrepA', 'DPrepB', 'DPrepC']\n",
157+
"pipelines = ['Ingest', 'RCAL', 'FastImg', 'ICAL', 'DPrepA', 'DPrepB', 'DPrepC']\n",
170158
"suffix = '.yml'\n",
171159
"\n",
172160
"infile_names = []\n",
@@ -175,13 +163,11 @@
175163
" infile_names.append(prefix + pipeline + suffix)\n",
176164
"\n",
177165
"infile_paths = []\n",
178-
"custom_arrays = []\n",
179166
"\n",
180167
"for infile in infile_names:\n",
181168
" infile_paths.append(yml_path + infile)\n",
182-
" custom_arrays.append(False)\n",
183169
"\n",
184-
"reports.write_csv_custom(infile_paths, outfile, custom_arrays, parallel=parallel, verbose=False)"
170+
"reports.write_csv_custom(infile_paths, outfile, parallel=parallel, verbose=False)"
185171
]
186172
},
187173
{
@@ -198,7 +184,7 @@
198184
"prefix_1 = 'reduced_max_mid_band1/hpso_max_mid_band1_'\n",
199185
"prefix_2 = 'reduced_hpso_4b/hpso_4b_'\n",
200186
"\n",
201-
"pipelines_1 = ['Ingest', 'RCal', 'FastImg', 'ICal', 'DPrepA', 'DPrepB', 'DPrepC']\n",
187+
"pipelines_1 = ['Ingest', 'RCAL', 'FastImg', 'ICAL', 'DPrepA', 'DPrepB', 'DPrepC']\n",
202188
"pipelines_2 = ['Ingest', 'RCAL', 'PSS', 'FastImg']\n",
203189
"\n",
204190
"suffix = '.yml'\n",
@@ -212,13 +198,11 @@
212198
" infile_names.append(prefix_2 + pipeline + suffix)\n",
213199
"\n",
214200
"infile_paths = []\n",
215-
"custom_arrays = []\n",
216201
"\n",
217202
"for infile in infile_names:\n",
218203
" infile_paths.append(yml_path + infile)\n",
219-
" custom_arrays.append(False)\n",
220204
"\n",
221-
"reports.write_csv_custom(infile_paths, outfile, custom_arrays, parallel=parallel, verbose=False)"
205+
"reports.write_csv_custom(infile_paths, outfile, parallel=parallel, verbose=False)"
222206
]
223207
},
224208
{

notebooks/SKA1_Imaging_Performance_Model.ipynb

+29-8
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
"source": [
6161
"## Compute requirements for a custom telescope and pipeline configuration\n",
6262
"\n",
63-
"A yaml file needs to be created that contains the custom telescope observation attributes. Examples are provided in the /data/yaml/ directory. The output verbosity also needs to be set.\n",
63+
"A yaml file needs to be created that contains the custom telescope observation attributes. Examples are provided in the `/data/yaml/` directory. The output verbosity also needs to be set.\n",
6464
"\n",
65-
"A custom telescope array configuration can be used by creating a txt file that contains each antenna's latitude and longitude coordinates - `custom_array` must be set to True in this case. Examples are provided in the /data/ayouts/ directory. A baseline histogram is created from the antenna positions to simplify calculations and `num_bins` can be used to set the number of histogram bins used.\n",
65+
"A custom telescope array configuration can be used by creating a txt file that contains each antenna's latitude and longitude coordinates - `array_config_file` must be set in the yaml file to use a custom telescope array. Example layout files are provided in the `/data/layouts/` directory. A baseline histogram is created from the antenna positions to simplify calculations and `array_config_bins` must be specified in the yaml which sets the number of histogram bins used. More bins makes the parametric model slower.\n",
6666
"\n",
6767
"Once the object is created, the `run` method can be called to compute the requirements. There's no interactive mode for this case."
6868
]
@@ -73,11 +73,32 @@
7373
"metadata": {},
7474
"outputs": [],
7575
"source": [
76-
"app = reports.CustomObservation(\n",
77-
" yaml_file=\"../data/yaml/hpso_max_mid_band1_ICal.yml\",\n",
78-
" custom_array=True,\n",
79-
" array_txt_file=\"../data/layouts/SKA1_Mid_rev_02.txt\",\n",
80-
" num_bins=10,\n",
76+
"app = reports.Observation(\n",
77+
" use_yaml=True,\n",
78+
" yaml_path=\"../data/yaml/hpso_max_mid_band1_ICal.yml\",\n",
79+
" verbose='Overview',\n",
80+
")\n",
81+
"app.run()"
82+
]
83+
},
84+
{
85+
"cell_type": "markdown",
86+
"metadata": {},
87+
"source": [
88+
"# Compute requirements for a hard-coded HPSO\n",
89+
"\n",
90+
"The following cell shows the Observation class being used with a specified HPSO, rather than a custom observation without an interactive interface."
91+
]
92+
},
93+
{
94+
"cell_type": "code",
95+
"execution_count": null,
96+
"metadata": {},
97+
"outputs": [],
98+
"source": [
99+
"app = reports.Observation(\n",
100+
" pipeline='Ingest',\n",
101+
" hpso='hpso04b',\n",
81102
" verbose='Overview',\n",
82103
")\n",
83104
"app.run()"
@@ -150,7 +171,7 @@
150171
"name": "python",
151172
"nbconvert_exporter": "python",
152173
"pygments_lexer": "ipython3",
153-
"version": "3.9.18"
174+
"version": "3.11.5"
154175
}
155176
},
156177
"nbformat": 4,

0 commit comments

Comments
 (0)