forked from ajstewart/PiLL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselfcal.parset
executable file
·1390 lines (1303 loc) · 99.9 KB
/
selfcal.parset
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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
################################################################################################################################################################################################################################################################
## ##
## Beginning of selfcal pipeline ##
## ##
################################################################################################################################################################################################################################################################
### Steps to run
pipeline.steps = [listsplit,listsplit2,listtemp2,listFRtar,listtec,listcolumn,listinst,addcol,sky_tar,sourcedbtar,listsourcedbtar2,predicttar,parmdbFRtar,fixFRtar,smoothtar,teccal,makevdstar,findvds,globaldbtec,h5parmtec,losotoplot,applytec,image_high1,createmap_high_image,mask_high,image_high2,listmodel,filter_model,make_sourcedb_target,listsourcedbtar3,predicttar_high,subtract_model,image_low,createmap_low_image,listmodel_low,mask_low,filter_model_low,make_sourcedb_target_low,listsourcedbtar4,predicttar_low,corrupt_model,subtract_model_low,restore_model,loop,image_deep,image_deep_high]
################################################################################################################################################################################################################################################################
################################################################################################################################################################################################################################################################
### Step: 00a
### --- Map splitted files
listsplit.control.kind = plugin # plugin -> short, non-parallel step
listsplit.control.type = createMapfile # generate a new mapfile
listsplit.control.method = mapfile_from_folder # look for all files in a given directory
listsplit.control.folder = {{ job_directory }} # directory in which to look for the data
listsplit.control.mapfile_dir = input.output.mapfile_dir # put the mapfile into the runtime directory
listsplit.control.filename = listsplit.mapfile # name of the generated mapfile
listsplit.control.pattern = *.time_split-split # use only files that match this pattern
### Step: 00b
### --- Map splitted files all to one
listsplit2.control.kind = plugin
listsplit2.control.type = createMapfile
listsplit2.control.method = mapfile_all_to_one
listsplit2.control.mapfile_dir = input.output.mapfile_dir
listsplit2.control.filename = listsplit2.mapfile
listsplit2.control.mapfile_in = listsplit.output.mapfile
### Step: 00c
### --- List of the single target MS which is used as a template for making a skymodel
listtemp2.control.kind = plugin # plugin -> short, non-parallel step
listtemp2.control.type = createMapfile # generate a new mapfile
listtemp2.control.method = mapfile_from_folder # look for all files in a given directory
listtemp2.control.folder = {{ target_directory }} # directory in which to look for the data
listtemp2.control.mapfile_dir = input.output.mapfile_dir # put the mapfile into the runtime directory
listtemp2.control.filename = listtemp2.mapfile # name of the generated mapfile
listtemp2.control.pattern = {{ target_template }} # use only files that match this pattern
### Step: 00d
### --- Update mapfile for calibrator FR tables
listFRtar.control.kind = plugin
listFRtar.control.type = changeMapfile
listFRtar.control.mapfile_in = listsplit.output.mapfile
listFRtar.control.join_files = instrument-fr
listFRtar.control.newname = listFRtar.mapfile
### Step: 00e
### --- Update mapfile for calibrator FR tables
listtec.control.kind = plugin
listtec.control.type = changeMapfile
listtec.control.mapfile_in = listsplit.output.mapfile
listtec.control.join_files = instrument-tec
listtec.control.newname = listtec.mapfile
### Step: 00f
### --- Update mapfile for conversion to circular
listcolumn.control.kind = plugin
listcolumn.control.type = changeMapfile
listcolumn.control.mapfile_in = listsplit.output.mapfile
listcolumn.control.add_name = :CORRECTED_DATA
listcolumn.control.newname = selfcal-listcolumn.mapfile
### Step: 00g
### --- Update mapfile for conversion to circular
listinst.control.kind = plugin
listinst.control.type = changeMapfile
listinst.control.mapfile_in = listsplit.output.mapfile
listinst.control.join_files = instrument
listinst.control.newname = selfcal-listinst.mapfile
### Step: 01
### --- Adding MODEL columns
addcol.control.type = executable_args
addcol.control.max_per_node = {{ max_per_node_limit }}
addcol.control.executable = {{ scripts }}/addcol2ms.py
addcol.argument.flags = [-m,listsplit.output.mapfile,outputkey,-c,MODEL_DATA_HIGHRES;SUBTRACTED_DATA]
### Step: 02
# Download the TGSS ADR skymodel for the target
sky_tar.control.type = pythonplugin
sky_tar.control.executable = {{ scripts }}/download_tgss_skymodel_target.py
sky_tar.argument.flags = [listtemp2.output.mapfile]
sky_tar.argument.DoDownload = True
sky_tar.argument.SkymodelPath = {{ job_directory }}/{{ target }}.skymodel
sky_tar.argument.Radius = 5. #in degrees
### Step: 03a
### --- Create skymodel for target
sourcedbtar.control.type = setupsourcedb
sourcedbtar.control.cmdline.mapfile = listtemp2.output.mapfile
sourcedbtar.control.skymodel = {{ job_directory }}/{{ target }}.skymodel
### Step: 03b
### --- Expand skymodel mapfile to the amount of target files
listsourcedbtar2.control.kind = plugin
listsourcedbtar2.control.type = expandMapfile
listsourcedbtar2.control.mapfile_in = sourcedbtar.output.mapfile
listsourcedbtar2.control.mapfile_ref = listsplit.output.mapfile
listsourcedbtar2.control.mapfile_dir = input.output.mapfile_dir
listsourcedbtar2.control.filename = listsourcedbtar.mapfile
### Step: 04
### --- Add target model to MODEL_DATA
predicttar.control.type = dppp
predicttar.control.inplace = True
predicttar.control.max_per_node = {{ max_per_node_limit }}
predicttar.control.error_tolerance = {{ error_tolerance }}
predicttar.argument.numthreads = {{ max_dppp_threads }}
predicttar.argument.msin = listsplit.output.mapfile
predicttar.argument.msin.baseline = [CR]S*&
predicttar.argument.msin.datacolumn = DATA
predicttar.argument.msout.datacolumn = MODEL_DATA
predicttar.argument.steps = [predict]
predicttar.argument.predict.type = predict
predicttar.argument.predict.sourcedb = listsourcedbtar2.output.mapfile
predicttar.argument.predict.usebeammodel = True
predicttar.argument.predict.usechannelfreq = True
predicttar.argument.predict.beammode = array_factor
### Step: 05
### --- Creation of fake-parmdbs (Faraday Rotation)
parmdbFRtar.control.type = python-calibrate-stand-alone
parmdbFRtar.control.error_tolerance = {{ error_tolerance }}
parmdbFRtar.argument.force = True # force replaceing of parmDB and skyDB
parmdbFRtar.argument.observation = listsplit.output.mapfile # run on files generated by flag_compress step
parmdbFRtar.argument.parmdb-name = instrument-fr
parmdbFRtar.argument.catalog = {{ skymodels }}/{{ calibrator }}.skymodel # which skymodel to use
parmdbFRtar.argument.numthreads = {{ max_per_node }}
parmdbFRtar.argument.Strategy.ChunkSize = 30
parmdbFRtar.argument.Strategy.Steps = [solve]
parmdbFRtar.argument.Step.solve.Operation = SOLVE
parmdbFRtar.argument.Step.solve.Model.Sources = [@MODEL_DATA]
parmdbFRtar.argument.Step.solve.Model.Cache.Enable = T
parmdbFRtar.argument.Step.solve.Model.FaradayRotation.Enable = T
parmdbFRtar.argument.Step.solve.Solve.Parms = ["RotationMeasure:*"]
parmdbFRtar.argument.Step.solve.Solve.CellSize.Freq = 0
parmdbFRtar.argument.Step.solve.Solve.CellSize.Time = 30
parmdbFRtar.argument.Step.solve.Solve.CellChunkSize = 30
parmdbFRtar.argument.Step.solve.Solve.PropagateSolutions = F
parmdbFRtar.argument.Step.solve.Solve.Options.MaxIter = 1
### Step: 06
### --- Fix entries in the NAMES subtable
fixFRtar.control.type = executable_args
fixFRtar.control.executable = {{ scripts }}/fixFR-self.bash
fixFRtar.control.error_tolerance = {{ error_tolerance }}
fixFRtar.argument.flags = [listFRtar.output.mapfile]
### Step: 07
### --- Smooth the data (baseline-based)
smoothtar.control.type = executable_args
smoothtar.control.error_tolerance = {{ error_tolerance }}
smoothtar.control.max_per_node = 1
smoothtar.control.executable = {{ scripts }}/BLsmooth.py
smoothtar.argument.flags = [-r,-f,0.2,-i,DATA,-o,SMOOTHED_DATA,listsplit.output.mapfile]
### Step: 08
### --- Calibrate smoothed data
teccal.control.type = dppp
teccal.control.inplace = True
teccal.control.error_tolerance = {{ error_tolerance }}
teccal.control.mapfiles_in = [listsplit.output.mapfile,listtec.output.mapfile]
teccal.control.inputkeys = [infiles,parmdbs]
teccal.argument.numthreads = {{ max_dppp_threads }}
teccal.argument.msin = infiles
teccal.argument.msin.datacolumn = SMOOTHED_DATA
teccal.argument.msin.baseline = [CR]S*&
teccal.argument.msout.datacolumn = CORRECTED_DATA
teccal.argument.steps = [filter,gaincal]
teccal.argument.filter.blrange = [1000,1e30]
teccal.argument.gaincal.type = gaincal
teccal.argument.gaincal.parmdb = parmdbs
teccal.argument.gaincal.caltype = tec
teccal.argument.gaincal.maxiter = 500
teccal.argument.gaincal.usemodelcolumn = True
teccal.argument.gaincal.nchan = 1
teccal.argument.gaincal.solint = 1
teccal.argument.gaincal.propagatesolutions = True
### Step: 09a
### --- Creating VDS files
makevdstar.control.type = vdsmaker
makevdstar.control.cmdline.inmap = listsplit.output.mapfile
makevdstar.control.unlink = True
### Step: 09b
### --- Creating mapfile for the VDS files
findvds.control.kind = plugin
findvds.control.type = createMapfile
findvds.control.method = mapfile_from_folder
findvds.control.folder = {{ job_directory }}/vds
findvds.control.mapfile_dir = input.output.mapfile_dir
findvds.control.filename = findvds.mapfile
### Step: 09c
### --- Create globaldb out of the VDS files for the instrument tables
globaldbtec.control.type = executable_args
globaldbtec.control.executable = {{ losoto_directory }}/bin/parmdb_collector.py
globaldbtec.argument.flags = [-v,-d,findvds.output.mapfile,-p,instrument-tec,-g,outputkey]
### Step: 09d
### --- Import globaldb to h5parm
h5parmtec.control.type = executable_args
h5parmtec.control.executable = {{ losoto_directory }}/bin/H5parm_importer.py
h5parmtec.argument.flags = [-v,outputkey,globaldbtec.output.mapfile]
### Step: 09c
### --- Running losoto to plot, flag and do the Farady Rotation extraction
losotoplot.control.type = executable_args
losotoplot.control.executable = {{ losoto_directory }}/bin/losoto
losotoplot.control.parsetasfile = True
losotoplot.control.args_format = losoto
losotoplot.argument.flags = [-v,h5parmtec.output.mapfile]
losotoplot.argument.LoSoTo.Steps = [plotTEC, plotCSP, plotCSPTEC]
losotoplot.argument.LoSoTo.Solset = [sol000]
losotoplot.argument.LoSoTo.Soltab = []
losotoplot.argument.LoSoTo.SolType = []
losotoplot.argument.LoSoTo.ant = []
losotoplot.argument.LoSoTo.pol = [XX, YY]
losotoplot.argument.LoSoTo.dir = []
losotoplot.argument.LoSoTo.Ncpu = {{ max_per_node }}
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.Operation = PLOT
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.Soltab = [sol000/scalarphase000]
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.Axes = time
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.TableAxis = ant
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.PlotFlag = True
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.Prefix = plots-tec/csptec_
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.Reference = {{ reference_station }}
losotoplot.argument.LoSoTo.Steps.plotCSPTEC.Add = [sol000/tec000]
losotoplot.argument.LoSoTo.Steps.plotCSP.Operation = PLOT
losotoplot.argument.LoSoTo.Steps.plotCSP.Soltab = [sol000/scalarphase000]
losotoplot.argument.LoSoTo.Steps.plotCSP.Axes = time
losotoplot.argument.LoSoTo.Steps.plotCSP.TableAxis = ant
losotoplot.argument.LoSoTo.Steps.plotCSP.PlotFlag = True
losotoplot.argument.LoSoTo.Steps.plotCSP.Prefix = plots-tec/csp_
losotoplot.argument.LoSoTo.Steps.plotCSP.Reference = {{ reference_station }}
losotoplot.argument.LoSoTo.Steps.plotTEC.Operation = PLOT
losotoplot.argument.LoSoTo.Steps.plotTEC.Soltab = [sol000/tec000]
losotoplot.argument.LoSoTo.Steps.plotTEC.Axes = time
losotoplot.argument.LoSoTo.Steps.plotTEC.TableAxis = ant
losotoplot.argument.LoSoTo.Steps.plotTEC.PlotFlag = True
losotoplot.argument.LoSoTo.Steps.plotTEC.MinMax = [-0.5,0.5]
losotoplot.argument.LoSoTo.Steps.plotTEC.Prefix = plots-tec/tec_
losotoplot.argument.LoSoTo.Steps.plotTEC.Reference = {{ reference_station }}
### Step: 10
### --- Apply TEC and common scalar phase
applytec.control.type = dppp
applytec.control.inplace = True
applytec.control.error_tolerance = {{ error_tolerance }}
applytec.control.max_per_node = {{ max_per_node_limit }}
applytec.control.mapfiles_in = [listsplit.output.mapfile,listtec.output.mapfile]
applytec.control.inputkeys = [infiles,parmdbs]
applytec.argument.numthreads = {{ max_dppp_threads }}
applytec.argument.msin = infiles
applytec.argument.msin.datacolumn = DATA
applytec.argument.msout.datacolumn = CORRECTED_DATA
applytec.argument.steps = [correcttec,correctphase,count]
applytec.argument.correcttec.type = applycal
applytec.argument.correcttec.parmdb = parmdbs
applytec.argument.correcttec.correction = tec
applytec.argument.correctphase.type = applycal
applytec.argument.correctphase.parmdb = parmdbs
applytec.argument.correctphase.correction = commonscalarphase
### Step: 11
# First high-res imaging
image_high1.control.kind = recipe
image_high1.control.type = executable_args
image_high1.control.executable = {{ wsclean_directory }}/bin/wsclean
image_high1.control.outputsuffixes = [-image.fits,-model.fits]
image_high1.control.outputkey = name
image_high1.control.args_format = wsclean
image_high1.control.max_per_node = 1
image_high1.control.error_tolerance = {{ error_tolerance }}
image_high1.control.mapfiles_in = [listsplit2.output.mapfile]
image_high1.control.inputkeys = [infiles]
image_high1.argument.flags = [-reorder,-no-update-model-required,-joinchannels,infiles]
image_high1.argument.size = 4000 4000
image_high1.argument.trim = 3500 3500
image_high1.argument.mem = {{ max_mem_per_img }}
image_high1.argument.j = {{ max_per_node }}
image_high1.argument.baseline-averaging = 2.0
image_high1.argument.scale = 12arcsec
image_high1.argument.weight = briggs 0.0
image_high1.argument.niter = 100000
image_high1.argument.maxuv-l = 5000
image_high1.argument.mgain = 0.9
image_high1.argument.pol = I
image_high1.argument.fit-spectral-pol = 2
image_high1.argument.channelsout = 10
image_high1.argument.auto-threshold = 20
image_high1.argument.minuv-l = 30
### Step: 12a
# create a map with the wsclean MFS image only
createmap_high_image.control.kind = plugin
createmap_high_image.control.type = createMapfile
createmap_high_image.control.method = mapfile_from_folder
createmap_high_image.control.mapfile_dir = input.output.mapfile_dir
createmap_high_image.control.filename = createmap_high_image.mapfile
createmap_high_image.control.folder = {{ job_directory }}
createmap_high_image.control.pattern = *image_high1*MFS-image.fits
### Step: 12b
# make mask for the high-res image
mask_high.control.type = pythonplugin
mask_high.control.executable = {{ scripts }}/make_clean_mask.py
mask_high.control.max_per_node = 1
mask_high.control.error_tolerance = {{ error_tolerance }}
mask_high.control.mapfile_in = image_high1.output.image_high1-image.fits.mapfile
mask_high.control.inputkey = imagefile
mask_high.control.outputkey = maskfile
mask_high.argument.flags = [imagefile,maskfile]
mask_high.argument.threshisl = 3.0
mask_high.argument.threshpix = 7.0
mask_high.argument.atrous_do = True
mask_high.argument.rmsbox = (55,12)
mask_high.argument.rmsbox_bright = (30,10)
mask_high.argument.adaptive_rmsbox = True
mask_high.argument.img_format = fits
mask_high.argument.atrous_jmax = 3
### Step: 13
# First high-res imaging
image_high2.control.kind = recipe
image_high2.control.type = executable_args
image_high2.control.executable = {{ wsclean_directory }}/bin/wsclean
image_high2.control.outputsuffixes = [-image.fits,-model.fits]
image_high2.control.outputkey = name
image_high2.control.args_format = wsclean
image_high2.control.max_per_node = 1
image_high2.control.error_tolerance = {{ error_tolerance }}
image_high2.control.mapfiles_in = [listsplit2.output.mapfile,mask_high.output.mapfile]
image_high2.control.inputkeys = [infiles,mask]
image_high2.argument.flags = [-reorder,-no-update-model-required,-joinchannels,-multiscale,-save-source-list,infiles]
image_high2.argument.fitsmask = mask
image_high2.argument.size = 4000 4000
image_high2.argument.trim = 3500 3500
image_high2.argument.mem = {{ max_mem_per_img }}
image_high2.argument.j = {{ max_per_node }}
image_high2.argument.baseline-averaging = 2.0
image_high2.argument.scale = 12arcsec
image_high2.argument.weight = briggs 0.0
image_high2.argument.niter = 100000
image_high2.argument.maxuv-l = 5000
image_high2.argument.mgain = 0.8
image_high2.argument.multiscale-scale-bias = 0.5
image_high2.argument.multiscale-scales = 0,3,9
image_high2.argument.pol = I
image_high2.argument.fit-spectral-pol = 2
image_high2.argument.channelsout = 10
image_high2.argument.auto-threshold = 0.1
image_high2.argument.minuv-l = 30
### Step: 14a
# create a map with the wsclean MFS image model only
listmodel.control.kind = plugin
listmodel.control.type = createMapfile # generate a new mapfile
listmodel.control.method = mapfile_from_folder # look for all files in a given directory
listmodel.control.folder = {{ job_directory }} # directory in which to look for the data
listmodel.control.mapfile_dir = input.output.mapfile_dir # put the mapfile into the runtime directory
listmodel.control.filename = listmodel.mapfile
listmodel.control.pattern = *image_high2-sources.txt
### Step: 14b
# filter CC model
filter_model.control.type = pythonplugin
filter_model.control.executable = {{ scripts }}/filter_model.py
filter_model.control.error_tolerance = {{ error_tolerance }}
filter_model.control.mapfiles_in = [listtemp2.output.mapfile,listmodel.output.mapfile,mask_high.output.mapfile]
filter_model.control.inputkeys = [msfiles,inmodel,inmask]#,mask_high.output.mapfile,createmap_high_model.output.mapfile]
filter_model.argument.ms = msfiles
filter_model.argument.skymodel = inmodel
filter_model.argument.maskname = inmask
filter_model.argument.skymodel_cut = outputkey
filter_model.argument.scripts = {{ scripts }}
### Step: 15a
### --- Create skymodel for calibrator
make_sourcedb_target.control.kind = recipe
make_sourcedb_target.control.type = executable_args
make_sourcedb_target.control.executable = {{ lofar_directory }}/bin/makesourcedb
make_sourcedb_target.control.error_tolerance = {{ error_tolerance }}
make_sourcedb_target.control.args_format = lofar
make_sourcedb_target.control.outputkey = out
make_sourcedb_target.control.mapfile_in = filter_model.output.mapfile
make_sourcedb_target.control.inputkey = in
make_sourcedb_target.argument.format = <
make_sourcedb_target.argument.outtype = blob
### Step: 15b
### --- Expand skymodel mapfile to the amount of target files
listsourcedbtar3.control.kind = plugin
listsourcedbtar3.control.type = expandMapfile
listsourcedbtar3.control.mapfile_in = make_sourcedb_target.output.mapfile
listsourcedbtar3.control.mapfile_ref = listsplit.output.mapfile
listsourcedbtar3.control.mapfile_dir = input.output.mapfile_dir
listsourcedbtar3.control.filename = listsourcedbtar3.mapfile
### Step: 16
### --- Add selfcal-target model to MODEL_DATA
predicttar_high.control.type = dppp
predicttar_high.control.inplace = True
predicttar_high.control.max_per_node = {{ max_per_node_limit }}
predicttar_high.control.error_tolerance = {{ error_tolerance }}
predicttar_high.argument.numthreads = {{ max_dppp_threads }}
predicttar_high.argument.msin = listsplit.output.mapfile
predicttar_high.argument.msin.baseline = [CR]S*&
predicttar_high.argument.msin.datacolumn = DATA
predicttar_high.argument.msout.datacolumn = MODEL_DATA_HIGHRES
predicttar_high.argument.steps = [predict]
predicttar_high.argument.predict.type = predict
predicttar_high.argument.predict.sourcedb = listsourcedbtar3.output.mapfile
predicttar_high.argument.predict.usebeammodel = False
predicttar_high.argument.predict.usechannelfreq = True
predicttar_high.argument.predict.beammode = array_factor
### Step: 17
### --- Subtract model from all TCs
subtract_model.control.type = executable_args
subtract_model.control.executable = {{ scripts }}/subtract.bash
subtract_model.control.error_tolerance = {{ error_tolerance }}
subtract_model.argument.flags = [listsplit.output.mapfile]
### Step: 18
# First low-res imaging
image_low.control.kind = recipe
image_low.control.type = executable_args
image_low.control.executable = {{ wsclean_directory }}/bin/wsclean
image_low.control.outputsuffixes = [-image.fits,-model.fits]
image_low.control.outputkey = name
image_low.control.args_format = wsclean
image_low.control.max_per_node = 1
image_low.control.error_tolerance = {{ error_tolerance }}
image_low.control.mapfiles_in = [listsplit2.output.mapfile]
image_low.control.inputkeys = [infiles]
image_low.argument.flags = [-reorder,-no-update-model-required,-joinchannels,-save-source-list,infiles]
image_low.argument.size = 4500 4500
image_low.argument.trim = 4000 4000
image_low.argument.mem = {{ max_mem_per_img }}
image_low.argument.j = {{ max_per_node }}
image_low.argument.baseline-averaging = 2.0
image_low.argument.scale = 20arcsec
image_low.argument.weight = briggs 0.0
image_low.argument.niter = 100000
image_low.argument.maxuv-l = 2000
image_low.argument.mgain = 0.8
image_low.argument.pol = I
image_low.argument.fit-spectral-pol = 2
image_low.argument.channelsout = 10
image_low.argument.auto-threshold = 1
image_low.argument.minuv-l = 100
### Step: 19a
# create a map with the wsclean MFS image only
createmap_low_image.control.kind = plugin
createmap_low_image.control.type = createMapfile
createmap_low_image.control.method = mapfile_from_folder
createmap_low_image.control.mapfile_dir = input.output.mapfile_dir
createmap_low_image.control.filename = createmap_low_image.mapfile
createmap_low_image.control.folder = {{ job_directory }}
createmap_low_image.control.pattern = *image_low*MFS-image.fits
### Step: 19b
# create a map with the wsclean MFS image model only
listmodel_low.control.kind = plugin
listmodel_low.control.type = createMapfile # generate a new mapfile
listmodel_low.control.method = mapfile_from_folder # look for all files in a given directory
listmodel_low.control.folder = {{ job_directory }} # directory in which to look for the data
listmodel_low.control.mapfile_dir = input.output.mapfile_dir # put the mapfile into the runtime directory
listmodel_low.control.filename = listmodel_low.mapfile
listmodel_low.control.pattern = *image_low-sources.txt
### Step: 19c
# make mask for the low-res image
mask_low.control.type = pythonplugin
mask_low.control.executable = {{ scripts }}/make_clean_mask.py
mask_low.control.max_per_node = 1
mask_low.control.error_tolerance = {{ error_tolerance }}
mask_low.control.mapfile_in = createmap_low_image.output.mapfile
mask_low.control.inputkey = imagefile
mask_low.control.outputkey = maskfile
mask_low.argument.flags = [imagefile,maskfile]
mask_low.argument.threshisl = 5.0
mask_low.argument.threshpix = 7.0
mask_low.argument.atrous_do = True
mask_low.argument.rmsbox = (55,12)
mask_low.argument.rmsbox_bright = (30,10)
mask_low.argument.adaptive_rmsbox = True
mask_low.argument.img_format = fits
mask_low.argument.atrous_jmax = 3
### Step: 19d
# filter CC model
filter_model_low.control.type = pythonplugin
filter_model_low.control.executable = {{ scripts }}/filter_model.py
filter_model_low.control.max_per_node = 1
filter_model_low.control.error_tolerance = {{ error_tolerance }}
filter_model_low.control.mapfiles_in = [listtemp2.output.mapfile,listmodel_low.output.mapfile,mask_low.output.mapfile]
filter_model_low.control.inputkeys = [msfiles,inmodel,inmask]#,mask_high.output.mapfile,createmap_high_model.output.mapfile]
filter_model_low.argument.ms = msfiles
filter_model_low.argument.skymodel = inmodel
filter_model_low.argument.maskname = inmask
filter_model_low.argument.skymodel_cut = outputkey
filter_model_low.argument.scripts = {{ scripts }}
### Step: 20a
### --- Create skymodel for calibrator
make_sourcedb_target_low.control.kind = recipe
make_sourcedb_target_low.control.type = executable_args
make_sourcedb_target_low.control.executable = {{ lofar_directory }}/bin/makesourcedb
make_sourcedb_target_low.control.error_tolerance = {{ error_tolerance }}
make_sourcedb_target_low.control.args_format = lofar
make_sourcedb_target_low.control.outputkey = out
make_sourcedb_target_low.control.mapfile_in = filter_model_low.output.mapfile
make_sourcedb_target_low.control.inputkey = in
make_sourcedb_target_low.argument.format = <
make_sourcedb_target_low.argument.outtype = blob
### Step: 20b
### --- Expand skymodel mapfile to the amount of target files
listsourcedbtar4.control.kind = plugin
listsourcedbtar4.control.type = expandMapfile
listsourcedbtar4.control.mapfile_in = make_sourcedb_target_low.output.mapfile
listsourcedbtar4.control.mapfile_ref = listsplit.output.mapfile
listsourcedbtar4.control.mapfile_dir = input.output.mapfile_dir
listsourcedbtar4.control.filename = listsourcedbtar4.mapfile
### Step: 21
### --- Add selfcal-target model to MODEL_DATA
predicttar_low.control.type = dppp
predicttar_low.control.inplace = True
predicttar_low.control.max_per_node = {{ max_per_node_limit }}
predicttar_low.control.error_tolerance = {{ error_tolerance }}
predicttar_low.argument.numthreads = {{ max_dppp_threads }}
predicttar_low.argument.msin = listsplit.output.mapfile
predicttar_low.argument.msin.baseline = [CR]S*&
predicttar_low.argument.msin.datacolumn = DATA
predicttar_low.argument.msout.datacolumn = MODEL_DATA
predicttar_low.argument.steps = [predict]
predicttar_low.argument.predict.type = predict
predicttar_low.argument.predict.sourcedb = listsourcedbtar4.output.mapfile
predicttar_low.argument.predict.usebeammodel = False
predicttar_low.argument.predict.usechannelfreq = True
predicttar_low.argument.predict.beammode = array_factor
### Step: 22
### --- corrupt model with TEC and common scalar phase solutions
corrupt_model.control.type = dppp
corrupt_model.control.inplace = True
corrupt_model.control.max_per_node = {{ max_per_node_limit }}
corrupt_model.control.error_tolerance = {{ error_tolerance }}
corrupt_model.control.mapfiles_in = [listsplit.output.mapfile,listtec.output.mapfile]
corrupt_model.control.inputkeys = [infiles,parmdbs]
corrupt_model.argument.numthreads = {{ max_dppp_threads }}
corrupt_model.argument.msin = infiles
corrupt_model.argument.msin.datacolumn = MODEL_DATA
corrupt_model.argument.msout.datacolumn = MODEL_DATA
corrupt_model.argument.steps = [applytec,applyphase]
corrupt_model.argument.applytec.type = applycal
corrupt_model.argument.applytec.parmdb = parmdbs
corrupt_model.argument.applytec.correction = tec
corrupt_model.argument.applytec.invert = False
corrupt_model.argument.applyphase.type = applycal
corrupt_model.argument.applyphase.parmdb = parmdbs
corrupt_model.argument.applyphase.correction = commonscalarphase
corrupt_model.argument.applyphase.invert = False
### Step: 23
### --- Subtract low-res model
subtract_model_low.control.type = executable_args
subtract_model_low.control.executable = {{ scripts }}/subtract_low.bash
subtract_model_low.control.error_tolerance = {{ error_tolerance }}
subtract_model_low.argument.flags = [listsplit.output.mapfile]
### Step: 24
### --- Restore best model
restore_model.control.type = executable_args
restore_model.control.executable = {{ scripts }}/restore.bash
restore_model.control.error_tolerance = {{ error_tolerance }}
restore_model.argument.flags = [listsplit.output.mapfile]
### Step: 25
### --- Running the selfcal pipeline in a loop
loop.control.kind = pipeline
loop.control.type = {{ local_directory }}/selfcal_loop.parset
loop.argument.niter = {{ niter }}
### Step: 26
# prepare mapfiles for the loop
prep.control.kind = plugin
prep.control.type = PrepareLoop
prep.control.mapfile_dir = input.output.mapfile_dir
prep.control.infile = listsplit.output.mapfile
prep.control.jobname = {{ job_directory }}/{{ job_name }}
prep.control.filename = prep_loop.mapfile
prep.control.counter = selfcal-loop-steps.output.counter
### Step: 27
### --- Smooth the data (baseline-based)
smoothtar_loop.control.type = executable_args
smoothtar_loop.control.error_tolerance = {{ error_tolerance }}
smoothtar_loop.control.max_per_node = 1
smoothtar_loop.control.executable = {{ scripts }}/BLsmooth.py
smoothtar_loop.argument.flags = [-r,-f,0.2,-i,SUBTRACTED_DATA,-o,SMOOTHED_DATA,listsplit.output.mapfile]
### Step: 28a
### --- Create globaldb out of the VDS files for the instrument tables
globaldbtec_loop.control.type = executable_args
globaldbtec_loop.control.executable = {{ losoto_directory }}/bin/parmdb_collector.py
globaldbtec_loop.control.mapfiles_in = [findvds.output.mapfile,selfcal-prep.output.globaldbtec]
globaldbtec_loop.control.inputkeys = [vds,globaldb]
globaldbtec_loop.argument.flags = [-v,-d,vds,-p,instrument-tec,-g,globaldb]
### Step: 28b
### --- Create globaldb out of the VDS files for the instrument tables
globaldbFR.control.type = executable_args
globaldbFR.control.executable = {{ losoto_directory }}/bin/parmdb_collector.py
globaldbFR.control.mapfiles_in = [findvds.output.mapfile,selfcal-prep.output.globaldbFR]
globaldbFR.control.inputkeys = [vds,globaldb]
globaldbFR.argument.flags = [-v,-d,vds,-p,instrument-fr,-g,globaldb]
### Step: 28c
### --- Import globaldb to h5parm
h5parmtec_loop.control.type = executable_args
h5parmtec_loop.control.executable = {{ losoto_directory }}/bin/H5parm_importer.py
h5parmtec_loop.control.mapfiles_in = [selfcal-prep.output.h5parmtec,selfcal-prep.output.globaldbtec]
h5parmtec_loop.control.inputkeys = [h5parm,globaldb]
h5parmtec_loop.argument.flags = [-v,h5parm,globaldb]
### Step: 28d
### --- Running losoto to plot
losotoplot_loop.control.type = executable_args
losotoplot_loop.control.executable = {{ losoto_directory }}/bin/losoto
losotoplot_loop.control.parsetasfile = True
losotoplot_loop.control.args_format = losoto
losotoplot_loop.control.mapfile_in = selfcal-prep.output.h5parmtec
losotoplot_loop.control.inputkey = h5parm
losotoplot_loop.argument.flags = [-v,h5parm]
losotoplot_loop.argument.LoSoTo.Steps = [plotTEC, plotCSP, plotCSPTEC]
losotoplot_loop.argument.LoSoTo.Solset = [sol000]
losotoplot_loop.argument.LoSoTo.Soltab = []
losotoplot_loop.argument.LoSoTo.SolType = []
losotoplot_loop.argument.LoSoTo.ant = []
losotoplot_loop.argument.LoSoTo.pol = [XX, YY]
losotoplot_loop.argument.LoSoTo.dir = []
losotoplot_loop.argument.LoSoTo.Ncpu = {{ max_per_node }}
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.Operation = PLOT
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.Soltab = [sol000/scalarphase000]
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.Axes = time
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.TableAxis = ant
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.PlotFlag = True
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.Prefix = selfcal-prep.output.plotstec/csptec_
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.Reference = {{ reference_station }}
losotoplot_loop.argument.LoSoTo.Steps.plotCSPTEC.Add = [sol000/tec000]
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.Operation = PLOT
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.Soltab = [sol000/scalarphase000]
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.Axes = time
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.TableAxis = ant
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.PlotFlag = True
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.Prefix = selfcal-prep.output.plotstec/csp_
losotoplot_loop.argument.LoSoTo.Steps.plotCSP.Reference = {{ reference_station }}
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.Operation = PLOT
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.Soltab = [sol000/tec000]
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.Axes = time
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.TableAxis = ant
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.PlotFlag = True
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.MinMax = [-0.5,0.5]
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.Prefix = selfcal-prep.output.plotstec/tec_
losotoplot_loop.argument.LoSoTo.Steps.plotTEC.Reference = {{ reference_station }}
### Step: 29
### --- Apply TEC and common scalar phase
applytec_loop.control.type = dppp
applytec_loop.control.inplace = True
applytec_loop.control.error_tolerance = {{ error_tolerance }}
applytec_loop.control.max_per_node = {{ max_per_node_limit }}
applytec_loop.control.mapfiles_in = [listsplit.output.mapfile,listtec.output.mapfile]
applytec_loop.control.inputkeys = [infiles,parmdbs]
applytec_loop.argument.numthreads = {{ max_dppp_threads }}
applytec_loop.argument.msin = infiles
applytec_loop.argument.msin.datacolumn = SUBTRACTED_DATA
applytec_loop.argument.msout.datacolumn = CORRECTED_DATA
applytec_loop.argument.steps = [correcttec]
# applytec_loop.argument.steps = [correcttec,correctphase]
applytec_loop.argument.correcttec.type = applycal
applytec_loop.argument.correcttec.parmdb = parmdbs
applytec_loop.argument.correcttec.correction = tec
# applytec_loop.argument.correctphase.type = applycal
# applytec_loop.argument.correctphase.parmdb = parmdbs
# applytec_loop.argument.correctphase.correction = commonscalarphase
### Step: 30
### --- Convert to circular
lintocirc.control.type = executable_args
lintocirc.control.max_per_node = {{ max_per_node_limit }}
lintocirc.control.error_tolerance = {{ error_tolerance }}
lintocirc.control.executable = {{ scripts }}/mslin2circ.py
lintocirc.argument.flags = [-i,listcolumn.output.mapfile,-o,listcolumn.output.mapfile]
### Step: 31
### --- Smooth the data (baseline-based)
smooth.control.type = executable_args
smooth.control.error_tolerance = {{ error_tolerance }}
smooth.control.max_per_node = 1
smooth.control.executable = {{ scripts }}/BLsmooth.py
smooth.argument.flags = [-r,-f,0.5,-i,CORRECTED_DATA,-o,SMOOTHED_DATA,listsplit.output.mapfile]
### Step: 32a
### --- Calibrate smoothed data
smoothcal.control.type = dppp
smoothcal.control.inplace = True
smoothcal.control.error_tolerance = {{ error_tolerance }}
smoothcal.control.max_per_node = {{ max_per_node }}
smoothcal.control.mapfiles_in = [listsplit.output.mapfile,listinst.output.mapfile]
smoothcal.control.inputkeys = [infiles,parmdbs]
smoothcal.argument.numthreads = {{ max_dppp_threads }}
smoothcal.argument.msin = infiles
smoothcal.argument.msin.datacolumn = SMOOTHED_DATA
smoothcal.argument.msin.baseline = [CR]S*&
smoothcal.argument.msout.datacolumn = CORRECTED_DATA
smoothcal.argument.steps = [filter,gaincal]
smoothcal.argument.filter.blrange = [1500,1e30]
smoothcal.argument.gaincal.type = gaincal
smoothcal.argument.gaincal.parmdb = parmdbs
smoothcal.argument.gaincal.caltype = diagonal
smoothcal.argument.gaincal.maxiter = 100
smoothcal.argument.gaincal.usemodelcolumn = True
smoothcal.argument.gaincal.solint = 30
smoothcal.argument.gaincal.nchan = 8
smoothcal.argument.gaincal.propagatesolutions = True
### Step: 32b
### --- Create globaldb out of the VDS files for the instrument tables
globaldb.control.type = executable_args
globaldb.control.executable = {{ losoto_directory }}/bin/parmdb_collector.py
globaldb.control.mapfiles_in = [findvds.output.mapfile,selfcal-prep.output.globaldb]
globaldb.control.inputkeys = [vds,globaldb]
globaldb.argument.flags = [-v,-d,vds,-g,globaldb]
### Step: 33a
### --- Import globaldb to h5parm
h5parmFR.control.type = executable_args
h5parmFR.control.executable = {{ losoto_directory }}/bin/H5parm_importer.py
h5parmFR.control.mapfiles_in = [selfcal-prep.output.h5parmFR,selfcal-prep.output.globaldb]
h5parmFR.control.inputkeys = [h5parm,globaldb]
h5parmFR.argument.flags = [-v,h5parm,globaldb]
### Step: 33b
# losoto parset
losotoFR.control.type = executable_args
losotoFR.control.executable = {{ losoto_directory }}/bin/losoto
losotoFR.control.parsetasfile = True
losotoFR.control.args_format = losoto
losotoFR.control.mapfile_in = selfcal-prep.output.h5parmFR
losotoFR.control.inputkey = h5parm
losotoFR.argument.flags = [-v,h5parm]
losotoFR.argument.LoSoTo.Steps = [plotPi, plotAi1, plotAi2, plotAi3, faraday, plotFR, residuals, plotPr]
losotoFR.argument.LoSoTo.Solset = [sol000]
losotoFR.argument.LoSoTo.Soltab = []
losotoFR.argument.LoSoTo.SolType = []
losotoFR.argument.LoSoTo.ant = []
losotoFR.argument.LoSoTo.pol = [XX, YY]
losotoFR.argument.LoSoTo.dir = []
losotoFR.argument.LoSoTo.Ncpu = {{ max_per_node }}
losotoFR.argument.LoSoTo.Steps.plotPi.Operation = PLOT
losotoFR.argument.LoSoTo.Steps.plotPi.Soltab = [sol000/phase000]
losotoFR.argument.LoSoTo.Steps.plotPi.Axes = [time,freq]
losotoFR.argument.LoSoTo.Steps.plotPi.TableAxis = ant
losotoFR.argument.LoSoTo.Steps.plotPi.DiffAxis = pol
losotoFR.argument.LoSoTo.Steps.plotPi.PlotFlag = True
losotoFR.argument.LoSoTo.Steps.plotPi.Prefix = selfcal-prep.output.plotsFR/ph_
losotoFR.argument.LoSoTo.Steps.plotPi.Reference = {{ reference_station }}
losotoFR.argument.LoSoTo.Steps.plotPi.MinMax = [-3.14,3.14]
losotoFR.argument.LoSoTo.Steps.plotAi1.Operation = PLOT
losotoFR.argument.LoSoTo.Steps.plotAi1.Soltab = [sol000/amplitude000]
losotoFR.argument.LoSoTo.Steps.plotAi1.freq.minmax = [0,100e6,30]
losotoFR.argument.LoSoTo.Steps.plotAi1.Axes = time
losotoFR.argument.LoSoTo.Steps.plotAi1.TableAxis = ant
losotoFR.argument.LoSoTo.Steps.plotAi1.ColorAxis = pol
losotoFR.argument.LoSoTo.Steps.plotAi1.PlotFlag = True
losotoFR.argument.LoSoTo.Steps.plotAi1.Prefix = selfcal-prep.output.plotsFR/amp_
losotoFR.argument.LoSoTo.Steps.plotAi1.Columns = 2
losotoFR.argument.LoSoTo.Steps.plotAi1.FigSize = [20,20]
losotoFR.argument.LoSoTo.Steps.plotAi1.MinMax = [0,2]
losotoFR.argument.LoSoTo.Steps.plotAi2.Operation = PLOT
losotoFR.argument.LoSoTo.Steps.plotAi2.Soltab = [sol000/amplitude000]
losotoFR.argument.LoSoTo.Steps.plotAi2.time.minmax = [0,1e20,200]
losotoFR.argument.LoSoTo.Steps.plotAi2.Axes = freq
losotoFR.argument.LoSoTo.Steps.plotAi2.TableAxis = ant
losotoFR.argument.LoSoTo.Steps.plotAi2.ColorAxis = pol
losotoFR.argument.LoSoTo.Steps.plotAi2.PlotFlag = True
losotoFR.argument.LoSoTo.Steps.plotAi2.Prefix = selfcal-prep.output.plotsFR/amp_
losotoFR.argument.LoSoTo.Steps.plotAi2.MinMax = [0,2]
losotoFR.argument.LoSoTo.Steps.plotAi3.Operation = PLOT
losotoFR.argument.LoSoTo.Steps.plotAi3.Soltab = [sol000/amplitude000]
losotoFR.argument.LoSoTo.Steps.plotAi3.Axes = [time,freq]
losotoFR.argument.LoSoTo.Steps.plotAi3.TableAxis = ant
losotoFR.argument.LoSoTo.Steps.plotAi3.PlotFlag = True
losotoFR.argument.LoSoTo.Steps.plotAi3.Prefix = selfcal-prep.output.plotsFR/amp_
losotoFR.argument.LoSoTo.Steps.plotAi3.MinMax = [0,2]
losotoFR.argument.LoSoTo.Steps.faraday.Operation = FARADAY
losotoFR.argument.LoSoTo.Steps.faraday.Soltab = [sol000/phase000]
losotoFR.argument.LoSoTo.Steps.faraday.MaxResidual = 2.
losotoFR.argument.LoSoTo.Steps.plotFR.Operation = PLOT
losotoFR.argument.LoSoTo.Steps.plotFR.Soltab = [sol000/rotationmeasure000]
losotoFR.argument.LoSoTo.Steps.plotFR.Axes = [time]
losotoFR.argument.LoSoTo.Steps.plotFR.TableAxis = ant
losotoFR.argument.LoSoTo.Steps.plotFR.Prefix = selfcal-prep.output.plotsFR/fr
losotoFR.argument.LoSoTo.Steps.residuals.Operation = RESIDUALS
losotoFR.argument.LoSoTo.Steps.residuals.Soltab = [sol000/phase000]
losotoFR.argument.LoSoTo.Steps.residuals.Sub = [sol000/rotationmeasure000]
losotoFR.argument.LoSoTo.Steps.plotPr.Operation = PLOT
losotoFR.argument.LoSoTo.Steps.plotPr.Soltab = [sol000/phase000]
losotoFR.argument.LoSoTo.Steps.plotPr.Axes = [time,freq]
losotoFR.argument.LoSoTo.Steps.plotPr.TableAxis = ant
losotoFR.argument.LoSoTo.Steps.plotPr.DiffAxis = pol
losotoFR.argument.LoSoTo.Steps.plotPr.PlotFlag = True
losotoFR.argument.LoSoTo.Steps.plotPr.Prefix = selfcal-prep.output.plotsFR/phRes_
losotoFR.argument.LoSoTo.Steps.plotPr.Reference = {{ reference_station }}
losotoFR.argument.LoSoTo.Steps.plotPr.MinMax = [-3.14,3.14]
### Step: 33c
### --- Export rotationmeasure from h5parm to globaldb-fr
h5parmexpFR.control.type = executable_args
h5parmexpFR.control.executable = {{ scripts }}/H5parm_exporter.py
h5parmexpFR.control.mapfiles_in = [selfcal-prep.output.h5parmFR,selfcal-prep.output.globaldbFR]
h5parmexpFR.control.inputkeys = [h5parm,globaldb]
h5parmexpFR.argument.flags = [-v,-c,-t,rotationmeasure000,h5parm,globaldb]
### Step: 33d
### --- List new solution tables
listsolFR.control.kind = plugin # plugin -> short, non-parallel step
listsolFR.control.type = createMapfile # generate a new mapfile
listsolFR.control.method = mapfile_from_folder # look for all files in a given directory
listsolFR.control.folder = selfcal-prep.output.globaldbFR_folder
listsolFR.control.mapfile_dir = input.output.mapfile_dir # put the mapfile into the runtime directory
listsolFR.control.filename = selfcal-listsolFR.mapfile # name of the generated mapfile
listsolFR.control.pattern = sol000_instrument*
### Step: 34
### --- Convert to circular
circtolin.control.type = executable_args
circtolin.control.max_per_node = {{ max_per_node_limit }}
circtolin.control.error_tolerance = {{ error_tolerance }}
circtolin.control.executable = {{ scripts }}/mslin2circ.py
circtolin.argument.flags = [-r,-i,listcolumn.output.mapfile,-o,listcolumn.output.mapfile]
### Step: 35
### --- Apply FaradyRotation correction
applyFR.control.type = dppp
applyFR.control.inplace = True
applyFR.control.error_tolerance = {{ error_tolerance }}
applyFR.control.max_per_node = {{ max_per_node_limit }}
applyFR.control.mapfiles_in = [listsplit.output.mapfile,selfcal-listsolFR.output.mapfile]
applyFR.control.inputkeys = [infiles,parmdbs]
applyFR.argument.numthreads = {{ max_dppp_threads }}
applyFR.argument.msin = infiles
applyFR.argument.msin.datacolumn = CORRECTED_DATA
applyFR.argument.msout.datacolumn = CORRECTED_DATA
applyFR.argument.steps = [correct]
applyFR.argument.correct.type = correct
applyFR.argument.correct.parmdb = parmdbs
applyFR.argument.correct.correction = RotationMeasure
### Step: 36a
### --- Create globaldb out of the VDS files for the instrument tables
globaldbCD.control.type = executable_args
globaldbCD.control.executable = {{ losoto_directory }}/bin/parmdb_collector.py
globaldbCD.control.mapfiles_in = [findvds.output.mapfile,selfcal-prep.output.globaldbCD]
globaldbCD.control.inputkeys = [vds,globaldb]
globaldbCD.argument.flags = [-v,-d,vds,-g,globaldb]
### Step: 36b
### --- Create globaldb out of the VDS files for the instrument tables
globaldbamp.control.type = executable_args
globaldbamp.control.executable = {{ losoto_directory }}/bin/parmdb_collector.py
globaldbamp.control.mapfiles_in = [findvds.output.mapfile,selfcal-prep.output.globaldbamp]
globaldbamp.control.inputkeys = [vds,globaldb]
globaldbamp.argument.flags = [-v,-d,vds,-g,globaldb]
### Step: 37a
### --- Import globaldb to h5parm
h5parmCD.control.type = executable_args
h5parmCD.control.executable = {{ losoto_directory }}/bin/H5parm_importer.py
h5parmCD.control.mapfiles_in = [selfcal-prep.output.h5parmCD,selfcal-prep.output.globaldbCD]
h5parmCD.control.inputkeys = [h5parm,globaldb]
h5parmCD.argument.flags = [-v,h5parm,globaldb]
### Step: 37b
### --- Import globaldb to h5parm
h5parmamp.control.type = executable_args
h5parmamp.control.executable = {{ losoto_directory }}/bin/H5parm_importer.py
h5parmamp.control.mapfiles_in = [selfcal-prep.output.h5parmamp,selfcal-prep.output.globaldbamp]
h5parmamp.control.inputkeys = [h5parm,globaldb]
h5parmamp.argument.flags = [-v,h5parm,globaldb]
### Step: 38a
# losoto parset for crossdelays
losotoCD.control.type = executable_args
losotoCD.control.executable = {{ losoto_directory }}/bin/losoto
losotoCD.control.parsetasfile = True
losotoCD.control.args_format = losoto
losotoCD.control.mapfile_in = selfcal-prep.output.h5parmCD
losotoCD.control.inputkey = h5parm
losotoCD.argument.flags = [-v,h5parm]
losotoCD.argument.LoSoTo.Steps = [duplicateBkp, plotPi, plotPi2, crossdelay, plotCD, plotCD2, residuals, plotPr, plotPr2, reset]
losotoCD.argument.LoSoTo.Solset = [sol000]
losotoCD.argument.LoSoTo.Soltab = []
losotoCD.argument.LoSoTo.SolType = []
losotoCD.argument.LoSoTo.ant = []
losotoCD.argument.LoSoTo.pol = [XX, YY]
losotoCD.argument.LoSoTo.dir = []
losotoCD.argument.LoSoTo.Ncpu = {{ max_per_node }}
losotoCD.argument.LoSoTo.Steps.duplicateBkp.Operation = DUPLICATE
losotoCD.argument.LoSoTo.Steps.duplicateBkp.InTable = sol000/phase000
losotoCD.argument.LoSoTo.Steps.duplicateBkp.OutTable = sol000/phaseOrig000
losotoCD.argument.LoSoTo.Steps.plotPi.Operation = PLOT
losotoCD.argument.LoSoTo.Steps.plotPi.Soltab = [sol000/phase000]
losotoCD.argument.LoSoTo.Steps.plotPi.Axes = [time,freq]
losotoCD.argument.LoSoTo.Steps.plotPi.TableAxis = ant
losotoCD.argument.LoSoTo.Steps.plotPi.DiffAxis = pol
losotoCD.argument.LoSoTo.Steps.plotPi.PlotFlag = True
losotoCD.argument.LoSoTo.Steps.plotPi.Prefix = selfcal-prep.output.plotsCD/ph-init_
losotoCD.argument.LoSoTo.Steps.plotPi.Reference = {{ reference_station }}
losotoCD.argument.LoSoTo.Steps.plotPi.MinMax = [-1,+1]
losotoCD.argument.LoSoTo.Steps.plotPi2.Operation = PLOT
losotoCD.argument.LoSoTo.Steps.plotPi2.Soltab = [sol000/phase000]
losotoCD.argument.LoSoTo.Steps.plotPi2.time.minmax = [0,1e20,500]
losotoCD.argument.LoSoTo.Steps.plotPi2.Axes = freq
losotoCD.argument.LoSoTo.Steps.plotPi2.TableAxis = ant
losotoCD.argument.LoSoTo.Steps.plotPi2.ColorAxis = pol
losotoCD.argument.LoSoTo.Steps.plotPi2.PlotFlag = True
losotoCD.argument.LoSoTo.Steps.plotPi2.Prefix = selfcal-prep.output.plotsCD/ph-init_
losotoCD.argument.LoSoTo.Steps.plotPi2.Reference = {{ reference_station }}
losotoCD.argument.LoSoTo.Steps.crossdelay.Soltab = [sol000/phase000]
losotoCD.argument.LoSoTo.Steps.crossdelay.Operation = CROSSDELAY
losotoCD.argument.LoSoTo.Steps.crossdelay.OutTable = crossdelay
losotoCD.argument.LoSoTo.Steps.crossdelay.MaxResidual = 2.
losotoCD.argument.LoSoTo.Steps.crossdelay.Smooth = 51
losotoCD.argument.LoSoTo.Steps.plotCD.Operation = PLOT
losotoCD.argument.LoSoTo.Steps.plotCD.Soltab = [sol000/crossdelay]
losotoCD.argument.LoSoTo.Steps.plotCD.Axes = [time,freq]
losotoCD.argument.LoSoTo.Steps.plotCD.TableAxis = ant
losotoCD.argument.LoSoTo.Steps.plotCD.DiffAxis = pol
losotoCD.argument.LoSoTo.Steps.plotCD.PlotFlag = True
losotoCD.argument.LoSoTo.Steps.plotCD.Prefix = selfcal-prep.output.plotsCD/ph-CD_
losotoCD.argument.LoSoTo.Steps.plotCD.Reference = {{ reference_station }}
losotoCD.argument.LoSoTo.Steps.plotCD.MinMax = [-1,+1]
losotoCD.argument.LoSoTo.Steps.plotCD2.Operation = PLOT
losotoCD.argument.LoSoTo.Steps.plotCD2.Soltab = [sol000/crossdelay]
losotoCD.argument.LoSoTo.Steps.plotCD2.time.minmax = [0,1e20,500]
losotoCD.argument.LoSoTo.Steps.plotCD2.Axes = freq
losotoCD.argument.LoSoTo.Steps.plotCD2.TableAxis = ant
losotoCD.argument.LoSoTo.Steps.plotCD2.ColorAxis = pol
losotoCD.argument.LoSoTo.Steps.plotCD2.PlotFlag = True
losotoCD.argument.LoSoTo.Steps.plotCD2.Prefix = selfcal-prep.output.plotsCD/ph-CD_
losotoCD.argument.LoSoTo.Steps.plotCD2.Reference = {{ reference_station }}
losotoCD.argument.LoSoTo.Steps.residuals.Operation = RESIDUALS
losotoCD.argument.LoSoTo.Steps.residuals.Soltab = [sol000/phase000]
losotoCD.argument.LoSoTo.Steps.residuals.Sub = [sol000/crossdelay]
losotoCD.argument.LoSoTo.Steps.plotPr.Operation = PLOT
losotoCD.argument.LoSoTo.Steps.plotPr.Soltab = [sol000/phase000]
losotoCD.argument.LoSoTo.Steps.plotPr.Axes = [time,freq]
losotoCD.argument.LoSoTo.Steps.plotPr.TableAxis = ant
losotoCD.argument.LoSoTo.Steps.plotPr.DiffAxis = pol
losotoCD.argument.LoSoTo.Steps.plotPr.PlotFlag = True
losotoCD.argument.LoSoTo.Steps.plotPr.Prefix = selfcal-prep.output.plotsCD/ph-res_
losotoCD.argument.LoSoTo.Steps.plotPr.Reference = {{ reference_station }}
losotoCD.argument.LoSoTo.Steps.plotPr.MinMax = [-1,+1]
losotoCD.argument.LoSoTo.Steps.plotPr2.Operation = PLOT
losotoCD.argument.LoSoTo.Steps.plotPr2.Soltab = [sol000/phase000]
losotoCD.argument.LoSoTo.Steps.plotPr2.time.minmax = [0,1e20,500]
losotoCD.argument.LoSoTo.Steps.plotPr2.Axes = freq
losotoCD.argument.LoSoTo.Steps.plotPr2.TableAxis = ant
losotoCD.argument.LoSoTo.Steps.plotPr2.ColorAxis = pol
losotoCD.argument.LoSoTo.Steps.plotPr2.PlotFlag = True
losotoCD.argument.LoSoTo.Steps.plotPr2.Prefix = selfcal-prep.output.plotsCD/ph-res_
losotoCD.argument.LoSoTo.Steps.plotPr2.Reference = {{ reference_station }}
losotoCD.argument.LoSoTo.Steps.reset.Operation = RESET
losotoCD.argument.LoSoTo.Steps.reset.Soltab = [sol000/amplitude000]
### Step: 38b
### --- Import globaldb to h5parm
losotoamp.control.type = executable_args
losotoamp.control.executable = {{ losoto_directory }}/bin/losoto
losotoamp.control.parsetasfile = True
losotoamp.control.args_format = losoto
losotoamp.control.mapfile_in = selfcal-prep.output.h5parmamp
losotoamp.control.inputkey = h5parm
losotoamp.argument.flags = [-v,h5parm]
losotoamp.argument.LoSoTo.Steps = [duplicateAbkp, plotAi1, plotAi2, plotAi3, flag, smoothA, plotAs, residualA, plotAr, resetP, norm]
losotoamp.argument.LoSoTo.Solset = [sol000]
losotoamp.argument.LoSoTo.Soltab = []
losotoamp.argument.LoSoTo.SolType = []
losotoamp.argument.LoSoTo.ant = []