pwem.convert.symmetry module

This module returns the matrices related with the different point symmetries. Code based on chimera file sym.py

class pwem.convert.symmetry.Cyclic(n, circumscribed_radius=1, center=(0, 0, 0), offset=None)[source]

Bases: object

cyclic class. Allow to compute symmetry matrices, vertices, symmetry axis and unit cell planes

Parameters

n: int order of symmetry circumscribed_radius: float radius of the circumscribed sphere center: tuple of 3 floats, center of the circumscribed sphere offset: float, angle in degrees to rotate the symmetry axis

it modifies the unit cell but not the symmetry matrices

symmetryMatrices()[source]

get Matrices for cyclic symmetry of order n

unitCellPlanes()[source]

get planes that define a unit cell for cyclic symmetry of order n

class pwem.convert.symmetry.Dihedral(n, circumscribed_radius=1, center=(0, 0, 0), offset=None, sym=1)[source]

Bases: Cyclic

dihedral class. Allow to compute symmetry matrices, vertices, symmetry axis and unit cell planes

Parameters

n: int order of symmetry circumscribed_radius: float radius of the circumscribed sphere center: tuple of 3 floats, center of the circumscribed sphere offset: float, angle in degrees to rotate the symmetry axis

it modifies the unit cell but not the symmetry matrices

coordinateSystemTransform(origSym, targetSym)[source]
symmetryMatrices()[source]

get Matrices for cyclic symmetry of order n

unitCellPlanes()[source]

get planes that define a unit cell for dihedral symmetry of order n

class pwem.convert.symmetry.Icosahedron(circumscribed_radius=1, orientation='222', center=(0, 0, 0))[source]

Bases: object

Icosahedron class. Allow to compute symmetry matrices, icosahedron vertices,

symmetry axis and unit cell planes

point = np.array([0, 1, PHI]

coordinateSystemTransform(from_cs, to_cs)[source]
get2foldAxis()[source]
get3foldAxis()[source]
getEdges()[source]
getTriangles()[source]
getVertices()[source]
icosahedralMatrixTable()[source]
icosahedralSymmetryMatrices()[source]
icosahedronAngles()[source]
icosahedronEdgeLength(circumscribed_radius)[source]
icosahedronGeometry()[source]
unitCellPlanes()[source]

get planes that define a unit cell for an octahedral symmetry

class pwem.convert.symmetry.Octahedral(circumscribed_radius=1, center=(0, 0, 0), offset=None)[source]

Bases: object

Octahedral class. Allow to compute symmetry matrices, symmetry axis and unit cell planes of an octahedral symmetry. 4-folds along x, y, z axes.

Parameters

circumscribed_radius: float radius of the circumscribed sphere center: tuple of 3 floats, center of the circumscribed sphere offset: float, angle in degrees to rotate the symmetry axis

it modifies the unit cell but not the symmetry matrices

symmetryMatrices()[source]

get Matrices for cyclic symmetry of order n

unitCellPlanes()[source]

get planes that define a unit cell for an octahedral symmetry

class pwem.convert.symmetry.SymmetryHelper[source]

Bases: object

This is a static class so there is no need to instantiate it. Given a symmetry the class provides methods to “move” projection directions to the equivalent orientation that lays within the unit cells defined at https://scipion-em.github.io/docs/release-3.0.0/docs/developer/symmetries/symmetries.html?highlight=symmetry.

classmethod getSymmetryKey(sym, n)[source]
classmethod getSymmetryMatricesAndPlanes(sym, n)[source]

Lazy return a tuple of symmetry matrices and unit cell planes for the symmetry and order passed

Parameters
  • sym – Symmetry type

  • n – symmetry order

classmethod moveParticleInsideUnitCell(particle, symmetry, symmetryOrder)[source]

apply to the projection direction the symmetry matrix that “moves” the projection direction to the equivalent orientation that lays within the “canonical” unit This is useful to move for example Cryosparc angles to a same unit cell and therefore been able to plot angular distribution. This method can be used in the typical “updateParticle” callback when generating any output set.

Parameters
  • particle – Particle to move.

  • symmetry – symmetry type in scipion’s convention.

  • symmetryOrder – order of the symmetry

class pwem.convert.symmetry.Tetrahedral(circumscribed_radius=1, center=(0, 0, 0), sym=4)[source]

Bases: object

Tetrahedral class. Allow to compute symmetry matrices, vertices, symmetry axis and unit cell planes

Parameters

n: int order of symmetry circumscribed_radius: float radius of the circumscribed sphere center: tuple of 3 floats, center of the circumscribed sphere

coordinateSystemTransform(origSym, targetSym)[source]
symmetryMatrices()[source]

identity 4 * rotation by 120 clockwise (seen from a vertex):

(234), (143), (412), (321)

4 * rotation by 120 counterclockwise (ditto) 3 * rotation by 180

unitCellPlanes()[source]

get planes that define a unit cell for tetrahedral symmetry of order n

pwem.convert.symmetry.getSymmetryMatrices(sym=0, n=1, circumscribed_radius=1, center=(0, 0, 0), offset=None)[source]

interface between scipion and chimera code chimera code uses tuples of tuples as matrices but scipion uses np.arrays (lists of lists) so let us convert them here. Direct use of the classes return 3x3 arrays which may be OK in many cases, but not in all

pwem.convert.symmetry.getUnitCell(sym=0, n=1, circumscribed_radius=1, center=(0, 0, 0), offset=None, generalize=False)[source]

return vectors normal to the unit cell faces

pwem.convert.symmetry.moveParticleInsideUnitCell(particle, matrixSet, unitCellPlanes)[source]
pwem.convert.symmetry.moveParticlesInsideUnitCell(setIN, setOUT, sym=0, n=1)[source]

Move particles projection direction inside the unit cell associated to symmetry sym. This function (1) gets the symmetry matrices and (2) applies them to

each projection direction until is inside the unit cell.