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
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
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
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
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
def get_offset(self): """Calibration offset in seconds""" offset = dbget("timing.lxd.offset") try: return float(offset) except Exception: return 0.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
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
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))
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
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
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
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
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
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
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)
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
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
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
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))
def get_z_motor_name(self): try: return eval(dbget("sample.z_motor_name")) except: return "GonZ"
def get_click_center_z(self): try: return float(dbget("sample.click_center_z")) except: return 0.0
def get_calibration_z(self): try: return float(dbget("sample.calibration_z")) except: return 0.0
def get_auto_reverse(self): try: return bool(int(dbget("sample_translation/auto_reverse"))) except ValueError: return False
def get_phi_motor_name(self): try: return eval(dbget("sample.phi_motor_name")) except: return "Phi"
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