Exemplo n.º 1
0
 def update_settings(self):
     """Reload saved settings from the settings file"""
     nrows = self.Descriptions.shape[0]
     for i in range(0, nrows):
         text = dbget("%s.line%d.description" % (self.name, i))
         self.Descriptions[i].Value = text
         text = dbget("%s.line%d.updated" % (self.name, i))
         self.Dates[i].Value = text
         for j in range(0, len(self.motors)):
             value = dbget("%s.line%d.%s" %
                           (self.name, i, self.motor_names[j]))
             self.Positions[i, j].Value = value
Exemplo n.º 2
0
 def get_n(self):
     """Size of the grid"""
     try:
         value = asarray(eval(dbget("sample_translation_grid.n")))
     except:
         value = array([8, 8, 10, 10])
     return value
Exemplo n.º 3
0
 def get_temperature_correction(self):
     """Use temperatrue to adjust start and end position and stepsize?"""
     try:
         return bool(int(
             dbget("sample_translation/temperature_correction")))
     except ValueError:
         return False
Exemplo n.º 4
0
 def get_calibrated_start_position_2(self):
     """Start position at calibration temperature"""
     try:
         return float(
             dbget("sample_translation/calibrated_start_position_2"))
     except ValueError:
         return -2.0
Exemplo n.º 5
0
 def get_max_dial(self):
     """Calibration max_dial in seconds"""
     max_dial = dbget("timing.lxd.max_dial")
     try:
         return float(max_dial)
     except Exception:
         return inf
Exemplo n.º 6
0
 def get_offset(self):
     """Calibration offset in seconds"""
     offset = dbget("timing.lxd.offset")
     try:
         return float(offset)
     except Exception:
         return 0.0
Exemplo n.º 7
0
 def get_origin(self):
     """XYZ coordinates of the grid point (0,0,..0).
     3D vector"""
     try:
         value = asarray(eval(dbget("sample_translation_grid.origin")))
     except:
         value = array([-4.000, -4.000, 0.0])
     return value
Exemplo n.º 8
0
 def get_tweak_values(self):
     from DB import dbget
     values = dbget("motor_panel.%s.tweak_values" % self.motor.name)
     try: values = eval(values)
     except: values = [1.0]
     try: values = [float(x) for x in values]
     except: pass
     return values
 def get_rotation_center_y(self):
     """To which position do you have to drive the Y motor for the rotation
     axis to be in the crosshair of both cameras?"""
     try:
         x, y = eval(dbget("sample.rotation_center"))
     except:
         return 0.0
     return y
Exemplo n.º 10
0
 def get_support_xyz(self):
     """m x 3 matrix (N: number of dimensions)"""
     s = dbget("sample_translation_grid.support_xyz")
     try:
         value = atleast_2d(eval(s))
     except Exception, details:
         debug("sample_translation_grid.support_xyz: %s: %s" % (s, details))
         value = zeros((0, 3))
Exemplo n.º 11
0
 def get_calibration_temperature_2(self):
     """Temperature at which 'calibrated stepsize' and
     'calibrated starting position' are the actual stepsize and starting
     positions"""
     try:
         return float(dbget("sample_translation/calibration_temperature_2"))
     except ValueError:
         return 40.0
Exemplo n.º 12
0
 def get_prefix(self):
     from DB import dbget
     dbname = getattr(self, "__db_name__", "")
     try:
         prefix = eval(dbget("EPICS_motor/" + dbname + ".prefix"))
     except:
         prefix = ""
     if not prefix: prefix = getattr(self, "__my_prefix__", "")
     return prefix
Exemplo n.º 13
0
 def get_support_indices(self):
     """N x 3 matrix (m: number of support points)"""
     s = dbget("sample_translation_grid.support_indices")
     try:
         value = atleast_2d(eval(s))
     except Exception, details:
         debug("sample_translation_grid.support_indices: %s: %s" %
               (s, details))
         value = zeros((0, 0), dtype=int)
 def position_of_row(self, row):
     position = []
     for j in range(0, len(self.motors)):
         position += [
             tofloat(
                 dbget("%s.line%d.%s" %
                       (self.name, row, self.motor_names[j])))
         ]
     return asarray(position)
 def get_voltage(self):
     """Operation voltage"""
     from DB import dbget
     value = dbget("Ensemble.illuminator.voltage")
     try:
         value = float(value)
     except ValueError:
         value = 3.3
     return value
