Differences between revisions 1 and 2
Revision 1 as of 2007-07-11 17:35:04
Size: 944
Editor: gtang
Comment:
Revision 2 as of 2007-07-11 19:16:11
Size: 1065
Editor: gtang
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Here is a python script that should give you something to start with. Don't forget the help() function in python, ie: '''Question:''' I have a bunch of MRC convention Euler angles and need to generate projections of a model in EMAN
Line 3: Line 3:
 import EMAN
 help(EMAN.EMData)
 help(EMAN.Euler)
 
'''
'''
Line 8: Line 6:
'''Answer:''' Here is a python script that should give you something to start with. Don't forget the help() function in python, ie:

 . import EMAN help(EMAN.EMData) help(EMAN.Euler)
Line 10: Line 11:
# This reads a text file with a space separates Euler triplet
# and generates projections
from EMAN import *
infile=open("eulers.txt","r")
lines=infile.readlines()
infile.close()
# This reads a text file with a space separates Euler triplet # and generates projections from EMAN import * infile=open("eulers.txt","r") lines=infile.readlines() infile.close()
Line 17: Line 13:
# Ok, this next line is not all that transparent, there
# are other ways to do this, but it is a useful construct
# converts a set of input lines into a list of tuples
eulers=map(lambda x:tuple(map(lambda y:float(y)*math.pi/180.0,x.split())),lines)
e=Euler()
# Ok, this next line is not all that transparent, there # are other ways to do this, but it is a useful construct # converts a set of input lines into a list of tuples eulers=map(lambda x:tuple(map(lambda y:float(y)*math.pi/180.0,x.split())),lines) e=Euler()
Line 23: Line 15:
# read the volume data
data=EMData()
data.readImage("model.mrc",-1)
# read the volume data data=EMData() data.readImage("model.mrc",-1)
Line 28: Line 18:
 e.setByType(euler,Euler.MRC)
Line 30: Line 19:
 # -4 is the best real-space projection mode
out=data.project3d(e.alt(),e.az(),e.phi(),-4)
out.writeImage("proj.hed",-1) # file type determined by extension
 . e.setByType(euler,Euler.MRC) # -4 is the best real-space projection mode out=data.project3d(e.alt(),e.az(),e.phi(),-4) out.writeImage("proj.hed",-1) # file type determined by extension

Question: I have a bunch of MRC convention Euler angles and need to generate projections of a model in EMAN

Answer: Here is a python script that should give you something to start with. Don't forget the help() function in python, ie:

  • import EMAN help(EMAN.EMData) help(EMAN.Euler)

Here's the script:

# This reads a text file with a space separates Euler triplet # and generates projections from EMAN import * infile=open("eulers.txt","r") lines=infile.readlines() infile.close()

# Ok, this next line is not all that transparent, there # are other ways to do this, but it is a useful construct # converts a set of input lines into a list of tuples eulers=map(lambda x:tuple(map(lambda y:float(y)*math.pi/180.0,x.split())),lines) e=Euler()

# read the volume data data=EMData() data.readImage("model.mrc",-1)

for euler in eulers:

  • e.setByType(euler,Euler.MRC) # -4 is the best real-space projection mode out=data.project3d(e.alt(),e.az(),e.phi(),-4) out.writeImage("proj.hed",-1) # file type determined by extension

FAQ_EMAN_USING_29 (last edited 2008-11-26 04:42:29 by localhost)