本文整理汇总了Python中Matrix.chimera_xform方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.chimera_xform方法的具体用法?Python Matrix.chimera_xform怎么用?Python Matrix.chimera_xform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix
的用法示例。
在下文中一共展示了Matrix.chimera_xform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fit_map_in_map
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import chimera_xform [as 别名]
def fit_map_in_map(map1, map2,
initial_map1_transform = None,
map1_threshold = None,
ijk_step_size_min = 0.01, # Grid index units
ijk_step_size_max = 1.5, # Grid index units
max_steps = 10000,
optimize_translation = True,
optimize_rotation = True):
# Files have to have file suffix indicating volume format.
if initial_map1_transform:
xf = Matrix.chimera_xform(initial_map1_transform)
map1.surface_model().openState.globalXform(xf)
use_threshold = (map1_threshold != None)
points, point_weights = map_points_and_weights(map1, use_threshold)
if len(points) == 0:
if use_threshold:
print 'No grid points above map threshold.'
else:
print 'Map has no non-zero values.'
return
move_tf, stats = motion_to_maximum(points, point_weights, map2, max_steps,
ijk_step_size_min, ijk_step_size_max,
optimize_translation, optimize_rotation)
if initial_map1_transform:
move_tf = Matrix.multiply_matrices(move_tf, initial_map1_transform)
header = ('\nFit map %s in map %s using %d points\n'
% (map1.name, map2.name, stats['points']) +
' correlation = %.4g, overlap = %.4g\n'
% (stats['correlation'], stats['overlap']) +
' steps = %d, shift = %.3g, angle = %.3g degrees\n'
% (stats['steps'], stats['shift'], stats['angle']))
print header
#tfs = Matrix.transformation_description(move_tf)
#print tfs
xf = Matrix.chimera_xform(move_tf)
map1.surface_model().openState.globalXform(xf)
示例2: graph_event_cb
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import chimera_xform [as 别名]
def graph_event_cb(event, v1=v1, axis=axis, center=center, cur_angle = [0]):
if not event.button is None:
angle = event.xdata
if angle is None:
angle = 0 # Click outside graph bounds
import Matrix
tf = Matrix.rotation_transform(axis, angle-cur_angle[0], center)
xf = Matrix.chimera_xform(tf)
v1.openState.localXform(xf)
cur_angle[0] = angle
ax.cur_position.set_xdata((angle,angle))
ax.figure.canvas.draw()
示例3: parameter_xform
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import chimera_xform [as 别名]
def parameter_xform(rotq, rotc, trans):
import Matrix as m
ttf = m.translation_matrix(trans)
sa2 = m.norm(rotq[:3])
ca2 = rotq[3]
from math import atan2, pi
angle = 2*atan2(sa2,ca2) * 180.0/pi
axis = m.normalize_vector(rotq[:3])
rtf = m.rotation_transform(axis, angle, rotc)
tf = m.multiply_matrices(ttf, rtf)
xf = m.chimera_xform(tf)
return xf
示例4: move_models_and_atoms
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import chimera_xform [as 别名]
def move_models_and_atoms(tf, models, atoms, move_whole_molecules, base_model):
if move_whole_molecules:
models = list(models) + list(set([a.molecule for a in atoms]))
atoms = []
global position_history
position_history.record_position(models, atoms, base_model)
import Matrix
xf = Matrix.chimera_xform(tf)
for os in set([m.openState for m in models]):
os.globalXform(xf)
for a in atoms:
mxfinv = a.molecule.openState.xform.inverse()
a.setCoord(mxfinv.apply(xf.apply(a.xformCoord())))
position_history.record_position(models, atoms, base_model)