Exemplo n.º 16
0
 def get_tolerance(self):
     """For scans, to provide feedback whether the temperature 'motor'
     is still 'moving'"""
     from DB import dbget
     s = dbget("lightwave_temperature_controller.temperature.tolerance")
     try:
         return float(s)
     except:
         return 3.0
Exemplo n.º 17
0
 def get_serial_port_name(self):
     """Which serial port to use to communication with the pump?
 "COM4" for NIH MacBook running Windows
 "14IDB:serial16" for BioCARS, VME crate
 "14IDB-NIH:serial7" for NIH Linux box 
 """
     from DB import dbget
     port_name = dbget(self.name + ".serial_port")
     if port_name == "": port_name = "COM4"
     return port_name
Exemplo n.º 18
0
 def get_base_vectors(self):
     """m x (N+1) matrix (m: number of support points, N: number of
     dimensions)"""
     try:
         value = asarray(eval(
             dbget("sample_translation_grid.base_vectors")))
     except:
         value = array([[1.000, 0, 0], [0, 1.000, 0], [0.050, 0, 0],
                        [0, 0.05, 0]])
     return value
Exemplo n.º 19
0
def load_configuration(name):
    """name: 'NIH Diffractometer' or 'BioCARS Diffractometer'"""
    from DB import dbget
    for par in configuration_parameters:
        par_name = "diffractometer/"+name+"."+par
        str_value = dbget(par_name)
        try: value = eval(str_value)
        except Exception,message:
            print("%s: %s: %s" % (par_name,str_value,message))
            continue
        setattr(diffractometer,par,value)
Exemplo n.º 20
0
 def get(self):
     class_name = getattr(self,"name",self.__class__.__name__)
     if not "{name}" in name: 
         if class_name: dbname = class_name+"."+name
         else: dbname = name
     else: dbname = name.replace("{name}",class_name)
     ##debug("persistent_property.get: %s: %r, %r: %r" % (name,self,class_name,dbname))
     from DB import dbget
     t = dbget(dbname)
     if type(default_value) == str and default_value.startswith("self."):
         def_val = getattr(self,default_value[len("self."):])
     else: def_val = default_value
     dtype = type(def_val)
     try: from numpy import nan,inf,array # for "eval"
     except: pass
     try: import wx # for "eval"
     except: pass
     try: t = dtype(eval(t))
     except: t = def_val
     return t
Exemplo n.º 21
0
 def get_phi_scale(self):
     """Scale factor to apply to the hardware Phi rotation motor"""
     try:
         return float(dbget("sample.phi_scale"))
     except ValueError:
         return 1.0
Exemplo n.º 22
0
 def get_z_scale(self):
     """Scale factor to apply to the hardware Z translation motor"""
     try:
         return float(dbget("sample.z_scale"))
     except ValueError:
         return 1.0
Exemplo n.º 23
0
 def get_xy_rotating(self):
     """Do the hardware X and Y motors rotate with the PHI rotation stage?"""
     return dbget("sample.xy_rotating") == "True"
 def description(self, row):
     """row: zero-based index"""
     return dbget("%s.line%d.description" % (self.name, row))
Exemplo n.º 25
0
 def get_z_motor_name(self):
     try:
         return eval(dbget("sample.z_motor_name"))
     except:
         return "GonZ"
Exemplo n.º 26
0
 def get_click_center_z(self):
     try:
         return float(dbget("sample.click_center_z"))
     except:
         return 0.0
Exemplo n.º 27
0
 def get_calibration_z(self):
     try:
         return float(dbget("sample.calibration_z"))
     except:
         return 0.0
Exemplo n.º 28
0
 def get_auto_reverse(self):
     try:
         return bool(int(dbget("sample_translation/auto_reverse")))
     except ValueError:
         return False
Exemplo n.º 29
0
 def get_phi_motor_name(self):
     try:
         return eval(dbget("sample.phi_motor_name"))
     except:
         return "Phi"
Exemplo n.º 30
0
 def get_move_when_idle(self):
     """Keep moving te stage when not triggered"""
     try:
         return bool(int(dbget("sample_translation/move_when_idle")))
     except ValueError:
         return False