From 78e62a41f297ba35d2e9c7da4c7f6bddae7d89f9 Mon Sep 17 00:00:00 2001
From: alex <alex@tls-tautenburg.de>
Date: Tue, 20 Feb 2024 08:39:16 +0000
Subject: [PATCH] add remove_phase_wraps option

---
 docs/source/calibrator.rst             | 1 +
 docs/source/parset.rst                 | 1 +
 workflows/HBA_calibrator.cwl           | 5 +++++
 workflows/LBA_calibrator.cwl           | 5 +++++
 workflows/linc_calibrator.cwl          | 5 +++++
 workflows/linc_calibrator/clocktec.cwl | 5 +++++
 workflows/linc_calibrator/ion.cwl      | 5 +++++
 7 files changed, 27 insertions(+)

diff --git a/docs/source/calibrator.rst b/docs/source/calibrator.rst
index 15bb28ba..feaf4851 100644
--- a/docs/source/calibrator.rst
+++ b/docs/source/calibrator.rst
@@ -256,6 +256,7 @@ User-defined parameter configuration
 - ``trusted_sources``: comma-separated list of trusted calibrator sources. Solutions are only transferred from a reference solution set in case the observed calibrator is not among them (default: ``3C48,3C147,3C196,3C295,3C380``)
 - ``ion_3rd``: take into account also 3rd-order effects for the clock-TEC separation (ionospheric calibration, default: ``false``)
 - ``clock_smooth``: only take the median of the derived clock solutions (enable this in case of non-joint observations, default: ``true``)
+- ``remove_phase_wraps``: detect and remove phase wraps in the clock-TEC separation (default: ``false``)
 
 A comprehensive explanation of the baseline selection syntax can be found `here`_.
 
diff --git a/docs/source/parset.rst b/docs/source/parset.rst
index d5658598..0bd16a5b 100644
--- a/docs/source/parset.rst
+++ b/docs/source/parset.rst
@@ -85,6 +85,7 @@ There are more parameters you may want to adjust that can be added to this input
         "lbfgs_robustdof" : 200,
         "aoflag_reorder" : false,
         "aoflag_chunksize" : 2000
+        "remove_phase_wraps": false
     }
 
 If you just want to alter one of the defaults it is sufficient to override it by specifing its new value the JSON input file::
diff --git a/workflows/HBA_calibrator.cwl b/workflows/HBA_calibrator.cwl
index dd04a133..ade6cd70 100644
--- a/workflows/HBA_calibrator.cwl
+++ b/workflows/HBA_calibrator.cwl
@@ -125,6 +125,9 @@ inputs:
   - id: aoflag_chunksize
     type: int?
     default: 2000
+  - id: remove_phase_wraps
+    type: boolean?
+    default: false
 outputs:
   - id: log_files
     outputSource:
@@ -226,6 +229,8 @@ steps:
         source: aoflag_reorder
       - id: aoflag_chunksize
         source: aoflag_chunksize
+      - id: remove_phase_wraps
+        source: remove_phase_wraps
     out:
       - id: logfiles
       - id: solutions
diff --git a/workflows/LBA_calibrator.cwl b/workflows/LBA_calibrator.cwl
index eb2e0a4c..a5d3c066 100644
--- a/workflows/LBA_calibrator.cwl
+++ b/workflows/LBA_calibrator.cwl
@@ -123,6 +123,9 @@ inputs:
   - id: aoflag_chunksize
     type: int?
     default: 2000
+  - id: remove_phase_wraps
+    type: boolean?
+    default: true
 outputs:
   - id: log_files
     outputSource:
@@ -224,6 +227,8 @@ steps:
         source: aoflag_reorder
       - id: aoflag_chunksize
         source: aoflag_chunksize
+      - id: remove_phase_wraps
+        source: remove_phase_wraps
     out:
       - id: logfiles
       - id: solutions
diff --git a/workflows/linc_calibrator.cwl b/workflows/linc_calibrator.cwl
index 6cd97500..c3c3dc64 100644
--- a/workflows/linc_calibrator.cwl
+++ b/workflows/linc_calibrator.cwl
@@ -125,6 +125,9 @@ inputs:
   - id: aoflag_chunksize
     type: int?
     default: 2000
+  - id: remove_phase_wraps
+    type: boolean?
+    default: false
 outputs:
   - id: inspection
     linkMerge: merge_flattened
@@ -408,6 +411,8 @@ steps:
         source: filter_baselines
       - id: check_Ateam_separation.json
         source: prep/check_Ateam_separation.json
+      - id: remove_phase_wraps
+        source: remove_phase_wraps
     out:
       - id: summary_file
       - id: outsolutions
diff --git a/workflows/linc_calibrator/clocktec.cwl b/workflows/linc_calibrator/clocktec.cwl
index 4423e917..65132b7a 100644
--- a/workflows/linc_calibrator/clocktec.cwl
+++ b/workflows/linc_calibrator/clocktec.cwl
@@ -17,6 +17,9 @@ inputs:
   - id: clock_smooth
     type: boolean?
     default: true
+  - id: remove_phase_wraps
+    type: boolean?
+    default: true
 outputs:
   - id: output_h5parm
     outputSource:
@@ -71,6 +74,8 @@ steps:
         source: fit3rdorder
       - id: Circular
         default: false
+      - id: removePhaseWraps
+        source: remove_phase_wraps
     out:
       - id: output_h5parm
       - id: parset
diff --git a/workflows/linc_calibrator/ion.cwl b/workflows/linc_calibrator/ion.cwl
index 3ccd1183..9df3b20c 100644
--- a/workflows/linc_calibrator/ion.cwl
+++ b/workflows/linc_calibrator/ion.cwl
@@ -42,6 +42,9 @@ inputs:
     type: File
   - id: check_Ateam_separation.json
     type: File
+  - id: remove_phase_wraps
+    type: boolean?
+    default: true
 outputs:
   - id: summary_file
     outputSource:
@@ -77,6 +80,8 @@ steps:
         source: ion_3rd
       - id: clock_smooth
         source: clock_smooth
+      - id: remove_phase_wraps
+        source: remove_phase_wraps
     out:
       - id: output_h5parm
       - id: logfiles
-- 
GitLab