fixes to make pylint happy
Change-Id: I95baf4e585603a640d4ec71076a4d509082775ed
This commit is contained in:
parent
778ac17172
commit
5951312d40
@ -218,7 +218,7 @@ max-branches=50
|
|||||||
max-statements=150
|
max-statements=150
|
||||||
|
|
||||||
# Maximum number of parents for a class (see R0901).
|
# Maximum number of parents for a class (see R0901).
|
||||||
max-parents=15
|
max-parents=25
|
||||||
|
|
||||||
# Maximum number of attributes for a class (see R0902).
|
# Maximum number of attributes for a class (see R0902).
|
||||||
max-attributes=50
|
max-attributes=50
|
||||||
|
2
Makefile
2
Makefile
@ -38,7 +38,7 @@ doc:
|
|||||||
$(MAKE) -C doc html
|
$(MAKE) -C doc html
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
pylint -j 0 -f colorized -r n --rcfile=.pylintrc secop secop_* test
|
pylint -f colorized -r n --rcfile=.pylintrc secop secop_* test
|
||||||
|
|
||||||
isort:
|
isort:
|
||||||
@find test -name '*.py' -print0 | xargs -0 isort -e -m 2 -w 80 -ns __init__.py
|
@find test -name '*.py' -print0 | xargs -0 isort -e -m 2 -w 80 -ns __init__.py
|
||||||
|
@ -327,15 +327,15 @@ class HeaterOutput(HasInput, MercuryChannel, Writable):
|
|||||||
self._last_target = self._volt_target ** 2 / max(10, self.resistivity)
|
self._last_target = self._volt_target ** 2 / max(10, self.resistivity)
|
||||||
return self._last_target
|
return self._last_target
|
||||||
|
|
||||||
def set_target(self, value):
|
def set_target(self, target):
|
||||||
"""set the target without switching to manual
|
"""set the target without switching to manual
|
||||||
|
|
||||||
might be used by a software loop
|
might be used by a software loop
|
||||||
"""
|
"""
|
||||||
self._volt_target = math.sqrt(value * self.resistivity)
|
self._volt_target = math.sqrt(target * self.resistivity)
|
||||||
self.change('HTR:SIG:VOLT', self._volt_target)
|
self.change('HTR:SIG:VOLT', self._volt_target)
|
||||||
self._last_target = value
|
self._last_target = target
|
||||||
return value
|
return target
|
||||||
|
|
||||||
def write_target(self, value):
|
def write_target(self, value):
|
||||||
self.write_controlled_by(SELF)
|
self.write_controlled_by(SELF)
|
||||||
@ -482,13 +482,13 @@ class PressureLoop(HasInput, PressureSensor, Loop, Drivable):
|
|||||||
def read_target(self):
|
def read_target(self):
|
||||||
return self.query('PRES:LOOP:PRST')
|
return self.query('PRES:LOOP:PRST')
|
||||||
|
|
||||||
def set_target(self, value):
|
def set_target(self, target):
|
||||||
"""set the target without switching to manual
|
"""set the target without switching to manual
|
||||||
|
|
||||||
might be used by a software loop
|
might be used by a software loop
|
||||||
"""
|
"""
|
||||||
self.change('PRES:LOOP:PRST', value)
|
self.change('PRES:LOOP:PRST', target)
|
||||||
super().set_target(value)
|
super().set_target(target)
|
||||||
|
|
||||||
def write_target(self, value):
|
def write_target(self, value):
|
||||||
self.write_controlled_by(SELF)
|
self.write_controlled_by(SELF)
|
||||||
|
@ -34,13 +34,11 @@ class PhytronIO(StringIO):
|
|||||||
timeout = 0.5
|
timeout = 0.5
|
||||||
identification = [('0IVR', 'MCC Minilog .*')]
|
identification = [('0IVR', 'MCC Minilog .*')]
|
||||||
|
|
||||||
def communicate(self, command, expect_response=True):
|
def communicate(self, command):
|
||||||
for ntry in range(5, 0, -1):
|
for ntry in range(5, 0, -1):
|
||||||
try:
|
try:
|
||||||
_, _, reply = super().communicate('\x02' + command).partition('\x02')
|
_, _, reply = super().communicate('\x02' + command).partition('\x02')
|
||||||
if reply[0] == '\x06': # ACK
|
if reply[0] == '\x06': # ACK
|
||||||
if len(reply) == 1 and expect_response:
|
|
||||||
raise CommunicationFailedError('empty response')
|
|
||||||
break
|
break
|
||||||
raise CommunicationFailedError('missing ACK %r' % reply)
|
raise CommunicationFailedError('missing ACK %r' % reply)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -77,7 +75,7 @@ class Motor(PersistentMixin, HasIO, Drivable):
|
|||||||
_backlash_pending = False
|
_backlash_pending = False
|
||||||
_mismatch_count = 0
|
_mismatch_count = 0
|
||||||
_rawlimits = None
|
_rawlimits = None
|
||||||
_step_size = None
|
_step_size = None # degree / step
|
||||||
|
|
||||||
def earlyInit(self):
|
def earlyInit(self):
|
||||||
super().earlyInit()
|
super().earlyInit()
|
||||||
@ -92,7 +90,7 @@ class Motor(PersistentMixin, HasIO, Drivable):
|
|||||||
return self.communicate('\x02%x%s%s' % (self.address, self.axis, cmd))
|
return self.communicate('\x02%x%s%s' % (self.address, self.axis, cmd))
|
||||||
|
|
||||||
def set(self, cmd, value):
|
def set(self, cmd, value):
|
||||||
self.communicate('\x02%x%s%s%g' % (self.address, self.axis, cmd, value), False)
|
self.communicate('\x02%x%s%s%g' % (self.address, self.axis, cmd, value))
|
||||||
|
|
||||||
def set_get(self, cmd, value, query):
|
def set_get(self, cmd, value, query):
|
||||||
self.set(cmd, value)
|
self.set(cmd, value)
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
"""oxford instruments triton (kelvinoxjt dil)"""
|
"""oxford instruments triton (kelvinoxjt dil)"""
|
||||||
|
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
from secop.core import Writable, Parameter, Readable, Drivable, IDLE, WARN, BUSY, Done
|
from secop.core import Writable, Parameter, Readable, Drivable, IDLE, WARN, BUSY, ERROR, Done
|
||||||
from secop.errors import HardwareError
|
|
||||||
from secop.datatypes import EnumType, FloatRange
|
from secop.datatypes import EnumType, FloatRange
|
||||||
from secop.lib.enum import Enum
|
from secop.lib.enum import Enum
|
||||||
from secop_psi.mercury import MercuryChannel, Mapped, off_on, HasInput, SELF
|
from secop_psi.mercury import MercuryChannel, Mapped, off_on, HasInput, SELF
|
||||||
@ -62,7 +61,7 @@ class Action(MercuryChannel, Writable):
|
|||||||
# PCOND (pause pre-cool (not condense?) automation)
|
# PCOND (pause pre-cool (not condense?) automation)
|
||||||
# RCOND (resume pre-cool (not condense?) automation)
|
# RCOND (resume pre-cool (not condense?) automation)
|
||||||
# WARM (warm-up)
|
# WARM (warm-up)
|
||||||
# EPCL (empty pre-coll automation)
|
# EPCL (empty pre-cool automation)
|
||||||
|
|
||||||
|
|
||||||
class Valve(MercuryChannel, Drivable):
|
class Valve(MercuryChannel, Drivable):
|
||||||
@ -76,7 +75,19 @@ class Valve(MercuryChannel, Drivable):
|
|||||||
self.read_status()
|
self.read_status()
|
||||||
|
|
||||||
def read_value(self):
|
def read_value(self):
|
||||||
return self.query('VALV:SIG:STATE', open_close)
|
pos = self.query('VALV:SIG:STATE', open_close)
|
||||||
|
if pos == self.target:
|
||||||
|
self.status = IDLE, ''
|
||||||
|
self._try_count = 0
|
||||||
|
self.setFastPoll(False)
|
||||||
|
elif self._try_count <= 7: # odd number: last try is previous position
|
||||||
|
# toggle new/previous position until success or too many tries
|
||||||
|
self.change('VALV:SIG:STATE', pos if self._try_count % 2 else self.target, open_close)
|
||||||
|
self._try_count += 1
|
||||||
|
self.status = BUSY, 'opening' if self.target else 'closing'
|
||||||
|
else:
|
||||||
|
self.status = ERROR, 'can not %s valve' % self.target.name
|
||||||
|
return pos
|
||||||
|
|
||||||
def read_status(self):
|
def read_status(self):
|
||||||
pos = self.read_value()
|
pos = self.read_value()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user