Scripts: eulermove.py

File eulermove.py, 730 bytes (added by goddard, 14 years ago)
Line 
1# Script to rotate a volume using Euler angles, then shift it, then resample it
2# on the original unrotated grid.
3#
4# runscript eulermove.py #0 45 60 20 15 33.5 -10
5
6if len(arguments) != 7:
7 from Commands import CommandError
8 raise CommandError('eulermove.py requires 7 arguments')
9
10from chimera import specifier
11m = specifier.evalSpec(arguments[0]).models()[0]
12euler_angles = [float(a) for a in arguments[1:4]]
13translation = [float(x) for x in arguments[4:7]]
14
15from Matrix import euler_xform
16xf = euler_xform(euler_angles, translation)
17mcopy = m.copy()
18mcopy.openState.localXform(xf)
19
20from chimera import runCommand
21runCommand('vop resample %s onGrid %s boundingGrid true' %
22 (mcopy.oslIdent(), m.oslIdent()))