def __init__(self, image_file, **kwargs): assert self.understand(image_file) FormatXTC.__init__(self, image_file, locator_scope=multiple_locator_scope, **kwargs) self._ds = FormatXTCMultipleDetectors._get_datasource( image_file, self.params) self._env = self._ds.env() self.populate_events() self.n_images = len(self.times) if any( ["rayonix" in src.lower() for src in self.params.detector_address]): FormatXTCRayonix.__init__(self, image_file, **kwargs) if any( ["cspad" in src.lower() for src in self.params.detector_address]): FormatXTCCspad.__init__(self, image_file, **kwargs) if any([ "jungfrau" in src.lower() for src in self.params.detector_address ]): FormatXTCJungfrau.__init__(self, image_file, **kwargs) FormatXTC.__init__(self, image_file, locator_scope=multiple_locator_scope, **kwargs)
def __init__(self, image_file, **kwargs): assert (self.understand(image_file)) FormatXTCCspad.__init__(self, image_file, locator_scope=d9114_locator_scope, **kwargs) self._ds = FormatXTC._get_datasource(image_file, self.params) self.run_number = self.params.run[0] self.cspad = psana.Detector(self.params.detector_address[0]) self.dark = self.cspad.pedestals(self.run_number).astype(np.float64) self.gain = self.cspad.gain_mask(self.run_number) == 1. if CSPAD_MASK is not None: self.cspad_mask = CSPAD_MASK else: self.cspad_mask = np.ones_like(self.gain) self.nominal_gain_val = self.cspad._gain_mask_factor self.populate_events() self.n_images = len(self.times) self.params = FormatXTCD9114.get_params(image_file) self._set_pppg_args() self._set_psf() self._set_2d_img_info() self.detector_distance = env_distance(self.params.detector_address[0], self._ds.env(), self.params.cspad.detz_offset)
def __init__(self, image_file, **kwargs): if any(["rayonix" in src.lower() for src in self.params.detector_address]): FormatXTCRayonix.__init__(self, image_file, **kwargs) if any(["cspad" in src.lower() for src in self.params.detector_address]): FormatXTCCspad.__init__(self, image_file, **kwargs) if any(["jungfrau" in src.lower() for src in self.params.detector_address]): FormatXTCJungfrau.__init__(self, image_file, **kwargs) FormatXTC.__init__( self, image_file, locator_scope=multiple_locator_scope, **kwargs )
def __init__(self, image_file, **kwargs): assert(self.understand(image_file)) FormatXTC.__init__(self, image_file, locator_scope = multiple_locator_scope, **kwargs) self._ds = self._get_datasource(image_file) self._env = self._ds.env() self.populate_events() self.n_images = len(self.times) if any(['rayonix' in src.lower() for src in FormatXTC._src]): FormatXTCRayonix.__init__(self, image_file, **kwargs) if any(['cspad' in src.lower() for src in FormatXTC._src]): FormatXTCCspad.__init__(self, image_file, **kwargs) if any(['jungfrau' in src.lower() for src in FormatXTC._src]): FormatXTCJungfrau.__init__(self, image_file, **kwargs) FormatXTC.__init__(self, image_file, locator_scope = multiple_locator_scope, **kwargs)
def _detector(self, index=None): if index is None: index = 0 d = Detector() root = d.hierarchy() all_addresses = self.params.detector_address def recursive_add_node(a, b): # add a to b if a.is_panel(): b.add_panel(a) else: g = b.add_group(a) for child in a: recursive_add_node(child, g) for address in all_addresses: self.params.detector_address = [address] sub_d = None try: if "rayonix" in address.lower(): sub_d = FormatXTCRayonix._detector(self) elif "cspad" in address.lower(): sub_d = FormatXTCCspad._detector(self, index) elif "jungfrau" in address.lower(): sub_d = FormatXTCJungfrau._detector(self, index) except Exception: continue assert sub_d is not None, address recursive_add_node(sub_d.hierarchy(), root) self.params.detector_address = all_addresses return d
def get_raw_data(self, index=None): if index is None: index = 0 all_addresses = self.params.detector_address raw_data = [] for address in all_addresses: self.params.detector_address = [address] sub_d = None if "rayonix" in address.lower(): data = FormatXTCRayonix.get_raw_data(self, index) elif "cspad" in address.lower(): data = FormatXTCCspad.get_raw_data(self, index) elif "jungfrau" in address.lower(): data = FormatXTCJungfrau.get_raw_data(self, index) assert data is not None, address if not isinstance(data, tuple): data = (data, ) raw_data.extend(data) self.params.detector_address = all_addresses self._raw_data = raw_data return tuple(raw_data)
def _detector(self, index=None): from dxtbx.model import Detector if index is None: index = 0 d = Detector() root = d.hierarchy() all_addresses = self._src def recursive_add_node(a, b): # add a to b if a.is_panel(): b.add_panel(a) else: g = b.add_group(a) for child in a: recursive_add_node(child, g) for address in all_addresses: self._src = [address] sub_d = None try: if 'rayonix' in address.lower(): sub_d = FormatXTCRayonix._detector(self) elif 'cspad' in address.lower(): sub_d = FormatXTCCspad._detector(self, index) elif 'jungfrau' in address.lower(): sub_d = FormatXTCJungfrau._detector(self, index) except Exception: continue assert sub_d is not None, address recursive_add_node(sub_d.hierarchy(), root) self._src = all_addresses return d
def get_raw_data(self,index=None): if index is None: index = 0 all_addresses = self._src raw_data = [] for address in all_addresses: self._src = [address] sub_d = None if 'rayonix' in address.lower(): data = FormatXTCRayonix.get_raw_data(self, index) elif 'cspad' in address.lower(): data = FormatXTCCspad.get_raw_data(self, index) elif 'jungfrau' in address.lower(): data = FormatXTCJungfrau.get_raw_data(self, index) assert data is not None, address if not isinstance(data, tuple): data = (data,) raw_data.extend(data) self._src = all_addresses self._raw_data = raw_data return tuple(raw_data)