diff --git a/notebooks/LPD/LPD_Correct_Fast.ipynb b/notebooks/LPD/LPD_Correct_Fast.ipynb
index a2c8909dfecacc4044ae3c3f9fe1780bfdb562b3..5929947c55f8c9720a1d5a06ef3686d94635c87f 100644
--- a/notebooks/LPD/LPD_Correct_Fast.ipynb
+++ b/notebooks/LPD/LPD_Correct_Fast.ipynb
@@ -284,20 +284,12 @@
     "\n",
     "else:\n",
     "    cell_ids_pattern_s = None  # TODO: FIX AFTER REBASING\n",
-    "    if use_cell_order != 'never':\n",
+    "    if use_cell_order:\n",
     "        # Read the order of memory cells used\n",
     "        raw_data = xd.DataCollection.from_paths([e[1] for e in data_to_process])\n",
-    "        cell_ids_pattern_s = make_cell_order_condition(\n",
-    "            use_cell_order, get_mem_cell_pattern(raw_data, det_inp_sources)\n",
-    "        )\n",
+    "        cell_ids_pattern_s = get_mem_cell_order(raw_data, det_inp_sources)\n",
     "        print(\"Memory cells order:\", cell_ids_pattern_s)\n",
     "\n",
-    "    if cell_ids_pattern_s is not None:\n",
-    "        dark_condition = base_condition + [\n",
-    "            dict(parameter_name='Memory cell order', value=cell_ids_pattern_s),\n",
-    "        ]\n",
-    "    else:\n",
-    "        dark_condition = base_condition.copy()\n",
     "    lpd_cal = LPD_CalibrationData(\n",
     "        detector_name=karabo_id,\n",
     "        modules=karabo_da,\n",
@@ -305,6 +297,7 @@
     "        memory_cells=mem_cells,  # TODO: ADD MISSING CONDITION AFTER REBASING\n",
     "        feedback_capacitor=capacitor,\n",
     "        source_energy=photon_energy,\n",
+    "        memory_cell_order=cell_ids_pattern_s,\n",
     "        category=category,\n",
     "        event_at=creation_time,\n",
     "        client=rest_cfg.calibration_client(),\n",
diff --git a/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb b/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb
index 37ed6f26ba3b8e63a252d8d97b5c5daac0c115d7..85fa3456d70283a521b9c2552e3d82d965a2e56c 100644
--- a/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb
+++ b/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb
@@ -59,6 +59,7 @@
     "from cal_tools.lpdlib import get_mem_cell_pattern, make_cell_order_condition\n",
     "import cal_tools.restful_config as rest_cfg\n",
     "from cal_tools.calcat_interface import LPD_CalibrationData\n",
+    "from cal_tools.lpdlib import get_mem_cell_order\n",
     "from cal_tools.tools import (\n",
     "    CalibrationMetadata,\n",
     "    calcat_creation_time,\n",
@@ -84,12 +85,16 @@
     "print(f'Using {creation_time.isoformat()} as creation time')\n",
     "\n",
     "# Pick all modules/aggregators or those selected.\n",
-    "if karabo_da == ['']:\n",
-    "    if modules == [-1]:\n",
+    "if not karabo_da or karabo_da == ['']:\n",
+    "    if not modules or modules == [-1]:\n",
     "        modules = list(range(16))\n",
+    "\n",
     "    karabo_da = [f'LPD{i:02d}' for i in modules]\n",
     "else:\n",
-    "    modules = [int(x[-2:]) for x in karabo_da]"
+    "    modules = [int(x[-2:]) for x in karabo_da]\n",
+    "\n",
+    "# List of detector sources.\n",
+    "det_inp_sources = [input_source.format(karabo_id=karabo_id, module_index=int(da[-2:])) for da in karabo_da]"
    ]
   },
   {
@@ -108,6 +113,14 @@
    "outputs": [],
    "source": [
     "step_timer.start()\n",
+    "\n",
+    "cell_ids_pattern_s = None\n",
+    "if use_cell_order:\n",
+    "    # Read the order of memory cells used\n",
+    "    raw_data = xd.RunDirectory(Path(in_folder, f'r{run:04d}'))\n",
+    "    cell_ids_pattern_s = get_mem_cell_order(raw_data, det_inp_sources)\n",
+    "    print(\"Memory cells order:\", cell_ids_pattern_s)\n",
+    "\n",
     "lpd_cal = LPD_CalibrationData(\n",
     "    detector_name=karabo_id,\n",
     "    modules=karabo_da,\n",
@@ -115,6 +128,7 @@
     "    memory_cells=mem_cells,\n",
     "    feedback_capacitor=capacitor,\n",
     "    source_energy=photon_energy,\n",
+    "    memory_cell_order=cell_ids_pattern_s,\n",
     "    category=category,\n",
     "    event_at=creation_time,\n",
     "    client=rest_cfg.calibration_client(),\n",
@@ -124,24 +138,6 @@
     "    \"BadPixelsFF\", \"GainAmpMap\",\n",
     "    \"FFMap\", \"RelativeGain\",\n",
     "]\n",
-    "cell_ids_pattern_s = None\n",
-    "if use_cell_order != 'never':\n",
-    "    # Read the order of memory cells used\n",
-    "    raw_data = xd.RunDirectory(Path(in_folder, f'r{run:04d}'))\n",
-    "    cell_ids_pattern_s = make_cell_order_condition(\n",
-    "        use_cell_order, get_mem_cell_pattern(raw_data, det_inp_sources)\n",
-    "    )\n",
-    "    print(\"Memory cells order:\", cell_ids_pattern_s)\n",
-    "\n",
-    "if cell_ids_pattern_s is not None:\n",
-    "    dark_condition = base_condition + [\n",
-    "        dict(parameter_name='Memory cell order', value=cell_ids_pattern_s),\n",
-    "    ]\n",
-    "else:\n",
-    "    dark_condition = base_condition.copy()\n",
-    "\n",
-    "# for cname in constant_names:\n",
-    "# Error out if dark constants are not retrieved.\n",
     "\n",
     "lpd_cal_metadata = lpd_cal.metadata(constant_names)\n",
     "\n",
diff --git a/src/cal_tools/calcat_interface.py b/src/cal_tools/calcat_interface.py
index 1ad313f0a97f51ed2fc9f2b4e8eacb36a7d96598..a66a8e11259528e0862fee4c2e94f5ecf3a16efa 100644
--- a/src/cal_tools/calcat_interface.py
+++ b/src/cal_tools/calcat_interface.py
@@ -1001,6 +1001,7 @@ class LPD_CalibrationData(SplitConditionCalibrationData):
         "Pixels X",
         "Pixels Y",
         "Feedback capacitor",
+        "Memory cell order",
     ]
     illuminated_parameters = dark_parameters + ["Source Energy", "category"]
 
@@ -1013,6 +1014,7 @@ class LPD_CalibrationData(SplitConditionCalibrationData):
         pixels_x=256,
         pixels_y=256,
         source_energy=9.2,
+        memory_cell_order=None,
         category=1,
         modules=None,
         client=None,
@@ -1034,6 +1036,7 @@ class LPD_CalibrationData(SplitConditionCalibrationData):
         self.pixels_x = pixels_x
         self.pixels_y = pixels_y
         self.feedback_capacitor = feedback_capacitor
+        self.memory_cell_order = memory_cell_order
         self.source_energy = source_energy
         self.category = category