frappy/secop_psi/SR_7270.py
Markus Zolliker 41baf5805f migrated secop_psi drivers to new syntax
- includes all changes up to 'fix inheritance order' from git_mlz
  6a32ecf34224c559ae558efd7c0d20078d09463b

Change-Id: Ie3ceee3dbd0a9284b47b1d5b5dbe262eebe8f283
2021-02-25 14:01:54 +01:00

49 lines
1.8 KiB
Python

#!/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:
# Daniel Margineda <daniel.margineda@psi.ch>
# *****************************************************************************
"""SIGNAL RECOVERY SR7270: lOCKIN AMPLIFIER FOR AC SUSCEPTIBILITY"""
from secop.core import FloatRange, HasIodev, \
Parameter, Readable, StringIO, TupleOf
class SR7270(StringIO):
# end_of_line = '\x00' #termination line from maanual page 6.8
end_of_line = '\n'
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'), readonly=False, default=100)
iodevClass = SR7270
def read_value(self):
reply = self.sendRecv('XY.').split('\x00')[-1]
return reply.split(',')
def read_freq(self):
reply = self.sendRecv('OF.').split('\x00')[-1]
return reply
def write_freq(self,value):
self.sendRecv('OF. %g' % value)
return value