From 60f74673240680c95f0fca4a756d8727080e2542 Mon Sep 17 00:00:00 2001
From: David Hammer <dhammer@mailbox.org>
Date: Thu, 7 Oct 2021 18:01:46 +0200
Subject: [PATCH] Setting proper, distinct default values for memoryCells

---
 src/calng/AgipdCorrection.py | 1 +
 src/calng/DsscCorrection.py  | 1 +
 src/calng/base_correction.py | 2 +-
 src/calng/calcat_utils.py    | 4 +++-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/calng/AgipdCorrection.py b/src/calng/AgipdCorrection.py
index d54f984d..02cea77b 100644
--- a/src/calng/AgipdCorrection.py
+++ b/src/calng/AgipdCorrection.py
@@ -39,6 +39,7 @@ class AgipdCorrection(BaseCorrection):
     @staticmethod
     def expectedParameters(expected):
         super(AgipdCorrection, AgipdCorrection).expectedParameters(expected)
+        expected.setDefaultValue("dataFormat.memoryCells", 352)
         (
             STRING_ELEMENT(expected)
             .key("gainMode")
diff --git a/src/calng/DsscCorrection.py b/src/calng/DsscCorrection.py
index 1687328c..3c5b8f18 100644
--- a/src/calng/DsscCorrection.py
+++ b/src/calng/DsscCorrection.py
@@ -23,6 +23,7 @@ class DsscCorrection(BaseCorrection):
     @staticmethod
     def expectedParameters(expected):
         super(DsscCorrection, DsscCorrection).expectedParameters(expected)
+        expected.setDefaultValue("dataFormat.memoryCells", 400)
         DsscCalcatFriend.add_schema(expected)
         add_correction_step_schema(expected, DsscCorrection._correction_field_names)
 
diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py
index 8d22d024..c3b608ad 100644
--- a/src/calng/base_correction.py
+++ b/src/calng/base_correction.py
@@ -160,7 +160,7 @@ class BaseCorrection(PythonDevice):
             .displayedName("Memory cells")
             .description("Full number of memory cells in incoming data")
             .assignmentOptional()
-            .defaultValue(352)
+            .noDefaultValue()
             .commit(),
             STRING_ELEMENT(expected)
             .key("dataFormat.outputAxisOrder")
diff --git a/src/calng/calcat_utils.py b/src/calng/calcat_utils.py
index 2943b05f..577d526e 100644
--- a/src/calng/calcat_utils.py
+++ b/src/calng/calcat_utils.py
@@ -187,7 +187,7 @@ class BaseCalcatFriend:
             UINT32_ELEMENT(schema)
             .key(f"{param_prefix}.memoryCells")
             .assignmentOptional()
-            .defaultValue(352)
+            .noDefaultValue()
             .reconfigurable()
             .commit(),
             UINT32_ELEMENT(schema)
@@ -418,6 +418,7 @@ class AgipdCalcatFriend(BaseCalcatFriend):
         super(AgipdCalcatFriend, AgipdCalcatFriend).add_schema(
             schema, "AGIPD-Type", param_prefix, status_prefix
         )
+        schema.setDefaultValue(f"{param_prefix}.memoryCells", 352)
 
         (
             DOUBLE_ELEMENT(schema)
@@ -495,6 +496,7 @@ class DsscCalcatFriend(BaseCalcatFriend):
         super(DsscCalcatFriend, DsscCalcatFriend).add_schema(
             schema, "DSSC-Type", param_prefix, status_prefix
         )
+        schema.setDefaultValue(f"{param_prefix}.memoryCells", 400)
         (
             DOUBLE_ELEMENT(schema)
             .key(f"{param_prefix}.pulseIdChecksum")
-- 
GitLab