Adding code to upload calibration curves to the LakeShore372

This commit is contained in:
2025-04-28 11:50:29 +02:00
parent 7cedef60c2
commit 1bc2c38f62
3 changed files with 341 additions and 0 deletions

View File

@ -0,0 +1,203 @@
Comment: 04.03.2024, FP and CMN & 300mK calibrated Cernox, 10mK--300K
Sensor Model: RX-1000-BF0.007
Serial Number: U08910
Data Format: 4 (Log Ohms/Kelvin)
SetPoint Limit: 300 (Kelvin)
Temperature coefficient: 1 (Negative)
Number of Breakpoints: 198
No. Units Temperature (K)
1 3.2956295902328776 302.29637503738195
2 3.296971553758573 286.59226140605614
3 3.2983135172842686 271.70396696844415
4 3.299655480809964 257.58911041144177
5 3.300997444335659 244.20751210549773
6 3.302339407861355 231.52107972848407
7 3.3036818765611495 219.49369983134258
8 3.3050323435963356 208.09113503682508
9 3.3063934527709518 197.28092657869934
10 3.3077654039497144 187.03230190398392
11 3.3091483996009528 177.3160870751909
12 3.3105426698485854 168.10462372321913
13 3.3119485429113964 159.3716903144932
14 3.313365832918274 151.09242750822975
15 3.314795228931611 143.2432673913455
16 3.3162368461502933 135.8018663895707
17 3.3176906985072994 128.74704166378885
18 3.319157426347004 122.05871081054872
19 3.320636699020502 115.71783469509784
20 3.3221294031199156 109.70636325420453
21 3.323635646989159 104.00718411449277
22 3.325155697312089 98.60407388002093
23 3.3266895030606904 93.4816519504428
24 3.328238010142075 88.62533673828631
25 3.3298008788239555 84.02130416071917
26 3.3313788446867956 79.65644828764113
27 3.3329727432588303 75.51834403408456
28 3.3345811872805866 71.59521179072186
29 3.336206204307136 67.87588389179719
30 3.3378478744654845 64.34977282502827
31 3.3395059840391 61.00684109298458
32 3.3411815292834635 57.837572640149205
33 3.342875053133617 54.832945764327
34 3.3445861403197856 51.984407435288716
35 3.346315698908105 49.28384894754648
36 3.3480641173233012 46.72358283795236
37 3.3498322407191785 44.29632100241391
38 3.3516204680550605 41.995153949432975
39 3.3534286930796613 39.81353113141089
40 3.3552582600565795 37.74524229773012
41 3.3571092858062257 35.784399816532066
42 3.3589825915944305 33.9254219148681
43 3.3608785913010175 32.16301678951433
44 3.3627980289823687 30.49216754321982
45 3.364741620223096 28.90811790350802
46 3.3667098700936138 27.406358683377427
47 3.3687039478285716 25.98261494536069
48 3.3707235773374595 24.632833832403346
49 3.37277133503211 23.353173030920722
50 3.3748455474506427 22.13998983319222
51 3.3769492037738775 20.98983076795747
52 3.379082130210903 19.89942176969694
53 3.3812468912200466 18.86565885861225
54 3.3834415713505166 17.885599304775926
55 3.3856685392929724 16.956453251298342
56 3.387929826792408 16.07557577266593
57 3.3902261503658764 15.240459345643886
58 3.3925578041399542 14.448726711311119
59 3.3949270835254253 13.698124107907942
60 3.397334638561418 12.986514855233365
61 3.3997820025545176 12.311873272328953
62 3.4022709453035063 11.67227891113548
63 3.4048025551410936 11.065911089707491
64 3.407378355422513 10.49104370942407
65 3.4100015348859105 9.94604034144247
66 3.4126709440454133 9.429349568407416
67 3.4153898146397594 8.939500568155754
68 3.418160887344365 8.475098926845106
69 3.4209904043122297 8.03482266958783
70 3.423867471449978 7.617418497291169
71 3.426804146772174 7.221698218991336
72 3.4298048270181756 6.846535369525613
73 3.432870807504802 6.490862002914374
74 3.436004010114819 6.153665652324934
75 3.4392020513422925 5.833986447963495
76 3.4424697766282844 5.5309143846908135
77 3.4458369896176633 5.243586731583568
78 3.4492607571427865 4.971185576067502
79 3.452776776304858 4.71293549563132
80 3.4563978335001964 4.46810135049362
81 3.460121839605028 4.2359861909395065
82 3.4639172272350875 4.015929273369738
83 3.467833038329369 3.807304179414953
84 3.4718732525135834 3.6095170327607455
85 3.4760360318685564 3.4220048086076407
86 3.480312983322039 3.244233730953563
87 3.4847516614737923 3.075697753136513
88 3.489322824785482 2.9159171173121625
89 3.4940628250494328 2.7644369887656834
90 3.4992781908553496 2.6208261611702555
91 3.504493556661267 2.4846758291066324
92 3.509708922467184 2.3555984243495516
93 3.514924288273101 2.2332265126083577
94 3.520913958670413 2.1172117475813073
95 3.527026477483079 2.007223879346092
96 3.5331389962957447 1.9029498142638925
97 3.5393943873586804 1.8040927237208286
98 3.5465319139534577 1.710371199169777
99 3.5536694405482345 1.6215184510672331
100 3.560806967143012 1.5372815494249217
101 3.5686905153641195 1.4574207038143048
102 3.5768508955582234 1.381708580774404
103 3.5850112757523274 1.3099296566798764
104 3.593698085472017 1.2418796042272113
105 3.602631619392163 1.1773647107925866
106 3.611565153312309 1.1162013270056885
107 3.620882639856867 1.058215343969781
108 3.6302995177307116 1.003241697639888
109 3.6397163956045557 0.9511238989482141
110 3.649533300856781 0.9017135883392788
111 3.659436352438514 0.8548701134466694
112 3.6693479003538143 0.8104601287092384
113 3.6797714440274105 0.7683572157869951
114 3.690194987701007 0.728441523696159
115 3.7007681829294663 0.6905994276389837
116 3.711756789517688 0.6547232055571611
117 3.72274539610591 0.6207107314880822
118 3.7340844685272794 0.5884651848510551
119 3.745680147471145 0.5578947748359261
120 3.7573196563629345 0.5289124791095453
121 3.7695684590443044 0.5014357960962763
122 3.781859577422382 0.47538651012737754
123 3.79443201382344 0.4506904687907373
124 3.8074509225413267 0.4272773718471503
125 3.8204789400748815 0.4050805711122684
126 3.8340535211284785 0.3840368807345631
127 3.8480390185041493 0.36408639732923054
128 3.8622289734274187 0.3451723294560343
129 3.877045131102691 0.3272408359556686
130 3.891861288777964 0.3102408726844505
131 3.9074050969632546 0.2941240472110529
132 3.9232569930343835 0.27884448106165194
133 3.939249533723833 0.26435867912135835
134 3.9562141364028824 0.2506254058201632
135 3.973178739081932 0.23760556775094957
136 3.990811505670929 0.2252621023854283
137 4.008898357507565 0.2135598725712115
138 4.027525306166772 0.20246556650970152
139 4.046669062715386 0.19194760293006582
140 4.066269293060244 0.18197604118936814
141 4.086464635020096 0.17252249604294276
142 4.10708267496966 0.16356005684239572
143 4.128212304273615 0.15506321093122177
144 4.1497964988101135 0.14700777101997242
145 4.1718545620357785 0.13937080633423948
146 4.1944731546272775 0.13213057733946004
147 4.2175931299504645 0.1252664738567274
148 4.241320472954545 0.11875895639344891
149 4.265650972000818 0.11258950052184033
150 4.290637706203435 0.10674054414692336
151 4.3162693569021275 0.10119543751391945
152 4.342571536323674 0.09593839581272874
153 4.369631083366805 0.09095445424457764
154 4.397461209645033 0.08622942542292727
155 4.426096322389766 0.08174985898737834
156 4.455594816299184 0.07750300331560955
157 4.485969952485805 0.07347676922435774
158 4.517286983891768 0.0696596955561098
159 4.549560141125718 0.06604091655354509
160 4.5828445692629565 0.06261013092885631
161 4.617178068253681 0.05935757253989995
162 4.652615771955327 0.05627398258970298
163 4.68912614277281 0.05335058327018861
164 4.72676568020895 0.05057905277509439
165 4.765573053660718 0.04795150161095398
166 4.805367540464258 0.04546045013870923
167 4.846329596238018 0.04309880728202191
168 4.888307477100742 0.0408598503416756
169 4.931236929634964 0.03873720585860732
170 4.975023573391239 0.036724831471093074
171 5.019510673835353 0.034816998714441556
172 5.06456090421599 0.033008276714233335
173 5.109977140496435 0.03129351672668646
174 5.155565201987605 0.029667837482140764
175 5.201123341544657 0.02812661128993907
176 5.246436209367498 0.026665450865151596
177 5.2913068994535655 0.025280196839644054
178 5.335601353712727 0.023966905921938023
179 5.379134719679635 0.022721839672159586
180 5.421779127089443 0.021541453860122534
181 5.463440548802624 0.02042238837625263
182 5.504046641622135 0.019361457666633382
183 5.543560197902048 0.018355641664945254
184 5.581962708369557 0.01740207719548528
185 5.619232597122327 0.016498049822794465
186 5.65538878178095 0.015640986124692228
187 5.690449928333749 0.014828446366721992
188 5.724435993781677 0.014058117557154814
189 5.757380641974088 0.013327806862781469
190 5.789364194551921 0.012635435366750132
191 5.82032460391876 0.011979032150680542
192 5.850468560762334 0.011356728684208848

