From 02d46aa05bb699e531a3cff33a1c91411213f783 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Schr=C3=B6n?= <martin.schroen@ufz.de>
Date: Sun, 3 Mar 2024 12:19:06 +0100
Subject: [PATCH] New feature for outlier detection in other columns

---
 VERSION         |  2 +-
 default.cfg     |  4 ++++
 instantPASDy.py | 12 ++++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 7ada0d3..7fc2521 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.8.5
+0.8.6
diff --git a/default.cfg b/default.cfg
index 65a7d7e..981bb32 100644
--- a/default.cfg
+++ b/default.cfg
@@ -296,6 +296,10 @@ sm_range =
 # Units: cph
 muon_range = 
 
+## Other variables
+# Other columns that should be cleaned based on a valid range.
+other_names = SMT1
+other_range = 0.01, 1.0
 
 ## Split tracks
 # Identify single tracks between locations A and B (yes/no)
diff --git a/instantPASDy.py b/instantPASDy.py
index 1457db9..7149533 100644
--- a/instantPASDy.py
+++ b/instantPASDy.py
@@ -719,6 +719,18 @@ def main(configfile=None, cfg_prefix=None):
 
     #data[['GpsUTC', 'LatDec', 'LongDec', 'Alt']].to_csv('testgps.csv', index=False)
 
+    ####################################################
+    ###### Other variables
+    
+    if cc(config, 'clean', 'other_names') and cc(config, 'clean', 'other_range'):
+        other_names = xsplit(gc(config,'clean','other_names'), type=str)
+        (a,b)  = xsplit(gc(config, 'clean', 'other_range'), range=2, type=float)
+
+        for c in other_names:
+            if c in data.columns:
+                data[c] = find_outlier(data, c, lower=a, upper=b)
+
+    
     ####################################################
     ###### Muons #######################################
     ####################################################
-- 
GitLab