IMP logo
IMP Reference Guide  2.20.2
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, 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")
RMF::FrameID save_frame(RMF::FileHandle file, std::string name="")
Save the current state of the linked objects as a new RMF frame.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
DensityMap * create_density_map(const IMP::algebra::GridD< 3, S, V, E > &arg)
Create a density map from an arbitrary IMP::algebra::GridD.
Definition: DensityMap.h:674
Basic utilities for handling cryo-electron microscopy 3D density maps.
algebra::BoundingBoxD< 3 > get_bounding_box(const DensityMap *m)
Definition: DensityMap.h:505
Vector< VectorD< D > > get_vertices(const UnitSimplexD< D > &s)
Return a list of the vertices (bases) of the unit simplex.
Definition: UnitSimplexD.h:130
VectorD< 3 > Vector3D
Definition: VectorD.h:425
void add_geometry(RMF::FileHandle file, display::Geometry *r)
Add a single geometry to the file.
Output IMP model data in various file formats.
Support for the RMF file format for storing hierarchical molecular data and markup.
std::string create_temporary_file_name(std::string prefix="imp_temp", std::string suffix="")
Create a temporary file.