From 6436a89fce14b533d9bd13ec341901d95792d4df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Le=20Guyader?= <loic.le.guyader@xfel.eu>
Date: Wed, 1 Apr 2020 14:10:19 +0200
Subject: [PATCH] Update default DSSC geo file and allows for different geo
 file and quadrants position

---
 DSSC.py | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/DSSC.py b/DSSC.py
index 408eaed..0e88693 100644
--- a/DSSC.py
+++ b/DSSC.py
@@ -231,17 +231,28 @@ class DSSC:
         print((f'Rejecting {nrejected} out of {len(self.run.train_ids)} trains due to xgm '
                f'thresholds: [{self.xgm_low}, {self.xgm_high}]'))
 
-    def load_geom(self):
+    def load_geom(self, geopath=None, quad_pos=None):
         """ Loads and return the DSSC geometry.
+
+            inputs:
+                geopath: path to the h5 geometry file. If None uses a default file.
+                quad_pos: list of quadrants tuple position. If None uses a default position.
+
+            output:
+                return the loaded geometry
         """
-        quad_pos = [
-            (-124.100,    3.112),  # TR
-            (-133.068, -110.604),  # BR
-            (   0.988, -125.236),  # BL
-            (   4.528,   -4.912)   # TL
-            ]
-        path = '/gpfs/exfel/sw/software/exfel_environments/misc/git/karabo_data/docs/dssc_geo_june19.h5'
-        self.geom = DSSC_1MGeometry.from_h5_file_and_quad_positions(path, quad_pos)
+        if quad_pos is None:
+            quad_pos = [(-124.100,    3.112),  # TR
+                    (-133.068, -110.604),  # BR
+                    (   0.988, -125.236),  # BL
+                    (   4.528,   -4.912)   # TL
+                ]
+
+        if geopath is None:
+            geopath = '/gpfs/exfel/sw/software/git/EXtra-geom/docs/dssc_geo_june19.h5'
+
+        self.geom = DSSC_1MGeometry.from_h5_file_and_quad_positions(geopath, quad_pos)
+
         return self.geom
                
     def load_mask(self, fname, plot=True):
-- 
GitLab