rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
reference_array = miller_array.map_to_asu() | reference_array = reference_array.map_to_asu() | def run(command_name, args): if (len(args)==0 or "--help" in args or "--h" in args or "-h" in args): print_help(appl=command_name) else: log = multi_out() if (not "--quiet" in args): log.register(label="stdout", file_object=sys.stdout) string_buffer = StringIO() string_buffer_plots = StringIO() log.register(label="log... |
result.append(partition[0]) | result.append(cb_op.apply(partition[0])) | def possible_twin_laws(self): result = [] for partition in sgtbx.cosets.left_decomposition( g=self.lattice_group, h=self.intensity_symmetry.space_group() .build_derived_acentric_group() .make_tidy()).partitions[1:]: if (partition[0].r().determinant() > 0): result.append(partition[0]) return result |
s = str(self.idealized_input_unit_cell()) | idealized_cell = self.idealized_input_unit_cell() s = str(idealized_cell) | def show_possible_twin_laws(self): print "Space group of the intensities:", \ self.intensity_symmetry.space_group_info() \ .as_reference_setting() print "Space group of the metric: ", \ self.lattice_symmetry.space_group_info() \ .as_reference_setting() twin_laws = self.possible_twin_laws() if (len(twin_laws) == 0):... |
print "Possible twin laws:" | print "Possible twin laws (ignoring intrinsic systematic absences):" | def show_possible_twin_laws(self): print "Space group of the intensities:", \ self.intensity_symmetry.space_group_info() \ .as_reference_setting() print "Space group of the metric: ", \ self.lattice_symmetry.space_group_info() \ .as_reference_setting() twin_laws = self.possible_twin_laws() if (len(twin_laws) == 0):... |
print " ", s.r().as_hkl() | hkl_str = s.r().as_hkl() cb_op = sgtbx.change_of_basis_op(hkl_str) assert cb_op.apply(idealized_cell).is_similar_to(idealized_cell) print " ", hkl_str | def show_possible_twin_laws(self): print "Space group of the intensities:", \ self.intensity_symmetry.space_group_info() \ .as_reference_setting() print "Space group of the metric: ", \ self.lattice_symmetry.space_group_info() \ .as_reference_setting() twin_laws = self.possible_twin_laws() if (len(twin_laws) == 0):... |
"Fatal Error: Incomplete libtbx environment!", | "Fatal Error: Incomplete libtbx environment\\!", | def write_incomplete_libtbx_environment(f): message = [ "*******************************************", "Fatal Error: Incomplete libtbx environment!", "*******************************************", "Please re-run the libtbx/configure.py command."] if (os.name != "nt"): for line in message: print >> f, ' echo "%s"' % li... |
print >> f, 'libtbx_pythonhome_save="$PYTHONHOME"' | print >> f, 'libtbx_pyhome_save="$PYTHONHOME"' | def write_setpaths_sh(self, suffix): setpaths = unix_setpaths(self, "sh", suffix) s, u = setpaths.s, setpaths.u for f in s, u: print >> f, 'libtbx_pythonhome_save="$PYTHONHOME"' print >> f, 'unset PYTHONHOME' print >> f, '"%s" -V > /dev/null 2>&1' % self.python_exe print >> f, 'if [ $? -ne 0 -o ! -f "%s" ]; then' % sel... |
print >> f, 'if [ -n "$libtbx_pythonhome_save" ]; then' print >> f, ' PYTHONHOME="$libtbx_pythonhome_save"' | print >> f, 'if [ -n "$libtbx_pyhome_save" ]; then' print >> f, ' PYTHONHOME="$libtbx_pyhome_save"' | def write_setpaths_sh(self, suffix): setpaths = unix_setpaths(self, "sh", suffix) s, u = setpaths.s, setpaths.u for f in s, u: print >> f, 'libtbx_pythonhome_save="$PYTHONHOME"' print >> f, 'unset PYTHONHOME' print >> f, '"%s" -V > /dev/null 2>&1' % self.python_exe print >> f, 'if [ $? -ne 0 -o ! -f "%s" ]; then' % sel... |
print >> f, 'unset libtbx_pythonhome_save' | print >> f, 'unset libtbx_pyhome_save' | def write_setpaths_sh(self, suffix): setpaths = unix_setpaths(self, "sh", suffix) s, u = setpaths.s, setpaths.u for f in s, u: print >> f, 'libtbx_pythonhome_save="$PYTHONHOME"' print >> f, 'unset PYTHONHOME' print >> f, '"%s" -V > /dev/null 2>&1' % self.python_exe print >> f, 'if [ $? -ne 0 -o ! -f "%s" ]; then' % sel... |
print >> f, ' set libtbx_pythonhome_save="$PYTHONHOME"' | print >> f, ' set libtbx_pyhome_save="$PYTHONHOME"' | def write_setpaths_csh(self, suffix): setpaths = unix_setpaths(self, "csh", suffix) s, u = setpaths.s, setpaths.u for f in s, u: print >> f, 'if ($?PYTHONHOME) then' print >> f, ' set libtbx_pythonhome_save="$PYTHONHOME"' print >> f, ' unsetenv PYTHONHOME' print >> f, 'endif' print >> f, '"%s" -V >& /dev/null' % self... |
print >> f, 'if ($?libtbx_pythonhome_save) then' print >> f, ' setenv PYTHONHOME "$libtbx_pythonhome_save"' print >> f, ' unset libtbx_pythonhome_save' | print >> f, 'if ($?libtbx_pyhome_save) then' print >> f, ' setenv PYTHONHOME "$libtbx_pyhome_save"' print >> f, ' unset libtbx_pyhome_save' | def write_setpaths_csh(self, suffix): setpaths = unix_setpaths(self, "csh", suffix) s, u = setpaths.s, setpaths.u for f in s, u: print >> f, 'if ($?PYTHONHOME) then' print >> f, ' set libtbx_pythonhome_save="$PYTHONHOME"' print >> f, ' unsetenv PYTHONHOME' print >> f, 'endif' print >> f, '"%s" -V >& /dev/null' % self... |
assert serial < 100000 | def xray_structure_as_pdb_file(self, remark=None, remarks=[], fractional_coordinates=00000, res_name=None, connect=None): if (remark is not None): remarks.insert(0, remark) s = StringIO() for remark in remarks: print >> s, "REMARK", remark print >> s, "REMARK Number of scatterers:", self.scatterers().size() print >> s,... | |
serial, label[:4], res_name_i, serial%10000),) | serial, label[:4], res_name_i, serial%100000),) | def xray_structure_as_pdb_file(self, remark=None, remarks=[], fractional_coordinates=00000, res_name=None, connect=None): if (remark is not None): remarks.insert(0, remark) s = StringIO() for remark in remarks: print >> s, "REMARK", remark print >> s, "REMARK Number of scatterers:", self.scatterers().size() print >> s,... |
elif (msg.find("The step is at the lower bound stpmax().") >= 0): | elif (msg.find("The step is at the lower bound stpmin().") >= 0): | def filter(self, msg, n, x, g): if (not msg.startswith("lbfgs error")): return 1 if (msg.find("Rounding errors prevent further progress.") >= 0): if (self.ignore_line_search_failed_rounding_errors): return 0 elif (msg.find("The step is at the lower bound stpmax().") >= 0): if (x is not None and g is not None and ext.tr... |
for high_score in [2,1]: | for high_score in xrange(max(scores),0,-1): | def match_data_label(self, label, command_line_switch, f=None): if (f is None): f = self.err scores = self.scores(label=label) selected_array = None for high_score in [2,1]: if (scores.count(high_score) > 0): if (scores.count(high_score) > 1): print >> f print >> f, "Ambiguous %s=%s" % (command_line_switch, label) prin... |
print >> out, "| trace(B) = (B11 + B22 + b33)/3 = %-10.3f |"%self.u_iso() | print >> out, "| trace(B) = (B11 + B22 + B33)/3 = %-10.3f |"%self.u_iso() | def show_k_sol_b_sol_b_cart_target(self, header=None,target=None,out=None): if(out is None): out = sys.stdout p = " " if(header is None): header = "" line_len = len("|-"+"|"+header) fill_len = 80-line_len-1 print >> out, "|-"+header+"-"*(fill_len)+"|" k_sol = self.k_sol b_sol = self.b_sol u0,u1,u2,u3,u4,u5 = self.b_car... |
_open(self._file_name, "w", self._mode) | _open(self._file_name, "wb", self._mode) | def __init__(self, file_base_name, flag, mode): assert flag in (None, "r", "w", "c", "n") if (flag is None): flag = "r" self._file_name = file_base_name + ".dblite" self._flag = flag self._mode = mode self._dict = {} self._needs_sync = 00000 if (self._flag == "n"): _open(self._file_name, "w", self._mode) else: try: f =... |
f = _open(self._file_name, "r") | f = _open(self._file_name, "rb") | def __init__(self, file_base_name, flag, mode): assert flag in (None, "r", "w", "c", "n") if (flag is None): flag = "r" self._file_name = file_base_name + ".dblite" self._flag = flag self._mode = mode self._dict = {} self._needs_sync = 00000 if (self._flag == "n"): _open(self._file_name, "w", self._mode) else: try: f =... |
f = _open(self._file_name, "w", self._mode) | f = _open(self._file_name, "wb", self._mode) | def sync(self): self._check_writable() f = _open(self._file_name, "w", self._mode) pickle.dump(self._dict, f, 1) f.close() self._needs_sync = 00000 |
if (0 and self.platform != "irix_CC"): | if (1 or self.platform != "irix_CC"): | def format_libs(self, libs, macros): s = "" if (len(libs)): if (self.platform in ("vc60", "win32_mwcc")): s = s + " $(SP_LIBDIR_WIN)\\lib*.lib" else: s = s + " -L$(SP_LIBDIR_UNIX)" if (0 and self.platform != "irix_CC"): # XXX disabled for testing for l in libs: s = s + " -l" + l else: for l in libs: s = s + " -exports ... |
try: os.remove(path) except OSError: try: os.remove(path+".old") except OSError: pass try: os.rename(path, path+".old") except OSError: pass | if (os.path.isfile(path)): try: os.remove(path) except OSError: try: os.remove(path+".old") except OSError: pass try: os.rename(path, path+".old") except OSError: pass | def remove_or_rename(path): try: os.remove(path) except OSError: try: os.remove(path+".old") except OSError: pass try: os.rename(path, path+".old") except OSError: pass |
if ("--only" in args): self.reset_module_registry() | def process_args(self, args, default_repository=None): cold_start = default_repository is not None if (len(args) == 0): args = ["--help"] if (default_repository is None): command_name = "libtbx.configure" else: command_name = "libtbx/configure.py" parser = option_parser(usage="%s [options] module_name ..." % command_na... | |
if (cold_start): | module_names = list(command_line.args) if (not cold_start): if (not command_line.options.only): for module in self.module_list: module_names.append(module.name) else: | def process_args(self, args, default_repository=None): cold_start = default_repository is not None if (len(args) == 0): args = ["--help"] if (default_repository is None): command_name = "libtbx.configure" else: command_name = "libtbx/configure.py" parser = option_parser(usage="%s [options] module_name ..." % command_na... |
module_names = list(command_line.args) | self.reset_module_registry() | def process_args(self, args, default_repository=None): cold_start = default_repository is not None if (len(args) == 0): args = ["--help"] if (default_repository is None): command_name = "libtbx.configure" else: command_name = "libtbx/configure.py" parser = option_parser(usage="%s [options] module_name ..." % command_na... |
assert approx_equal(u.shortest_vector_sq(), 4*4) | assert approx_equal(u.shortest_vector_sq(), 2*2) | def exercise_basic(): d = (1,1,1,90,90,90) u = uctbx.unit_cell() assert approx_equal(u.parameters(), d) u = uctbx.unit_cell(d) assert u.parameters() == d assert approx_equal(u.parameters(), u.reciprocal_parameters()) assert approx_equal(u.volume(), 1) assert approx_equal(u.longest_vector_sq(), 3) assert approx_equal(u.... |
return sys._getframe(frames_back+1).f_code.co_varnames | f_code = sys._getframe(frames_back+1).f_code return f_code.co_varnames[:f_code.co_argcount] | def varnames(frames_back=0): return sys._getframe(frames_back+1).f_code.co_varnames |
varnames = frame.f_code.co_varnames | tmp = frame.f_code varnames = tmp.co_varnames[:tmp.co_argcount] | def adopt_init_args(exclusions=[], prefix="", frames_back=0): frame = sys._getframe(frames_back+1) varnames = frame.f_code.co_varnames exclusions.append(varnames[0]) # self init_locals = frame.f_locals self = init_locals[varnames[0]] for varname in varnames: if (varname not in exclusions): setattr(self, prefix+varname,... |
init_locals = frame.f_locals self = init_locals[varnames[0]] | tmp = frame.f_locals self = tmp[varnames[0]] | def adopt_init_args(exclusions=[], prefix="", frames_back=0): frame = sys._getframe(frames_back+1) varnames = frame.f_code.co_varnames exclusions.append(varnames[0]) # self init_locals = frame.f_locals self = init_locals[varnames[0]] for varname in varnames: if (varname not in exclusions): setattr(self, prefix+varname,... |
setattr(self, prefix+varname, init_locals[varname]) | setattr(self, prefix+varname, tmp[varname]) | def adopt_init_args(exclusions=[], prefix="", frames_back=0): frame = sys._getframe(frames_back+1) varnames = frame.f_code.co_varnames exclusions.append(varnames[0]) # self init_locals = frame.f_locals self = init_locals[varnames[0]] for varname in varnames: if (varname not in exclusions): setattr(self, prefix+varname,... |
if(arg2 > self.overflow_limit): term2 = math.exp(700) else: term2 = math.exp(arg2) | if(arg2 > self.overflow_limit): term2 = math.exp(700) elif(arg2 < -self.overflow_limit): term2 = math.exp(-700) else: term2 = math.exp(arg2) try: tmp = 1. / term2 except: print "*"*79 print math.exp(arg2), arg2, u, self.u_max print "*"*79 tmp = 0.0 assert 0 | def functional(self, u_isos): assert u_isos.size() > 0 result = 0.0 for u in u_isos: arg1 = self.shape_factor_left * (self.u_min - u) arg2 = self.shape_factor_right * (self.u_max - u) if(u > self.right_limit or u < self.left_limit): if(arg1 > self.overflow_limit): term1 = math.exp(700) else: ... |
self.right_term_weight * (1. / term2) | self.right_term_weight * tmp | def functional(self, u_isos): assert u_isos.size() > 0 result = 0.0 for u in u_isos: arg1 = self.shape_factor_left * (self.u_min - u) arg2 = self.shape_factor_right * (self.u_max - u) if(u > self.right_limit or u < self.left_limit): if(arg1 > self.overflow_limit): term1 = math.exp(700) else: ... |
if(arg2 > self.overflow_limit): term2 = math.exp(700) else: term2 = math.exp(arg2) | if(arg2 > self.overflow_limit): term2 = math.exp(700) elif(arg2 < -self.overflow_limit): term2 = math.exp(-700) else: term2 = math.exp(arg2) try: tmp = 1. / term2 except: print "*"*79 print math.exp(arg2), arg2, u, self.u_max print "*"*79 tmp = 0.0 assert 0 | def gradient(self, u_isos): assert u_isos.size() > 0 result = flex.double() for u in u_isos: arg1 = self.shape_factor_left * (self.u_min - u) arg2 = self.shape_factor_right * (self.u_max - u) if(u > self.right_limit or u < self.left_limit): if(arg1 > self.overflow_limit): term1 = math.exp(700) else: ... |
self.right_term_weight * self.shape_factor_right * (1. / term2)) | self.right_term_weight * self.shape_factor_right * tmp) | def gradient(self, u_isos): assert u_isos.size() > 0 result = flex.double() for u in u_isos: arg1 = self.shape_factor_left * (self.u_min - u) arg2 = self.shape_factor_right * (self.u_max - u) if(u > self.right_limit or u < self.left_limit): if(arg1 > self.overflow_limit): term1 = math.exp(700) else: ... |
try: open(target_file, "wb").write(open(source_file, "rb").read()) | try: shutil.copy(source_file, target_file) | def write_command_version_duplicates(self): if (self.command_version_suffix is None): return suffix = "_" + self.command_version_suffix for file_name in os.listdir(self.bin_path): if (file_name.startswith(".")): continue source_file = os.path.join(self.bin_path, file_name) if (os.name == "nt" and file_name.lower().ends... |
def run(n=10): | def exercise_core(n=10, verbose=0): | def write_ensemble(self, pdb_inp, out): for index in xrange( len(self.matches) ): name = out+"_%s.pdb"%(index) file = open(name, "w") for ser, lbl, atom in zip( pdb_inp.atom_serial_number_strings(), pdb_inp.input_atom_labels_list(), pdb_inp.atoms() ): r = self.matches[index][1] t = self.matches[index][2] print >> file,... |
if (verbose): tmp.show() | def run(n=10): # make two random sets of sites please c = euler_angles_as_matrix([random.uniform(0,360) for i in xrange(3)]) set_1 = flex.vec3_double(flex.random_double(n*3)*10-2) set_2 = flex.vec3_double(flex.random_double(n*3)*10-2) set_3 = tuple(c)*set_2 set_a = set_1.concatenate( set_2 ) set_b = set_1.concatenate(... | |
run(4) run(10) run(20) run(100) run(200) print "OK" | exercise() | def run(n=10): # make two random sets of sites please c = euler_angles_as_matrix([random.uniform(0,360) for i in xrange(3)]) set_1 = flex.vec3_double(flex.random_double(n*3)*10-2) set_2 = flex.vec3_double(flex.random_double(n*3)*10-2) set_3 = tuple(c)*set_2 set_a = set_1.concatenate( set_2 ) set_b = set_1.concatenate(... |
continuous_shift_flags): | continuous_shift_flags, options): | def hcp_fill_box(unit_cell, point_distance, rational_asu, continuous_shift_flags): assert point_distance > 0 hex_box = hexagonal_box( unit_cell=unit_cell, vertices_frac=rational_asu.volume_vertices(), point_distance=point_distance) box_grid = [iceil(abs(b-e))+1 for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-1... |
box_grid = [iceil(abs(b-e))+1 for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-1,-1,-1] | if (options.no_buffer): extra_steps = 1 else: extra_steps = 2 box_grid = [iceil(abs(e-b))+extra_steps for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-extra_steps]*3 | def hcp_fill_box(unit_cell, point_distance, rational_asu, continuous_shift_flags): assert point_distance > 0 hex_box = hexagonal_box( unit_cell=unit_cell, vertices_frac=rational_asu.volume_vertices(), point_distance=point_distance) box_grid = [iceil(abs(b-e))+1 for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-1... |
thickness=(1+1/2.*math.sqrt(3))*point_distance) for facet in float_asu_buffer.facets(): print facet.n, facet.c | thickness=buffer_thickness) if (0): for facet in float_asu_buffer.facets(): print facet.n, facet.c | def hcp_fill_box(unit_cell, point_distance, rational_asu, continuous_shift_flags): assert point_distance > 0 hex_box = hexagonal_box( unit_cell=unit_cell, vertices_frac=rational_asu.volume_vertices(), point_distance=point_distance) box_grid = [iceil(abs(b-e))+1 for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-1... |
sites_frac = flex.vec3_double() | sites_frac = labeled_sites() | def hcp_fill_box(unit_cell, point_distance, rational_asu, continuous_shift_flags): assert point_distance > 0 hex_box = hexagonal_box( unit_cell=unit_cell, vertices_frac=rational_asu.volume_vertices(), point_distance=point_distance) box_grid = [iceil(abs(b-e))+1 for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-1... |
if (point[2] % 2 == 0): site_hex = [point[0],point[1],point[2]*.5] else: site_hex = [point[0]+1/3.,point[1]+2/3.,point[2]*.5] site_frac = hex_to_frac_matrix * matrix.col(site_hex) if (float_asu_buffer.is_inside(site_frac)): sites_frac.append(site_frac) | site_hex = matrix.col(hex_box.min) \ + matrix.col(hex_indices_as_site(point)) site_frac = hex_to_frac_matrix * site_hex if (1 and float_asu_buffer.is_inside(site_frac)): sites_frac.append(str(point), site_frac) elif (not options.strictly_inside and options.no_buffer): if (0): sites_around = labeled_sites() else: sites_... | def hcp_fill_box(unit_cell, point_distance, rational_asu, continuous_shift_flags): assert point_distance > 0 hex_box = hexagonal_box( unit_cell=unit_cell, vertices_frac=rational_asu.volume_vertices(), point_distance=point_distance) box_grid = [iceil(abs(b-e))+1 for b,e in zip(hex_box.min, hex_box.max)] box_origin = [-1... |
point_distance): | point_distance, options): | def hexagonal_close_packing_sampling(crystal_symmetry, symmetry_flags, point_distance): cb_op_work = crystal_symmetry.change_of_basis_op_to_reference_setting() point_group_type = crystal_symmetry.space_group().point_group_type() add_cb_op = {"2": "z,x,y", "m": "y,z,x"}.get(point_group_type, None) if (add_cb_op is not N... |
continuous_shift_flags=search_symmetry.continuous_shift_flags()) | continuous_shift_flags=search_symmetry.continuous_shift_flags(), options=options) | def hexagonal_close_packing_sampling(crystal_symmetry, symmetry_flags, point_distance): cb_op_work = crystal_symmetry.change_of_basis_op_to_reference_setting() point_group_type = crystal_symmetry.space_group().point_group_type() add_cb_op = {"2": "z,x,y", "m": "y,z,x"}.get(point_group_type, None) if (add_cb_op is not N... |
sites_frac = rt[:9] * work_sites_frac | sites_frac = rt[:9] * work_sites_frac.sites | def hexagonal_close_packing_sampling(crystal_symmetry, symmetry_flags, point_distance): cb_op_work = crystal_symmetry.change_of_basis_op_to_reference_setting() point_group_type = crystal_symmetry.space_group().point_group_type() add_cb_op = {"2": "z,x,y", "m": "y,z,x"}.get(point_group_type, None) if (add_cb_op is not N... |
return crystal_symmetry.unit_cell().orthogonalization_matrix() * sites_frac def check_sites(sites_cart, point_distance): asu_mappings = non_crystallographic_asu_mappings(sites_cart=sites_cart) | return labeled_sites( labels=work_sites_frac.labels, sites=crystal_symmetry.unit_cell().orthogonalization_matrix() * sites_frac) def check_distances(sites_cart, point_distance): asu_mappings = non_crystallographic_asu_mappings(sites_cart=sites_cart.sites) | def hexagonal_close_packing_sampling(crystal_symmetry, symmetry_flags, point_distance): cb_op_work = crystal_symmetry.change_of_basis_op_to_reference_setting() point_group_type = crystal_symmetry.space_group().point_group_type() add_cb_op = {"2": "z,x,y", "m": "y,z,x"}.get(point_group_type, None) if (add_cb_op is not N... |
if (0 and labels[pair.i_seq] in ["(0, 0, 0)", "(0, 0, 1)"]): print "pair:", labels[pair.i_seq], labels[pair.j_seq] | def check_sites(sites_cart, point_distance): asu_mappings = non_crystallographic_asu_mappings(sites_cart=sites_cart) distance_cutoff = point_distance * math.sqrt(2) * 0.99 simple_pair_generator = crystal.neighbors_simple_pair_generator( asu_mappings=asu_mappings, distance_cutoff=distance_cutoff, full_matrix=0001) pair_... | |
sites_cart, point_distance): | sites_cart, point_distance, options): | def check_with_grid_tags(inp_symmetry, symmetry_flags, sites_cart, point_distance): cb_op_inp_ref = inp_symmetry.change_of_basis_op_to_reference_setting() print "cb_op_inp_ref.c():", cb_op_inp_ref.c() ref_symmetry = inp_symmetry.change_basis(cb_op_inp_ref) search_symmetry = sgtbx.search_symmetry( flags=symmetry_flags, ... |
* sites_cart | * sites_cart.sites | def check_with_grid_tags(inp_symmetry, symmetry_flags, sites_cart, point_distance): cb_op_inp_ref = inp_symmetry.change_of_basis_op_to_reference_setting() print "cb_op_inp_ref.c():", cb_op_inp_ref.c() ref_symmetry = inp_symmetry.change_basis(cb_op_inp_ref) search_symmetry = sgtbx.search_symmetry( flags=symmetry_flags, ... |
if (min_dist > point_distance): | if (min_dist > max_distance): | def check_with_grid_tags(inp_symmetry, symmetry_flags, sites_cart, point_distance): cb_op_inp_ref = inp_symmetry.change_of_basis_op_to_reference_setting() print "cb_op_inp_ref.c():", cb_op_inp_ref.c() ref_symmetry = inp_symmetry.change_basis(cb_op_inp_ref) search_symmetry = sgtbx.search_symmetry( flags=symmetry_flags, ... |
raise AssertionError | def check_with_grid_tags(inp_symmetry, symmetry_flags, sites_cart, point_distance): cb_op_inp_ref = inp_symmetry.change_of_basis_op_to_reference_setting() print "cb_op_inp_ref.c():", cb_op_inp_ref.c() ref_symmetry = inp_symmetry.change_basis(cb_op_inp_ref) search_symmetry = sgtbx.search_symmetry( flags=symmetry_flags, ... | |
point_distance=point_distance) check_sites(sites_cart, point_distance) check_with_grid_tags( inp_symmetry=crystal_symmetry, symmetry_flags=symmetry_flags, sites_cart=sites_cart, point_distance=point_distance) if (0): | point_distance=point_distance, options=options) if (1): check_distances(sites_cart, point_distance) if (not options.strictly_inside): check_with_grid_tags( inp_symmetry=crystal_symmetry, symmetry_flags=symmetry_flags, sites_cart=sites_cart, point_distance=point_distance, options=options) if (flags.write_pdb): | def run_call_back(flags, space_group_info): crystal_symmetry = crystal.symmetry( unit_cell=space_group_info.any_compatible_unit_cell(volume=1000), space_group_info=space_group_info) symmetry_flags=sgtbx.search_symmetry_flags( use_space_group_symmetry=0001, use_space_group_ltr=0, use_seminvariant=0001, use_normalizer_k2... |
for serial,site in zip(count(1), sites_cart): | print >> f, iotbx.pdb.format_cryst1_record( crystal_symmetry=crystal_symmetry) for serial,site in zip(count(1), sites_cart.sites): | def run_call_back(flags, space_group_info): crystal_symmetry = crystal.symmetry( unit_cell=space_group_info.any_compatible_unit_cell(volume=1000), space_group_info=space_group_info) symmetry_flags=sgtbx.search_symmetry_flags( use_space_group_symmetry=0001, use_space_group_ltr=0, use_seminvariant=0001, use_normalizer_k2... |
debug_utils.parse_options_loop_space_groups(sys.argv[1:], run_call_back) | debug_utils.parse_options_loop_space_groups(sys.argv[1:], run_call_back, ( "no_buffer", "strictly_inside", "write_pdb")) | def run(): debug_utils.parse_options_loop_space_groups(sys.argv[1:], run_call_back) print "OK" |
SnapParameters = sgtbx.SpecialPositionSnapParameters(UnitCell, SgOps) | SnapParameters = sgtbx.SpecialPositionSnapParameters( UnitCell, SgOps, 1, 1.e-6) | def get_unitcell(SgType): if (143 <= SgType.SgNumber() < 195): RefUnitCell = uctbx.UnitCell((10, 10, 10, 90, 90, 120)) else: RefUnitCell = uctbx.UnitCell((10, 10, 10, 90, 90, 90)) return RefUnitCell.ChangeBasis(SgType.CBOp().M().as_tuple()[0]) |
def append(self, key, value): self.dict[key] = value self.list.append(key) | def append(self, key, value): self.dict[key] = value self.list.append(key) | |
i = 0 for key in other.list: if (not key in self.dict): | i = len(self.list) other_reverse = other.list[:] other_reverse.reverse() for key in other_reverse: if (key in self.dict): i = self.list.index(key) else: | def merge(self, other): i = 0 for key in other.list: if (not key in self.dict): self.insert(i, key, other.dict[key]) i += 1 i = 0 for key in other.missing_for_build: if (not key in self.missing_for_build): self.missing_for_build.insert(i, key) i += 1 |
i += 1 i = 0 for key in other.missing_for_build: if (not key in self.missing_for_build): | other_reverse = other.missing_for_build[:] for key in other_reverse: if (key in self.missing_for_build): i = self.missing_for_build.index(key) else: | def merge(self, other): i = 0 for key in other.list: if (not key in self.dict): self.insert(i, key, other.dict[key]) i += 1 i = 0 for key in other.missing_for_build: if (not key in self.missing_for_build): self.missing_for_build.insert(i, key) i += 1 |
i += 1 | def merge(self, other): i = 0 for key in other.list: if (not key in self.dict): self.insert(i, key, other.dict[key]) i += 1 i = 0 for key in other.missing_for_build: if (not key in self.missing_for_build): self.missing_for_build.insert(i, key) i += 1 | |
self._resolve_dependencies(self.dependency_registry) def _resolve_dependencies(self, registry): if (self.name in registry.dict): return registry.append(self.name, self) | self.dependency_registry.insert(0, self.name, self) | def _build_dependency_registry(self): self.dependency_registry = registry() self._resolve_dependencies(self.dependency_registry) |
package(self.dist_root, package_name)._resolve_dependencies(registry) | p = package(self.dist_root, package_name) self.dependency_registry.merge(p.dependency_registry) | def _resolve_dependencies(self, registry): if (self.name in registry.dict): return registry.append(self.name, self) if (self.config is not None): for package_name in self.config.get("packages_required_for_use", []): package(self.dist_root, package_name)._resolve_dependencies(registry) for package_name in self.config.ge... |
registry.missing_for_build.append(package_name) | self.dependency_registry.missing_for_build.append(package_name) | def _resolve_dependencies(self, registry): if (self.name in registry.dict): return registry.append(self.name, self) if (self.config is not None): for package_name in self.config.get("packages_required_for_use", []): package(self.dist_root, package_name)._resolve_dependencies(registry) for package_name in self.config.ge... |
p._resolve_dependencies(registry) | self.dependency_registry.merge(p.dependency_registry) | def _resolve_dependencies(self, registry): if (self.name in registry.dict): return registry.append(self.name, self) if (self.config is not None): for package_name in self.config.get("packages_required_for_use", []): package(self.dist_root, package_name)._resolve_dependencies(registry) for package_name in self.config.ge... |
registry_copy = copy.deepcopy(registry) try: p._resolve_dependencies(registry_copy) except UserError: pass else: p = package(self.dist_root, package_name) p._resolve_dependencies(registry) | self.dependency_registry.merge(p.dependency_registry) | def _resolve_dependencies(self, registry): if (self.name in registry.dict): return registry.append(self.name, self) if (self.config is not None): for package_name in self.config.get("packages_required_for_use", []): package(self.dist_root, package_name)._resolve_dependencies(registry) for package_name in self.config.ge... |
BYTE_ORDER=little_endian; | BYTE_ORDER=%(BYTE_ORDER)s; | def debug_write(self,fileout,mod_data=None): info = """{ |
def filter(self, msg, x, g): | def filter(self, msg, n, x, g): if (not msg.startswith("lbfgs error")): return 1 | def filter(self, msg, x, g): if (msg.find("Rounding errors prevent further progress.") >= 0): if (self.ignore_line_search_failed_rounding_errors): return 0 elif (msg.find("The step is at the lower bound stpmax().") >= 0): if (ext.traditional_convergence_test(target_evaluator.n)(x, g)): return 0 if (self.ignore_line_sea... |
if (ext.traditional_convergence_test(target_evaluator.n)(x, g)): | if (ext.traditional_convergence_test(n)(x, g)): | def filter(self, msg, x, g): if (msg.find("Rounding errors prevent further progress.") >= 0): if (self.ignore_line_search_failed_rounding_errors): return 0 elif (msg.find("The step is at the lower bound stpmax().") >= 0): if (ext.traditional_convergence_test(target_evaluator.n)(x, g)): return 0 if (self.ignore_line_sea... |
minimizer.error, x, g) | minimizer.error, target_evaluator.n, x, g) | def run_c_plus_plus(target_evaluator, termination_params=None, core_params=None, exception_handling_params=None): if (termination_params is None): termination_params = termination_parameters() if (core_params is None): core_params = core_parameters() if (exception_handling_params is None): exception_handling_params = e... |
if (x is not None and x_after_step is not None): x.clear() x.extend(x_after_step) | def run_c_plus_plus(target_evaluator, termination_params=None, core_params=None, exception_handling_params=None): if (termination_params is None): termination_params = termination_parameters() if (core_params is None): core_params = core_parameters() if (exception_handling_params is None): exception_handling_params = e... | |
self.symbol = symbol.strip() self.category = _all[self.symbol.replace(" ","").upper()] | self.symbol = symbol.strip().replace(" ","").upper() self.category = _all[self.symbol] | def __init__(self, symbol): self.symbol = None try: self.symbol = symbol.strip() self.category = _all[self.symbol.replace(" ","").upper()] except: self.category = None |
if (__builtins__.get("_enumerate", None) is None): | if (__builtins__.get("enumerate", None) is None): | def bool(value): if (value): return True return False |
symmetry_constraints_on_b_cart = False): | symmetry_constraints_on_b_cart = False, k_sol_max = 10., k_sol_min =-10., b_sol_max = 500., b_sol_min =-500.): | def __init__(self, fc, fo, fm, k_initial, b_initial, u_initial, scale_initial, refine_k, refine_b, refine_u, refine_scale, alpha = None, beta = None, min_iterations=50, max_iterations=50, lbfgs_exception_handling_params = None, symmetry_constraints_on_b_cart = False): adopt_init_args(self, locals()) assert self.fc.indi... |
if twin_fraction > 0.06: | if twin_fraction > 0.10: | def twin_the_data_and_analyse(twin_operator,twin_fraction=0.2): out_string = StringIO() miller_array = random_data(35).map_to_asu() miller_array = miller_array.f_as_f_sq() cb_op = sgtbx.change_of_basis_op( twin_operator ) miller_array_mod, miller_array_twin = miller_array.common_sets( miller_array.change_basis( cb_... |
twin_the_data_and_analyse('h+k,-k,-l',0) | twin_the_data_and_analyse('h+k,-k,-l',0.00) twin_the_data_and_analyse('h+k,-k,-l',0.10) | def test_kernel_based_normalisation(): miller_array = random_data(35.0, d_min=2.5 ) normalizer = absolute_scaling.kernel_normalisation( miller_array, auto_kernel=True) z_values = normalizer.normalised_miller.data()/\ normalizer.normalised_miller.epsilons().data().as_double() z_values = flex.mean(z_values) assert approx... |
return s[:-2] + "}" | if (self.n_rows() > 0): s = s[:-2] return s + "}" | def mathematica_form(self, label="", one_row_per_line=False, format=None): s = "" if (label): s = label + "=" s += "{" for ir in xrange(self.n_rows()): s += "{" for ic in xrange(self.n_columns()): if (format is None): s += str(self(ir, ic)) else: s += format % self(ir, ic) s += ", " s = s[:-2] + "}," if (one_row_per_li... |
if (self.weights): | if (self.weights != None): | def __call__(self, f_calc_array, compute_derivatives): assert f_calc_array.unit_cell().is_similar_to(self.f_obs_array.unit_cell()) assert f_calc_array.space_group() == self.f_obs_array.space_group() if (self.weights): return self.target_calculator(self.f_obs_array.data(), self.weights, f_calc_array.data(), compute_deri... |
self.weights = self.sigmas() | self.weights = f_obs_array.sigmas().data() | def __init__(self, f_obs_array, weights=None, use_sigmas_as_weights=False): adopt_init_args(self, locals()) assert self.weights == None or self.use_sigmas_as_weights == False self.target_calculator = targets_least_squares_residual if (self.use_sigmas_as_weights): self.weights = self.sigmas() |
self.weights = self.multiplicities() | self.weights = f_obs_array.multiplicities().data() | def __init__(self, f_obs_array, weights=None, use_multiplicities_as_weights=False): adopt_init_args(self, locals()) assert self.weights == None or self.use_multiplicities_as_weights == False self.target_calculator = targets_intensity_correlation if (self.use_multiplicities_as_weights): self.weights = self.multiplicitie... |
self.gradients = self.gradients * (1. / self.number_of_restraints()) | self.gradients = self.gradients \ * (1. / max(1, self.number_of_restraints())) | def __init__(self, sites_cart, bond_proxies=None, nonbonded_proxies=None, nonbonded_function=None, angle_proxies=None, dihedral_proxies=None, chirality_proxies=None, planarity_proxies=None, compute_gradients=True, disable_asu_cache=False, normalization=None): adopt_init_args(self, locals()) if (nonbonded_proxies is not... |
return target / self.number_of_restraints() | return target / max(1, self.number_of_restraints()) | def target(self): target = self.bond_residual_sum +\ self.nonbonded_residual_sum +\ self.angle_residual_sum +\ self.dihedral_residual_sum +\ self.chirality_residual_sum +\ self.planarity_residual_sum if(self.normalization): return target / self.number_of_restraints() else: return target |
print >> sys.stderr, "Warning: Cannot find SCons (Software Construction Tool)" | print >> sys.stderr, "Warning:", print >> "Cannot find SCons (Software Construction Tool)" | def emit_SConstruct(env, libtbx_info): if (env.libtbx_scons == None): if (not os.path.isdir("libtbx")): print >> sys.stderr, "Warning: Cannot find SCons (Software Construction Tool)" print >> sys.stderr, " For more information please refer to:" print >> sys.stderr, " XXX" return SConstruct_path = norm(j... |
print >> f, 'use_SConscript_if_present("%s")' % (package_name,) | print >> f, 'use_SConscript_if_present("%s")' % package_name | def use_SConscript_if_present(package_name): dist = os.environ[package_name.upper() + "_DIST"] if (os.path.isfile(dist + "/SConscript")): SConscript(package_name + "/SConscript") |
if (not os.path.isfile(file_name)): continue | path = self.under_build(file_name) if (not os.path.isfile(path)): continue | def dispatcher_include(self): if (not hasattr(self, "_dispatcher_include")): self._dispatcher_include = [] for file_name in os.listdir(self.build_path): if (not os.path.isfile(file_name)): continue if ( file_name.startswith("dispatcher_include") and file_name.endswith(".sh")): try: lines = open(file_name).read().spl... |
try: lines = open(file_name).read().splitlines() | try: lines = open(path).read().splitlines() | def dispatcher_include(self): if (not hasattr(self, "_dispatcher_include")): self._dispatcher_include = [] for file_name in os.listdir(self.build_path): if (not os.path.isfile(file_name)): continue if ( file_name.startswith("dispatcher_include") and file_name.endswith(".sh")): try: lines = open(file_name).read().spl... |
return input_symmetry | self._cb_op = sgtbx.change_of_basis_op() self._symmetry = input_symmetry return | def __init__(self, input_symmetry, angular_tolerance): space_group_number = input_symmetry.space_group_info().type().number() if (space_group_number < 3 or space_group_number >= 75): return input_symmetry standard_info = sgtbx.space_group_info( symbol=space_group_number, table_id="A1983") cb_op_inp_ref = input_symmetry... |
affine_cb_op = sgtbx.change_of_basis_op(affine_s) | affine_cb_op = sgtbx.change_of_basis_op(affine_s) \ .new_denominators(best_cb_op) | def __init__(self, input_symmetry, angular_tolerance): space_group_number = input_symmetry.space_group_info().type().number() if (space_group_number < 3 or space_group_number >= 75): return input_symmetry standard_info = sgtbx.space_group_info( symbol=space_group_number, table_id="A1983") cb_op_inp_ref = input_symmetry... |
for space_group_number in xrange(3,75): | for space_group_number in xrange(3,76): | def exercise(): from cctbx import crystal cb_op = sgtbx.change_of_basis_op("y,z,x") for space_group_number in xrange(3,75): sgi = sgtbx.space_group_info(symbol=space_group_number) uc = sgi.any_compatible_unit_cell(volume=1000) best = find_best_cell( crystal.symmetry(unit_cell=uc, space_group_info=sgi).change_basis(cb_o... |
def dispatcher_include(self): if (not hasattr(self, "_dispatcher_include")): self._dispatcher_include = [] | def dispatcher_include(self, where): assert where in ["at_start", "before_command"] if (not hasattr(self, "_dispatcher_include_at_start")): self._dispatcher_include_at_start = [] self._dispatcher_include_before_command = [] | def dispatcher_include(self): if (not hasattr(self, "_dispatcher_include")): self._dispatcher_include = [] for file_name in os.listdir(self.build_path): path = self.under_build(file_name) if (not os.path.isfile(path)): continue if ( file_name.startswith("dispatcher_include") and file_name.endswith(".sh")): try: line... |
lines.insert(0, " highlight_dispatcher_include_lines(lines) self._dispatcher_include.extend(lines) return self._dispatcher_include | lines_at_start = [] lines_before_command = [] buffer = lines_before_command for line in lines: l = " ".join(line.split()).lower() if (l.startswith(" l = " if (l == " buffer = lines_at_start elif (l == " buffer = lines_before_command else: buffer.append(line) for buffer,target in [(lines_at_start, self._dispatcher_inc... | def dispatcher_include(self): if (not hasattr(self, "_dispatcher_include")): self._dispatcher_include = [] for file_name in os.listdir(self.build_path): path = self.under_build(file_name) if (not os.path.isfile(path)): continue if ( file_name.startswith("dispatcher_include") and file_name.endswith(".sh")): try: line... |
for line in self.dispatcher_include(): | for line in self.dispatcher_include(where="before_command"): | def write_bin_sh_dispatcher(self, source_file, target_file): f = open(target_file, "w") if (source_file is not None): print >> f, '#! /bin/sh' print >> f, '# LIBTBX_DISPATCHER DO NOT EDIT' else: print >> f, '# LIBTBX_DISPATCHER_HEAD DO NOT EDIT' print >> f, 'unset PYTHONHOME' print >> f, 'LIBTBX_BUILD="%s"' % self.buil... |
if not %LIBTBX_BATCH_INSTALL% == 0 goto final_exit | if not %%LIBTBX_BATCH_INSTALL%% == 0 goto final_exit | def create_script(bundle, top_modules): py_major, py_minor = sys.version_info[:2] return r"""@echo off |
uc = uctbx.unit_cell( '60, 40, 30, 90, 90, 90' ) sg_info_3 = sgtbx.space_group_info( 'P 1 1 21' ) sg_3 = sg_info_3.group() best_cell_finder = fbc( uc, sg_3 ) xs_best = best_cell_finder.return_best_xs() uc_correct = uctbx.unit_cell( '40, 30, 60, 90, 90, 90' ) sg_correct = sgtbx.space_group_info( 'P 1 21 1' ).group() ... | def tst_find_best_cell(): uc_array=[ uctbx.unit_cell( '40, 50, 60, 90, 90, 90' ), uctbx.unit_cell( '40, 60, 50, 90, 90, 90' ), uctbx.unit_cell( '50, 40, 60, 90, 90, 90' ), uctbx.unit_cell( '50, 60, 40, 90, 90, 90' ), uctbx.unit_cell( '60, 40, 50, 90, 90, 90' ), uctbx.unit_cell( '60, 50, 40, 90, 90, 90' ) ] uc_correct ... | |
[random.uniform(0,360) for i in xrange(3)]).elems | [random.uniform(0,360) for i in xrange(3)], deg=True).elems | def random_rotate_ellipsoid(u_cart): c = scitbx.math.euler_angles_as_matrix( [random.uniform(0,360) for i in xrange(3)]).elems return c_u_c_transpose(c, u_cart) |
assert approx_equal(flex.mean(flex.abs(sfweight.fb())), 0.0840891829706) assert approx_equal(flex.mean(flex.abs(sfweight.fd())), 0.111121311816) | assert approx_equal(flex.mean(flex.abs(sfweight.fb())), 1.22050766588) assert approx_equal(flex.mean(flex.abs(sfweight.fd())), 1.61219832101) | def exercise_with_fixed_structure(): structure = xray.structure( crystal_symmetry=crystal.symmetry( unit_cell=(46.7058, 46.7058, 79.3998, 90, 90, 120), space_group_symbol="P 31"), scatterers=flex.xray_scatterer( [xray.scatterer(scattering_type="const", site=site) for site in [ (0.0169, 0.8953, 0.1115), (0.9395, 0.1282,... |
' if [ "$%s" == "L_I_B_T_B_X_E_M_P_T_Y" ]; then unset %s; fi' % ( | ' if [ "$%s" = "L_I_B_T_B_X_E_M_P_T_Y" ]; then unset %s; fi' % ( | def update_path(self, var_name, val): val = os.pathsep.join(val) for f,action in [(self.s, "prepend"), (self.u, "delete")]: print >> f, ''' %s"`'%s' '%s' %s %s '%s'`"''' % ( self._setenv % var_name, self.env.python_exe, self.env.path_utility, action, var_name, val) if (f is self.s and self.shell == "sh"): print >> f, ... |
'DISTANCE':10.*(self.bruker.distance_cm+10.*self.bruker.distance_delta), | 'DISTANCE':10.0*(self.bruker.distance_cm+self.bruker.distance_delta), | def readHeader(self): self.parameters={ # image saturation not available. take the maximum pixel instead 'CCD_IMAGE_SATURATION': self.bruker.ccd_image_saturation, 'SIZE1':1024, 'SIZE2':1024, 'PIXEL_SIZE':self.bruker.pixel_size, 'OSC_START':self.bruker.osc_start, 'DISTANCE':10.*(self.bruker.distance_cm+10.*self.bruker.... |
assert approx_equal(f(-1+1.e-10), -3.84598441993) | assert approx_equal(f(-1+1.e-10), -23.0258508472) | def exercise_slatec_dbinom(): f = scitbx.math.slatec_dlnrel try: f(-1) except RuntimeError, e: assert str(e) == \ "slatec: dlnrel: x is le -1 (nerr=2, level=2)" else: raise RuntimeError("Exception expected.") assert approx_equal(f(-1+1.e-10), -3.84598441993) assert approx_equal(f(0.374), 0.3177261938) assert approx_equ... |
d_min=2., | d_min=3., | def print_structure_factors(SgInfo, adp=0, d_min=2., grid_resolution_factor = 1./3): elements = ("N", "C", "C", "O", "N", "C", "C", "O") xtal = debug_utils.random_structure( SgInfo, elements, volume_per_atom=50., min_distance=1.5, general_positions_only=0, anisotropic_displacement_parameters=adp) if (0): assert SgInfo.... |
general_positions_only=0, | general_positions_only=1, | def print_structure_factors(SgInfo, adp=0, d_min=2., grid_resolution_factor = 1./3): elements = ("N", "C", "C", "O", "N", "C", "C", "O") xtal = debug_utils.random_structure( SgInfo, elements, volume_per_atom=50., min_distance=1.5, general_positions_only=0, anisotropic_displacement_parameters=adp) if (0): assert SgInfo.... |
max_q, grid_resolution_factor, fft.Nreal(), fft.Mreal()) | max_q, grid_resolution_factor, u_extra, fft.Nreal(), fft.Mreal(), wing_cutoff, exp_table_one_over_step_size) | def print_structure_factors(SgInfo, adp=0, d_min=2., grid_resolution_factor = 1./3): elements = ("N", "C", "C", "O", "N", "C", "C", "O") xtal = debug_utils.random_structure( SgInfo, elements, volume_per_atom=50., min_distance=1.5, general_positions_only=0, anisotropic_displacement_parameters=adp) if (0): assert SgInfo.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.