def zero_below_threshold(self, m): maptbx.reset( data = m, substitute_value = 0.0, less_than_threshold = 0.24, greater_than_threshold = -9999, use_and = True)
def randomize_completeness2(map_coeffs, crystal_gridding, n_cycles=10): map_filter = None from mmtbx.maps import fem for cycle in xrange(n_cycles): if (cycle > 0): mc = map_coeffs.select(flex.random_bool(map_coeffs.size(), 0.99)) else: mc = map_coeffs.deep_copy() m = get_map(map_coeffs=mc, crystal_gridding=crystal_gridding) maptbx.reset(data=m, substitute_value=0.0, less_than_threshold=0.5, greater_than_threshold=-9999, use_and=True) m = maptbx.volume_scale(map=m, n_bins=10000).map_data() if (map_filter is not None): map_filter = maptbx.volume_scale(map=map_filter, n_bins=10000).map_data() map_filter = fem.intersection(m1=map_filter, m2=m, thresholds=flex.double( [i / 100. for i in range(0, 55, 5)]), average=True) #map_filter = map_filter.set_selected(map_filter< 0.5, 0) #map_filter = map_filter.set_selected(map_filter>=0.5, 1) return map_filter
def randomize_completeness2(map_coeffs, crystal_gridding, n_cycles=10): map_filter = None from mmtbx.maps import fem for cycle in xrange(n_cycles): if(cycle>0): mc = map_coeffs.select(flex.random_bool(map_coeffs.size(), 0.99)) else: mc = map_coeffs.deep_copy() m = get_map(map_coeffs=mc, crystal_gridding=crystal_gridding) maptbx.reset( data=m, substitute_value=0.0, less_than_threshold=0.5, greater_than_threshold=-9999, use_and=True) m = maptbx.volume_scale(map = m, n_bins = 10000).map_data() if(map_filter is not None): map_filter = maptbx.volume_scale(map = map_filter, n_bins = 10000).map_data() map_filter = fem.intersection(m1=map_filter, m2=m, thresholds=flex.double([i/100. for i in range(0,55,5)]), average=True) #map_filter = map_filter.set_selected(map_filter< 0.5, 0) #map_filter = map_filter.set_selected(map_filter>=0.5, 1) return map_filter