diff --git a/DSSC.py b/DSSC.py index 408eaedf95b2415a730fa5c32836ecdaf2fea1e4..0e88693dfb05bd5a9ed3454d33276f7de8640f8a 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):