103 KiB
103 KiB
Scripts for Calibration of Cernox Sensors¶
Make a copy of this notebook for an other run.
In [1]:
import numpy as np import matplotlib.pyplot as plt import math from scipy.interpolate import splrep, splev from zcalib import read_curve, convert_res, compare_calib, make_calib, logrange, Sensor, CalibRun, nplog, npexp
In [2]:
run = CalibRun([ Sensor(3, 'X75610'), # the reference sensor must be the first Sensor(1, 'X161269', 'CX-1050-CU'), Sensor(4, 'X163062', 'CX-1050-CU'), ], t_points = (1.0, 1.2) + logrange(1.4, 310, n=195) + (330,), # the points to be used in the cal file caldate = '2022-03-08', # the first measuring day! logT = False, logR = True, calib_data_file = '/home/l_samenv/sea/calib_scripts/calib_data/calib%s_p%d_c%d.dat', outputpath='%s/%s.340') # smooth depends on number of measured points (1e-7 for 60, 0.8e-7 for 48 and 0.4e-7 for 24 points) run.make(diflim=0.001, smoothref=1e-7, smoothtst=0.4e-7)
('lsdat', 'READ /afs/psi.ch/project/SampleEnvironment/SE_internal/Thermometer_calibs/2012/73027 Cernox 5/X75610.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p0_c1.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p1_c1.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p2_c1.dat')
{'selected': 0, 'averaged': 62}
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p0_c4.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p1_c4.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p2_c4.dat')
{'selected': 0, 'averaged': 62}
In [5]:
# compare known sensors (skip if not applicable) plt.figure(figsize=(10, 6)) tmin,tmax,dmax=1.4,310,0.001 testlist = (('X161269', 'z340'),('X163062', 'z340'),) for sensno, kind in testlist: r0, t0 = read_curve('2022-03-08/%s.340' % sensno, 'z340') r1, t1 = read_curve('../tcl/calcurves/%s.340' % sensno, kind) diff = compare_calib(r1, t1, r0, t0) plt.plot(t0, diff, '-') plt.plot([tmin,tmax,tmax,tmin,tmin], [-dmax,-dmax,dmax,dmax,-dmax], '-') plt.legend([sensno + "." + kind[-3:] for sensno, kind in testlist] + ["window"]) plt.xscale('log') plt.yscale('symlog',linthreshy=dmax) plt.grid(True, axis='y') plt.axis([1.0,350,-1,1]) plt.show()
('z340', 'READ 2022-03-08/X161269.340')
('z340', 'READ ../tcl/calcurves/X161269.340')
('z340', 'READ 2022-03-08/X163062.340')
('z340', 'READ ../tcl/calcurves/X163062.340')
(106.9606417567978, 178.166, 213.11672914630574, 0.19616946637577173)
(109.54939917249371, 173.2998, 250.06021465453486, 0.44293423682274796)
(112.19461174307791, 168.5665, 218.7291728866863, 0.29758387868696523)
(114.89681764977057, 163.9624, 106.58110492804356, -0.34996618170968735)
(117.65679122773477, 159.4842, 34.2654057152976, -0.7851485870368501)
(120.47390842786656, 155.1282, 79.43411773164775, -0.48794533984376953)
(126.28215950654182, 146.7699, 65.81136705382042, -0.5516017449502901)
(129.2736466821245, 142.7612, 60.11085138326901, -0.5789412572654965)
(135.43471556792514, 135.0693, 47.53890684517614, -0.6480406217758132)
(138.60471366473823, 131.3801, 104.05673424645977, -0.2079718751434976)
(141.8335587736692, 127.7918, 259.22724513812494, 1.0285123547686545)
(145.12057817753117, 124.3014, 26.29540374655533, -0.7884544844502529)
(148.46770660710757, 120.9064, 29.020039578113032, -0.7599792932540128)
(155.3652899939468, 114.392, 68.88701271702354, -0.3977986859481123)
(158.92674915736464, 111.2676, 31.927742091615546, -0.7130544552806428)
(162.56273599018843, 108.2285, 121.18031284037167, 0.11967100015588937)
(166.269656665291, 105.2725, 120.37774034424727, 0.14348704879476862)
(170.04309457814682, 102.3972, 5.944869479008909, -0.9419430464992313)
(173.881749032887, 99.60045, 0.8091122980418981, -0.9918764192527052)
(177.78699932105118, 96.88007, 7.470665900848824, -0.9228874844862434)
(181.7619611723602, 94.234, 872.9700313250054, 8.263854143143721)
(185.8086808233549, 91.66019, 172.42968476699946, 0.8811840207509876)
(189.92931416236428, 89.15669, 27.785339128632813, -0.6883538506349572)
(194.1243434915129, 86.72156, 121.92096132862544, 0.40588985401814087)
(198.3960402951603, 84.35294, 53.537609577654884, -0.3653142430168423)
(202.74539557386922, 82.04902, 27.665201266536936, -0.6628210639622881)
(211.68447114658778, 77.62824, 39.20209542371122, -0.4950021355152298)
(216.2773302698515, 75.50799, 29.475296125086306, -0.6096400377617481)
(225.7158205025115, 71.43963, 42.01262118743896, -0.41191435079606425)
(230.5632047196252, 69.48841, 14.665940831557512, -0.7889440723775732)
(235.49842123785174, 67.59048, 9.832505076055467, -0.8545282549250209)
(240.52210718976625, 65.74439, 15.410473265566749, -0.7656001787290634)
(245.63485941569877, 63.94872, 51.635275415133854, -0.19255185381139991)
(250.8378097648446, 62.2021, 54.904668312856046, -0.1173180919477631)
(256.1326837215261, 60.50318, 19.26940786872846, -0.6815141308485196)
(261.51945348588794, 58.85066, 11.424254899036129, -0.8058772000341861)
(267.0004541062212, 57.24328, 12.215124153131544, -0.7866103383116492)
(272.57561459962585, 55.6798, 15.99381459149707, -0.7127537349003217)
(278.2466857037919, 54.15902, 18.231111530760753, -0.6633781126253622)
(284.01481850403655, 52.67978, 17.476112175146092, -0.6682576849192216)
(289.88049883915926, 51.24095, 15.700469482586684, -0.6935952693580684)
(295.8448407498338, 49.84141, 14.571348218597397, -0.7076457464065041)
(301.9089585205724, 48.4801, 14.166308279722626, -0.707791273538573)
(308.07396634261295, 47.15596, 14.036736563272994, -0.702333775767199)
(314.340254173901, 45.868, 13.81835517607771, -0.6987364791122851)
(320.71036790454275, 44.61521, 13.437459822123422, -0.6988143769328123)
(327.18395661645906, 43.39664, 12.993613289523013, -0.700584808189689)
(333.76208517118164, 42.21135, 12.57587847359243, -0.7020735306122067)
(340.4465989900902, 41.05844, 12.21570962879201, -0.7024799376500419)
(347.2378032050953, 39.93701, 11.89258020520394, -0.7022165603983889)
(354.1367521667284, 38.84622, 11.586160984924618, -0.701742898410074)
(361.14449565990384, 37.78522, 11.283734158213429, -0.7013717491068353)
(368.26292643698036, 36.75319, 10.98555028272141, -0.7010994070794558)
(375.49226921174846, 35.74936, 10.693444992837609, -0.7008773026191907)
(382.83708432739576, 34.77294, 10.408943263022213, -0.7006596720604523)
(390.29770717292524, 33.82319, 10.13424642122957, -0.7003757947955361)
(397.87715144482166, 32.89938, 9.87151639296473, -0.6999482545578449)
(405.5785703386686, 32.0008, 9.622607408478368, -0.699301035959152)
(413.40430989714173, 31.12677, 9.387787321978951, -0.6984014942128929)
(421.35679310515883, 30.27661, 9.164964443983473, -0.697292251543899)
(429.44050019312516, 29.44966, 8.951974939387222, -0.6960245062460069)
(437.6581296021079, 28.64531, 8.746908581798838, -0.6946477946372779)
(446.0124687056897, 27.86292, 8.547942566164162, -0.6932144022893449)
(454.5074434087937, 27.10191, 8.353308727038542, -0.6917815487159931)
(463.14608789308176, 26.36167, 8.161426394341834, -0.6904055625329566)
(471.93262344369595, 25.64166, 7.970948352547351, -0.6891407049096138)
(480.8703503075437, 24.94131, 7.782731414424113, -0.6879581940794565)
(489.9615501474853, 24.26009, 7.5994537456013385, -0.6867508016004336)
(499.20968228957383, 23.59748, 7.423566449059485, -0.6854085076432108)
(508.619492262742, 22.95297, 7.257075056782546, -0.6838284955375036)
(518.1959328163927, 22.32605, 7.099697969145973, -0.6819993698327302)
(527.945387583412, 21.71626, 6.949758290820411, -0.679974438930994)
(537.8733167648923, 21.12313, 6.805711397049237, -0.6778076261875376)
(547.9841537246775, 20.5462, 6.666164746591532, -0.6755524259185868)
(558.2863377119871, 19.98502, 6.530289431513577, -0.6732407857728651)
(568.7848236428206, 19.43917, 6.39805122241777, -0.6708680863217015)
(579.4874034914161, 18.90823, 6.26943174028229, -0.66842841766351)
(590.4036041544978, 18.39179, 6.144395766844579, -0.6659163807957476)
(601.5434468527084, 17.88946, 6.022887382462091, -0.663327602819644)
(612.9160583773069, 17.40085, 5.904746679253265, -0.6606633193635216)
(624.5324374219396, 16.92558, 5.789766891946389, -0.6579280064880265)
(636.4012148261739, 16.46329, 5.677781156841228, -0.6551247559363148)
(648.5373609742134, 16.01363, 5.568579128891649, -0.6522600354265928)
(660.9490763318921, 15.57626, 5.462046171109686, -0.6493351952837404)
(673.6510638967947, 15.15082, 5.358059562399547, -0.6463518435042099)
(686.6588154812781, 14.73701, 5.256509372426493, -0.6433123562767147)
(699.9822058255919, 14.3345, 5.15734013676869, -0.6402148566905933)
(713.6413399675084, 13.94298, 5.060429773875157, -0.6370625380029838)
(727.6491058295712, 13.56216, 4.965714246343661, -0.6338552084370291)
(742.0223729055967, 13.19174, 4.873103186986181, -0.6305943577582501)
(756.7719039536884, 12.83143, 4.782553173072509, -0.627278239987865)
(771.9123689095481, 12.48097, 4.694001044333694, -0.6239073530075231)
(787.4572756828293, 12.14008, 4.607395649288033, -0.6204806188025093)
(803.4243683290259, 11.8085, 4.522656147305347, -0.6169999451831014)
(819.8284777590374, 11.48597, 4.4397142863333885, -0.6134663170517258)
(836.6888857020122, 11.17226, 4.358485465835384, -0.6098832764511939)
(854.0277844374699, 10.86711, 4.278880239540542, -0.6062540786335519)
(871.8745483906489, 10.5703, 4.2007892652705205, -0.6025856158036649)
(890.2561858385483, 10.28159, 4.124143929518755, -0.5988807247207139)
(909.2053865073127, 10.00077, 4.048876405454923, -0.5951435334024356)
(928.7525089890632, 9.727624, 3.9749405949355086, -0.5913760035404834)
(948.9296135200868, 9.461935, 3.902293987755088, -0.5875797088275191)
(969.7683364024988, 9.203502, 3.830905015549617, -0.5837557252065989)
(991.2951925488409, 8.952128, 3.760767362006892, -0.57990241403978)
(1013.544917073896, 8.707619, 3.6918541251918566, -0.5760202501749495)
(1036.547002320081, 8.469789, 3.6241611338471156, -0.5721072704589081)
(1060.3347631112508, 8.238455, 3.557677263748145, -0.5681620809061717)
(1084.9431945708939, 8.013439, 3.49239132045055, -0.5641832026860689)
(1110.4141823241623, 7.794568, 3.428274039797016, -0.5601713860476918)
(1136.784124706771, 7.581676, 3.365312628136329, -0.5561255020477888)
(1164.0992247266765, 7.374599, 3.3034761784924718, -0.5520466701318306)
(1192.4055808328253, 7.173177, 3.2427412756439167, -0.5479351372977529)
(1221.7490218559558, 6.977257, 3.1830908529089097, -0.5437905106678872)
(1252.1806836471449, 6.786688, 3.1245010987448065, -0.5396132695734935)
(1283.7575181532318, 6.601324, 3.066942960458726, -0.5354048732559217)
(1316.53679070864, 6.421023, 3.01039384733579, -0.5311660077629702)
(1350.58213271214, 6.245646, 2.954826896941466, -0.5268981147920542)
(1385.9705429683631, 6.075059, 2.9002021285997777, -0.52260510908622)
(1422.777537428745, 5.909132, 2.846492136408196, -0.5182892958884323)
(1461.0934707212923, 5.747736, 2.793657663586502, -0.5139551184002706)
(1501.0079760443634, 5.590749, 2.741671150525829, -0.5096057521942357)
(1542.6237023688443, 5.43805, 2.690498212554355, -0.5052457751299905)
(1586.0285472261328, 5.289521, 2.6401318325108543, -0.5008750636379259)
(1631.3006153171386, 5.145049, 2.5905810344843294, -0.49649050291176444)
(1678.5257187766367, 5.004522, 2.5418486281952486, -0.492089628500934)
(1727.790174681757, 4.867834, 2.4939392160857956, -0.4876696255283571)
(1779.2050394228281, 4.73488, 2.4468368789023534, -0.4832314907870203)
(1832.8883043654953, 4.605557, 2.400526421605706, -0.47877609122942)
(1888.9740857007976, 4.479766, 2.3549879230215454, -0.4743055947517023)
(1947.5965654304398, 4.35741, 2.3102093146088984, -0.46982053224073506)
(2008.9077768436412, 4.238397, 2.2661719976065746, -0.46532332917219066)
(2073.0653846834894, 4.122634, 2.222861205891689, -0.4608152928706043)
(2140.242579649755, 4.010033, 2.1802620648631796, -0.4562982237644479)
(2210.6296974069924, 3.900507, 2.1383617297972957, -0.4517733900240929)
(2284.4360236061116, 3.793973, 2.097145805827313, -0.4472428228067745)
(2361.880931901753, 3.690349, 2.0566038187888513, -0.4427075003505491)
(2443.1998891047324, 3.589555, 2.01672604205984, -0.4381682291927997)
(2528.6574459454228, 3.491514, 1.977498668290237, -0.4336271691047961)
(2618.532689740033, 3.39615, 1.9389119724972903, -0.42908529585051003)
(2713.132476768282, 3.303392, 1.9009546236479742, -0.42454464270423425)
(2812.7750427921524, 3.213166, 1.8636210155094823, -0.420004750607506)
(2917.8166622085696, 3.125406, 1.82690130154619, -0.41546752596424597)
(3028.628466316469, 3.040042, 1.7907907550346913, -0.4109322321748544)
(3145.625378514024, 2.957009, 1.7552805509070788, -0.4063999971230799)
(3269.226420164485, 2.876245, 1.7203707571691826, -0.4018691880666693)
(3399.9067052669234, 2.797686, 1.68605501117084, -0.39733944010484384)
(3538.1806251560724, 2.721273, 1.6523278704377036, -0.3928106917469495)
(3684.5885654310355, 2.646948, 1.6191887126549747, -0.3882808756896718)
(3839.723926353774, 2.574652, 1.5866348858663515, -0.3837478284962972)
(4004.2298609932514, 2.504331, 1.5546636542888974, -0.37920999488929485)
(4178.803983204483, 2.43593, 1.523272395420811, -0.37466495530626454)
(4364.17342097778, 2.369398, 1.4924645479445353, -0.3701081253784567)
(4561.1567753726185, 2.304683, 1.4622372479048151, -0.36553649768544516)
(4770.621927278813, 2.241735, 1.4325892830050662, -0.36094619435166675)
(4993.510874639158, 2.180507, 1.4035187474024062, -0.3563337575149237)
(5230.870880764615, 2.120951, 1.3750131170319788, -0.3516997247781873)
(5483.880721613951, 2.063022, 1.3467673420472936, -0.3471871157712843)
(5753.856149250909, 2.006675, 1.3186254058187201, -0.34288043364335524)
(6042.212569408162, 1.951866, 1.2905935005022062, -0.33878990642687246)
(6350.559655064113, 1.898555, 1.2626732154689295, -0.3349293460189831)
(6680.638930367525, 1.8467, 1.2348695696714116, -0.33131013717906993)
(7034.382828447838, 1.796262, 1.2071870343782263, -0.3279449020364366)
(7413.938855851158, 1.747201, 1.1796296408295486, -0.3248460590226605)
(7821.697214858729, 1.699479, 1.1522010846428457, -0.32202687727071316)
(8260.265375199966, 1.653062, 1.1249082413283589, -0.31950027202345777)
(8732.568479588233, 1.607912, 1.097756408648412, -0.31727830338450613)
(9241.958201321704, 1.563995, 1.0707462909410215, -0.3153774206816381)
(9792.19379711283, 1.521278, 1.043878860070456, -0.3138145295794351)
(10387.403448039275, 1.479727, 1.017159554477244, -0.3126032339227141)
(11032.349204190787, 1.439312, 0.9905887987754469, -0.3117622872765273)
(11733.268256090052, 1.4, 0.9641364118714606, -0.3113311343775281)
(16898.41610758743, 1.2, 0.8213390500515669, -0.3155507916236942)
(26617.606475286462, 1.0, 0.6726896920393037, -0.32731030796069627)
In [4]:
# compare calibration files from points 0,1,2 # with the optimized (average or selection of best) for sensor in run.sensors: r0, t0 = read_curve(sensor.outputpath, sensor.outputkind) plt.figure() dif = [0,0,0] for j in range(3): rr, rt = read_curve(sensor.caldat_file[j], 'zdat') rc, tc = make_calib(run.rref, run.tref, rr, rt, run.t_points) dif[j] = compare_calib(r0, t0, rc, tc) plt.plot(t0, dif[j], '-') plt.xscale('log') plt.yscale('symlog', linthreshy=0.001) plt.grid(True, axis='y') plt.axis([min(t0),max(t0),-1,1]) tmin,tmax,dmax=1.4,310,0.001 plt.plot([tmin,tmax,tmax,tmin,tmin], [-dmax,-dmax,dmax,dmax,-dmax], '-') #plt.legend(['dif1','dif2','dif3','est']) plt.show()
('z340', 'READ 2022-03-08/X161269.340')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p0_c1.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p1_c1.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p2_c1.dat')
('z340', 'READ 2022-03-08/X163062.340')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p0_c4.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p1_c4.dat')
('zdat', 'READ /home/l_samenv/sea/calib_scripts/calib_data/calib2022-03-08_p2_c4.dat')
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: