IMP  2.4.0
The Integrative Modeling Platform
cube.py
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 from __future__ import print_function
9 import IMP.em
10 import IMP.display
11 
13  IMP.algebra.Vector3D(11, 11, 11))
14 dm = IMP.em.create_density_map(bb, 2.5)
15 dmbb = IMP.em.get_bounding_box(dm)
16 print(dmbb, bb)
17 
18 for i in range(0, dm.get_number_of_voxels()):
19  dm.set_value(i, 1)
20 
21 nm = IMP.create_temporary_file_name("cube", ".mrc")
22 print(nm)
23 IMP.em.write_map(dm, nm)
24 
25 nm = IMP.create_temporary_file_name("cube", ".py")
26 print(nm)
28 
29 for v in IMP.algebra.get_vertices(bb):
31  w.add_geometry(g)
DensityMap * create_density_map(const algebra::GridD< 3, algebra::DenseGridStorageD< 3, float >, float > &grid)
Write geometry to a Python file for Chimera to read.
Definition: ChimeraWriter.h:29
void write_map(DensityMap *m, std::string filename)
Write a density map to a file.
Basic utilities for handling cryo-electron microscopy 3D density maps.
algebra::BoundingBoxD< 3 > get_bounding_box(const DensityMap *m)
Definition: DensityMap.h:461
VectorD< 3 > Vector3D
Definition: VectorD.h:395
base::Vector< VectorD< D > > get_vertices(const BoundingBoxD< D > &bb)
Return a list of the 2^D bounding points for the bounding box.
Definition: BoundingBoxD.h:274
Output IMP model data in various file formats.