def get_goniometer_shadow_masker(self, goniometer=None): if goniometer is None: goniometer = self.get_goniometer() assert goniometer is not None if goniometer.get_names()[1] == 'GON_CHI': # SmarGon from dxtbx.format.SmarGonShadowMask import SmarGonShadowMaskGenerator return SmarGonShadowMaskGenerator(goniometer) else: raise RuntimeError("Don't understand this goniometer: %s" % list(goniometer.get_names()))
def get_goniometer_shadow_masker(self, goniometer=None): if goniometer is None: goniometer = self.get_goniometer() assert goniometer is not None # avoid a module-level import from the DIALS namespace that kills LABELIT from dials.util.masking import GoniometerShadowMaskGenerator if goniometer.get_names()[1] == "GON_CHI": # SmarGon from dxtbx.format.SmarGonShadowMask import SmarGonShadowMaskGenerator return SmarGonShadowMaskGenerator(goniometer) elif goniometer.get_names()[1] == "GON_KAPPA": # mini Kappa from dials.util.masking import GoniometerShadowMaskGenerator from scitbx.array_family import flex # Simple model of cone around goniometer phi axis # Exact values don't matter, only the ratio of height/radius height = 50 # mm radius = 20 # mm steps_per_degree = 1 theta = ( flex.double([range(360 * steps_per_degree)]) * math.pi / 180 * 1 / steps_per_degree ) y = radius * flex.cos(theta) # x z = radius * flex.sin(theta) # y x = flex.double(theta.size(), height) # z coords = flex.vec3_double(zip(x, y, z)) coords.insert(0, (0, 0, 0)) return GoniometerShadowMaskGenerator( goniometer, coords, flex.size_t(len(coords), 0) ) else: raise RuntimeError( "Don't understand this goniometer: %s" % list(goniometer.get_names()) )
def get_goniometer_shadow_masker(self, goniometer=None): if goniometer is None: goniometer = self.get_goniometer() if not goniometer or not len(self.get_goniometer().get_names()) == 3: return None # No dynamic shadowing available if goniometer.get_names()[1] == "GON_CHI": # SmarGon from dxtbx.format.SmarGonShadowMask import SmarGonShadowMaskGenerator return SmarGonShadowMaskGenerator(goniometer) else: raise RuntimeError("Don't understand this goniometer: %s" % list(goniometer.get_names()))