IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
em2d.py
1 """@namespace IMP.pmi.restraints.em2d
2 Restraints for handling electron microscopy images.
3 """
4 
5 from __future__ import print_function
6 import IMP
7 import IMP.core
8 import IMP.algebra
9 import IMP.atom
10 import IMP.em2d
11 import IMP.pmi.tools
12 
13 class ElectronMicroscopy2D():
14 
15  def __init__(
16  self,
17  representation,
18  images,
19  pixel_size,
20  image_resolution,
21  projection_number,
22  resolution=None):
23 
24  self.weight=1.0
25  self.m = representation.prot.get_model()
26  self.rs = IMP.RestraintSet(self.m, 'em2d')
27  self.label = "None"
28 
29  # IMP.atom.get_by_type
30  particles = IMP.pmi.tools.select(
31  representation,
32  resolution=resolution)
33 
34  #print particles
35 
36 
38  particles, images, pixel_size, image_resolution, projection_number, True)
39  self.rs.add_restraint(em2d)
40 
41  def set_label(self, label):
42  self.label = label
43 
44  def add_to_model(self):
46 
47  def get_restraint(self):
48  return self.rs
49 
50  def set_weight(self,weight):
51  self.weight=weight
52  self.rs.set_weight(self.weight)
53 
54  def get_output(self):
55  self.m.update()
56  output = {}
57  score = self.weight*self.rs.unprotected_evaluate(None)
58  output["_TotalScore"] = str(score)
59  output["ElectronMicroscopy2D_" + self.label] = str(score)
60  return output
Restraints using electron microscopy 2D images (class averages).
Miscellaneous utilities.
Definition: tools.py:1
Object used to hold a set of restraints.
Definition: RestraintSet.h:36
A restraint for fast scoring of Particles vs. em2d class averages.
def add_restraint_to_model
Add a PMI restraint to the model.
Definition: tools.py:22
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:662
Functionality for loading, creating, manipulating and scoring atomic structures.