Example #1
0
 def initialize(self):
     super().initialize()
     # Connect to the proxy.
     if 'controller' not in self.config:
         self._proxy = Pyro4.Proxy(self.uri)
     else:
         c = depot.getDeviceWithName(self.config['controller'])
         c_name = self.config.get('controller.name', None)
         if c_name is not None:
             try:
                 self._proxy = c._proxy.devices[c_name]
             except:
                 raise Exception("%s: device not found on controller '%s'." % (self.name, c.name))
         elif len(c._proxy.devices) == 0:
             raise Exception("%s: no devices found on controller." % self.name)
         elif len(c._proxy.devices) == 1:
                 self._proxy = next(iter(c._proxy.devices.values()))
         else:
              raise Exception("%s: More than one device found on controller, "\
                              "so must specify controller.name." % self.name)
     self.get_all_settings = self._proxy.get_all_settings
     self.get_setting = self._proxy.get_setting
     self.set_setting = self._proxy.set_setting
     self.describe_setting = self._proxy.describe_setting
     self.describe_settings = self._proxy.describe_settings
 def __init__(self, collectionOrder, bleachCompensations, numAngles, numPhases,
         angleHandler = None, phaseHandler = None, polarizerHandler = None,
         slmHandler = None,
         *args, **kwargs):
     # Store the collection order in the MRC header.
     metadata = 'SI order: %s' % collectionOrder
     #Store the diffraction angle in MRC metadata
     slmdev=depot.getDeviceWithName('slm')
     if(slmdev):
         diffangle=slmdev.connection.get_sim_diffraction_angle()
         metadata += ': SLM diff_angle %.3f' % diffangle
     if 'metadata' in kwargs:
         # Augment the existing string.
         kwargs['metadata'] += "; %s" % metadata
     else:
         kwargs['metadata'] = metadata
     experiment.Experiment.__init__(self, *args, **kwargs)
     self.numAngles = numAngles
     self.numPhases = numPhases
     self.numZSlices = int(math.ceil(self.zHeight / self.sliceHeight))
     if self.zHeight > 1e-6:
         # Non-2D experiment; tack on an extra image to hit the top of
         # the volume.
         self.numZSlices += 1
     self.collectionOrder = collectionOrder
     self.angleHandler = angleHandler
     self.phaseHandler = phaseHandler
     self.polarizerHandler = polarizerHandler
     self.slmHandler = slmHandler
     self.handlerToBleachCompensation = bleachCompensations