def truncate_with_roots(m, fmodel, c1, c2, cutoff, scale, zero_all_interblob_region=True, as_int=False, average_peak_volume=None, selection=None): assert c1 >= c2 if (average_peak_volume is None): sites_cart = fmodel.xray_structure.sites_cart() if (selection is not None): sites_cart = sites_cart.select(selection) average_peak_volume = maptbx.peak_volume_estimate( map_data=m, sites_cart=sites_cart, crystal_symmetry=fmodel.xray_structure.crystal_symmetry(), cutoff=cutoff) if (average_peak_volume is None or int(average_peak_volume * scale) - 1 == 0): return None average_peak_volume = int( average_peak_volume * scale / 2) - 1 # XXX "/2" is ad hoc and I don't know why! co1 = maptbx.connectivity(map_data=m, threshold=c1) co2 = maptbx.connectivity(map_data=m, threshold=c2) result = co2.noise_elimination_two_cutoffs( connectivity_object_at_t1=co1, elimination_volume_threshold_at_t1=average_peak_volume, zero_all_interblob_region=zero_all_interblob_region) if (as_int): return result else: return result.as_double()
def run_group(symbol): group = space_group_info(symbol) elements = ('C', ) * 10 xrs = random_structure.xray_structure(space_group_info=group, volume_per_atom=50., general_positions_only=True, elements=elements, min_distance=2.0, u_iso=0.1) d_min = 2. fc = xrs.structure_factors(d_min=d_min).f_calc() symmetry_flags = None #maptbx.use_space_group_symmetry fft_map = fc.fft_map(symmetry_flags=symmetry_flags, resolution_factor=1. / 5) fft_map.apply_volume_scaling() map_data = fft_map.real_map_unpadded() # r = maptbx.peak_volume_estimate(map_data=map_data, sites_cart=xrs.sites_cart(), crystal_symmetry=xrs.crystal_symmetry(), cutoff=0.3, atom_radius=1.5) result.append(r)
def run_group(symbol): group = space_group_info(symbol); elements = ('C',)*10 xrs = random_structure.xray_structure( space_group_info = group, volume_per_atom = 50., general_positions_only = True, elements = elements, min_distance = 2.0, u_iso=0.1) d_min = 2. fc = xrs.structure_factors(d_min=d_min).f_calc() symmetry_flags = None#maptbx.use_space_group_symmetry fft_map = fc.fft_map(symmetry_flags = symmetry_flags, resolution_factor=1./5) fft_map.apply_volume_scaling() map_data = fft_map.real_map_unpadded() # r = maptbx.peak_volume_estimate( map_data = map_data, sites_cart = xrs.sites_cart(), crystal_symmetry = xrs.crystal_symmetry(), cutoff = 0.3, atom_radius = 1.5) result.append(r)
def truncate_with_roots( m, fmodel, c1, c2, cutoff, scale, zero_all_interblob_region=True, as_int=False, average_peak_volume=None, selection=None): assert c1>=c2 if(average_peak_volume is None): sites_cart = fmodel.xray_structure.sites_cart() if(selection is not None): sites_cart = sites_cart.select(selection) average_peak_volume = maptbx.peak_volume_estimate( map_data = m, sites_cart = sites_cart, crystal_symmetry = fmodel.xray_structure.crystal_symmetry(), cutoff = cutoff) if(average_peak_volume is None or int(average_peak_volume*scale)-1==0): return None average_peak_volume = int(average_peak_volume*scale/2)-1 # XXX "/2" is ad hoc and I don't know why! co1 = maptbx.connectivity(map_data=m, threshold=c1) co2 = maptbx.connectivity(map_data=m, threshold=c2) result = co2.noise_elimination_two_cutoffs( connectivity_object_at_t1=co1, elimination_volume_threshold_at_t1=average_peak_volume, zero_all_interblob_region=zero_all_interblob_region) if(as_int): return result else: return result.as_double()