Example #1
0
    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)
Example #2
0
 def understand(image_file):
     try:
         params = FormatXTC.params_from_phil(cspad_locator_scope,
                                             image_file)
     except Exception:
         return False
     ds = FormatXTC._get_datasource(image_file, params)
     return any(["cspad" in src.lower() for src in params.detector_address])
Example #3
0
 def __init__(self, image_file, **kwargs):
     assert self.understand(image_file)
     FormatXTC.__init__(
         self, image_file, locator_scope=jungfrau_locator_scope, **kwargs
     )
     self._ds = FormatXTC._get_datasource(image_file, self.params)
     self._env = self._ds.env()
     self.populate_events()
     self.n_images = len(self.times)
     self._cached_detector = {}
     self._cached_psana_detectors = {}
Example #4
0
 def __init__(self, image_file, **kwargs):
     super(FormatXTCJungfrau,
           self).__init__(image_file,
                          locator_scope=jungfrau_locator_scope,
                          **kwargs)
     self._ds = FormatXTC._get_datasource(image_file, self.params)
     self._env = self._ds.env()
     self.populate_events()
     self.n_images = len(self.times)
     self._cached_detector = {}
     self._cached_psana_detectors = {}
     self._beam_index = None
     self._beam_cache = None
Example #5
0
 def __init__(self, image_file, locator_scope=cspad_locator_scope, **kwargs):
     super(FormatXTCCspad, self).__init__(
         image_file, locator_scope=locator_scope, **kwargs
     )
     assert (
         self.params.cspad.detz_offset is not None
     ), "Supply a detz_offset for the cspad"
     self._ds = FormatXTC._get_datasource(image_file, self.params)
     self._psana_runs = FormatXTC._get_psana_runs(self._ds)
     self._cache_psana_det()  # NOTE: move to base FormatXTC class
     self._cache_psana_pedestals()  # NOTE: move to base FormatXTC class
     self._cache_psana_gain()
     self.populate_events()
     self.n_images = len(self.times)
    def understand(image_file):
        try:
            params = FormatXTC.params_from_phil(multiple_locator_scope,
                                                image_file)
        except Exception:
            return False
        ds = FormatXTC._get_datasource(image_file, params)

        if params.detector_address is None or len(
                params.detector_address) <= 1:
            return False
        return [
            "rayonix" in src.lower() or "cspad" in src.lower()
            or "jungfrau" in src.lower() for src in params.detector_address
        ].count(True) >= 2