-
Notifications
You must be signed in to change notification settings - Fork 0
/
oms-cabs.yml
483 lines (446 loc) · 11.3 KB
/
oms-cabs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
_include:
- (quartical)stimela_cabs.yaml[optional]
- (cubical)stimela/stimela_cabs.yaml[optional]
## this augments the standard 'cabs' config section
cabs:
wsclean:
image: ''
command: /home/oms/src/wsclean/build/wsclean
inputs:
subtract-model:
dtype: bool
default: false
taper-inner-tukey:
dtype: float
minuv-l:
dtype: float
maxuv-l:
dtype: float
minuvw-m:
dtype: float
maxuvw-m:
dtype: float
wsclean_pol:
# policies:
# skip_implicits: true
image: ''
command: /home/oms/src/wsclean/build/wsclean
inputs:
taper-inner-tukey:
dtype: float
minuv-l:
dtype: float
maxuv-l:
dtype: float
minuvw-m:
dtype: float
maxuvw-m:
dtype: float
dummy:
image: ''
command: echo
inputs:
args:
dtype: List[str]
policies:
positional: true
repeat: repeat
mkdir:
command: mkdir
inputs:
dir:
dtype: str
policies:
positional: true
mv:
command: mv
policies:
positional: true
inputs:
src:
dtype: File
required: true
outputs:
dest:
dtype: Union[File, Directory]
required: true
cp:
command: cp -a
policies:
positional: true
inputs:
src:
dtype: File
required: true
outputs:
dest:
dtype: Union[File, Directory]
required: true
print_uniq_column_values:
command: "python3 -c 'from casacore.tables import table; import sys; print(len(set(table(sys.argv[1]).getcol(sys.argv[2]))),sys.argv[3]);'"
policies:
positional: true
inputs:
ms:
dtype: MS
required: true
column:
default: 'TIME'
label:
default: 'timeslots'
stack_freq_cube:
command: fitstool.py
inputs:
images:
dtype: List[File]
required: true
policies:
positional: true
repeat: repeat
outputs:
cube:
dtype: File
policies:
positional: true
format: '--stack={0}:FREQ'
fitstool:
command: fitstool.py
inputs:
images:
dtype: List[File]
required: true
policies:
positional: true
repeat: repeat
mean:
dtype: bool
diff:
dtype: bool
force:
dtype: bool
default: true
outputs:
output:
dtype: File
pybdsm:
name: pybdsm
command: |
import sys
import bdsf as bdsm
# these arguments belong to write_catalog() -- this gives their names -- the rest are used by process_image()
WRITE_CATALOG_ARGS = dict(catalog_format='format')
outfile_gaul = args.pop('outfile_gaul', None)
outfile_srl = args.pop('outfile_srl', None)
if not outfile_gaul and not outfile_srl:
raise RutimeError("at least one of 'outfile_gaul' or 'outfile_srl' needs to be supplied")
# enforce type conversions
ARG_TYPES = dict(rms_box=tuple)
# form args for process_image
process_image_args = dict(
print_timing=True,
quiet=True,
# for some reason process_image locks up unless this is set to True. Something to do with the progress bar filling up buffers on stdout?
#verbose_fitting=True,
)
image_name = args.pop('image')
for arg, value in args.items():
if arg not in WRITE_CATALOG_ARGS:
if arg in ARG_TYPES:
value = ARG_TYPES[arg](value)
process_image_args[arg] = value
print(f"process_image arguments: {image_name} {process_image_args}")
sys.stdout.flush()
print(f"calling process_image")
sys.stdout.flush()
img = bdsm.process_image(image_name, **process_image_args)
print(f"calling write_catalog")
sys.stdout.flush()
# form args for write_catalog
write_catalog_args = dict(clobber=True)
for arg, value in args.items():
if arg in WRITE_CATALOG_ARGS:
if arg in ARG_TYPES:
value = ARG_TYPES[arg](value)
write_catalog_args[WRITE_CATALOG_ARGS[arg]] = value
print(f"write_catalog arguments: {write_catalog_args}")
sys.stdout.flush()
if outfile_gaul:
print(f"calling write_catalog('{outfile_gaul}',...)")
sys.stdout.flush()
img.write_catalog(outfile=outfile_gaul, catalog_type='gaul', **write_catalog_args)
if outfile_srl:
print(f"calling write_catalog('{outfile_srl}',...)")
sys.stdout.flush()
img.write_catalog(outfile=outfile_srl, catalog_type='srl', **write_catalog_args)
print(f"finished")
sys.stdout.flush()
flavour:
kind: python-code
input_vars: false
input_dict: args
inputs:
image:
dtype: File
required: true
detection_image:
dtype: File
required: false
spectralindex_do:
dtype: bool
default: false
flagging_opts:
dtype: bool
default: false
flag_maxsize_bm:
dtype: float
required: false
rms_box:
required: false
dtype: Tuple[int, int]
thresh_isl:
dtype: float
default: 3
thresh_pix:
dtype: float
default: 5
catalog_format:
choices: [bbs, ds9, fits, star, kvis, ascii, csv, casabox, sagecal]
default: ascii
rms_map:
dtype: bool
required: false
outputs:
outfile_gaul:
dtype: File
outfile_srl:
dtype: File
tigger_convert:
command: tigger-convert
inputs:
src:
dtype: File
required: true
policies:
positional: true
force:
dtype: bool
default: true
outputs:
dest:
dtype: File
policies:
positional: true
msutils.copycol:
flavour: python
command: MSUtils.msutils.copycol
inputs:
msname:
dtype: MS
required: true
fromcol:
dtype: str
required: true
tocol:
dtype: str
required: true
msutils.addcol:
flavour: python
command: MSUtils.msutils.addcol
inputs:
msname:
dtype: MS
required: true
colname:
dtype: str
required: true
smops:
command: smops --ms {current.ms}
policies:
prefix: '--'
inputs:
output-prefix:
dtype: str
required: true
mkdir: true
num-threads:
dtype: int
stokes:
dtype: str
default: I
ms:
dtype: MS
policies:
skip: true
input-prefix:
required: true
dtype: str
channels-out:
required: true
dtype: int
polynomial-order:
dtype: int
required: true
outputs:
model:
dtype: List[File]
implicit: =GLOB("{current.output-prefix}*model*fits")
fft-image:
flavour: python-code
command: |
from astropy.io import fits
from numpy import fft
import math
ff = fits.open(image)
im = ff[0].data[0,0,...]
hdr = ff[0].header
im[:] = fft.fftshift(abs(fft.fft2(im)))
if lambda_per_arcsec:
scaling = 1 / (3600 * lambda_per_arcsec)
hdr['CUNIT1'] = hdr['CUNIT2'] = 'deg'
else:
hdr['CTYPE1'] = 'U'
hdr['CTYPE2'] = 'V'
hdr['CUNIT1'] = hdr['CUNIT2'] = 'lambda'
scaling = 1
hdr['CDELT1'] = scaling / (abs(hdr['CDELT1'])*hdr['NAXIS1']*math.pi/180)
hdr['CDELT2'] = scaling / (abs(hdr['CDELT2'])*hdr['NAXIS2']*math.pi/180)
hdr['CRVAL1'] = hdr['CRVAL2'] = 0.0
ff.writeto(fft_image, overwrite=True)
inputs:
image:
dtype: File
required: True
lambda-per-arcsec:
info: |
If set, fakes a WCS at RA=0 Dec=0, with that many uv-lambdas per arcsec. This can be useful to
fool some FITS viewers (i.e. CARTA) into drawing a useful WCS, which they otherwise don't
dtype: float
default: 0
outputs:
fft-image:
dtype: File
required: true
tricolour:
command: tricolour
inputs:
ms:
dtype: MS
policies:
positional: true
config:
dtype: File
ignore-flags:
dtype: bool
flagging-strategy:
choices: [standard,polarisation,total_power]
row-chunks:
dtype: int
baseline-chunks:
dtype: int
nworkers:
dtype: int
dilate-masks:
dtype: Union[int,str]
data-column:
dtype: str
field-names:
dtype: str
scan_numbers:
dtype: str
disable-post-mortem:
dtype: bool
default: true
window-backend:
choices: [numpy, zarr-disk]
temporary-directory:
dtype: Directory
subtract-model-column:
dtype: str
lib:
steps:
wsclean:
base:
info: "base wsclean settings"
cab: wsclean
params:
padding: 1.3
nwlayers-factor: 3
use-wgridder: true
log-time: true
dirty:
_use: lib.steps.wsclean.base
info: "wsclean step for dirty-only image"
params:
column: CORRECTED_DATA
niter: 0
# parallel_gridding: 64
dirty_pol:
_use: lib.steps.wsclean.dirty
info: "wsclean step for dirty-only IQUV image"
params:
pol: IQUV
image:
_use: lib.steps.wsclean.dirty
info: "wsclean step for imaging"
params:
fit-beam: true
elliptical-beam: true
# parallel-deconvolution: 1500
join-channels: true
mgain: 0.9
image_pol:
_use: lib.steps.wsclean.image
info: "wsclean step for IQUV imaging"
params:
join-polarizations: true
fit-spectral-pol: =UNSET
pol: IQUV
mgain: 0.9
predict:
_use: lib.steps.wsclean.base
info: "wsclean step for predicting a model"
params:
predict: true
predict_pol:
_use: lib.steps.wsclean.predict
info: "wsclean step for predicting an IQUV model"
params:
predict: true
pol: IQUV
predict_pol2:
_use: lib.steps.wsclean.predict_pol
info: "wsclean step for predicting an IQ model"
params:
pol: IQUV
quartical:
base:
cab: quartical
params:
input_ms:
time_chunk: '16'
freq_chunk: '0'
group_by: [SCAN_NUMBER,FIELD_ID,DATA_DESC_ID]
select_uv_range: [150, 0]
select_corr: [0, 3]
input_model:
apply_p_jones: false
solver:
terms: [K]
iter_recipe: [25]
propagate_flags: true
robust: false
output:
overwrite: true
products: [corrected_data]
columns: [CORRECTED_DATA]
flags: true
apply_p_jones_inv: false
mad_flags:
enable: true
threshold_bl: 5
threshold_global: 5
max_deviation: 5
K:
time_interval: 1
freq_interval: 0
type: delay