Commit 59f1d598 authored by Christian Schneider's avatar Christian Schneider
Browse files

Bugfixes

parent d9ca6ca7
...@@ -10,7 +10,7 @@ v2.0.1 - OSC: ...@@ -10,7 +10,7 @@ v2.0.1 - OSC:
import numpy as np import numpy as np
import visa import visa
import struct import struct
from Instruments.Drivers import dummy from Instruments.Drivers.dummy import dummy
class FSV30(object): class FSV30(object):
...@@ -25,7 +25,7 @@ class FSV30(object): ...@@ -25,7 +25,7 @@ class FSV30(object):
""" """
# Use dummy driver if testing # Use dummy driver if testing
if test: if test:
self._inst = dummy self._inst = dummy(ip)
else: else:
rm = visa.ResourceManager() rm = visa.ResourceManager()
self._inst = rm.open_resource('TCPIP::{}::INSTR'.format(ip) ) self._inst = rm.open_resource('TCPIP::{}::INSTR'.format(ip) )
......
...@@ -12,7 +12,7 @@ import struct ...@@ -12,7 +12,7 @@ import struct
import time import time
import numpy as np import numpy as np
import visa import visa
from Instruments.Drivers import dummy from Instruments.Drivers.dummy import dummy
class RSA5115B(object): class RSA5115B(object):
"""Instrument Driver for Tektronix RSA5115B Spectum analyzer""" """Instrument Driver for Tektronix RSA5115B Spectum analyzer"""
...@@ -25,7 +25,7 @@ class RSA5115B(object): ...@@ -25,7 +25,7 @@ class RSA5115B(object):
IP of spectrum analyzer IP of spectrum analyzer
""" """
if test: if test:
self._inst = dummy self._inst = dummy(ip)
else: else:
rm = visa.ResourceManager() rm = visa.ResourceManager()
self._inst = rm.open_resource('TCPIP::{}::INSTR'.format(ip) ) self._inst = rm.open_resource('TCPIP::{}::INSTR'.format(ip) )
...@@ -54,7 +54,8 @@ class RSA5115B(object): ...@@ -54,7 +54,8 @@ class RSA5115B(object):
return resp.strip('\n') return resp.strip('\n')
else: else:
self._inst.write("{} {}".format(command, arg)) arg = "{} {}".format(command, arg)
self._inst.write(arg)
return 0 return 0
def clear(self): def clear(self):
......
...@@ -11,14 +11,14 @@ class dummy(object): ...@@ -11,14 +11,14 @@ class dummy(object):
"""Dummy instrument for testing """Dummy instrument for testing
""" """
def __init__(self, ip, reset=False): def __init__(self, ip):
self.version = VERSION self.version = VERSION
self.ip = ip self.ip = ip
def close(self): def close(self):
return 0 return 0
def write(self): def write(self, c):
"""Dummy write: Does nothing""" """Dummy write: Does nothing"""
return 0 return 0
......
...@@ -56,19 +56,20 @@ class SA(object): ...@@ -56,19 +56,20 @@ class SA(object):
# Device parameters #################################################### # Device parameters ####################################################
self.test = False # Running in test mode? self.test = False # Running in test mode?
try: if id_string in IPList:
# Try to find device in IPList # Try to find device in IPList
self.ip = IPList[id_string] self.ip = IPList[id_string]
except KeyError: else:
# If it is a test, give IP with zeros and set test mode to true # If it is a test, give IP with zeros and set test mode to true
if id_string[-4:-1].lower() == 'tes': if id_string[-4:-1].lower() == 'tes':
self.ip = '0.0.0.0' self.ip = '0.0.0.0'
self.test = True self.test = True
# If SA is not specified by valid IPList entry. Try directly ip # If SA is not specified by valid IPList entry. Try directly ip
if driver is not None: elif driver is not None:
self.ip = id_string self.ip = id_string
else: else:
raise Exception('SA not in IPList. Please specify driver') raise Exception('SA not in IPList. Please specify driver')
self.CryoID = cryostat self.CryoID = cryostat
self.ch = 1 self.ch = 1
self.id = id_string self.id = id_string
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment