IMP logo
IMP Reference Guide  2.22.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, 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")
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:678
Basic utilities for handling cryo-electron microscopy 3D density maps.
algebra::BoundingBoxD< 3 > get_bounding_box(const DensityMap *m)
Definition: DensityMap.h:509
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:408
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.