update code in several drivers
- remove poll arguments - change from HasIodev to HasIO Change-Id: I2668f1068c17a50d9aff43b1bb3e4fb03c8d840e
This commit is contained in:
parent
38b3a192ab
commit
0fec736886
@ -18,83 +18,86 @@
|
||||
# Module authors:
|
||||
# Daniel Margineda <daniel.margineda@psi.ch>
|
||||
# *****************************************************************************
|
||||
"""WAVE FUNCTION LECROY XX: SIGNAL GENERATOR"""
|
||||
"""WAVE FUNCTION LECROY XX: SIGNAL GENERATOR
|
||||
|
||||
modifications not tested!
|
||||
"""
|
||||
|
||||
from secop.core import Readable, Parameter, FloatRange, \
|
||||
IntRange, BoolType, EnumType, Module, Property
|
||||
IntRange, BoolType, EnumType, Module, Property, HasIO
|
||||
|
||||
|
||||
class Channel(Module):
|
||||
class Channel(HasIO, Module):
|
||||
channel = Property('choose channel to manipulate', IntRange(1, 2))
|
||||
freq = Parameter('frequency', FloatRange(1e-6, 20e6, unit='Hz'),
|
||||
poll=True, initwrite=True, default=1000)
|
||||
initwrite=True, default=1000)
|
||||
amp = Parameter('exc_volt_int', FloatRange(0.00, 5, unit='Vrms'),
|
||||
poll=True, readonly=False, initwrite=True, default=0.1)
|
||||
readonly=False, initwrite=True, default=0.1)
|
||||
offset = Parameter('offset_volt_int', FloatRange(0.0, 10, unit='V'),
|
||||
poll=True, readonly=False, initwrite=True, default=0.0)
|
||||
readonly=False, initwrite=True, default=0.0)
|
||||
wave = Parameter('type of wavefunction',
|
||||
EnumType('WaveFunction', SINE=1, SQUARE=2, RAMP=3, PULSE=4, NOISE=5, ARB=6, DC=7),
|
||||
poll=True, readonly=False, default='SINE')
|
||||
readonly=False, default='SINE')
|
||||
phase = Parameter('signal phase', FloatRange(0, 360, unit='deg'),
|
||||
poll=True, readonly=False, initwrite=True, default=0)
|
||||
readonly=False, initwrite=True, default=0)
|
||||
enabled = Parameter('enable output channel', datatype=EnumType('OnOff', OFF=0, ON=1),
|
||||
readonly=False, default='OFF')
|
||||
symm = Parameter('wavefunction symmetry', FloatRange(0, 100, unit=''),
|
||||
poll=True, readonly=False, default=0)
|
||||
readonly=False, default=0)
|
||||
|
||||
def read_value(self):
|
||||
return self.sendRecv('C%d:BSWV FRQ?' % self.channel)
|
||||
return self.communicate('C%d:BSWV FRQ?' % self.channel)
|
||||
|
||||
def write_target(self, value):
|
||||
self.sendRecv('C%d:BSWV FRQ, %gHz' % (self.channel, value))
|
||||
self.communicate('C%d:BSWV FRQ, %gHz' % (self.channel, value))
|
||||
return value
|
||||
|
||||
# signal wavefunction parameter
|
||||
def read_wave(self):
|
||||
return self.sendRecv('C%d:BSWV WVTP?' % self.channel)
|
||||
return self.communicate('C%d:BSWV WVTP?' % self.channel)
|
||||
|
||||
def write_wave(self, value): # string value
|
||||
self.sendRecv('C%d:BSWV WVTP, %s' % (self.channel, value.name))
|
||||
self.communicate('C%d:BSWV WVTP, %s' % (self.channel, value.name))
|
||||
return value
|
||||
|
||||
# signal amplitude parameter
|
||||
def read_amp(self):
|
||||
return self.sendRecv('C%d:BSWV AMP?' % self.channel)
|
||||
return self.communicate('C%d:BSWV AMP?' % self.channel)
|
||||
|
||||
def write_amp(self, value):
|
||||
self.sendRecv('C%d:BSWV AMP, %g' % (self.channel, value))
|
||||
self.communicate('C%d:BSWV AMP, %g' % (self.channel, value))
|
||||
return value
|
||||
|
||||
# offset value parameter
|
||||
def read_offset(self):
|
||||
return self.sendRecv('C%d:BSWV OFST?' % self.channel)
|
||||
return self.communicate('C%d:BSWV OFST?' % self.channel)
|
||||
|
||||
def write_offset(self, value):
|
||||
self.sendRecv('C%d:BSWV OFST %g' % (self.channel, value))
|
||||
self.communicate('C%d:BSWV OFST %g' % (self.channel, value))
|
||||
return value
|
||||
|
||||
# channel symmetry
|
||||
def read_symm(self):
|
||||
return self.sendRecv('C%d:BSWV SYM?' % self.channel)
|
||||
return self.communicate('C%d:BSWV SYM?' % self.channel)
|
||||
|
||||
def write_symm(self, value):
|
||||
self.sendRecv('C%d:BSWV SYM %g' % (self.channel, value))
|
||||
self.communicate('C%d:BSWV SYM %g' % (self.channel, value))
|
||||
return value
|
||||
|
||||
# wave phase parameter
|
||||
def read_phase(self):
|
||||
return self.sendRecv('C%d:BSWV PHSE?' % self.channel)
|
||||
return self.communicate('C%d:BSWV PHSE?' % self.channel)
|
||||
|
||||
def write_phase(self, value):
|
||||
self.sendRecv('C%d:BSWV PHSE %g' % (self.channel, value))
|
||||
self.communicate('C%d:BSWV PHSE %g' % (self.channel, value))
|
||||
return value
|
||||
|
||||
# dis/enable output channel
|
||||
def read_enabled(self):
|
||||
return self.sendRecv('C%d: OUTP?' % self.channel)
|
||||
return self.communicate('C%d: OUTP?' % self.channel)
|
||||
|
||||
def write_enabled(self, value):
|
||||
self.sendRecv('C%d: OUTP %s' % (self.channel, value.name))
|
||||
self.communicate('C%d: OUTP %s' % (self.channel, value.name))
|
||||
return value
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
"""Signal Recovery SR7270: lockin amplifier for AC susceptibility"""
|
||||
|
||||
from secop.core import Readable, Parameter, Command, FloatRange, TupleOf, \
|
||||
HasIodev, StringIO, Attached, IntRange, BoolType, EnumType
|
||||
HasIO, StringIO, Attached, IntRange, BoolType, EnumType
|
||||
|
||||
|
||||
class SR7270(StringIO):
|
||||
@ -33,7 +33,7 @@ class SR7270(StringIO):
|
||||
return reply + ';%d;%d' % tuple(status)
|
||||
|
||||
|
||||
class XY(HasIodev, Readable):
|
||||
class XY(HasIO, Readable):
|
||||
x = Attached()
|
||||
y = Attached()
|
||||
freq_arg = Attached()
|
||||
@ -46,29 +46,29 @@ class XY(HasIodev, Readable):
|
||||
value = Parameter('X, Y', datatype=TupleOf(FloatRange(unit='V'), FloatRange(unit='V')))
|
||||
freq = Parameter('exc_freq_int',
|
||||
FloatRange(0.001, 250e3, unit='Hz'),
|
||||
poll=True, readonly=False, initwrite=True, default=1000)
|
||||
readonly=False, initwrite=True, default=1000)
|
||||
amp = Parameter('exc_volt_int',
|
||||
FloatRange(0.00, 5, unit='Vrms'),
|
||||
poll=True, readonly=False, initwrite=True, default=0.1)
|
||||
range = Parameter('sensitivity value', FloatRange(0.00, 1, unit='V'), poll=True, default=1)
|
||||
irange = Parameter('sensitivity index', IntRange(0, 27), poll=True, readonly=False, default=25)
|
||||
readonly=False, initwrite=True, default=0.1)
|
||||
range = Parameter('sensitivity value', FloatRange(0.00, 1, unit='V'), default=1)
|
||||
irange = Parameter('sensitivity index', IntRange(0, 27), readonly=False, default=25)
|
||||
autorange = Parameter('autorange_on', EnumType('autorange', off=0, soft=1, hard=2),
|
||||
readonly=False, default=0, initwrite=True)
|
||||
tc = Parameter('time constant value', FloatRange(10e-6, 100, unit='s'), poll=True, default=0.1)
|
||||
itc = Parameter('time constant index', IntRange(0, 30), poll=True, readonly=False, initwrite=True, default=14)
|
||||
tc = Parameter('time constant value', FloatRange(10e-6, 100, unit='s'), default=0.1)
|
||||
itc = Parameter('time constant index', IntRange(0, 30), readonly=False, initwrite=True, default=14)
|
||||
nm = Parameter('noise mode', BoolType(), readonly=False, default=0)
|
||||
phase = Parameter('Reference phase control', FloatRange(-360, 360, unit='deg'),
|
||||
poll=True, readonly=False, initwrite=True, default=0)
|
||||
readonly=False, initwrite=True, default=0)
|
||||
vmode = Parameter('Voltage input configuration', IntRange(0, 3), readonly=False, default=3),
|
||||
# dac = Parameter('output DAC channel value', datatype=TupleOf(IntRange(1, 4), FloatRange(0.0, 5000, unit='mV')),
|
||||
# poll=True, readonly=False, initwrite=True, default=(3,0))
|
||||
# readonly=False, initwrite=True, default=(3,0))
|
||||
dac = Parameter('output DAC channel value', FloatRange(-10000, 10000, unit='mV'),
|
||||
poll=True, readonly=False, initwrite=True, default=0)
|
||||
readonly=False, initwrite=True, default=0)
|
||||
|
||||
iodevClass = SR7270
|
||||
ioClass = SR7270
|
||||
|
||||
def comm(self, command):
|
||||
reply, status, overload = self.sendRecv(command).split(';')
|
||||
reply, status, overload = self.communicate(command).split(';')
|
||||
if overload != '0':
|
||||
self.status = self.Status.WARN, 'overload %s' % overload
|
||||
else:
|
||||
@ -200,10 +200,10 @@ class XY(HasIodev, Readable):
|
||||
|
||||
|
||||
class Comp(Readable):
|
||||
pollerClass = None
|
||||
enablePoll = False
|
||||
value = Parameter(datatype=FloatRange(unit='V'))
|
||||
|
||||
|
||||
class arg(Readable):
|
||||
pollerClass = None
|
||||
enablePoll = False
|
||||
value = Parameter(datatype=FloatRange(unit=''))
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
"""driver for cryotel stirling cryocooler"""
|
||||
|
||||
from secop.core import Command, EnumType, FloatRange, HasIodev, Parameter, Drivable, StringIO, StringType
|
||||
from secop.core import Command, EnumType, FloatRange, HasIO, Parameter, Drivable, StringIO, StringType
|
||||
from secop.errors import CommunicationFailedError, HardwareError
|
||||
|
||||
|
||||
@ -48,27 +48,27 @@ class CryotelIO(StringIO):
|
||||
return reply
|
||||
|
||||
|
||||
class Cryo(HasIodev, Drivable):
|
||||
class Cryo(HasIO, Drivable):
|
||||
value = Parameter('current temperature', FloatRange(unit='deg'))
|
||||
target = Parameter('target temperature', FloatRange(unit='deg'), readonly=False)
|
||||
mode = Parameter('control mode', EnumType('mode', off=0, power=1, temperature=2), readonly=False, poll=True)
|
||||
power = Parameter('power', FloatRange(unit='W'), poll=True)
|
||||
mode = Parameter('control mode', EnumType('mode', off=0, power=1, temperature=2), readonly=False)
|
||||
power = Parameter('power', FloatRange(unit='W'))
|
||||
setpower = Parameter('requested power', FloatRange(unit='W'), default=0)
|
||||
cool_power = Parameter('power for cooling', FloatRange(unit='W'), default=240, readonly=False)
|
||||
hold_power = Parameter('power for holding T', FloatRange(unit='W'), default=120, readonly=False)
|
||||
cool_threshold = Parameter('switch to cool_power once above this value', FloatRange(unit='K'), default=100, readonly=False)
|
||||
hold_threshold = Parameter('switch to hold_power once below this value', FloatRange(unit='K'), default=95, readonly=False)
|
||||
|
||||
iodevClass = CryotelIO
|
||||
ioClass = CryotelIO
|
||||
cnt_inside = 0
|
||||
|
||||
def get(self, cmd):
|
||||
return float(self._iodev.communicate(cmd))
|
||||
return float(self.communicate(cmd))
|
||||
|
||||
def set(self, cmd, value, check=False):
|
||||
setcmd = '%s=%.2f' % (cmd, value)
|
||||
self._iodev.communicate(setcmd)
|
||||
reply = float(self._iodev.communicate(cmd))
|
||||
self.communicate(setcmd)
|
||||
reply = float(self.communicate(cmd))
|
||||
if check:
|
||||
if value != reply:
|
||||
raise HardwareError('illegal reply from %s: %g' % (cmd, reply))
|
||||
|
@ -21,10 +21,8 @@
|
||||
# *****************************************************************************
|
||||
"""transducer DPM3 read out"""
|
||||
|
||||
import time
|
||||
|
||||
from secop.core import Readable, Parameter, FloatRange, StringIO,\
|
||||
HasIodev, IntRange, Done
|
||||
HasIO, IntRange, Done
|
||||
|
||||
|
||||
class DPM3IO(StringIO):
|
||||
@ -47,22 +45,22 @@ def float2hex(value, digits):
|
||||
return '%06X' % intvalue
|
||||
|
||||
|
||||
class DPM3(HasIodev, Readable):
|
||||
class DPM3(HasIO, Readable):
|
||||
OFFSET = 0x8f
|
||||
SCALE = 0x8c
|
||||
|
||||
MAGNITUDE = {'1': 1, '2': 10, '3': 100, '4': 1e3, '5': 1e4, '6': 1e5,
|
||||
'9': -1, 'A': -10, 'B': -100, 'C': -1e3, 'D': -1e4, 'E': -1e5}
|
||||
|
||||
iodevClass = DPM3IO
|
||||
ioClass = DPM3IO
|
||||
|
||||
value = Parameter(datatype=FloatRange(unit='N'))
|
||||
digits = Parameter('number of digits for value', IntRange(0, 5), initwrite=True, readonly=False)
|
||||
# Note: we have to treat the units properly.
|
||||
# We got an output of 150 for 10N. The maximal force we want to deal with is 100N,
|
||||
# thus a maximal output of 1500. 10=150/f
|
||||
offset = Parameter('', FloatRange(-1e5, 1e5), readonly=False, poll=True)
|
||||
scale_factor = Parameter('', FloatRange(-1e5, 1e5, unit='input_units/N'), readonly=False, poll=True)
|
||||
offset = Parameter('', FloatRange(-1e5, 1e5), readonly=False)
|
||||
scale_factor = Parameter('', FloatRange(-1e5, 1e5, unit='input_units/N'), readonly=False)
|
||||
|
||||
def query(self, adr, value=None):
|
||||
if value is not None:
|
||||
|
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# *****************************************************************************
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Module authors:
|
||||
# Markus Zolliker <markus.zolliker@psi.ch>
|
||||
# *****************************************************************************
|
||||
"""PPMS mf proxy"""
|
||||
|
||||
import secop_psi.ppms
|
||||
from secop.core import Drivable, Enum, EnumType, FloatRange, Override, Parameter
|
||||
from secop.datatypes import StatusType
|
||||
from secop.proxy import proxy_class
|
||||
|
||||
|
||||
class Field(proxy_class(secop_psi.ppms.Field)):
|
||||
"""magnetic field"""
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
Status = Enum(Drivable.Status,
|
||||
PREPARED = 150,
|
||||
PREPARING = 340,
|
||||
RAMPING = 370,
|
||||
FINALIZING = 390,
|
||||
)
|
||||
# pylint: disable=invalid-name
|
||||
PersistentMode = Enum('PersistentMode', persistent=0, driven=1)
|
||||
ApproachMode = Enum('ApproachMode', linear=0, no_overshoot=1, oscillate=2)
|
||||
|
||||
remoteParameters = {
|
||||
'value':
|
||||
Override(datatype=FloatRange(-1, 1, unit='T'), poll=True),
|
||||
'status':
|
||||
Override(datatype=StatusType(Status), poll=True),
|
||||
'target':
|
||||
Override(datatype=FloatRange(-15, 15, unit='T'), poll=True),
|
||||
'ramp':
|
||||
Parameter('ramping speed', readonly=False,
|
||||
datatype=FloatRange(0.064, 1.19, unit='T/min'), poll=True),
|
||||
'approachmode':
|
||||
Parameter('how to approach target', readonly=False,
|
||||
datatype=EnumType(ApproachMode), poll=True),
|
||||
'persistentmode':
|
||||
Parameter('what to do after changing field', readonly=False,
|
||||
datatype=EnumType(PersistentMode), poll=True),
|
||||
'pollinterval':
|
||||
Override(visibility=3),
|
||||
}
|
@ -32,20 +32,20 @@ from secop.core import Attached, BoolType, FloatRange, IntRange, \
|
||||
|
||||
|
||||
class Temperature(Readable):
|
||||
pollerClass = None
|
||||
enablePoll = False
|
||||
|
||||
value = Parameter(datatype=FloatRange(unit='degC'))
|
||||
|
||||
|
||||
class Bcomp(Readable):
|
||||
pollerClass = None
|
||||
enablePoll = False
|
||||
|
||||
value = Parameter(datatype=FloatRange(unit='T'))
|
||||
range = Parameter('working range', FloatRange(unit='T'), default=0)
|
||||
|
||||
|
||||
class Raw(Readable):
|
||||
pollerClass = None
|
||||
enablePoll = False
|
||||
|
||||
value = Parameter(datatype=FloatRange())
|
||||
|
||||
@ -62,7 +62,7 @@ class TeslameterBase(Readable):
|
||||
y = Attached()
|
||||
z = Attached()
|
||||
|
||||
value = Parameter('B vector', poll=True,
|
||||
value = Parameter('B vector',
|
||||
datatype=TupleOf(FloatRange(unit='T'), FloatRange(unit='T'), FloatRange(unit='T')))
|
||||
usb = Parameter('usb device', StringType(), readonly=False)
|
||||
enabled = Parameter('enable data acq', datatype=BoolType(), readonly=False, default=True)
|
||||
@ -152,7 +152,7 @@ class Teslameter3MH6(TeslameterBase):
|
||||
|
||||
range = Parameter('range or 0 for autorange', FloatRange(0, 20, unit='T'), readonly=False, default=0)
|
||||
rate = Parameter('sampling rate', datatype=FloatRange(10, 15000, unit='Hz'),
|
||||
readonly=False, poll=True)
|
||||
readonly=False)
|
||||
avtime = Parameter('data acquisition time', FloatRange(), default=0)
|
||||
|
||||
SAMPLING_RATES = {0xe0: 15000, 0xd0: 7500, 0xc0: 3750, 0xb0: 2000, 0xa1: 1000,
|
||||
|
@ -22,17 +22,17 @@
|
||||
|
||||
from secop.datatypes import FloatRange, IntRange, StringType
|
||||
from secop.modules import Drivable, Parameter, Readable
|
||||
from secop.io import HasIodev
|
||||
from secop.io import HasIO
|
||||
|
||||
Status = Drivable.Status
|
||||
|
||||
|
||||
class TempLoop(HasIodev, Drivable):
|
||||
class TempLoop(HasIO, Drivable):
|
||||
"""temperature channel on Lakeshore 336"""
|
||||
|
||||
value = Parameter(datatype=FloatRange(unit='K'), default=0, poll=True)
|
||||
value = Parameter(datatype=FloatRange(unit='K'), default=0)
|
||||
status = Parameter(poll=False)
|
||||
target = Parameter(datatype=FloatRange(1.0, 402.0, unit='K'), default=1.3, poll=True)
|
||||
target = Parameter(datatype=FloatRange(1.0, 402.0, unit='K'), default=1.3)
|
||||
tolerance = Parameter('the tolerance', FloatRange(-400, 400), default=1, readonly=False)
|
||||
pollinterval = Parameter(visibility=3)
|
||||
channel = Parameter('the Lakeshore channel', datatype=StringType(), export=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user