IMP  2.2.1
The Integrative Modeling Platform
em/cube.py

The example creates a simple mrc file that is filled uniformly with 1s. In addition, a chimera file is written with a marker at each corner of the density. When both files are opened, 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, a chimera file is written with a marker at each corner of
4 # the density. When both files are opened, the density should be centered
5 # among the markers. This can be used for testing for registration errors
6 # when reading and writing density maps.
7 
8 import IMP.em
9 import IMP.display
10 
12  IMP.algebra.Vector3D(11, 11, 11))
13 dm = IMP.em.create_density_map(bb, 2.5)
14 dmbb = IMP.em.get_bounding_box(dm)
15 print dmbb, bb
16 
17 for i in range(0, dm.get_number_of_voxels()):
18  dm.set_value(i, 1)
19 
20 nm = IMP.create_temporary_file_name("cube", ".mrc")
21 print nm
22 IMP.em.write_map(dm, nm)
23 
24 nm = IMP.create_temporary_file_name("cube", ".py")
25 print nm
27 
28 for v in IMP.algebra.get_vertices(bb):
30  w.add_geometry(g)