def receive(self, name, **kwargs): """performs receive of parameter name i.e. executing associated get_cmd with value checking""" get_cmd=self.func2log(name, 'get_cmd') if get_cmd!=None and self.status=='Active': self.receive_log(name) #self.busy=True value=get_cmd(self, **kwargs) #self.busy=False temp=self.get_tag(name, 'send_now', self.send_now) self.set_tag(name, send_now=False) value=self.get_value_check(name, value) setattr(self, name, value) self.set_tag(name, send_now=temp) else: log_warning("WARNING: get_cmd doesn't exist or instrument not active")
def data_save(self, instr, name, value): if not instr.get_tag(name, 'discard', False) and self.saving!="No buffer": if instr.get_tag(name, 'save', False): group_name=self.SAVE_GROUP_NAME else: group_name=self.SETUP_GROUP_NAME label=instr.get_tag(name, 'label', name) if instr.get_type(name) in (Float, Int, Range, FloatRange, ContainerList, Unicode, Str): self.save_file.data_save(data=value, name=label, group_name=group_name) elif instr.get_type(name) in (List, Callable): pass elif instr.get_type(name) in (Bool, Enum): self.save_file.data_save(data=str(value), name=label, group_name=group_name) else: log_warning("No save format!")
def data_save(self, instr, name, value): if not get_tag(instr, name, 'discard', False) and self.saving!="No buffer": if get_tag(instr, name, 'save', False): group_name=self.SAVE_GROUP_NAME else: group_name=self.SETUP_GROUP_NAME label=get_tag(instr, name, 'label', name) if get_type(instr, name) in (Float, Int, Range, FloatRange, ContainerList, Unicode, Str, float, int, basestring, list, List): self.save_file.data_save(data=value, name=label, group_name=group_name) elif get_type(instr, name) in (Callable,): pass elif get_type(instr, name) in (Bool, Enum, bool): self.save_file.data_save(data=str(value), name=label, group_name=group_name) else: log_warning("No save format!")
def send(self, name, value=None, **kwargs): """performs send of parameter name i.e. executing associated set_cmd. If value is specified, parameter is set to value kwargs allows additional parameters required by set_cmd to be fed in.""" set_cmd=self.func2log(name, 'set_cmd') if set_cmd!=None and self.status=='Active': #self.busy=True temp=self.get_tag(name, 'send_now', self.send_now) self.set_tag(name, send_now=False) if value!=None: setattr(self, name, value) self.send_log(name) set_cmd(self, **kwargs) self.set_tag(name, send_now=temp) #self.busy=False else: log_warning("WARNING: set_cmd doesn't exist or instrument not active")
def receive(self, name, **kwargs): """performs receive of parameter name i.e. executing associated get_cmd with value checking""" get_cmd = self.func2log(name, 'get_cmd') if get_cmd != None and self.status == 'Active': self.receive_log(name) #self.busy=True value = get_cmd(self, **kwargs) #self.busy=False temp = self.get_tag(name, 'send_now', self.send_now) self.set_tag(name, send_now=False) value = self.get_value_check(name, value) setattr(self, name, value) self.set_tag(name, send_now=temp) else: log_warning( "WARNING: get_cmd doesn't exist or instrument not active")
def send(self, name, value=None, **kwargs): """performs send of parameter name i.e. executing associated set_cmd. If value is specified, parameter is set to value kwargs allows additional parameters required by set_cmd to be fed in.""" set_cmd = self.func2log(name, 'set_cmd') if set_cmd != None and self.status == 'Active': #self.busy=True temp = self.get_tag(name, 'send_now', self.send_now) self.set_tag(name, send_now=False) if value != None: setattr(self, name, value) self.send_log(name) set_cmd(self, **kwargs) self.set_tag(name, send_now=temp) #self.busy=False else: log_warning( "WARNING: set_cmd doesn't exist or instrument not active")
def read_data_distribute(self): log_warning("read_data_distribute not tested!") for key, item in self.read_file.data.iteritems(): target=filter(lambda x: x.name==key, self.bases) if target!=[]: for subkey, subitem in item.iteritems(): if subkey in target[0].all_params: setattr(target[0], subkey, subitem) else: log_warning("target base does not have target param!") else: log_warning("target base not found!")
def read_data_distribute(self): log_warning("read_data_distribute not tested!") for key, item in self.read_file.data.iteritems(): target = filter(lambda x: x.name == key, self.bases) if target != []: for subkey, subitem in item.iteritems(): if subkey in target[0].all_params: setattr(target[0], subkey, subitem) else: log_warning("target base does not have target param!") else: log_warning("target base not found!")