def validate_options(self): """Check that the option fields are appropriate """ message = None messages = [] pn = int(self.get_pn()) td = float(self.get_td()) fd = float(self.get_fd()) #ensure ability to pulse more than 65025 pulses n_max_pn, final_pn = self.get_pn_sequence(pn) adjusted_pn, actual_pn, _, _ = parameters.pulse_number(final_pn) total_pn = n_max_pn * parameters.max_pulse_number + actual_pn adjusted_td, actual_td, _ = parameters.trigger_delay(td) adjusted_fd, actual_fd, _ = parameters.fibre_delay(fd) if adjusted_pn is True: self.pn_tkstr.set(total_pn) messages += ["Pulse number adjusted from %d to %s" % (pn, total_pn)] if adjusted_td is True: self.td_tkstr.set(actual_td) messages += ["Trigger delay adjusted from %s to %s" % (td, actual_td)] if adjusted_fd is True: self.fd_tkstr.set(actual_fd) messages += ["Fibre delay adjusted from %s to %s" % (fd, actual_fd)] if messages!=[]: message = ", ".join(m for m in messages) return message
def command_pulse_number(par): """Get the command to set a pulse number""" if par > _max_pulse_number or par < 0: raise tellie_exception.TellieException("Invalid pulse number: %s" % (par)) par = int(par) adjusted, actual_par, hi, lo = parameters.pulse_number(par) if adjusted is True: raise tellie_exception.TellieException("Invalid pulse number: %s" % (par)) command = [_cmd_pn_hi+chr(hi)] command+= [_cmd_pn_lo+chr(lo)] buffer_check = _cmd_pn_hi + _cmd_pn_lo return command, buffer_check
def command_pulse_number(par): """Get the command to set a pulse number""" if par > p._max_pulse_number or par < 0: raise TellieException("Invalid pulse number: %s" % (par)) par = int(par) #parameters = ParametersClass() adjusted, actual_par, hi, lo = p.pulse_number(par) if adjusted is True: raise TellieException("Invalid pulse number: %s - must be a multiple of two numbers 1-255" % (par)) command = [p._cmd_pulse_number_hi+chr(hi)] command+= [p._cmd_pulse_number_lo+chr(lo)] buffer_check = p._cmd_pulse_number_hi + p._cmd_pulse_number_lo return command, buffer_check
def command_pulse_number(par): """Get the command to set a pulse number""" if par > p._max_pulse_number or par < 0: raise TellieException("Invalid pulse number: %s" % (par)) par = int(par) #parameters = ParametersClass() adjusted, actual_par, hi, lo = p.pulse_number(par) if adjusted is True: raise TellieException( "Invalid pulse number: %s - must be a multiple of two numbers 1-255" % (par)) command = [p._cmd_pulse_number_hi + chr(hi)] command += [p._cmd_pulse_number_lo + chr(lo)] buffer_check = p._cmd_pulse_number_hi + p._cmd_pulse_number_lo return command, buffer_check
def validate_options(self): """Check that the option fields are appropriate """ message = None messages = [] pn = int(self.get_pn()) td = float(self.get_td()) fd = float(self.get_fd()) adjusted_pn,actual_pn,_,_ = parameters.pulse_number(pn) adjusted_td,actual_td,_ = parameters.trigger_delay(td) adjusted_fd,actual_fd,_ = parameters.fibre_delay(fd) if adjusted_pn==True: self.pn_tkstr.set(actual_pn) messages += ["Pulse number adjusted from %d to %s"%(pn,actual_pn)] if adjusted_td==True: self.td_tkstr.set(actual_td) messages += ["Trigger delay adjusted from %s to %s"%(td,actual_td)] if adjusted_fd==True: self.fd_tkstr.set(actual_fd) messages += ["Fibre delay adjusted from %s to %s"%(fd,actual_fd)] if messages!=[]: message = ", ".join(m for m in messages) return message