IMP logo
IMP Reference Guide  2.21.0
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 from __future__ import print_function
9 import IMP.em
10 import IMP.display
11 import IMP.rmf
12 import RMF
13 import sys
14 
15 IMP.setup_from_argv(sys.argv, "cube")
16 
18  IMP.algebra.Vector3D(11, 11, 11))
19 dm = IMP.em.create_density_map(bb, 2.5)
20 dmbb = IMP.em.get_bounding_box(dm)
21 print(dmbb, bb)
22 
23 for i in range(0, dm.get_number_of_voxels()):
24  dm.set_value(i, 1)
25 
26 nm = IMP.create_temporary_file_name("cube", ".mrc")
27 print(nm)
28 IMP.em.write_map(dm, nm)
29 
30 nm = IMP.create_temporary_file_name("cube", ".rmf")
31 print(nm)
32 w = RMF.create_rmf_file(nm)
33 
34 for v in IMP.algebra.get_vertices(bb):
37 IMP.rmf.save_frame(w, "zero")