Esempio n. 1
0
 def __init__(self, image_file, **kwargs):
   assert(self.understand(image_file))
   FormatXTC.__init__(self, image_file, locator_scope = rayonix_locator_scope, **kwargs)
   self._ds = self._get_datasource(image_file)
   self._env = self._ds.env()
   self.populate_events()
   self.n_images = len(self.times)
    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)
Esempio n. 3
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])
Esempio n. 4
0
 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
     )
Esempio n. 5
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 = {}
Esempio n. 6
0
 def __init__(self, image_file, **kwargs):
     assert (self.understand(image_file))
     FormatXTC.__init__(self,
                        image_file,
                        locator_scope=cspad_locator_scope,
                        **kwargs)
     assert self.params.cspad.detz_offset is not None, "Supply a detz_offset for the cspad"
     self._ds = FormatXTCCspad._get_datasource(image_file, self.params)
     self._env = self._ds.env()
     self.populate_events()
     self.n_images = len(self.times)
Esempio n. 7
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
Esempio n. 9
0
  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)
Esempio n. 10
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)
Esempio n. 11
0
 def understand(image_file):
     try:
         params = FormatXTC.params_from_phil(jungfrau_locator_scope, image_file)
         if params.jungfrau.monolithic:
             return True
         return False
     except Exception:
         return False
Esempio n. 12
0
 def understand(image_file):
     try:
         params = FormatXTC.params_from_phil(jungfrau_locator_scope,
                                             image_file)
     except Exception:
         return False
     return any(
         ["jungfrau" in src.lower() for src in params.detector_address])
Esempio n. 13
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
    def __init__(self, image_file, **kwargs):
        import psana

        assert (self.understand(image_file))
        FormatXTC.__init__(self,
                           image_file,
                           locator_scope=rayonix_locator_scope,
                           **kwargs)
        self._ds = FormatXTCRayonix._get_datasource(image_file, self.params)
        self._env = self._ds.env()
        self.populate_events()
        self.n_images = len(self.times)

        cfgs = self._ds.env().configStore()
        rayonix_cfg = cfgs.get(psana.Rayonix.ConfigV2, psana.Source('Rayonix'))
        if self.params.rayonix.bin_size is None:
            assert rayonix_cfg.binning_f() == rayonix_cfg.binning_s()
            self._bin_size = rayonix_cfg.binning_f()
        else:
            self._bin_size = self.params.rayonix.bin_size
        self._pixel_size = rayonix_tbx.get_rayonix_pixel_size(self._bin_size)
        self._image_size = rayonix_cfg.width(), rayonix_cfg.height()
Esempio n. 15
0
 def __init__(self, image_file, **kwargs):
     assert (self.understand(image_file))
     self._ds = self._get_datasource(image_file)
     self.events_list = []
     self.populate_events()
     FormatXTC.__init__(self, image_file, **kwargs)