Skip to content

Commit

Permalink
Add enumerate for HP 8116A
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLutton authored Mar 21, 2024
1 parent 6f2b23f commit faea61e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
18 changes: 13 additions & 5 deletions src/labtoolkit/WaveformGenerator/HP8116A.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..Instrument import Instrument
from ..IEEE488 import IEEE488


class HP8116A(Instrument):
Expand Down Expand Up @@ -52,19 +51,28 @@ def amplitude(self):

@amplitude.setter
# @AmplitudeLimiter
def amplitude(self, amplitude:
def amplitude(self, amplitude):
self.write(f"AMP {amplitude} V")

@property
def offset(self):
return self.query("IOFS")

@offset.setter
# @AmplitudeLimiter
def offset(self, amplitude:
@offset.setter
def offset(self, amplitude):
self.write(f"OFS {amplitude} V")

@property
def setup(self):
# ' M1,CT0,T0,W0,H0,A0,L0,C0,D0,FRQ 55.0 HZ,DTY 50 %,WID 500 MS,AMP 1.00 V,OFS 7.50 V,'
return self.query('CST')
setup_str = self.query('CST').strip()
# 'M1,CT0,T0,W0,H0,A0,L0,C0,D0,FRQ 55.0 HZ,DTY 50 %,WID 500 MS,AMP 1.00 V,OFS 7.50 V,'

flags = [x for x in setup_str.split(',') if len(x) == 2 or len(x) == 3]
# ['M1', 'CT0', 'T0', 'W0', 'H0', 'A0', 'L0', 'C0', 'D0']

values = [x for x in setup_str.split(',') if len(x) > 3]
# ['FRQ 55.0 HZ', 'DTY 50 %', 'WID 500 MS', 'AMP 1.00 V', 'OFS 7.50 V']
return setup_str

16 changes: 14 additions & 2 deletions src/labtoolkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def enumerate_resources(self):
# Hewlett-Packard, XXnnnnnnnn, ESG-3000A, A.01.00
# reorder to match normal IDNs
# Hewlett Packard,ESG-3000A,XXnnnnnnnn,A.01.00
# This is show & not explained in HP/Agilent manual
# This is shown & not explained in HP/Agilent manual
parts = [parts[0], parts[2], parts[1], parts[3]]

parts[1].removeprefix('MODEL ') if 'MODEL ' in parts[1] else parts[1]
Expand Down Expand Up @@ -217,6 +217,11 @@ def enumerate_resources(self):
mapping.loc[number, 'Serial'] = ''

# mapping.loc[number, 'Serial'] = '0'
if ' NO MESSAGE' in IDN or ' SYNTAX' in IDN:
mapping.loc[number, 'Resource'] = resource
mapping.loc[number, 'Manufacturer'] = 'Hewlett Packard'
mapping.loc[number, 'Model'] = '8116A'
mapping.loc[number, 'Serial'] = ''

except IndexError:
pass
Expand Down Expand Up @@ -279,6 +284,12 @@ def IDN_for_NVRS(self, inst, resource, mapping, number):

def IDN_for_HP(self, inst, resource, mapping, number):
ident = inst.query('ID?').strip()
if ident == 'HP3457A':
mapping.loc[number, 'Resource'] = resource
mapping.loc[number, 'Manufacturer'] = 'Hewlett Packard'
mapping.loc[number, 'Model'] = ident[2:]
mapping.loc[number, 'Serial'] = ''
return True
if ident[0:2] == 'HP':
# HP 8563E
# HP 8564E
Expand Down Expand Up @@ -480,4 +491,5 @@ def driver_load_all(self):
"""."""
for index, value in self.drivers_sorted()[['Type','Driver']].drop_duplicates().iterrows():
# print(f"labtoolkit.{value.Type}.{value.Driver}")
module = importlib.import_module(f'.{value.Type}.{value.Driver}', package='labtoolkit')
module = importlib.import_module(f'.{value.Type}.{value.Driver}', package='labtoolkit')

0 comments on commit faea61e

Please sign in to comment.