View File

@ -0,0 +1,131 @@
#Arg1=filename
#Arg2=base PV inc channel
#python UploadTempCurve.py U08910.340 SARES31-DIL-TST1:CV1
from epics import caget, caput
#Comment: 04.03.2024, FP and CMN & 300mK calibrated Cernox, 10mK--300K
#Sensor Model: RX-1000-BF0.007
#Serial Number: U08910
#Data Format: 4 (Log Ohms/Kelvin)
#SetPoint Limit: 300 (Kelvin)
#Temperature coefficient: 1 (Negative)
#Number of Breakpoints: 198
#No. Units Temperature (K)
#1 3.2956295902328776 302.29637503738195
#2 3.296971553758573 286.59226140605614
#3 3.2983135172842686 271.70396696844415
#4 3.299655480809964 257.58911041144177
import sys
#import re
with open(sys.argv[1], 'r') as f: #File of pv names to a list
data= f.readlines()
Model="?"
SN="?"
DF="?"
DFU="?"
TC="?"
TCU="?"
BPS="?"
SPL="?"
SPLU="?"
a = [0] * 205
b = [0] * 205
c = [0] * 205
lastpoint="0"
for line in data:
#print(len(line))
if (len(line)>10):
sp=line.replace("\t"," ")
sp=sp.replace("\n","")
# sp =re.split(' |\n', sp)
if ":" in line:
sp=sp.split(":")
sp0=sp[0]
pos=sp[1].lstrip()
#print("line:"+line)
#print(" '"+sp0.lower()+"' ")
#print(pos.split(" "))
if sp0.lower()=="sensor model" :
Model=pos.split(" ")[0]
if sp0.lower()=="serial number" :
SN=pos.split(" ")[0]
if sp0.lower()=="data format" :
DF=pos.split(" ")[0]
DFU=pos.split(" ")[1]
if sp0.lower()=="setpoint limit" :
SPL=pos.split(" ")[0]
SPLU=pos.split(" ")[1]
if sp0.lower()=="temperature coefficient" :
TC=pos.split(" ")[0]
TCU=pos.split(" ")[1]
if sp0.lower()=="number of breakpoints" :
BPS=pos.split(" ")[0]
else:
q=sp.split()
#print(sp)
#print(">"+q[0]+"<")
if (q[0].isdigit() ):
#print(">"+q[0]+"<")
#print(q[1])
val=int(q[0])
a[val-1]=val
b[val-1]=float(q[1])
c[val-1]=float(q[2])
lastpoint=q[0]
else:
sp="XXXX"
pv = sys.argv[2].strip()
print ("Upload: "+Model+","+SN+","+DF+","+SPL+","+TC+","+BPS+","+str(lastpoint)+" PV:"+pv)
#print(a)
#print(b)
#print(c)
caput(pv+"_NAME" ,Model.encode())
caput(pv+"_SN" ,SN.encode())
caput(pv+"_FORMAT" ,DF.encode())
caput(pv+"_SPLIM" ,SPL.encode())
caput(pv+"_COEF" ,TC.encode())
caput(pv+"_BPTS" ,BPS.encode())
caput(pv+"_NO" ,a)
caput(pv+"_UNITS" ,b)
caput(pv+"_TEMP" ,c)
caput(pv+"_NUM_ROWS" ,lastpoint.encode())
print ('Finished')

View File

@ -0,0 +1,7 @@
# How to upload .340 curve to a LakeShore 372 in EPICS
If something unclear, contact the creator Edwin
active the enviromnet with pyepics in it. Then in this folder run 'python UploadTempCurve.py _340-file_ _LakeShoreBaseName:CVCurveNumber_'
e.g. python UploadTempCurve.py U08910.340 SARES31-DIL-TST1:CV1
the code gives an error, but works.