From 5b1ae75b4aa80ee3859e82b5b64fb8ae74ef1fc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Le=20Guyader?= <loic.le.guyader@xfel.eu>
Date: Fri, 12 Apr 2019 13:35:16 +0200
Subject: [PATCH] Gives the option to define a different data path formating
 string

---
 Load.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Load.py b/Load.py
index 4b9cb11..4c81f83 100644
--- a/Load.py
+++ b/Load.py
@@ -149,14 +149,15 @@ mnemonics = {
     "MCP4raw": {'source':'SCS_UTC1_ADQ/ADC/1:network',
                 'key':'digitizers.channel_1_D.raw.samples',
                 'dim': ['samplesId']},
-    
+
     # KARABACON
     "KARABACON": {'source':'SCS_DAQ_SCAN/MDL/KARABACON',
                     'key': 'actualStep.value',
                     'dim': None}
 }
 
-def load(fields, runNB, proposalNB, semesterNB, topic='SCS', display=False, validate=False):
+def load(fields, runNB, proposalNB, semesterNB, topic='SCS', display=False,
+    validate=False, runpath='/gpfs/exfel/exp/{}/{}/{}/raw/r{:04d}/'):
     """ Load a run and extract the data. Output is an xarray with aligned trainIds
 
         Inputs:
@@ -169,12 +170,14 @@ def load(fields, runNB, proposalNB, semesterNB, topic='SCS', display=False, vali
             topic: string of the topic
             display: boolean, whether to show the run.info or not
             validate: boolean, whether to run karabo-data-validate or not
+            runpath: a string to fromat the run folder path with topic,
+                semesterNB, proposalNB and runNB
 
         Outputs:
             res: an xarray DataSet with aligned trainIds
     """
 
-    runFolder = '/gpfs/exfel/exp/{}/{}/{}/raw/r{:04d}/'.format(topic, semesterNB, proposalNB, runNB)
+    runFolder = runpath.format(topic, semesterNB, proposalNB, runNB)
     run = RunDirectory(runFolder)
 
     if validate:
-- 
GitLab