コード例 #1
0
def parse_relative_transform(row):
    """
        Returns an relative transform with the conventions used by IMP.
        row - A list containing a splitted line from the relative output file
    """
    euler = [-float(x) for x in row[8:11]]
    xyz = [float(x) for x in row[5:8]]
    R = alg.get_rotation_from_fixed_zyz(*euler)
    R = R.get_inverse()
    t = alg.Vector3D(*xyz)
    return alg.Transformation3D(R, t)
コード例 #2
0
def parse_hex_transform(row):
    """
        Returns an HEX transform with the conventions used by IMP.
        @param row A list containing a splitted line from the HEX output file
        NOTE: An HEX rotation is the inverse of the IMP convention
    """
    euler = map(float,row[8:11])
    xyz = map(float, row[5:8])
    euler = [-euler[0], -euler[1], -euler[2]]
    R = alg.get_rotation_from_fixed_zyz(*euler)
    R = R.get_inverse()
    t = alg.Vector3D(*xyz)
    return alg.Transformation3D(R, t)
コード例 #3
0
def get_random_transformation(max_distance, max_angle, seed=-1):
    """
        Return a random transformation
        @param distance Maximum translation allowed
        @param max_angle Maximum rotation angle allowed
    """

    if seed == -1:
        random.seed()
    else:
        random.seed(seed)

    phi = random.uniform(-max_angle, max_angle)
    theta = random.uniform(-max_angle, max_angle)
    psi = random.uniform(-max_angle, max_angle)
    trans_x = random.uniform(-max_distance, max_distance)
    trans_y = random.uniform(-max_distance, max_distance)
    trans_z = random.uniform(-max_distance, max_distance)
    trns = alg.Vector3D(trans_x, trans_y, trans_z)
    rot = alg.get_rotation_from_fixed_zyz(phi, theta, psi)
    transformation = alg.Transformation3D(rot, trns)
    return transformation
コード例 #4
0
ファイル: movement.py プロジェクト: andreyto/imp-fork-proddl
def get_random_transformation(max_distance, max_angle, seed=-1):
    """
        Return a random transformation
        @param distance Maximum translation allowed
        @param max_angle Maximum rotation angle allowed
    """

    if seed == -1:
        random.seed()
    else:
        random.seed(seed)

    phi = random.uniform( -max_angle , max_angle )
    theta = random.uniform(-max_angle,max_angle)
    psi = random.uniform(-max_angle,max_angle)
    trans_x = random.uniform(-max_distance,max_distance)
    trans_y = random.uniform(-max_distance,max_distance)
    trans_z = random.uniform(-max_distance,max_distance)
    trns = alg.Vector3D(trans_x, trans_y, trans_z)
    rot = alg.get_rotation_from_fixed_zyz(phi,theta,psi)
    transformation=alg.Transformation3D(rot, trns)
    return transformation