From fd89c06fd51aa5086180628e62e926295372b67b Mon Sep 17 00:00:00 2001
From: Alexander Drabent <alex@tls-tautenburg.de>
Date: Thu, 15 Jul 2021 10:39:38 +0200
Subject: [PATCH] bugfixes + only apply element beam for target

Former-commit-id: d85209357c1f06e1e73a89253446a1ef1b629360
---
 lofar-cwl/steps/makesourcedb.cwl        | 9 +++++++--
 steps/find_skymodel_cal.cwl             | 2 +-
 steps/transfer_solutions.cwl            | 2 +-
 subworkflow/prep_target_applycal.cwl    | 2 +-
 subworkflow/smooth_calibrate.cwl        | 2 +-
 workflows/prefactor_target/finalize.cwl | 4 +++-
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lofar-cwl/steps/makesourcedb.cwl b/lofar-cwl/steps/makesourcedb.cwl
index 97b23e5f..521981fa 100755
--- a/lofar-cwl/steps/makesourcedb.cwl
+++ b/lofar-cwl/steps/makesourcedb.cwl
@@ -10,11 +10,12 @@ inputs:
     type:
       - File
       - string
-    default: '/data/skymodels/Ateam_LBA_CC.skymodel'
+    default: '$PREFACTOR_DATA_ROOT/skymodels/Ateam_LBA_CC.skymodel'
     inputBinding:
       position: 0
       prefix: in=
       separate: false
+      shellQuote: false
   - default: Ateam.sourcedb
     id: output_file_name
     type: string?
@@ -23,6 +24,7 @@ inputs:
       prefix: out=
       separate: false
       valueFrom: $(inputs.output_file_name)
+      shellQuote: false
   - default: blob
     id: outtype
     type: string?
@@ -30,13 +32,15 @@ inputs:
       position: 2
       prefix: outtype=
       separate: false
-  - default: <
+      shellQuote: false
+  - default: '"<"'
     id: format
     type: string?
     inputBinding:
       position: 3
       prefix: format=
       separate: false
+      shellQuote: false
   - default: make_sourcedb.log
     id: logname
     type: string?
@@ -58,3 +62,4 @@ hints:
 stdout: $(inputs.logname)
 requirements:
   - class: InlineJavascriptRequirement
+  - class: ShellCommandRequirement
\ No newline at end of file
diff --git a/steps/find_skymodel_cal.cwl b/steps/find_skymodel_cal.cwl
index 98c665d5..e5ad659a 100644
--- a/steps/find_skymodel_cal.cwl
+++ b/steps/find_skymodel_cal.cwl
@@ -71,7 +71,7 @@ requirements:
             max_separation_arcmin = 1.0 if max_separation_arcmin is None else max_separation_arcmin
             extension = "$(inputs.skymodels_extension)"
             if skymodels is None:
-                skymodels = "/data/skymodels"
+                skymodels = os.path.expandvars("$PREFACTOR_DATA_ROOT/skymodels")
             else:
                 skymodels = skymodels["path"]
             output = {}
diff --git a/steps/transfer_solutions.cwl b/steps/transfer_solutions.cwl
index e92ba2e4..65c53c38 100644
--- a/steps/transfer_solutions.cwl
+++ b/steps/transfer_solutions.cwl
@@ -17,7 +17,7 @@ inputs:
     type:
       - File?
       - string?
-    default: '/data/solutions/3C48.h5'
+    default: '$PREFACTOR_DATA_ROOT/solutions/3C48.h5'
     inputBinding:
       position: 0
       prefix: '--refh5parm'
diff --git a/subworkflow/prep_target_applycal.cwl b/subworkflow/prep_target_applycal.cwl
index e3968609..04036992 100644
--- a/subworkflow/prep_target_applycal.cwl
+++ b/subworkflow/prep_target_applycal.cwl
@@ -131,7 +131,7 @@ steps:
       - id: invert
         default: true
       - id: beammode
-        default: default
+        default: element
     out:
       - id: augmented_steps
     run: ../lofar-cwl/steps/DP3.ApplyBeamStepGenerator.cwl
diff --git a/subworkflow/smooth_calibrate.cwl b/subworkflow/smooth_calibrate.cwl
index 29fb52a9..8995c3b0 100644
--- a/subworkflow/smooth_calibrate.cwl
+++ b/subworkflow/smooth_calibrate.cwl
@@ -65,7 +65,7 @@ steps:
     label: smooth_corrected
     scatter:
       - msin
-    scatterMethod: flat_crossproduct
+#    scatterMethod: flat_crossproduct
     'sbg:x': -394
     'sbg:y': -29
   - id: calib_cal
diff --git a/workflows/prefactor_target/finalize.cwl b/workflows/prefactor_target/finalize.cwl
index 8543d90c..fb5429cb 100644
--- a/workflows/prefactor_target/finalize.cwl
+++ b/workflows/prefactor_target/finalize.cwl
@@ -140,7 +140,7 @@ steps:
     scatter:
       - msin
       - msout_name
-    scatterMethod: flat_crossproduct
+    scatterMethod: dotproduct
     'sbg:x': 400
     'sbg:y': 0
   - id: average
@@ -171,6 +171,8 @@ steps:
     label: average
     scatter:
       - msin
+      - msout_name
+    scatterMethod: dotproduct
     'sbg:x': 600
     'sbg:y': -200
   - id: wsclean
-- 
GitLab