def doInit(self, mode): MultiSwitcher.doInit(self, mode) self._sm_values = sorted( [x for x in self.mapping if isinstance(x, number_types)])[1:] named_vals = {k: v[0] for k, v in self.mapping.items()} self.valuetype = oneofdict_or(named_vals, floatrange(0, self._sm_values[-1]))
def doStatus(self, maxage=0): # when the sequence is running only it's status is of interest if self._seq_status[0] != status.OK: return self._seq_status # otherwise the actual doppler status is relevant acq_speed, acq_ampl = self._attached_acq.read() speed, ampl = self._readRaw() if self._attached_switch.read() == 'off': if not self.withinMargins(acq_speed, 0, SPEED): return (status.WARN, 'detector registers movement of the ' 'doppler, although it has been stopped.') elif not self.withinMargins(acq_speed, speed, SPEED): return (status.WARN, 'detector observes a speed differing ' 'from the dopplerspeed') elif not self.withinMargins(acq_ampl, ampl, AMPLITUDE): return (status.WARN, 'detector observes an amplitude differing ' 'from the doppleramplitude') elif round(speed, 2) not in self._sm_values \ and self.inRange(speed): return status.OK, 'Doppler runs at custom speed' return MultiSwitcher.doStatus(self, maxage)
def doInit(self, mode): if len(self._attached_moveables) != 3: raise ConfigurationError('I need exactly 3 attached moveables, %d ' 'given' % len(self._attached_moveables)) MultiSwitcher.doInit(self, mode)
def doInit(self, mode): GenericMultiSwitcher.doInit(self, mode) self._xdev = self._attached_moveables[0] if self._xdev.name != 'x_m': raise NicosError(self, 'first attached device must be x_m')
def _start_unchecked(self, position): MultiSwitcher._start_unchecked(self, position) self._attached_det_pos._updateMapping(position)
def start(self, position): MultiSwitcher.start(self, position) self._attached_det_pos._updateMapping(position)
def _mapReadValue(self, pos): value = MultiSwitcher._mapReadValue(self, pos) if value == self.fallback and self.inRange(pos[0]): value = pos[0] return value
def isAllowed(self, pos): if self.inRange(pos): return True, '' else: return MultiSwitcher.isAllowed(self, pos)