def _compute_and_apply_mask(self): if (not self.params.mask_maps): return # Decide about auto_masking auto_mask = False if (self.xray_structure is None) and (self.params.auto_mask_if_no_model): auto_mask = True elif (self.xray_structure is not None) and (self.params.auto_mask_if_model): auto_mask = True if auto_mask: self.mask_smooth = None if not self.params.resolution: raise Sorry( "Need approximate resolution for auto_mask_if_no_model") # generate mask from the density self.mask_smooth = self._compute_soft_mask_from_density() if self.mask_smooth: # it worked self.auto_masked = True # we used auto_mask else: raise Sorry("Failed to auto-mask...try using a model ") else: self.mask_smooth = masks.smooth_mask( xray_structure=self.xray_structure, n_real=self.map_data.all(), rad_smooth=self.radius_smooth).mask_smooth self.map_data = self.map_data * self.mask_smooth if (self.map_data_1 is not None): self.map_data_1 = self.map_data_1 * self.mask_smooth self.map_data_2 = self.map_data_2 * self.mask_smooth
def __init__(self, map, d_min, pdb_hierarchy, crystal_symmetry, atom_radius, use_adp_restraints, nproc, log=None): adopt_init_args(self, locals()) self.xray_structure = self.pdb_hierarchy.extract_xray_structure( crystal_symmetry=self.crystal_symmetry) self.pdb_hierarchy.adopt_xray_structure(self.xray_structure) self.chain_selections = [] for chain in self.pdb_hierarchy.chains(): self.chain_selections.append(chain.atoms().extract_i_seq()) # XXX Probably better is to use this... # self.chain_selections = mmtbx.secondary_structure.contiguous_ss_selections( # pdb_hierarchy = self.pdb_hierarchy) # XXX ...but splitting needs to be improved (can result to tiny fragments). # self.chain_selections = [pdb_hierarchy.atoms().extract_i_seq()] # Soft mask out the map rad_smooth = min(5., d_min) mask_object = masks.smooth_mask(xray_structure=self.xray_structure, n_real=self.map.all(), rad_smooth=rad_smooth) self.map = self.map * mask_object.mask_smooth
def _compute_and_apply_mask(self): if (not self.params.mask_maps): return if (self.xray_structure is None): return self.mask_smooth = masks.smooth_mask( xray_structure=self.xray_structure, n_real=self.map_data.all(), rad_smooth=self.radius_smooth).mask_smooth self.map_data = self.map_data * self.mask_smooth if (self.map_data_1 is not None): self.map_data_1 = self.map_data_1 * self.mask_smooth self.map_data_2 = self.map_data_2 * self.mask_smooth
def _compute_mask(self): if (not self.params.mask_maps): return if (self.pdb_hierarchy is None): return self.radius_smooth = get_atom_radius( xray_structure=self.xray_structure, map_data=self.map_data, crystal_symmetry=self.crystal_symmetry, radius=self.radius_smooth) self.mask_object = masks.smooth_mask( xray_structure=self.xray_structure, n_real=self.map_data.all(), rad_smooth=self.radius_smooth)
def _compute_and_apply_mask(self): if (not self.params.mask_maps): return if (self.base.hierarchy() is None): return mask_smooth = masks.smooth_mask( xray_structure=self.base.xray_structure(), n_real=self.base.map_data().all(), rad_smooth=self.radius_smooth).mask_smooth self.base.update_maps(map_data=self.base.map_data() * mask_smooth) if (self.base.half_map_data_1() is not None): self.base.update_maps( half_map_data_1=self.base.half_map_data_1() * mask_smooth, half_map_data_2=self.base.half_map_data_2() * mask_smooth)
def _compute_and_apply_mask(self): if (not self.params.mask_maps): return if (self.xray_structure is None): self.mask_smooth = None if self.params.auto_mask_if_no_model: # generate mask from the density self.mask_smooth = self._compute_soft_mask_from_density() if not self.mask_smooth: # failed or did not attempt return else: self.mask_smooth = masks.smooth_mask( xray_structure=self.xray_structure, n_real=self.map_data.all(), rad_smooth=self.radius_smooth).mask_smooth self.map_data = self.map_data * self.mask_smooth if (self.map_data_1 is not None): self.map_data_1 = self.map_data_1 * self.mask_smooth self.map_data_2 = self.map_data_2 * self.mask_smooth