IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/22
The Integrative Modeling Platform
em/cube.py

The example creates a simple mrc file that is filled uniformly with 1s. In addition, an RMF file is written with a marker at each corner of the density. When both files are opened (e.g. in Chimera), the density should be centered among the markers. This can be used for testing for registration errors when reading and writing density maps.

1 ## \example em/cube.py
2 # The example creates a simple mrc file that is filled uniformly with 1s.
3 # In addition, an RMF file is written with a marker at each corner of the
4 # density. When both files are opened (e.g. in Chimera), the density should
5 # be centered among the markers. This can be used for testing for
6 # registration errors when reading and writing density maps.
7 
8 import IMP.em
9 import IMP.display
10 import IMP.rmf
11 import RMF
12 import sys
13 
14 IMP.setup_from_argv(sys.argv, "cube")
15 
17  IMP.algebra.Vector3D(11, 11, 11))
18 dm = IMP.em.create_density_map(bb, 2.5)
19 dmbb = IMP.em.get_bounding_box(dm)
20 print(dmbb, bb)
21 
22 for i in range(0, dm.get_number_of_voxels()):
23  dm.set_value(i, 1)
24 
25 nm = IMP.create_temporary_file_name("cube", ".mrc")
26 print(nm)
27 IMP.em.write_map(dm, nm)
28 
29 nm = IMP.create_temporary_file_name("cube", ".rmf")
30 print(nm)
31 w = RMF.create_rmf_file(nm)
32 
33 for v in IMP.algebra.get_vertices(bb):
36 IMP.rmf.save_frame(w, "zero")