From a13948c91caedb788f2d77ff563f4797add1285d Mon Sep 17 00:00:00 2001
From: Tammo Jan Dijkema <dijkema@astron.nl>
Date: Fri, 27 Sep 2019 14:19:38 +0200
Subject: [PATCH] Add AOFlaggerStepGenerator

---
 steps/AOFlaggerStepGenerator.cwl | 129 +++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
 create mode 100755 steps/AOFlaggerStepGenerator.cwl

diff --git a/steps/AOFlaggerStepGenerator.cwl b/steps/AOFlaggerStepGenerator.cwl
new file mode 100755
index 00000000..ab0e54c7
--- /dev/null
+++ b/steps/AOFlaggerStepGenerator.cwl
@@ -0,0 +1,129 @@
+#!/usr/bin/env cwl-runner
+
+class: CommandLineTool
+cwlVersion: v1.0
+id: average_step_generator
+baseCommand: [parset_concat.py]
+
+requirements:
+  DockerRequirement:
+    dockerPull: prefactor-utils:latest
+  InlineJavascriptRequirement: {}
+
+arguments: ['averager']
+
+inputs:
+  - id: parset
+    type: File
+    inputBinding:
+        position: -1
+        prefix: --input_parset
+  - id: step_name
+    type: string
+    default: average
+    doc: unique name for the step
+    inputBinding:
+        position: -1
+  - id: secondary_files
+    type: File[]
+    doc: Files other than the input used to process the data
+###############################################################################
+  - id: count.save
+    type: boolean
+    default: false
+    doc: If true, the flag percentages per frequency are saved to a table with extension .flagfreq and percentages per station to a table with extension .flagstat. The basename of the table is the MS name (without extension) followed by the stepname and extension.
+    inputBinding:
+      prefix: count.save=
+      separate: false
+  - id: count.path
+    type: string
+    default: ""
+    doc: The directory where to create the flag percentages table. If empty, the path of the input MS is used.
+    inputBinding:
+      prefix: count.path=
+      separate: false
+  - id: strategy
+    type: File?
+    default: null
+    doc: The name of the strategy file to use. If no name is given, the default strategy is used which is fine for HBA. For LBA data the strategy LBAdefault should be used.
+    inputBinding:
+      prefix: strategy=
+      separate: false
+  - id: memoryperc
+    type: int
+    default: 0
+    doc: If >0, percentage of the machines memory to use. If memorymax nor memoryperc is given, all memory will be used (minus 2 GB (at most 50%) for other purposes). Accepts only integer values (LOFAR v2.16). Limiting the available memory too much affects flagging accuracy; in general try to use at least 10 GB of memory.
+    inputBinding:
+      prefix: memoryperc=
+      separate: false
+  - id: memorymax
+    type: double
+    default: 0
+    doc: Maximum amount of memory (in GB) to use. ⇐0 means no maximum. As stated above, this affects flagging accuracy.
+    inputBinding:
+      prefix: memorymax=
+      separate: false
+  - id: timewindow
+    type: int
+    default: 0
+    doc: Number of time slots to be flagged jointly. The larger the time window, the better the flagging performs. 0 means that it will be deduced from the memory to use. Note that the time window can be extended with an overlap on the left and right side to minimize possible boundary effects.
+    inputBinding:
+      prefix: timewindow=
+      separate: false
+  - id: overlapperc
+    type: double
+    default: 0
+    doc: If >0, percentage of time window to be added to the left and right side for overlap purposes (to minimize boundary effects). If overlapmax is not given, it defaults to 1%.
+    inputBinding:
+      prefix: overlapperc=
+      separate: false
+  - id: overlapmax
+    type: int
+    default: 0
+    doc: Maximum overlap value (0 is no maximum).
+    inputBinding:
+      prefix: overlapmax=
+      separate: false
+  - id: autocorr
+    type: boolean
+    default: true
+    doc: Flag autocorrelations?
+    inputBinding:
+      prefix: autocorr=
+      separate: false
+  - id: pulsar
+    type: boolean
+    default: false
+    doc: Use flagging strategy optimized for pulsar observations?
+    inputBinding:
+      prefix: pulsar=
+      separate: false
+  - id: pedantic
+    type: boolean
+    default: false
+    doc: Be more pedantic when flagging?
+    inputBinding:
+      prefix: pedantic=
+      separate: false
+  - id: keepstatistics
+    type: boolean
+    default: true
+    doc: Write the quality statistics?
+    inputBinding:
+      prefix: keepstatistics=
+      separate: false
+
+stdout: output_parset
+outputs:
+  - id: output_parset
+    doc: Parset output file
+    streamable: True
+    type: File
+    outputBinding:
+        glob: output_parset
+
+  - id: secondary_files
+    doc: files needed to execute the step
+    type: File[]
+    outputBinding:
+      outputEval: $(inputs.strategy?inputs.secondary_files.concat([inputs.strategy]):inputs.secondary_files)
-- 
GitLab