-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtun5971.py
79 lines (65 loc) · 1.54 KB
/
tun5971.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import visa
import re
import json
import struct
import sys
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pygcms.msfile.readspec as readspec
import pygcms.device.busreader as busreader
import pygcms.device.hp5971 as hp5971
import tuning
import time
import msfileread as msfr
def load5971(br):
msd = br.deviceByName('5971')
if br.isSmartCardDevice(msd) and br.needsLoading(msd):
br.loadSmartCard(msd)
return msd
def test5971_alone():
m = hp5971.HP5971(msd, br)
m.getAScan(parms)
m.rs.plotit()
def emitScan( spec, n,pk):
spec.plotit(name = ' ' + str(pk))
def emitRamp(spec, n, pk, parm, ovolt):
spec.plotrampit(' ' +parm + ' ' + str(pk), currvolt=ovolt)
def main():
method = sys.argv[1]
f = open(method + ".json", "r")
mtparms = f.read()
mparms = json.loads(mtparms)
f.close()
parms = mparms['Method']['MSParms']
br = busreader.BusReader()
msd = load5971(br)
ms = hp5971.HP5971(msd, br)
ms.reset()
cd = ms.getConfig()
print(cd)
if cd ['Fault'] == 33:
br.loadSmartCard(msd, reboot=True)
print(ms.getAvc())
print(ms.getCivc())
wrd = ms.getRevisionWord()
print (hp5971.HP5971.getLogAmpScale(wrd))
print(ms.diagIO())
ms.calValve(1)
ms.readyOn()
time.sleep(30)
tun = tuning.HP5971Tuning(ms, parms, emitScan, emitRamp)
tun.abundance(1e6, 3e6)
tun.width(2)
tun.abundance(1e6, 3e6)
tun.axis(1)
tun.rampEnt()
tun.rampEntOfs()
tun.rampXray()
tun.rampRep()
tun.rampIon()
parms = tun.getParms()
f = open("tunnew.json", "w")
f.write(json.dumps(parms, indent=4))
f.close()
main()