From a699405c723451c3a7a79d433840ac4264341094 Mon Sep 17 00:00:00 2001
From: David Hammer <dhammer@mailbox.org>
Date: Mon, 20 Dec 2021 13:16:55 +0100
Subject: [PATCH] Renaming relGainXray to gainXray

---
 src/calng/AgipdCorrection.py   | 18 +++++++++---------
 src/calng/kernels/agipd_gpu.cu |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/calng/AgipdCorrection.py b/src/calng/AgipdCorrection.py
index 15d2ecc6..3b8072a5 100644
--- a/src/calng/AgipdCorrection.py
+++ b/src/calng/AgipdCorrection.py
@@ -72,7 +72,7 @@ class CorrectionFlags(enum.IntFlag):
     OFFSET = 2
     BLSHIFT = 4
     REL_GAIN_PC = 8
-    REL_GAIN_XRAY = 16
+    GAIN_XRAY = 16
     BPMASK = 32
 
 
@@ -434,7 +434,7 @@ class AgipdCorrection(BaseCorrection):
         ("thresholding", CorrectionFlags.THRESHOLD),
         ("offset", CorrectionFlags.OFFSET),
         ("relGainPc", CorrectionFlags.REL_GAIN_PC),
-        ("relGainXray", CorrectionFlags.REL_GAIN_XRAY),
+        ("gainXray", CorrectionFlags.GAIN_XRAY),
         ("badPixels", CorrectionFlags.BPMASK),
     )
     _kernel_runner_class = AgipdGpuRunner
@@ -516,7 +516,7 @@ class AgipdCorrection(BaseCorrection):
             .commit(),
 
             FLOAT_ELEMENT(expected)
-            .key("corrections.relGainXray.gGainValue")
+            .key("corrections.gainXray.gGainValue")
             .displayedName("G_gain_value")
             .description(
                 "Newer X-ray gain correction constants are absolute. The default "
@@ -559,7 +559,7 @@ class AgipdCorrection(BaseCorrection):
             "corrections.relGainPc.overrideMdAdditionalOffset"
         )
         AgipdCorrection._managed_keys.add("corrections.relGainPc.mdAdditionalOffset")
-        AgipdCorrection._managed_keys.add("corrections.relGainXray.gGainValue")
+        AgipdCorrection._managed_keys.add("corrections.gainXray.gGainValue")
         AgipdCorrection._managed_keys.add("corrections.badPixels.maskingValue")
         # TODO: DRY / encapsulate
         for field in BadPixelValues:
@@ -608,7 +608,7 @@ class AgipdCorrection(BaseCorrection):
         self._kernel_runner_init_args = {
             "gain_mode": self.gain_mode,
             "bad_pixel_mask_value": self.bad_pixel_mask_value,
-            "g_gain_value": config.get("corrections.relGainXray.gGainValue"),
+            "g_gain_value": config.get("corrections.gainXray.gGainValue"),
         }
 
         # configurability: overriding md_additional_offset
@@ -728,7 +728,7 @@ class AgipdCorrection(BaseCorrection):
                     self._override_md_additional_offset
                 )
         elif constant is AgipdConstants.SlopesFF:
-            field_name = "relGainXray"
+            field_name = "gainXray"
             self.kernel_runner.load_rel_gain_ff_map(constant_data)
         elif "BadPixels" in constant.name:
             field_name = "badPixels"
@@ -780,12 +780,12 @@ class AgipdCorrection(BaseCorrection):
 
         update = self._prereconfigure_update_hash
 
-        if update.has("corrections.relGainXray.gGainValue"):
+        if update.has("corrections.gainXray.gGainValue"):
             self.kernel_runner.set_g_gain_value(
-                self.get("corrections.relGainXray.gGainValue")
+                self.get("corrections.gainXray.gGainValue")
             )
             self._kernel_runner_init_args["g_gain_value"] = self.get(
-                "corrections.relGainXray.gGainValue"
+                "corrections.gainXray.gGainValue"
             )
 
         if update.has("corrections.badPixels.maskingValue"):
diff --git a/src/calng/kernels/agipd_gpu.cu b/src/calng/kernels/agipd_gpu.cu
index f2304785..20b08d43 100644
--- a/src/calng/kernels/agipd_gpu.cu
+++ b/src/calng/kernels/agipd_gpu.cu
@@ -125,7 +125,7 @@ extern "C" {
 						corrected += md_additional_offset[map_index];
 					}
 				}
-				if (corr_flags & REL_GAIN_XRAY) {
+				if (corr_flags & GAIN_XRAY) {
 					corrected = (corrected / rel_gain_xray_map[map_index]) * g_gain_value;
 				}
 			}
-- 
GitLab