Bio. DBC. vector模块
Vector类,包括与旋转相关的功能。
- Bio.PDB.vectors.m2rotaxis(m)
返回角,对应于旋转矩阵m的轴对。
的情况
m
单位矩阵对应于任何旋转轴都有效的奇异性。在这种情况下,Vector([1, 0, 0])
,已返回。
- Bio.PDB.vectors.vector_to_axis(line, point)
向轴法。
返回一点和直线上最近的点之间的载体(即线上点的垂直投影)。
- 参数:
line (L{Vector}) -- 定义直线的载体
point (L{Vector}) -- 定义点的载体
- Bio.PDB.vectors.rotaxis2m(theta, vector)
计算左乘旋转矩阵。
计算围绕载体旋转theta rad的左乘旋转矩阵。
- 参数:
theta (float) -- 旋转角
vector (L{Vector}) -- 旋转轴线
- 返回:
旋转矩阵,一个3x 3 NumPy数组。
示例
>>> from numpy import pi >>> from Bio.PDB.vectors import rotaxis2m >>> from Bio.PDB.vectors import Vector >>> m = rotaxis2m(pi, Vector(1, 0, 0)) >>> Vector(1, 2, 3).left_multiply(m) <Vector 1.00, -2.00, -3.00>
- Bio.PDB.vectors.rotaxis(theta, vector)
计算左乘旋转矩阵。
计算围绕载体旋转theta rad的左乘旋转矩阵。
- 参数:
theta (float) -- 旋转角
vector (L{Vector}) -- 旋转轴线
- 返回:
旋转矩阵,一个3x 3 NumPy数组。
示例
>>> from numpy import pi >>> from Bio.PDB.vectors import rotaxis2m >>> from Bio.PDB.vectors import Vector >>> m = rotaxis2m(pi, Vector(1, 0, 0)) >>> Vector(1, 2, 3).left_multiply(m) <Vector 1.00, -2.00, -3.00>
- Bio.PDB.vectors.refmat(p, q)
返回将p映射到q的(左乘)矩阵。
- 返回:
镜像操作,3x 3 NumPy数组。
示例
>>> from Bio.PDB.vectors import refmat >>> p, q = Vector(1, 2, 3), Vector(2, 3, 5) >>> mirror = refmat(p, q) >>> qq = p.left_multiply(mirror) >>> print(q) <Vector 2.00, 3.00, 5.00> >>> print(qq) <Vector 1.21, 1.82, 3.03>
- Bio.PDB.vectors.rotmat(p, q)
返回将p旋转到q上的(左乘)矩阵。
- 参数:
p (L{Vector}) -- 移动矢量
q (L{Vector}) -- 固定载体
- 返回:
将p旋转到q上的旋转矩阵
- 返回类型:
3x3 NumPy array
示例
>>> from Bio.PDB.vectors import rotmat >>> p, q = Vector(1, 2, 3), Vector(2, 3, 5) >>> r = rotmat(p, q) >>> print(q) <Vector 2.00, 3.00, 5.00> >>> print(p) <Vector 1.00, 2.00, 3.00> >>> p.left_multiply(r) <Vector 1.21, 1.82, 3.03>
- Bio.PDB.vectors.calc_angle(v1, v2, v3)
计算角度方法。
计算代表3个连接点的3个载体之间的角度。
- 参数:
v3 (v1, v2,) -- 定义角度的树点
- 返回:
角度
- 返回类型:
float
- Bio.PDB.vectors.calc_dihedral(v1, v2, v3, v4)
计算二面角法。
计算代表4个连接点的4个载体之间的二面角。角度为]-pi,pi]。
- 参数:
v4 (v1, v2, v3,) -- 定义二面角的四个点
- class Bio.PDB.vectors.Vector(x, y=None, z=None)
基类:
object
3D载体。
- __init__(x, y=None, z=None)
初始化课程。
- __repr__()
返回3D坐标。
- __neg__()
返回载体(-x,-y,-z)。
- __add__(other)
返回Vector+其他Vector或Scalable。
- __sub__(other)
返回Vector-其他Vector或Scalable。
- __mul__(other)
返回Vector。Vector(点积)。
- __truediv__(x)
返回载体(坐标/a)。
- __pow__(other)
返回VectorxVector(叉积)或Vectorxscalar。
- __getitem__(i)
返回数组索引i的值。
- __setitem__(i, value)
为数组索引i分配值。
- __contains__(i)
如果i在数组中,则验证。
- norm()
返回载体规范。
- normsq()
返回向范的平方。
- normalize()
规范化Vector对象。
更改的状态
self
并且不返回值。如果需要链接函数调用或创建新对象,请使用normalized
法
- normalized()
返回Vector的规范化副本。
要避免分配新对象,请使用
normalize
法
- angle(other)
两个方向之间的返回角。
- get_array()
返回坐标数组(的副本)。
- left_multiply(matrix)
返回方向=矩阵x方向。
- right_multiply(matrix)
返回方向=方向x矩阵。
- copy()
返回Vector的深度副本。
- __firstlineno__ = 253
- __static_attributes__ = ('_ar',)
- Bio.PDB.vectors.homog_rot_mtx(angle_rads: float, axis: str) ndarray
生成4x 4单轴NumPy旋转矩阵。
- 参数:
angle_rads (float) -- 所需的旋转角度(以弧度为单位)
axis (char) -- 指定旋转轴的字符
- Bio.PDB.vectors.set_Z_homog_rot_mtx(angle_rads: float, mtx: ndarray)
将现有的Z旋转矩阵更新为新角度。
- Bio.PDB.vectors.set_Y_homog_rot_mtx(angle_rads: float, mtx: ndarray)
将现有的Y旋转矩阵更新为新角度。
- Bio.PDB.vectors.set_X_homog_rot_mtx(angle_rads: float, mtx: ndarray)
将现有的X旋转矩阵更新为新角度。
- Bio.PDB.vectors.homog_trans_mtx(x: float, y: float, z: float) ndarray
生成4x 4 NumPy翻译矩阵。
- 参数:
z (x, y,) -- 各轴平移
- Bio.PDB.vectors.set_homog_trans_mtx(x: float, y: float, z: float, mtx: ndarray)
将现有翻译矩阵更新为新值。
- Bio.PDB.vectors.homog_scale_mtx(scale: float) ndarray
生成4x 4 NumPy缩放矩阵。
- 参数:
scale (float) -- 缩放倍增器
- Bio.PDB.vectors.get_spherical_coordinates(xyz: ndarray) tuple[float, float, float]
计算X、Y、Z点的球坐标(r、方位角、极角)。
- 参数:
xyz (array) -- 列载体(3行x 1列NumPy数组)
- 返回:
输入坐标的r、方位角、极角的多元组
- Bio.PDB.vectors.coord_space(a0: ndarray, a1: ndarray, a2: ndarray, rev: bool = False) tuple[ndarray, ndarray | None]
生成变换矩阵以协调由3个点定义的空间。
- 新的坐标空间将具有:
ACS [0] 在XZ飞机acs上 [1] 起源acs [2] 在+Z轴上
- 参数:
acs (NumPy column array x3) -- X、Y、Z列输入坐标x3
rev (bool) -- 如果为True,也返回逆变换矩阵(从coord_Space返回)
- 返回:
4x 4 NumPy数组,如果rev=True,则为x2
- Bio.PDB.vectors.multi_rot_Z(angle_rads: ndarray) ndarray
创建 [entries] NumPy Z旋转矩阵 [entries] 的角度
- 参数:
entries -- int生成的矩阵数量。
angle_rads -- NumPy角度阵列
- 返回:
条目x 4 x 4齐次旋转矩阵
- Bio.PDB.vectors.multi_rot_Y(angle_rads: ndarray) ndarray
创建 [entries] NumPy Y旋转矩阵 [entries] 的角度
- 参数:
entries -- int生成的矩阵数量。
angle_rads -- NumPy角度阵列
- 返回:
条目x 4 x 4齐次旋转矩阵
- Bio.PDB.vectors.multi_coord_space(a3: ndarray, dLen: int, rev: bool = False) ndarray
生成 [dLen] 将矩阵变换到由3个点定义的坐标空间。
- 新的坐标空间将具有:
ACS [0] 在XZ飞机acs上 [1] 起源acs [2] 在+Z轴上
:param NumPy数组 [entries] x3x3 [entries] 3个原子的XYZ坐标:param bool rev:如果为True,也返回反向变换矩阵(从coord_Space返回):返回: [entries] 4x 4 NumPy数组,如果rev=True,则为x2