def set_instrument(self, ins): if type(ins) == types.StringType: ins = qt.get_instrument_proxy(ins) if self._instrument == ins: return True if ins is not None: self._insname = ins.get_name() else: self._insname = '' self._instrument = ins self._func_list.clear() if ins is not None: self._func_list.append([TEXT_NONE, '<Nothing>']) funcs = ins.get_functions() for (name, options) in misc.dict_to_ordered_tuples(funcs): if 'doc' in options: doc = options['doc'] else: doc = '' self._func_list.append([name, doc]) else: self._func_list.clear()
def get_selection(self): try: selstr = self.get_active_text() if selstr == '': return None insname, dot, parname = selstr.partition('.') logging.debug('Selected instrument %s, parameter %s', insname, parname) ins = qt.get_instrument_proxy(insname) if ins is None: return None return ins, parname except Exception, e: return None
def get_instrument(self): item = self.get_active_iter() if item is None: return None ins_name = self._ins_list.get(item, 0) return qt.get_instrument_proxy(ins_name[0])
def _instrument_added_cb(self, sender, insname): ins = qt.get_instrument_proxy(insname) if ins is None: return if len(self._types) == 0 or ins.has_tag(self._types): self._ins_list.append([ins.get_name()])
def _instrument_added_cb(self, sender, insname): ins = qt.get_instrument_proxy(insname) if ins is not None: self.add_instrument(ins)
import lecroy from data import Data from numpy import * from lib.network import object_sharer as objsh import qtclient as qt measurement = qt.get_instrument_proxy('measurement') analysis = qt.get_instrument_proxy('analysis') #start_analysis() # Load matplotlib and select the GTK Agg back-end import matplotlib as mpl mpl.use('gtkagg') # Load pyplot wrappers and set interactive mode on import matplotlib.pyplot as plt plt.ion() def start_analysis(): ''' Start analysis of data as defined in virtual instrument 'measurement'. ''' if (measurement.get_data_updated()==True) & (measurement.get_data_done()==False): # Get names of columns data_obj = Data(measurement.get_data_path()) dimensions = data_obj.get_dimensions() column_names = [] for dimension in dimensions: column_names.append(dimension['name']) analysis.set_column_names(column_names)
def _instrument_added_cb(self, sender, insname): ins = qt.get_instrument_proxy(insname) if ins is not None: self._add_instrument(ins) else: logging.warning('Unable to locate added instrument %s', insname)
def _add_instruments(self): for name in self._instruments.get_instrument_names(): ins = qt.get_instrument_proxy(name) self._add_instrument(ins)
import lecroy from data import Data from numpy import * from lib.network import object_sharer as objsh import qtclient as qt measurement = qt.get_instrument_proxy('measurement') analysis = qt.get_instrument_proxy('analysis') #start_analysis() # Load matplotlib and select the GTK Agg back-end import matplotlib as mpl mpl.use('gtkagg') # Load pyplot wrappers and set interactive mode on import matplotlib.pyplot as plt plt.ion() def start_analysis(): ''' Start analysis of data as defined in virtual instrument 'measurement'. ''' if (measurement.get_data_updated() == True) & (measurement.get_data_done() == False): # Get names of columns data_obj = Data(measurement.get_data_path()) dimensions = data_obj.get_dimensions() column_names = [] for dimension in dimensions: column_names.append(dimension['name'])