rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
else: yield self.finished | if self.f_calc_solutions: yield self.finished else: yield self.starting | def _evaluating(self, original_f_obs): while 1: attempts = 0 while attempts < self.max_attempts_to_get_sharp_correlation_map: attempts += 1 self.f_calc_solutions = [] for f_calc, shift, cc_peak_height\ in f_calc_symmetrisations(original_f_obs, self.flipping_iterator.f_calc, self.min_cc_peak_height): if (not self.f_calc... |
final_phil = self.master_phil.fetch(sources=[self.working_phil]+sources) | final_phil = self.master_phil.fetch(sources=[self.working_phil] + list(sources)) | def save_param_file (self, file_name, sources=None, extra_phil="", diff_only=False, save_state=False) : if sources is None : sources = [] if extra_phil != "" : self.merge_phil(phil_string=extra_phil, rebuild_index=False) final_phil = self.master_phil.fetch(sources=[self.working_phil]+sources) if diff_only : output_phil... |
diff = xs1.delta_sites_cart_measure(xs0) assert approx_equal(diff, diff_ref, eps=rnd_delta) | mscd = xray.meaningful_site_cart_differences(xs1=xs1, xs2=xs0) assert approx_equal(mscd.max_absolute(), diff_ref, eps=rnd_delta) | def exercise_delta_sites_cart_measure(): rnd_delta = 1e-3 for hall_symbol, continuously_shift in [ ('P 2yb', lambda x,y,z: (x , y+0.7, z) ), ('P -2x', lambda x,y,z: (x , y+0.9, z-0.7)), ('P 1' , lambda x,y,z: (x+0.1, y+0.2, z+0.9)), ]: xs0 = random_structure.xray_structure( sgtbx.space_group_info('hall: %s' %... |
for map_coeffs in params.maps.map_coefficients : if map_coeffs.map_type.lower().startswith("anom") : raise Sorry(("Anomalous map coefficients ('%s') requested, but input "+ "data are not anomalous.") % map_coeffs.map_type) for map in params.maps.map : | all_maps = params.maps.map_coefficients + params.maps.map for map in all_maps : | def run(args, log = sys.stdout): print >> log, legend print >> log, "-"*79 if(len(args) == 0): parameter_file_name = "maps.params" print >> log, "Creating parameter file '%s' in the following directory:\n%s"%( parameter_file_name, os.path.abspath('.')) if(os.path.isfile(parameter_file_name)): msg="File '%s' exists alre... |
raise Sorry(("Anomalous map coefficients ('%s') requested, but input "+ "data are not anomalous.") % map_coeffs.map_type) | raise Sorry(("Anomalous map type ('%s') requested, but input "+ "data are not anomalous.") % map.map_type) | def run(args, log = sys.stdout): print >> log, legend print >> log, "-"*79 if(len(args) == 0): parameter_file_name = "maps.params" print >> log, "Creating parameter file '%s' in the following directory:\n%s"%( parameter_file_name, os.path.abspath('.')) if(os.path.isfile(parameter_file_name)): msg="File '%s' exists alre... |
easy_run.call("libtbx.start_process %s &" % params.run_file) | easy_run.call("libtbx.start_process %s &" % eff_file) | def exercise () : params = runtime_utils.process_master_phil.extract() i = 0 while True : output_dir = os.path.join(os.getcwd(), "simple_run%d" % i) if os.path.exists(output_dir) : i += 1 else : os.makedirs(output_dir) break run = runtime_utils.simple_run(output_dir) params.output_dir = output_dir params.buffer_stdout ... |
if new_array.is_xray_intensity_array() : if array_params.output_as == "amplitudes" : output_array = new_array.f_sq_as_f() if output_labels[0].upper().startswith("I") : raise Sorry(("The output labels for the array %s:%s (%s) are not "+ "suitable for amplitudes; please change them to something "+ "with an 'F', or leave ... | def __init__ (self, params, input_files=None, log=sys.stderr, accumulation_callback=None, symmetry_callback=None) : adopt_init_args(self, locals()) if len(params.mtz_file.miller_array) == 0 : raise Sorry("No Miller arrays have been selected for the output file.") elif len(params.mtz_file.miller_array) > 25 : raise Sorr... | |
missing_set = r_free_flags.complete_set(d_min=d_min, d_max=d_max).lone_set(r_free_flags.map_to_asu()) | if complete_set is not None : missing_set = complete_set.lone_set(r_free_flags.map_to_asu()) else : missing_set = r_free_flags.complete_set(d_min=d_min, d_max=d_max).lone_set(r_free_flags.map_to_asu()) | def __init__ (self, params, input_files=None, log=sys.stderr, accumulation_callback=None, symmetry_callback=None) : adopt_init_args(self, locals()) if len(params.mtz_file.miller_array) == 0 : raise Sorry("No Miller arrays have been selected for the output file.") elif len(params.mtz_file.miller_array) > 25 : raise Sorr... |
have_r_free_array = True if DEBUG and output_array is not None : print " Final size: %d" % miller_array.data().size() if miller_array.sigmas() is not None : print " sigmas: %d" % miller_array.sigmas().size() elif new_array.is_xray_intensity_array() : if array_params.output_as == "amplitudes" : output_ar... | fake_label = "A" + string.uppercase[i+1] self.add_array_to_mtz_dataset( output_array=output_array, fake_label=fake_label, column_types="I") for label in output_labels : labels.append(label) label_files.append(file_name) self.final_arrays.append(output_array) i += 1 | def __init__ (self, params, input_files=None, log=sys.stderr, accumulation_callback=None, symmetry_callback=None) : adopt_init_args(self, locals()) if len(params.mtz_file.miller_array) == 0 : raise Sorry("No Miller arrays have been selected for the output file.") elif len(params.mtz_file.miller_array) > 25 : raise Sorr... |
noise = flex.random_double(3)*2-1.0 | noise = mt.random_double(3)*2-1.0 | def tst_nsd(): moving1 = flex.vec3_double() moving2 = flex.vec3_double() fixed = flex.vec3_double() max_noise = 0 for ii in range(10): noise = flex.random_double(3)*2-1.0 if noise.norm() > max_noise: max_noise = noise.norm() xyz = flex.random_double(3)*5 fixed.append( list(xyz) ) moving1.append( list(xyz + noise/10) ... |
xyz = flex.random_double(3)*5 | xyz = mt.random_double(3)*5 | def tst_nsd(): moving1 = flex.vec3_double() moving2 = flex.vec3_double() fixed = flex.vec3_double() max_noise = 0 for ii in range(10): noise = flex.random_double(3)*2-1.0 if noise.norm() > max_noise: max_noise = noise.norm() xyz = flex.random_double(3)*5 fixed.append( list(xyz) ) moving1.append( list(xyz + noise/10) ... |
def __init__ (self, map, is_difference_map=False) : | def __init__ (self, map, is_difference_map=False, radius=10.0) : | def __init__ (self, map, is_difference_map=False) : adopt_init_args(self, locals()) self.unit_cell = map.unit_cell() o = self.unit_cell.orthogonalization_matrix() self.orthogonaliser = ( o[0:3] + (0,) + o[3:6] + (0,) + o[6:9] + (0,) + (0,0,0,1) ) p = self.unit_cell.orthogonalize((0,0,0)) q = self.unit_cell.orthogonali... |
self.radius = 10.0 | def __init__ (self, map, is_difference_map=False) : adopt_init_args(self, locals()) self.unit_cell = map.unit_cell() o = self.unit_cell.orthogonalization_matrix() self.orthogonaliser = ( o[0:3] + (0,) + o[3:6] + (0,) + o[6:9] + (0,) + (0,0,0,1) ) p = self.unit_cell.orthogonalize((0,0,0)) q = self.unit_cell.orthogonali... | |
map_object = map_data(map, is_difference_map) | map_object = map_data(map, is_difference_map=is_difference_map, radius=self.settings.opengl.map_radius) | def add_map (self, map_id, map, is_difference_map=False) : if map_id in self.map_ids : self.delete_map(map_id) map_object = map_data(map, is_difference_map) self.map_ids.append(map_id) self.map_objects.append(map_object) self.show_object[map_id] = True self.update_maps = True |
& -dtd0(y8) | & dtd0(y8) | def asu_212(): # P 43 3 2 (enantiomorph of 213) return (direct_space_asu('P 4acd 2ab 3') & zx2 & -yz0(-zx2) & ~yz2(tdd0) & -tdd0(x8) & -dtd0(y8) & ~tdu2(-x1*3/8) ) |
from libtbx.easy_run import subprocess | if (sys.version_info[:2] < (2,6)): from libtbx.easy_run import subprocess else: import subprocess | def run_in_dir(cmd_info): d = op.dirname(cmd_info.log) os.mkdir(d) os.chdir(d) from libtbx.command_line import printenv printenv.show(out=open("os_environ_at_start", "w")) from libtbx.easy_run import subprocess log = open("log", "w") t0 = time.time() try: subprocess.Popen( args=cmd_info.cmd, shell=True, bufsize=-1, std... |
return pdb_str | return pdb_str.getvalue() | def combine_pdb_files (self, file_names) : symm = None pdb_str = cStringIO.StringIO() hierarchies = [] for file_name in file_names : pdb_file = self._cached_input_files[file_name] file_symm = pdb_file.file_object.crystal_symmetry() if (file_symm is not None) and (symm is not None) : symm = file_symm hierarchy_str = sel... |
from scitbx.array_family import flex raw_records = flex.std_string() raw_records.extend(flex.split_lines(pdb_str)) pdb_in = iotbx.pdb.input(source_info=None, lines=raw_records) | pdb_in = iotbx.pdb.input(source_info=None, lines=pdb_str) | def get_combined_pdb_input (self, file_param_name=None) : if (file_param_name is not None) : file_names = self.get_param_files(file_param_name) if (len(file_names) == 1) : hierarchy = self.get_pdb_hierarchy(file_names[0]) xray_structure = self.get_xray_structure(file_names[0]) return (hierarchy, xray_structure) else : ... |
builder = shelx.afixed_crystal_structure_builder() | builder = shelx.crystal_structure_builder() | def trial_structure(): builder = shelx.afixed_crystal_structure_builder() stream = shelx.command_stream( file=cStringIO.StringIO(sucrose)) l_cs = shelx.crystal_symmetry_parser(stream, builder) l_afix = shelx.afix_parser(l_cs.filtered_commands(), builder) l_xs = shelx.atom_parser(l_afix.filtered_commands(), builder) l_x... |
l_afix = shelx.afix_parser(l_cs.filtered_commands(), builder) l_xs = shelx.atom_parser(l_afix.filtered_commands(), builder) | l_xs = shelx.atom_parser(l_cs.filtered_commands(), builder) | def trial_structure(): builder = shelx.afixed_crystal_structure_builder() stream = shelx.command_stream( file=cStringIO.StringIO(sucrose)) l_cs = shelx.crystal_symmetry_parser(stream, builder) l_afix = shelx.afix_parser(l_cs.filtered_commands(), builder) l_xs = shelx.atom_parser(l_afix.filtered_commands(), builder) l_x... |
from libtbx.complex_math import arg | from cmath import phase as arg | def exercise_symmetry_agreement_factor(): from libtbx.complex_math import arg uc = uctbx.unit_cell((1, 2, 3, 90, 101, 90)) cs = crystal.symmetry(uc, 'P 1') mi = miller.set( cs, flex.miller_index(((1,1,1), (-1,1,-1), (-1,1,1), (1,1,-1))), anomalous_flag=True) cb_op = sgtbx.change_of_basis_op(sgtbx.rt_mx('-x,y,-z+1/2')) ... |
def is_na (self, min_content=0.95) : | def is_na (self, min_content=0.8) : | def is_na (self, min_content=0.95) : rn_seq, residue_classes = self.get_residue_names_and_classes() n_aa = residue_classes["common_amino_acid"] n_na = residue_classes["common_rna_dna"] if ((n_na > n_aa) and ((n_na / len(rn_seq)) >= min_content)) : return True return False |
if ((n_na > n_aa) and ((n_na / len(rn_seq)) >= min_content)) : | if ((n_na > n_aa) and ((float(n_na) / len(rn_seq)) >= min_content)) : | def is_na (self, min_content=0.95) : rn_seq, residue_classes = self.get_residue_names_and_classes() n_aa = residue_classes["common_amino_acid"] n_na = residue_classes["common_rna_dna"] if ((n_na > n_aa) and ((n_na / len(rn_seq)) >= min_content)) : return True return False |
return run(list(self.args)) | results = run(list(self.args)) eff_file = self.args[0] if os.path.isfile(eff_file) : base, ext = os.path.splitext(eff_file) easy_pickle.dump("%s.pkl" % base, results) return results | def __call__ (self) : return run(list(self.args)) |
selections): | selections, log=sys.stdout): | def _alignment(self, pdb_hierarchy, pdb_hierarchy_ref, params, selections): res_match_hash = {} model_mseq_res_hash = {} model_seq, model_structures = self.extract_sequence_and_sites( pdb_hierarchy=pdb_hierarchy, selection=selections[0]) ref_mseq_res_hash = {} ref_seq, ref_structures = self.extract_sequence_and_sites( ... |
params): | params, log=sys.stdout): | def process_reference_groups(self, pdb_hierarchy, pdb_hierarchy_ref, params): model_iseq_hash = self.build_iseq_hash(pdb_hierarchy=pdb_hierarchy) model_name_hash = self.build_name_hash(pdb_hierarchy=pdb_hierarchy) ref_iseq_hash = self.build_iseq_hash(pdb_hierarchy=pdb_hierarchy_ref) sel_cache = pdb_hierarchy.atom_selec... |
selections = (sel_atoms_ref, sel_atoms) | selections = (sel_atoms, sel_atoms_ref) | def process_reference_groups(self, pdb_hierarchy, pdb_hierarchy_ref, params): model_iseq_hash = self.build_iseq_hash(pdb_hierarchy=pdb_hierarchy) model_name_hash = self.build_name_hash(pdb_hierarchy=pdb_hierarchy) ref_iseq_hash = self.build_iseq_hash(pdb_hierarchy=pdb_hierarchy_ref) sel_cache = pdb_hierarchy.atom_selec... |
selections=selections) | selections=selections, log=log) | def process_reference_groups(self, pdb_hierarchy, pdb_hierarchy_ref, params): model_iseq_hash = self.build_iseq_hash(pdb_hierarchy=pdb_hierarchy) model_name_hash = self.build_name_hash(pdb_hierarchy=pdb_hierarchy) ref_iseq_hash = self.build_iseq_hash(pdb_hierarchy=pdb_hierarchy_ref) sel_cache = pdb_hierarchy.atom_selec... |
params=work_params) | params=work_params, log=log) | def get_home_dihedral_proxies(self, work_params, geometry, pdb_hierarchy, geometry_ref, sites_cart_ref, pdb_hierarchy_ref, log=sys.stdout): ss_selection = None residue_match_hash = {} reference_dihedral_proxies = cctbx.geometry_restraints.shared_dihedral_proxy() sigma = work_params.sigma limit = work_params.limit i_seq... |
class launcher (runtime_utils.simple_launcher) : | class launcher (runtime_utils.simple_target) : | def __init__ (self, params, xtriage_results) : self.file_name = params.scaling.input.xray_data.file_name self.log_file = params.scaling.input.parameters.reporting.log self.file_labels = params.scaling.input.xray_data.obs_labels self.nresidues = params.scaling.input.asu_contents.n_residues self.nbases = params.scaling.i... |
'"hall: P 1"', '"hall: P 3"', '"hall: P 3 -2"' ], | '"hall: P 1"', '"hall: P 3"', '"hall: -P 2ybc"' ], | def run(): tst_list = ( "$D/ab_initio/tests/tst_ab_initio_ext.py", ["$D/ab_initio/tests/tst_charge_flipping.py", '--fix_seed', '--on=E', '"hall: P 1"', '"hall: P 3"', '"hall: P 3 -2"' ], "$D/masks/tests/tst_masks.py", "$D/structure_factors/direct/tests/tst_standard_xray.py", "$D/refinement/tests/tst_minimization.py", #... |
structure=xs, | structure=self.xray_structure, | def exercise_floating_origin_restraints(self): n = self.n_independent_params eps_zero_rhs = 1e-6 connectivity_table = smtbx.utils.connectivity_table(self.xray_structure) reparametrisation = constraints.reparametrisation( structure=xs, geometrical_constraints=[], connectivity_table=connectivity_table) normal_eqns = leas... |
clean_pdb_string = "" for line in pdb_string.splitlines(): line = clean_base_names(line) clean_pdb_string = clean_pdb_string+line+'\n' | clean_lines = [] for line in pdb_string.splitlines() : if not line.startswith("ANISOU") : line = clean_base_names(line) clean_lines.append(line) clean_pdb_string = "\n".join(clean_lines) | def run_reduce(hierarchy, remove_hydrogens=True): trim = "phenix.reduce -quiet -trim -" build = "phenix.reduce -quiet -build -allalt -" input_str = "" pdb_string = hierarchy.as_pdb_string() clean_pdb_string = "" for line in pdb_string.splitlines(): # *'s in atom names don't impact base, so leaving alone for now #line =... |
else: | elif (mlq is not None) : | def eval_sidechain_completeness(pdb_hierarchy, mon_lib_srv=None, ignore_hydrogens=True, report_whole_res=False, return_ca_pos=False): missing_atom_list=[] if mon_lib_srv is None: mon_lib_srv = monomer_library.server.server() for model in pdb_hierarchy.models(): for chain in model.chains(): for residue_group in chain.re... |
raise Sorry("File %s not found.") | raise RuntimeError("File %s not found.") | def run_ksdssp (file_name, log=sys.stderr) : if not os.path.isfile(file_name) : raise Sorry("File %s not found.") exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if not os.path.isfile(exe_path) : raise Sorry("KSDSSP not available.") print >> log, " Running KSDSSP to generate HELIX and SHEET records" ksdssp_out ... |
raise Sorry("KSDSSP not available.") | raise RuntimeError("KSDSSP not available.") | def run_ksdssp (file_name, log=sys.stderr) : if not os.path.isfile(file_name) : raise Sorry("File %s not found.") exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if not os.path.isfile(exe_path) : raise Sorry("KSDSSP not available.") print >> log, " Running KSDSSP to generate HELIX and SHEET records" ksdssp_out ... |
except Sorry : | except RuntimeError : | def exercise () : from iotbx import file_reader pdb_file = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf.pdb", test=os.path.isfile) pdb_file_h = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf_h.pdb", test=os.path.isfile) if pdb_file is None : print "Skipping" ret... |
f.evaluate(h) fe = f.f_calc assert f.grad_f_calc is None if fl or fe: assert 1 - eps < abs(fl - fe)/abs(fl + fe) < 1 + eps, (fl, fe) | f1.evaluate(h) fe = f1.f_calc assert f1.grad_f_calc is None assert approx_equal_relatively(fe, fl, relative_error=1e-15), (fe, fl) | def do_exercise(self, verbose=False): xs = self.xs sg = xs.space_group_info().group() origin_centric_case = sg.is_origin_centric() |
if (svd_lapack is None): return | def compare_times( comprehensive=False, svd_impl_name="dgesvd", use_fortran=False): import scitbx.linalg.svd from scitbx.array_family import flex import time from libtbx.utils import progress_displayed_as_fraction mt = flex.mersenne_twister(seed=0) samples = [] if not comprehensive: dims = (100, 200) for m in dims: for... | |
base_pair = pair[8]+pair[17] | base_pair = pair[6:9].strip()+pair[15:18].strip() | def get_base_pairs(pdb_hierarchy, probe_flags=None): #db = mmtbx.base_pairing.pair_database() if probe_flags is None: probe_flags = "-Both -Unformated -NOCLASHOUT -NOVDWOUT \"BASE\" \"BASE\"" probe_out = run_probe(pdb_hierarchy=pdb_hierarchy, flags=probe_flags) hbond_hash={} pair_hash={} reduced_pair_hash={} probe_iter... |
from_here=None, to_there=None, | def __init__(self, fft_map=None, unit_cell=None, raw_map=None, from_here=None, to_there=None, periodic=False, positive_iso_level=None, iso_level_positive_range_fraction=None, negative_iso_level=None, iso_level_negative_range_fraction=None, wires=True, **kwds): if fft_map is not None: unit_cell = fft_map.unit_cell() sup... | |
from_here=from_here, to_there=to_there, | def __init__(self, fft_map=None, unit_cell=None, raw_map=None, from_here=None, to_there=None, periodic=False, positive_iso_level=None, iso_level_positive_range_fraction=None, negative_iso_level=None, iso_level_negative_range_fraction=None, wires=True, **kwds): if fft_map is not None: unit_cell = fft_map.unit_cell() sup... | |
show_unit_cell=False, | is_unit_cell_shown=False, | def draw_triangulation(self): if self.wires: glPushAttrib(GL_LIGHTING_BIT) glDisable(GL_LIGHTING) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) glColor4fv(self.wire_colour) else: glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) self.material.execute(specular=not self.wires) va = gltbx.util.vertex_array(self.triangulation.vertices... |
k = 0.05 + 10 * flex.random_double() | k = 0.05 + 10 * mt.random_double() | def exercise_masks(): xs_ref = structure.from_shelx( file=cStringIO.StringIO(YAKRUY_ins)) mi = xs_ref.crystal_symmetry().build_miller_set( d_min=0.5, anomalous_flag=False) fo = mi.structure_factors_from_scatterers( xs_ref, algorithm="direct").f_calc().as_amplitude_array() k = 0.05 + 10 * flex.random_double() fo = fo.cu... |
flex.set_random_seed(0) fo2_incomplete = fo2.select(flex.random_bool(fo2.size(), 0.95)) | mt = flex.mersenne_twister(seed=0) fo2_incomplete = fo2.select(mt.random_bool(fo2.size(), 0.95)) | def exercise_masks(): xs_ref = structure.from_shelx( file=cStringIO.StringIO(YAKRUY_ins)) mi = xs_ref.crystal_symmetry().build_miller_set( d_min=0.5, anomalous_flag=False) fo = mi.structure_factors_from_scatterers( xs_ref, algorithm="direct").f_calc().as_amplitude_array() k = 0.05 + 10 * flex.random_double() fo = fo.cu... |
glTranslated(*self.compute_home_translation()) | translation = self.compute_home_translation() glTranslated(*translation) | def initialize_modelview(self, eye_vector=None, angle=None): glMatrixMode(GL_MODELVIEW) glLoadIdentity() self.setup_lighting() gluLookAt(0,0,0, 0,0,-1, 0,1,0) glTranslated(*self.compute_home_translation()) rc = self.minimum_covering_sphere.center() self.rotation_center = rc if eye_vector is None: eye_vector = (1,1,1) i... |
def setup_lighting (self) : if self.flag_use_lights : glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glEnable(GL_LIGHT1) glLightfv(GL_LIGHT0, GL_AMBIENT, [0.0, 0.0, 0.0, 1.0]) glLightfv(GL_LIGHT0, GL_DIFFUSE, [1, 1, 1, 1]) glLightfv(GL_LIGHT0, GL_SPECULAR, [0.5, 0.5, 0.5, 1.0]) gl... | def initialize_modelview(self, eye_vector=None, angle=None): glMatrixMode(GL_MODELVIEW) glLoadIdentity() self.setup_lighting() gluLookAt(0,0,0, 0,0,-1, 0,1,0) glTranslated(*self.compute_home_translation()) rc = self.minimum_covering_sphere.center() self.rotation_center = rc if eye_vector is None: eye_vector = (1,1,1) i... | |
return matrix.rt(( | return scitbx.matrix.rt(( | def modelview_matrix_as_rt(): return matrix.rt(( extract_rotation_from_gl_modelview_matrix(), extract_translation_from_gl_modelview_matrix())) |
var = covariance_diagonal[idx] | var = covariance_diagonal[idx+i] | def __init__(self, xray_structure, covariance_matrix=None): crystal_symmetry_as_cif_block.__init__( self, xray_structure.crystal_symmetry()) scatterers = xray_structure.scatterers() uc = xray_structure.unit_cell() if covariance_matrix is not None: param_map = xray_structure.parameter_map() covariance_diagonal = covaria... |
flex.size_t((i_seq,j_seq, k_seq)), cov_cart, param_map) | flex.size_t((j_seq, i_seq, k_seq)), cov_cart, param_map) | def __init__(self, angle, i_seqs, rt_mx_ji=None, rt_mx_ki=None, variance=None): libtbx.adopt_init_args(self, locals()) |
assert m.rms < 0.15, m.rms | assert m.rms < 0.2, m.rms | def randomly_exercise(flipping_type, space_group_info, elements, anomalous_flag, d_min, grid_resolution_factor=1./2, verbose=False, amplitude_type="F", ): assert amplitude_type in ('F', 'E', 'quasi-E') # Generate a random structure in real space, that we will try to recover target_structure = random_structure.xray_str... |
max_clusters=int(target_structure.scatterers().size()*1.05)) | max_clusters=target_structure.scatterers().size()+1) | def randomly_exercise(flipping_type, space_group_info, elements, anomalous_flag, d_min, grid_resolution_factor=1./2, verbose=False, amplitude_type="F", ): assert amplitude_type in ('F', 'E', 'quasi-E') # Generate a random structure in real space, that we will try to recover target_structure = random_structure.xray_str... |
assert m.rms < 0.1, m.rms | assert m.rms < 0.15, m.rms | def randomly_exercise(flipping_type, space_group_info, elements, anomalous_flag, d_min, grid_resolution_factor=1./2, verbose=False, amplitude_type="F", ): assert amplitude_type in ('F', 'E', 'quasi-E') # Generate a random structure in real space, that we will try to recover target_structure = random_structure.xray_str... |
if n > 24: | if not flags.high_symmetry and n > 24: | def exercise(flags, space_group_info): if not flags.repeats: flags.repeats = 1 if not flags.algo: flags.algo = "weak_reflection_improved" if not flags.on: flags.on = "E" if flags.fix_seed: random.seed(1) flex.set_random_seed(1) n = len(space_group_info.group()) print space_group_info.type().hall_symbol(), if n > 24: p... |
print "C%i O%i N%i" % (n_C*n, n_O*n, n_N*n) | print "unit cell content: C%i O%i N%i" % (n_C*n, n_O*n, n_N*n) print "asu content: C%i O%i N%i" % (n_C, n_O, n_N) | def exercise(flags, space_group_info): if not flags.repeats: flags.repeats = 1 if not flags.algo: flags.algo = "weak_reflection_improved" if not flags.on: flags.on = "E" if flags.fix_seed: random.seed(1) flex.set_random_seed(1) n = len(space_group_info.group()) print space_group_info.type().hall_symbol(), if n > 24: p... |
keywords=("repeats", 'on', 'algo', 'fix_seed'), | keywords=("repeats", 'on', 'algo', 'fix_seed', 'high_symmetry'), | def exercise_charge_flipping(): import sys debug_utils.parse_options_loop_space_groups( sys.argv[1:], exercise, keywords=("repeats", 'on', 'algo', 'fix_seed'), symbols_to_stderr=False, ) |
assert approx_equal(a.residual(), 2) | assert approx_equal(a.residual(), 124) | def exercise_adp_similarity(): u_cart = ((1,3,2,4,3,6),(2,4,2,6,5,1)) u_iso = (-1,-1) use_u_aniso = (True, True) weight = 1 a = adp_restraints.adp_similarity( u_cart=u_cart, u_iso=u_iso, use_u_aniso=use_u_aniso, weight=weight) assert approx_equal(a.u_cart, u_cart) assert approx_equal(a.u_iso, u_iso) assert approx_equal... |
((-2.0, 2.0, 0.0, 0.0, 0.0, 0.0), (2.0, -2.0, 0.0, 0.0, 0.0, 0.0))) assert approx_equal(a.deltas(), (-1.0, 1.0, 0.0, 0.0, 0.0, 0.0)) assert approx_equal(a.rms_deltas(), 0.47140452079103168) | ((-2, 2, 0, 16, 12, 24), (2, -2, 0, -16, -12, -24))) assert approx_equal(a.deltas(), (-1, 1, 0, 4, 3, 6)) assert approx_equal(a.rms_deltas(), 3.711842908553348) | def exercise_adp_similarity(): u_cart = ((1,3,2,4,3,6),(2,4,2,6,5,1)) u_iso = (-1,-1) use_u_aniso = (True, True) weight = 1 a = adp_restraints.adp_similarity( u_cart=u_cart, u_iso=u_iso, use_u_aniso=use_u_aniso, weight=weight) assert approx_equal(a.u_cart, u_cart) assert approx_equal(a.u_iso, u_iso) assert approx_equal... |
if (read_size != 0): pattern = "LIBTBX_SET_DISPATCHER_NAME" i = source_text.find(pattern) if (i >= 0): i += len(pattern) flds = source_text[i:].split(None, 1) if (len(flds) != 0 and len(flds[0]) != 0): target_file = flds[0] | pattern = "LIBTBX_SET_DISPATCHER_NAME" if (read_size > len(pattern)): for line in source_text.splitlines(): i = line.find(pattern) if (i >= 0): i += len(pattern) flds = line[i:].split(None, 1) if (len(flds) != 0): target_file = flds[0] if (len(target_file) != 0): self.env._write_dispatcher_in_bin( source_file=source_fi... | def write_dispatcher(self, source_dir, file_name, suppress_warning, target_file_name_infix="", scan_for_libtbx_set_dispatcher_name=False): assert target_file_name_infix == "" or not scan_for_libtbx_set_dispatcher_name if (len(file_name) == 0): return source_file = libtbx.path.norm_join(source_dir, file_name) if (not os... |
svd = lapack_dgesvd(a=a.transpose().as_flex_double_matrix()) | svd = lapack_dgesvd_fem(a=a.transpose().as_flex_double_matrix()) | def get_sigma(svd, m, n): elems = [0.] * (m*n) for i in xrange(min(m,n)): elems[i*n+i] = svd.s[i] return matrix.rec(elems=elems, n=(m,n)) |
exercise() compare_times() | import scitbx.linalg lapack_dgesvd_fem = getattr(scitbx.linalg, "lapack_dgesvd_fem", None) if (lapack_dgesvd_fem is None): print "Skipping tests: lapack_dgesvd_fem not available." else: exercise() compare_times() | def run(args): assert len(args) == 0 exercise() compare_times() print "OK" |
print "Start creating DAs..." da_xray_structures = create_da_xray_structures(xray_structure = xray_structure, params = params) | if(xray_structure_da is not None): print "Using external DA..." da_xray_structures = [xray_structure_da] else: print "Start creating DAs..." da_xray_structures = create_da_xray_structures(xray_structure = xray_structure, params = params) | def grow_density(f_obs, r_free_flags, xray_structure, params): print "Start creating DAs..." da_xray_structures = create_da_xray_structures(xray_structure = xray_structure, params = params) n_da = 0 for daxrs in da_xray_structures: n_da += daxrs.scatterers().size() print "Total number of dummy atoms to be added:", n_da... |
print "Total number of dummy atoms to be added:", n_da | print "Total number of dummy atoms:", n_da | def grow_density(f_obs, r_free_flags, xray_structure, params): print "Start creating DAs..." da_xray_structures = create_da_xray_structures(xray_structure = xray_structure, params = params) n_da = 0 for daxrs in da_xray_structures: n_da += daxrs.scatterers().size() print "Total number of dummy atoms to be added:", n_da... |
try: xray_structure_current = xray_structure_current.concatenate(da_xray_structure) da_sel.extend(flex.bool(da_xray_structure.scatterers().size(), True)) if(params.mode == "build_and_refine"): fmodel.update_xray_structure(update_f_calc=True, update_f_mask=False, xray_structure = xray_structure_current) refine_da(fmod... | xray_structure_current = xray_structure_current.concatenate(da_xray_structure) da_sel.extend(flex.bool(da_xray_structure.scatterers().size(), True)) if(params.mode == "build_and_refine"): fmodel.update_xray_structure(update_f_calc=True, update_f_mask=False, xray_structure = xray_structure_current) refine_da(fmodel = ... | def grow_density(f_obs, r_free_flags, xray_structure, params): print "Start creating DAs..." da_xray_structures = create_da_xray_structures(xray_structure = xray_structure, params = params) n_da = 0 for daxrs in da_xray_structures: n_da += daxrs.scatterers().size() print "Total number of dummy atoms to be added:", n_da... |
elif(parameter == "adps"): | if(parameter == "adp"): | def refinery(fmodels, number_of_iterations, iselection, parameter): fmodels.fmodel_xray().xray_structure.scatterers().flags_set_grads(state=False) lbfgs_termination_params = scitbx.lbfgs.termination_parameters( max_iterations = number_of_iterations) if(parameter == "occupancies"): fmodels.fmodel_xray().xray_structure.s... |
else: raise RuntimeError minimized = mmtbx.refinement.minimization.lbfgs( fmodels = fmodels, lbfgs_termination_params = lbfgs_termination_params, collect_monitor = False) | if(parameter == "sites"): fmodels.fmodel_xray().xray_structure.scatterers().flags_set_grad_site( iselection = iselection) try: minimized = mmtbx.refinement.minimization.lbfgs( fmodels = fmodels, lbfgs_termination_params = lbfgs_termination_params, collect_monitor = False) except Exception, e: ... | def refinery(fmodels, number_of_iterations, iselection, parameter): fmodels.fmodel_xray().xray_structure.scatterers().flags_set_grads(state=False) lbfgs_termination_params = scitbx.lbfgs.termination_parameters( max_iterations = number_of_iterations) if(parameter == "occupancies"): fmodels.fmodel_xray().xray_structure.s... |
def reset_occupancies(fmodels, selection, occ_min, occ_max, set_min, set_max): | def reset_occupancies(fmodels, selection, params): | def reset_occupancies(fmodels, selection, occ_min, occ_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure occ = xrs.scatterers().extract_occupancies() sel = occ < occ_min sel &= selection occ = occ.set_selected(sel, set_min) sel = occ > occ_max sel &= selection occ = occ.set_selected(sel, set_max) xrs.s... |
sel = occ < occ_min | sel = occ < params.filter.occupancy_min | def reset_occupancies(fmodels, selection, occ_min, occ_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure occ = xrs.scatterers().extract_occupancies() sel = occ < occ_min sel &= selection occ = occ.set_selected(sel, set_min) sel = occ > occ_max sel &= selection occ = occ.set_selected(sel, set_max) xrs.s... |
occ = occ.set_selected(sel, set_min) sel = occ > occ_max | occ = occ.set_selected(sel, params.filter.occupancy_min) sel = occ > params.filter.occupancy_max | def reset_occupancies(fmodels, selection, occ_min, occ_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure occ = xrs.scatterers().extract_occupancies() sel = occ < occ_min sel &= selection occ = occ.set_selected(sel, set_min) sel = occ > occ_max sel &= selection occ = occ.set_selected(sel, set_max) xrs.s... |
occ = occ.set_selected(sel, set_max) | occ = occ.set_selected(sel, params.filter.occupancy_max) | def reset_occupancies(fmodels, selection, occ_min, occ_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure occ = xrs.scatterers().extract_occupancies() sel = occ < occ_min sel &= selection occ = occ.set_selected(sel, set_min) sel = occ > occ_max sel &= selection occ = occ.set_selected(sel, set_max) xrs.s... |
def reset_adps(fmodels, selection, b_min, b_max, set_min, set_max): | def reset_adps(fmodels, selection, params): | def reset_adps(fmodels, selection, b_min, b_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure b = xrs.extract_u_iso_or_u_equiv()*adptbx.u_as_b(1.) sel = b > b_max sel &= selection b = b.set_selected(sel, set_max) sel = b < b_min sel &= selection b = b.set_selected(sel, set_min) xrs = xrs.set_b_iso(valu... |
sel = b > b_max | sel = b > params.filter.b_iso_max | def reset_adps(fmodels, selection, b_min, b_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure b = xrs.extract_u_iso_or_u_equiv()*adptbx.u_as_b(1.) sel = b > b_max sel &= selection b = b.set_selected(sel, set_max) sel = b < b_min sel &= selection b = b.set_selected(sel, set_min) xrs = xrs.set_b_iso(valu... |
b = b.set_selected(sel, set_max) sel = b < b_min | b = b.set_selected(sel, params.filter.b_iso_max) sel = b < params.filter.b_iso_min | def reset_adps(fmodels, selection, b_min, b_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure b = xrs.extract_u_iso_or_u_equiv()*adptbx.u_as_b(1.) sel = b > b_max sel &= selection b = b.set_selected(sel, set_max) sel = b < b_min sel &= selection b = b.set_selected(sel, set_min) xrs = xrs.set_b_iso(valu... |
b = b.set_selected(sel, set_min) | b = b.set_selected(sel, params.filter.b_iso_min) | def reset_adps(fmodels, selection, b_min, b_max, set_min, set_max): xrs = fmodels.fmodel_xray().xray_structure b = xrs.extract_u_iso_or_u_equiv()*adptbx.u_as_b(1.) sel = b > b_max sel &= selection b = b.set_selected(sel, set_max) sel = b < b_min sel &= selection b = b.set_selected(sel, set_min) xrs = xrs.set_b_iso(valu... |
def refine_da(fmodel, selection, params): def show(fmodels, selection, prefix): fmt1 = "%s Rwork= %8.6f Rfree= %8.6f Number of: non-DA= %d DA= %d all= %d" print fmt1%(prefix, fmodel.r_work(), fmodel.r_free(), selection.count(False),selection.count(True), fmodels.fmodel_xray().xray_structure.scatterers().size()) occ = f... | def show_refinement_update(fmodels, selection, prefix): fmt1 = "%s Rwork= %8.6f Rfree= %8.6f Number of: non-DA= %d DA= %d all= %d" print fmt1%(prefix, fmodels.fmodel_xray().r_work(), fmodels.fmodel_xray().r_free(), selection.count(False),selection.count(True), fmodels.fmodel_xray().xray_structure.scatterers().size()) o... | def refine_da(fmodel, selection, params): def show(fmodels, selection, prefix): fmt1 = "%s Rwork= %8.6f Rfree= %8.6f Number of: non-DA= %d DA= %d all= %d" print fmt1%(prefix, fmodel.r_work(), fmodel.r_free(), selection.count(False),selection.count(True), fmodels.fmodel_xray().xray_structure.scatterers().size()) occ = f... |
show(fmodels, selection, " START:") assert params.number_of_refinement_cycles > params.stop_reset_occupancies_at_macro_cycle assert params.number_of_refinement_cycles > params.stop_reset_adp_at_macro_cycle assert params.number_of_refinement_cycles > params.start_filtering_at_macro_cycle for i in xrange(params.number_o... | show_refinement_update(fmodels, selection, " START:") nrm = params.number_of_refinement_cycles assert nrm >= params.stop_reset_occupancies_at_macro_cycle assert nrm >= params.stop_reset_adp_at_macro_cycle assert nrm >= params.start_filtering_at_macro_cycle for macro_cycle in xrange(nrm): if("occupancies" in params.ref... | def show(fmodels, selection, prefix): fmt1 = "%s Rwork= %8.6f Rfree= %8.6f Number of: non-DA= %d DA= %d all= %d" print fmt1%(prefix, fmodel.r_work(), fmodel.r_free(), selection.count(False),selection.count(True), fmodels.fmodel_xray().xray_structure.scatterers().size()) occ = fmodels.fmodel_xray().xray_structure.scatte... |
def filter_da(fmodels, selection, params): xrs = fmodels.fmodel_xray().xray_structure xrs_d = xrs.select(selection) xrs_m = xrs.select(~selection) occ = xrs_d.scatterers().extract_occupancies() adp = xrs_d.extract_u_iso_or_u_equiv()*adptbx.u_as_b(1.) sel = occ < params.filter.occupancy_max sel &= occ > params.filter.... | def cmd_run(args, command_name): msg = """\ | |
if self.allow_multiple(file_param_name) : for param_name, file_list in self._param_files.iteritems() : if file_list.contains(file_name) : file_list.remove(file_name) | for param_name, param_file in self._param_files.iteritems() : if self.allow_multiple(param_name) : if param_file.contains(file_name) : parma_file.remove(file_name) if (len(param_file) == 0 ) : self._param_files.pop(param_name) | def remove_file (self, file_name) : if (file_name in self._cached_input_files) : self._cached_input_files.pop(file_name) if self.use_md5_sum : self._file_md5sums.pop(file_name) else : self._file_mtimes.pop(file_name) if (self.allowed_param_names is not None) : if self.allow_multiple(file_param_name) : for param_name, f... |
else : for param_name, param_file in self._param_files.iteritems() : if (param_file == file_name) : self._param_files.pop(param_name) break | elif (param_file == file_name) : self._param_files.pop(param_name) break | def remove_file (self, file_name) : if (file_name in self._cached_input_files) : self._cached_input_files.pop(file_name) if self.use_md5_sum : self._file_md5sums.pop(file_name) else : self._file_mtimes.pop(file_name) if (self.allowed_param_names is not None) : if self.allow_multiple(file_param_name) : for param_name, f... |
if (self.allow_multiple(file_param_name) and (file_param_name in self._param_files)) : self._param_files[file_param_name].append(file_name) | if self.allow_multiple(file_param_name) : if (not file_param_name in self._param_files) : self._param_files[file_param_name] = [] self._param_files[file_param_name].append(file_name) | def set_param_file (self, file_name, file_param_name, input_file=None, run_callback=True) : if self.allowed_param_names is not None : if not file_param_name in self.allowed_param_names : raise KeyError("Unrecognized input file parameter %s."%file_param_name) if (file_name is None) or (file_name == "") or (file_name == ... |
if (self._param_files[file_param_name] == file_name) : | param_files = self._param_files[file_param_name] if isinstance(param_files, list) and (file_name in param_files) : params.append(file_param_name) elif (param_files == file_name) : | def get_file_params (self, file_name) : params = [] for file_param_name in self._param_files : if (self._param_files[file_param_name] == file_name) : params.append(file_param_name) return params |
a[:,0], a[:, 1] = columns | a[:,0] = columns[0] a[:,1] = columns[1] | def exercise_matrix(): a = sparse.matrix(10,7) assert a.n_rows == 10 and a.n_cols == 7 for c in a.cols(): assert c.is_structurally_zero() a[0,1] = 1. a[9,5] = 2. assert a.non_zeroes == 2 for i in xrange(10): for j in xrange(7): if (i,j) == (0,1): assert a[i,j] == 1. elif (i,j) == (9,5): assert a[i,j] == 2. else: assert... |
pattern = re.compile(r'''_array_data.header_convention[ "]*SLS_1.0''') | pattern = re.compile(r'''_array_data.header_convention[ "]*SLS''') | def readHeader(self,maxlength=12288): # usually 1024 is OK; require 12288 for ID19 if not self.parameters: rawdata = open(self.filename,"rb").read(maxlength) # The tag _array_data.header_convention "SLS_1.0" could be with/without quotes "..." pattern = re.compile(r'''_array_data.header_convention[ "]*SLS_1.0''') match ... |
exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if not os.path.isfile(exe_path) : raise RuntimeError("KSDSSP not available.") | exe_path = get_ksdssp_exe_path() | def run_ksdssp (file_name, log=sys.stderr) : if not os.path.isfile(file_name) : raise RuntimeError("File %s not found.") exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if not os.path.isfile(exe_path) : raise RuntimeError("KSDSSP not available.") print >> log, " Running KSDSSP to generate HELIX and SHEET record... |
exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if (os.name == "nt"): exe_path += ".exe" if not os.path.isfile(exe_path) : raise RuntimeError, "KSDSSP not available" | exe_path = get_ksdssp_exe_path() | def run_ksdssp_direct(pdb_str) : exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if (os.name == "nt"): exe_path += ".exe" if not os.path.isfile(exe_path) : raise RuntimeError, "KSDSSP not available" ksdssp_out = easy_run.fully_buffered(command=exe_path, stdin_lines=pdb_str) return ( ksdssp_out.stdout_lines, ksds... |
print "Skipping" | print "Skipping exercise(): input file not available." | def exercise () : from iotbx import file_reader pdb_file = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf.pdb", test=os.path.isfile) pdb_file_h = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf_h.pdb", test=os.path.isfile) if pdb_file is None : print "Skipping" ret... |
try : | if (not libtbx.env.has_module(name="ksdssp")): print "Skipping KSDSSP tests: ksdssp module not available." else: | def exercise () : from iotbx import file_reader pdb_file = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf.pdb", test=os.path.isfile) pdb_file_h = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf_h.pdb", test=os.path.isfile) if pdb_file is None : print "Skipping" ret... |
except RuntimeError : print "skipping KSDSSP test" | def exercise () : from iotbx import file_reader pdb_file = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf.pdb", test=os.path.isfile) pdb_file_h = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf_h.pdb", test=os.path.isfile) if pdb_file is None : print "Skipping" ret... | |
try : | if (libtbx.env.has_module(name="ksdssp")): | def exercise () : from iotbx import file_reader pdb_file = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf.pdb", test=os.path.isfile) pdb_file_h = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf_h.pdb", test=os.path.isfile) if pdb_file is None : print "Skipping" ret... |
reference_index=None, group_sequences=True) : | reference_index=None) : | def __init__ (self, pdb_sequences, pdb_names, pdb_offsets, reference_sequence=None, reference_sequence_name="sequence", reference_sequence_offset=0, reference_index=None, group_sequences=True) : adopt_init_args(self, locals()) n_models = len(pdb_sequences) assert ((n_models >= 1) and (n_models==len(pdb_names)==len(pdb_... |
self.muscle_aln = get_muscle_alignment(fasta, group_sequences) | self.muscle_aln = get_muscle_alignment(fasta) | def __init__ (self, pdb_sequences, pdb_names, pdb_offsets, reference_sequence=None, reference_sequence_name="sequence", reference_sequence_offset=0, reference_index=None, group_sequences=True) : adopt_init_args(self, locals()) n_models = len(pdb_sequences) assert ((n_models >= 1) and (n_models==len(pdb_names)==len(pdb_... |
else : cmd += " -stable" | def run_muscle (fasta_sequences, group_sequences=True) : if not libtbx.env.has_module(name="muscle") : raise RuntimeError("MUSCLE not available or not configured.") exe_path = libtbx.env.under_build("muscle/exe/muscle") if (os.name == "nt") : exe_path += ".exe" if (not os.path.isfile(exe_path)) : raise RuntimeError("mu... | |
base_name=splitext(file_name), | base_name=splitext(file_name)[0], | def __init__ (self, file_names, template_format="pdb", group_by_directory=True) : import iotbx.pdb self.file_names = file_names self.grouped_files = [] self.ungrouped_files = [] self.ambiguous_files = [] templates = [] other_files = [] template_dirs = [] for file_name in file_names : file_type = guess_file_type(file_na... |
exe += ".exe" | exe_path += ".exe" | def run_ksdssp_direct(pdb_str) : exe_path = libtbx.env.under_build("ksdssp/exe/ksdssp") if (os.name == "nt"): exe += ".exe" if not os.path.isfile(exe_path) : raise RuntimeError, "KSDSSP not available" ksdssp_out = easy_run.fully_buffered(command=exe_path, stdin_lines=pdb_str) return ( ksdssp_out.stdout_lines, ksdssp_ou... |
self.list.InsertColumn(0, self.header_label, width=460) | self.list.InsertColumn(0, "Items", width=460) | def __init__ (self, *args, **kwds) : wx.Panel.__init__(self, *args, **kwds) self._default_label = "---" szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) self.list = wx.ListCtrl( parent=self, id=-1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL) self.list.InsertColumn(0, self.header_label, width=460) self.list.SetMinSize((480,16... |
btn_szr = self.CreateButtons() szr.Add(btn_szr, 0, wx.LEFT|wx.BOTTOM|wx.RIGHT, 5) | self.buttons = wx.BoxSizer(wx.HORIZONTAL) add_btn = self.AddControlButton( label="Add", bitmap=wxtbx.bitmaps.fetch_icon_bitmap("actions", "edit_add", 16)) self.Bind(wx.EVT_BUTTON, self.OnAdd, add_btn) del_btn = self.AddControlButton( label="Delete", bitmap=wxtbx.bitmaps.fetch_icon_bitmap("actions", "editdelete", 16)) s... | def __init__ (self, *args, **kwds) : wx.Panel.__init__(self, *args, **kwds) self._default_label = "---" szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) self.list = wx.ListCtrl( parent=self, id=-1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL) self.list.InsertColumn(0, self.header_label, width=460) self.list.SetMinSize((480,16... |
def CreateButtons (self) : btn_szr = wx.BoxSizer(wx.HORIZONTAL) add_btn = metallicbutton.MetallicButton( | def SetLabel (self, label, font_weight=wx.FONTWEIGHT_BOLD) : if (self._label is not None) : self._label.SetLabel(label) else : self._label = wx.StaticText(parent=self, label=label) font = self._label.GetFont() font.SetWeight(font_weight) self._label.SetFont(font) self.sizer.Insert(0, self._label, 0, wx.TOP|wx.LEFT, 5) ... | def CreateButtons (self) : btn_szr = wx.BoxSizer(wx.HORIZONTAL) add_btn = metallicbutton.MetallicButton( parent=self, label="Add", bmp=wxtbx.bitmaps.fetch_icon_bitmap("actions", "edit_add", 16), highlight_color=(200,220,240)) self.Bind(wx.EVT_BUTTON, self.OnAdd, add_btn) del_btn = metallicbutton.MetallicButton( parent=... |
label="Add", bmp=wxtbx.bitmaps.fetch_icon_bitmap("actions", "edit_add", 16), | label=label, bmp=bitmap, | def CreateButtons (self) : btn_szr = wx.BoxSizer(wx.HORIZONTAL) add_btn = metallicbutton.MetallicButton( parent=self, label="Add", bmp=wxtbx.bitmaps.fetch_icon_bitmap("actions", "edit_add", 16), highlight_color=(200,220,240)) self.Bind(wx.EVT_BUTTON, self.OnAdd, add_btn) del_btn = metallicbutton.MetallicButton( parent=... |
self.Bind(wx.EVT_BUTTON, self.OnAdd, add_btn) del_btn = metallicbutton.MetallicButton( parent=self, label="Delete", bmp=wxtbx.bitmaps.fetch_icon_bitmap("actions", "editdelete", 16), highlight_color=(200,220,240)) self.Bind(wx.EVT_BUTTON, self.OnDelete, del_btn) update_btn = metallicbutton.MetallicButton( parent=self, l... | self.buttons.Add(btn, 0, wx.RIGHT, 5) return btn | def CreateButtons (self) : btn_szr = wx.BoxSizer(wx.HORIZONTAL) add_btn = metallicbutton.MetallicButton( parent=self, label="Add", bmp=wxtbx.bitmaps.fetch_icon_bitmap("actions", "edit_add", 16), highlight_color=(200,220,240)) self.Bind(wx.EVT_BUTTON, self.OnAdd, add_btn) del_btn = metallicbutton.MetallicButton( parent=... |
while (i < self.list.GetItemCount()) : | n = self.list.GetItemCount() while (i < n) : | def GetValues (self) : items = [] i = 0 while (i < self.list.GetItemCount()) : txt = self.list.GetItemText(i) if (txt == self._default_label) : txt = None items.append(txt) return items |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.