def get_CSPAD_active_areas(image, version_phil): from libtbx.phil import parse from iotbx.detectors.npy import NpyImage from spotfinder.applications.xfel.cxi_phil import cxi_basic_start data = pickle.load(open(image, "rb")) scope = parse(file_name=version_phil) basic_scope = cxi_basic_start() new_scope = basic_scope.phil_scope.fetch(source=scope) phil = new_scope.extract() img = NpyImage("dummy", source_data=data) img.readHeader(phil) tm = img.get_tile_manager(phil) return list(tm.effective_tiling_as_flex_int())
def tiling_from_image(self): if self.tm is not None: return self.tm labelit_regression = libtbx.env.find_in_repositories( relative_path="labelit_regression", test=os.path.isdir) if detector_phil is None: detector_phil = os.path.join(labelit_regression, "xfel", "cxi-10.1.phil") detector_scope = parse(file_name=detector_phil) basic_scope = cxi_basic_start() new_scope = basic_scope.phil_scope.fetch(source=detector_scope) tiling_phil = new_scope.extract() img = NpyImage("dummy", source_data=img_data) img.readHeader(tiling_phil) self.tm = img.get_tile_manager(phil) return self.tm