From d56091985a9a933a86d320267647dc7a15a68389 Mon Sep 17 00:00:00 2001
From: mancini <mancini@astron.nl>
Date: Fri, 10 Jan 2020 13:37:36 +0100
Subject: [PATCH] Add LoSoTo Faraday

Former-commit-id: a488792f38e20485ca183c3c3662472d45c6099d
---
 .gitlab-ci.yml                | 10 ++++--
 steps/LoSoTo.Faraday.cwl      | 61 +++++++++++++++++++++++++++++++++++
 test_jobs/losoto_faraday.json |  5 +++
 3 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 steps/LoSoTo.Faraday.cwl
 create mode 100644 test_jobs/losoto_faraday.json

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a03cf0d5..78e53fe0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -111,6 +111,12 @@ losoto_clip:
   script:
     - cwl-runner --no-container steps/LoSoTo.Clip.cwl test_jobs/losoto_clip.json
 
+losoto_faraday:
+  stage: test_steps
+  allow_failure: true
+  script:
+    - cwl-runner --no-container steps/LoSoTo.Faraday.cwl test_jobs/losoto_faraday.json
+
 losoto_residual:
   stage: test_steps
   allow_failure: true
@@ -122,7 +128,7 @@ losoto_polalign:
   allow_failure: true
   script:
     - cwl-runner --no-container steps/LoSoTo.Polalign.cwl test_jobs/losoto_polalign.json
-    
+
 
 parset_selector:
   stage: test_steps
@@ -135,7 +141,7 @@ file_selector:
   allow_failure: true
   script:
     - cwl-runner steps/FileSelector.cwl test_jobs/file_selector.json
-    
+
 
 NDPPP:
   stage: test_steps
diff --git a/steps/LoSoTo.Faraday.cwl b/steps/LoSoTo.Faraday.cwl
new file mode 100644
index 00000000..e3092536
--- /dev/null
+++ b/steps/LoSoTo.Faraday.cwl
@@ -0,0 +1,61 @@
+#!/usr/bin/env cwl-runner
+
+class: CommandLineTool
+cwlVersion: v1.0
+id: losoto_faraday
+
+$namespaces:
+  lofar: https://git.astron.nl/eosc/ontologies/raw/master/schema/lofar.owl
+doc: |
+  Faraday rotation extraction from either a rotation table or a
+  circular phase (of which the operation get the polarisation difference).
+
+
+requirements:
+  InlineJavascriptRequirement:
+    expressionLib:
+      - { $include: utils.js}
+  InitialWorkDirRequirement:
+    listing:
+      - entryname: 'parset.config'
+        entry: $(get_losoto_config('FARADAY').join('\n'))
+
+      - entryname: $(inputs.input_h5parm.basename)
+        entry: $(inputs.input_h5parm)
+        writable: true
+
+baseCommand: "losoto"
+
+arguments:
+  - $(inputs.input_h5parm.basename)
+  - parset.config
+
+hints:
+  DockerRequirement:
+    dockerPull: lofareosc/lofar-pipeline-ci:latest
+
+inputs:
+  - id: input_h5parm
+    type: File
+    format: lofar:#H5Parm
+  - id: soltab
+    type: string
+    doc: "Solution table"
+  - id: refAnt
+    type: string?
+    doc:  Reference antenna, by default the first.
+  - id: maxResidual
+    type: float?
+    doc: |
+      Max average residual in radians before flagging datapoint,
+      by default 1. If 0: no check.
+
+
+outputs:
+  - id: output_h5parm
+    type: File
+    format: lofar:#H5Parm
+    outputBinding:
+      glob: $(inputs.input_h5parm.basename)
+$schema:
+  - https://git.astron.nl/eosc/ontologies/raw/master/schema/lofar.owl
diff --git a/test_jobs/losoto_faraday.json b/test_jobs/losoto_faraday.json
new file mode 100644
index 00000000..3632d7f1
--- /dev/null
+++ b/test_jobs/losoto_faraday.json
@@ -0,0 +1,5 @@
+{
+  "input_h5parm": {"class": "File", "path": "/data/example.h5", "format": "lofar:#H5Parm"},
+  "soltab":  "sol000/phase000",
+  "ncpu": 1
+}
-- 
GitLab