IMP  2.4.0
The Integrative Modeling Platform
em2d.py
1 """@namespace IMP.pmi.restraints.em2d
2 Restraints for handling electron microscopy images.
3 """
4 
5 import IMP
6 import IMP.core
7 import IMP.base
8 import IMP.algebra
9 import IMP.atom
10 import IMP.em2d
11 
12 class ElectronMicroscopy2D():
13 
14  def __init__(
15  self,
16  representation,
17  images,
18  pixel_size,
19  image_resolution,
20  projection_number,
21  resolution=None):
22 
23  self.weight=1.0
24  self.m = representation.prot.get_model()
25  self.rs = IMP.RestraintSet(self.m, 'em2d')
26  self.label = "None"
27 
28  # IMP.atom.get_by_type
29  particles = IMP.pmi.tools.select(
30  representation,
31  resolution=resolution)
32 
33  #print particles
34 
35 
37  particles, images, pixel_size, image_resolution, projection_number, True)
38  self.rs.add_restraint(em2d)
39 
40  def set_label(self, label):
41  self.label = label
42 
43  def add_to_model(self):
44  self.m.add_restraint(self.rs)
45 
46  def get_restraint(self):
47  return self.rs
48 
49  def set_weight(self,weight):
50  self.weight=weight
51  self.rs.set_weight(self.weight)
52 
53  def get_output(self):
54  self.m.update()
55  output = {}
56  score = self.weight*self.rs.unprotected_evaluate(None)
57  output["_TotalScore"] = str(score)
58  output["ElectronMicroscopy2D_" + self.label] = str(score)
59  return output
Restraints using electron microscopy 2D images (class averages).
Object used to hold a set of restraints.
Low level functionality (logging, error handling, profiling, command line flags etc) that is used by ...
A restraint for fast scoring of Particles vs. em2d class averages.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
def select
this function uses representation=SimplifiedModel it returns the corresponding selected particles rep...
Definition: tools.py:633
Functionality for loading, creating, manipulating and scoring atomic structures.