#general settings
%matplotlib notebook
%load_ext autoreload
%autoreload 2
/cvmfs/sft.cern.ch/lcg/releases/matplotlib/1.5.1-763af/x86_64-slc6-gcc49-opt/lib/python2.7/site-packages/matplotlib-1.5.1-py2.7-linux-x86_64.egg/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment. warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
import matplotlib.pyplot as plt
import numpy as np
import pytimber
from pytimber import BSRT
db = pytimber.LoggingDB()
t1=pytimber.parsedate("2016-08-24 03:34:00.000")
t2=pytimber.parsedate("2016-08-24 04:08:00.000")
generate the BSRT instance, which automatically calculates the emittances using the data stored in timber.
bsrt = BSRT.fromdb(t1,t2,beam='B1')
Dictionary with emittances and timestamps for each slot
bsrt.emit
array([(1472002447.645, 3.451221778985401, 2.9964924620987827), (1472002470.766, 3.503534068077894, 2.933003154332558), (1472002491.605, 3.3852197719151698, 2.7549211720602247), (1472002514.645, 3.3933059753786536, 2.8714228325039097), (1472002537.624, 3.4988308520855433, 3.0300499205333002), (1472002558.967, 3.578052412517453, 3.0030449136983193), (1472002580.526, 3.4369088377937245, 2.979947749010079), (1472002602.825, 3.440375026348834, 2.7949962447418066), (1472002625.105, 3.4755651602916044, 2.9838217635826823), (1472002647.725, 3.529972389885365, 3.090232709149782), (1472002669.525, 3.5445443533196106, 2.822615701692109), (1472002693.505, 3.551249889738612, 3.014212052277341), (1472002716.545, 3.525736983761412, 3.059324909059721), (1472002738.587, 3.6237871064804574, 2.84479952187861), (1472002759.947, 3.5886291540890376, 3.201249253691373), (1472002782.99, 3.4569226230695866, 2.8143163335773633), (1472002804.764, 3.5721537696298498, 3.128860264591737), (1472002826.304, 3.58459625626382, 2.8491011775750232), (1472002847.147, 3.609862698652636, 2.8518285888510824), (1472002869.227, 3.473707264388084, 3.011039328756653), (1472002890.805, 3.543727255881687, 2.945508754091297), (1472002912.885, 3.5723280209566695, 2.9280653382866757), (1472002936.366, 3.4055004285924677, 3.0391651895406993), (1472002957.965, 3.540367030971264, 3.1796410071543924), (1472002979.549, 3.6226426991178333, 2.9824934001862897), (1472003001.627, 3.471417664746949, 3.2318495762791892), (1472003022.688, 3.5156359012170917, 2.9779332412367596), (1472003045.468, 3.5978770330646515, 3.0245890393111874), (1472003068.807, 3.590874798440525, 3.0869771838058293), (1472003090.907, 3.6270036917836377, 2.854647889955398), (1472003113.411, 3.4882399820280012, 2.9690386087950094), (1472003135.748, 3.555491575189658, 2.9970715699724666), (1472003157.311, 3.6995299197030715, 3.2123502517896165), (1472003180.386, 3.635075766761165, 3.141098777981532), (1472003201.946, 3.7057032831509753, 3.0513047446539097), (1472003225.027, 3.5141877314063636, 3.006313061271427), (1472003246.649, 3.681946234012042, 2.824899315391038), (1472003269.19, 3.6121146223312164, 2.8927857029060946), (1472003291.028, 3.5112686292241944, 3.0140666441974617), (1472003312.927, 3.6353175208542297, 3.041647729571129), (1472003335.33, 3.650170484175868, 2.986650657581156), (1472003357.968, 3.5656946967992322, 3.0570261486858055), (1472003380.448, 3.569704047147852, 2.870276229207365), (1472003402.526, 3.5933527778944394, 2.8950506357058736), (1472003425.128, 3.637899109205171, 3.0781067860440596), (1472003447.391, 3.618944175460297, 3.0098503147701443), (1472003470.53, 3.6142284008137597, 2.991257266333981), (1472003491.85, 3.7206300285659526, 3.154090081118198), (1472003513.472, 3.599285957081051, 2.93128703605649), (1472003535.028, 3.5599028024722035, 2.929172055339087), (1472003557.63, 3.616227581576864, 3.2533371543054384), (1472003580.41, 3.7086129663425047, 2.858957118989305), (1472003601.988, 3.754827243912206, 3.0491493728032064), (1472003623.109, 3.5634694602607953, 3.0676868834310813), (1472003644.967, 3.6040582456714216, 2.8872400003040526), (1472003667.29, 3.6287360011453065, 2.948336133422273), (1472003688.909, 3.7525329347757514, 2.918954613281773), (1472003712.231, 3.748815573136937, 3.003324117407253), (1472003733.312, 3.628900833481487, 2.8644659646822106), (1472003755.47, 3.582730511201434, 3.0295768393845277), (1472003777.372, 3.528087806841701, 2.8822259459940676), (1472003800.05, 3.656569903399105, 3.0054835283712857), (1472003822.489, 3.617040754435355, 3.0844961584428985), (1472003845.111, 3.6755578036112166, 2.998671563740299), (1472003866.492, 3.703303795285719, 3.077894732594237), (1472003888.113, 3.6353175208542288, 3.0511128867707358), (1472003909.034, 3.690630543381096, 3.1800378500390614), (1472003931.374, 3.6436768750462423, 3.137680678326049), (1472003952.891, 3.7077275812224495, 3.1744759909836993), (1472003974.553, 3.7440903794997613, 2.9854813342721314), (1472003996.152, 3.606457733536678, 2.9246613755278488), (1472004017.272, 3.6437820537750434, 3.042293987703924), (1472004038.431, 3.595408472601376, 3.1326787413560533), (1472004059.371, 3.7720341699776805, 3.085705367996056), (1472004081.653, 3.765526432362096, 3.176547551232805), (1472004104.393, 3.7811768702244946, 3.175510508885336), (1472004127.071, 3.720278386248768, 3.025848232891804), (1472004148.891, 3.669888356162492, 3.2213191029388035), (1472004170.112, 3.6605415777851698, 3.107192946022305), (1472004193.612, 3.7314171275951384, 3.098122107261536), (1472004215.972, 3.7183482780836825, 3.148257601469729), (1472004236.671, 3.6160705983995487, 3.1305622459711513), (1472004258.534, 3.667250253867717, 3.2467150280009602), (1472004280.432, 3.652180653761384, 3.2335152056386343), (1472004303.052, 3.6863056568460735, 2.994242171084826), (1472004323.352, 3.7184895629432657, 2.876959447100959), (1472004345.274, 3.707796653820468, 3.19817548844727), (1472004367.912, 3.614074557299992, 3.0996064814102984), (1472004388.13, 3.6119168235277996, 3.2089594161491104), (1472004409.311, 3.6971947949405135, 3.0614434240012884), (1472004432.173, 3.7098900244899613, 3.1867246021568185), (1472004453.036, 3.654358795346627, 3.191443801193717), (1472004474.172, 3.6996021319646366, 3.190414332183742)], dtype=[('time', '<f8'), ('emith', '<f8'), ('emitv', '<f8')])
what slots do we have?
print sorted(bsrt.emit.keys())
[50.0, 62.0, 74.0, 86.0, 300.0, 312.0, 324.0, 336.0, 550.0, 562.0, 574.0, 586.0, 800.0, 812.0, 824.0, 836.0, 1050.0, 1062.0, 1074.0, 1086.0, 1300.0, 1312.0, 1324.0, 1336.0, 1550.0, 1562.0, 1574.0, 1586.0, 1800.0, 1812.0, 1824.0, 1836.0, 2050.0, 2062.0, 2074.0, 2086.0, 2300.0, 2312.0, 2324.0, 2336.0, 2550.0, 2562.0, 2574.0, 2586.0, 3100.0, 3112.0, 3124.0, 3136.0]
We can plot the emittance
plt.figure()
bsrt.plot(plane='v',t1=t1,t2=t2,slots=None,avg=None,fit=False)
<pytimber.LHCBSRT.BSRT at 0x7f038a634c50>
... and we can also perform a moving average over the data
plt.figure()
bsrt.plot(plane='h',t1=t1,t2=t2,slots=None,avg=10,fit=False)
<pytimber.LHCBSRT.BSRT at 0x7f038a634c50>
... or plot only specific slots
plt.figure()
bsrt.plot(plane='h',t1=t1,t2=t2,slots=[50,62],avg=10,fit=False)
<pytimber.LHCBSRT.BSRT at 0x7f038a634c50>
fit the emittance between tstart and tend
tstart=pytimber.parsedate("2016-08-24 03:45:00.000")
tend=pytimber.parsedate("2016-08-24 04:00:00.000")
The raw data can be also fitted with an exponential:
$\epsilon(t) = \epsilon_0\cdot e^{((t-t_{\rm start})/\tau)}$
plt.figure()
bsrt.plot(plane='h',t1=tstart,t2=tend,slots=[50,62],avg=10,fit=True)
<pytimber.LHCBSRT.BSRT at 0x7f038a634c50>
The fit data from tstart to tend ist then stored in bsrt.emitfit.
bsrt.emitfit
{50.0: {(1472003100.0, 1472004000.0): array([ (3.5928334023523734, 0.020034148758304234, 39632.274935301924, 16919.18929755318, 3.0106486627690368, 0.03002051965976216, -39470762976.68924, 2.846364729140598e+16)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 62.0: {(1472003100.0, 1472004000.0): array([ (3.316320676641235, 0.02158718678745798, 23753.62839620362, 7065.566806834086, 2.929940467848238, 0.04620767392611412, -2554376289.8299246, 101580394750299.47)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 74.0: {(1472003100.0, 1472004000.0): array([ (3.7493134700335373, 0.021310482083194436, 25235.689328307984, 6972.488774727582, 3.258549310783138, 0.036683457023379336, -50091034928.459885, 3.0828561352057228e+16)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 86.0: {(1472003100.0, 1472004000.0): array([ (3.5076763279112186, 0.02003223853676773, 38862.96198627122, 16656.411946851393, 3.1474372016042653, 0.033471282979469656, -18461811249.076477, 4315743136123330.0)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 300.0: {(1472003100.0, 1472004000.0): array([ (3.5551710001625163, 0.018638130565284766, 20397.543538716505, 4193.945903752842, 2.956680179106226, 0.03858813465287535, 9647.071630351238, 2307.257201032013)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 312.0: {(1472003100.0, 1472004000.0): array([ (3.3272492007604684, 0.017008038466323903, 26017.942605108474, 6664.06860190947, 2.8284377058095407, 0.03968296476739004, 8047.715496657623, 1716.8992111007783)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 324.0: {(1472003100.0, 1472004000.0): array([ (3.4516057736971253, 0.02324454501096096, 26231.681931296196, 8930.39708945736, 2.9730692733360344, 0.03325258022060418, 8847.28815122243, 1659.455266961581)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 336.0: {(1472003100.0, 1472004000.0): array([ (3.5214199155687225, 0.01793382919518763, 23754.550548377523, 5530.4409084559775, 3.130537005207759, 0.03330901978631897, 11101.393718158217, 2496.8195526037384)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 550.0: {(1472003100.0, 1472004000.0): array([ (3.7262686860574044, 0.01566558367976612, 38223.71163869721, 12173.336710210933, 3.2476499012724567, 0.04030576806362806, 7073.17811570643, 1200.2118701458373)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 562.0: {(1472003100.0, 1472004000.0): array([ (3.363393223748893, 0.0217155150694788, 22681.940468196764, 6553.215837222005, 3.0394962415790756, 0.03800198556632486, 6409.771684956372, 989.3085688289834)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 574.0: {(1472003100.0, 1472004000.0): array([ (3.4342104075821878, 0.022897788574458476, 24948.142045893164, 8187.958607409894, 3.1404591424714607, 0.031785231348558984, 6584.184220670871, 845.1697097180604)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 586.0: {(1472003100.0, 1472004000.0): array([ (3.38805888578514, 0.017598253802034117, 29473.392246585572, 8924.934185275833, 3.149625655721301, 0.03468944553084933, 5405.199859975974, 616.1951525170105)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 800.0: {(1472003100.0, 1472004000.0): array([ (3.2957745279900434, 0.018150608489676118, 23807.64039660748, 6157.336662974349, 2.934128303784925, 0.032779882143346255, 5141.478253100029, 563.8641820321784)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 812.0: {(1472003100.0, 1472004000.0): array([ (3.350720073672052, 0.017936895137278062, 14244.798825926731, 2131.3910590614755, 3.1135052530086194, 0.0353718400322795, 5171.318759330595, 580.7562845744162)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 824.0: {(1472003100.0, 1472004000.0): array([ (3.3815506148468706, 0.015668735159987412, 18658.118270251307, 3174.5741340802056, 3.053982795179427, 0.03926577180786348, 4567.066659060076, 509.5643906891776)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 836.0: {(1472003100.0, 1472004000.0): array([ (3.400736587068976, 0.010655545214312218, -154721993338.8391, 1.1662357791283582e+17, 3.022692290404258, 0.037900398775531176, 4486.478814799475, 479.63136450108067)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1050.0: {(1472003100.0, 1472004000.0): array([ (3.4765063834249528, 0.016057179820533292, 27992.75463160334, 7152.210453096445, 3.0289588673503642, 0.038512409917713916, 4293.955611558469, 444.26357279824805)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1062.0: {(1472003100.0, 1472004000.0): array([ (3.458043402814813, 0.021059180020883358, 20856.17615850709, 5225.402533626201, 3.1052891698204688, 0.04065571188135357, 4175.970513793839, 432.462130365034)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1074.0: {(1472003100.0, 1472004000.0): array([ (3.3241120427432795, 0.018944196914613454, 24422.925083527218, 6710.3734272468955, 3.066741700786719, 0.039855838021950855, 4440.458469260857, 486.40619098056555)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1086.0: {(1472003100.0, 1472004000.0): array([ (3.2869837232747408, 0.019071280043461803, 18534.344942566033, 3927.8094713886153, 3.0879682538015043, 0.047292423738654214, 4105.191702223589, 488.6257533429431)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1300.0: {(1472003100.0, 1472004000.0): array([ (3.5768123875855493, 0.017569469901178948, 55594.8576137187, 30133.306506853114, 3.1716631160429882, 0.04849087149568402, 4005.562677204029, 463.4671381650088)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1312.0: {(1472003100.0, 1472004000.0): array([ (3.226631762089064, 0.019185449675584065, 22114.67451280629, 5592.142705052591, 2.9897127998224984, 0.04210505935937543, 3667.2569799385446, 346.8330148417884)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1324.0: {(1472003100.0, 1472004000.0): array([ (3.3944394295970786, 0.019483364691299764, 26791.890926200613, 7931.122743041881, 3.1049904593521, 0.04393159228337751, 3817.8355637089385, 378.1627239554724)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1336.0: {(1472003100.0, 1472004000.0): array([ (3.31533683458793, 0.01819155663645797, -62237297752.028275, 3.250636388256429e+16, 3.1274383490680124, 0.05438602951394136, 4123.682199249209, 544.1269311369464)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1550.0: {(1472003100.0, 1472004000.0): array([ (3.5428315357502447, 0.0165236873917579, 25707.61499125673, 5932.961601463713, 3.2738216436770426, 0.04108439421765892, 16183.927045619272, 6294.227665544336)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1562.0: {(1472003100.0, 1472004000.0): array([ (3.1671395301358856, 0.015024318432037043, 39855.42152689988, 14533.816796142568, 3.2229542534673565, 0.026747271293845732, 20387.487579058452, 6618.397398801809)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1574.0: {(1472003100.0, 1472004000.0): array([ (3.39998403022378, 0.019396249738867617, 43279.93233388555, 20642.243730198785, 3.4692886106472285, 0.042462519263315374, 154505.84141576872, 565356.9061575917)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1586.0: {(1472003100.0, 1472004000.0): array([ (3.2374346040249997, 0.0165331892601767, 20411.339092792918, 4083.350301773396, 3.5706185377740987, 0.03759526488094949, 23728.22516806526, 11394.864440020674)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1800.0: {(1472003100.0, 1472004000.0): array([ (3.4411687521384895, 0.017924302290927327, 22311.681181376705, 4986.305379782021, 3.0629000904824544, 0.035865961782028305, 8109.158034807771, 1455.1374010459147)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1812.0: {(1472003100.0, 1472004000.0): array([ (3.2595546282298797, 0.0188278551607702, 24220.395112704584, 6513.624584198035, 3.0229647624445968, 0.040020609248132694, 7140.10742578774, 1269.42777065597)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1824.0: {(1472003100.0, 1472004000.0): array([ (3.4752672696340765, 0.02063466752948162, 29036.264510213223, 9650.265841635266, 3.27875928732842, 0.036618082974114924, 9596.555748451212, 1952.2393105946796)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 1836.0: {(1472003100.0, 1472004000.0): array([ (3.4500173829689924, 0.013286585979858432, -146636717350.0999, 1.1187522816737979e+17, 3.438547139877014, 0.03839230983403442, 27198.210390398694, 15900.762003030539)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2050.0: {(1472003100.0, 1472004000.0): array([ (3.472445635986763, 0.01353481080303811, -40325465456.60341, 1.2719321080824248e+16, 3.484882866956341, 0.035928636265734386, 6937.564802996959, 933.7698496766958)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2062.0: {(1472003100.0, 1472004000.0): array([ (3.433427877669568, 0.01137898318326973, -187343573236.61847, 1.0496006420403461e+17, 3.7687256148581105, 0.04243052303170006, 7294.509919327176, 1128.076887820335)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2074.0: {(1472003100.0, 1472004000.0): array([ (3.31331918352463, 0.013572726343436543, -323520582134.9989, 2.6130299876635846e+17, 3.7295050986152365, 0.044819241856481035, 9226.918458182512, 1940.5808091913207)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2086.0: {(1472003100.0, 1472004000.0): array([ (3.4018182805803816, 0.01849197575995004, 34876.59191538919, 12758.438755308594, 4.075252124646128, 0.04605665194197405, 8311.64821577782, 1476.1403518227876)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2300.0: {(1472003100.0, 1472004000.0): array([ (3.515906593044806, 0.016566698835885206, 24981.500588765346, 5663.83592764705, 3.525086085028626, 0.03973770190568445, 6272.903969330819, 832.1838829177749)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2312.0: {(1472003100.0, 1472004000.0): array([ (3.302968753266539, 0.013228327136781253, -116301400953.1485, 7.213101467675547e+16, 3.6269778632310934, 0.047898185775951466, 6463.1593506401005, 1035.4289905052372)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2324.0: {(1472003100.0, 1472004000.0): array([ (3.2627411337249934, 0.021310207248315997, 35304.77638995329, 15725.304396052983, 3.5810074249260007, 0.04454615741686583, 5363.630218909567, 667.69098657878)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2336.0: {(1472003100.0, 1472004000.0): array([ (3.1437352348764946, 0.020290544735994995, 34391.932411574955, 14730.76903653807, 3.732954058492442, 0.043018319903558484, 5440.061569232445, 636.12099171227)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2550.0: {(1472003100.0, 1472004000.0): array([ (3.305429973331156, 0.01875646205657223, 22856.99481220904, 5709.008849499278, 3.076748790193756, 0.03634252658804373, 4587.101442269497, 460.8083429721794)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2562.0: {(1472003100.0, 1472004000.0): array([ (3.526977831954576, 0.018696845727149764, 58240.6455200024, 34799.58052718536, 3.451905766906625, 0.0495598798324365, 5434.836780284352, 791.1319167377387)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2574.0: {(1472003100.0, 1472004000.0): array([ (3.4624381005863536, 0.010720723136000176, -185505666805.1015, 1.4243011534538355e+17, 3.4072933739890097, 0.04938356840296929, 4634.21196672999, 576.3962025842751)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 2586.0: {(1472003100.0, 1472004000.0): array([ (3.4270528930033066, 0.02074171083289148, 18847.590049388637, 4128.71890905838, 3.618367256406804, 0.04707041372409042, 5521.118023736918, 740.4660126748913)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 3100.0: {(1472003100.0, 1472004000.0): array([ (3.4106810171992623, 0.02094918842864698, 18343.803903615335, 3965.3456249168344, 3.0384781212921346, 0.03397570302934537, 17347.48939585438, 6451.2740110455)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 3112.0: {(1472003100.0, 1472004000.0): array([ (3.4797583728121526, 0.01863950949113955, 27072.62497822704, 7554.991075530625, 3.27356090754137, 0.03755287000590452, 19424.35296674403, 8298.945256691097)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 3124.0: {(1472003100.0, 1472004000.0): array([ (3.2640565576668887, 0.019631490216254873, 30906.686048711745, 11082.497679229196, 3.132636356509098, 0.03430343080090785, 37912.01613371549, 30393.942433732733)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}, 3136.0: {(1472003100.0, 1472004000.0): array([ (3.2654137853129, 0.023239667057800166, 36306.899998730216, 18104.83786522653, 3.376407414685584, 0.04318542057801505, -18161944905.37918, 5386592284921717.0)], dtype=[('ah', '<f8'), ('sigah', '<f8'), ('tauh', '<f8'), ('sigtauh', '<f8'), ('av', '<f8'), ('sigav', '<f8'), ('tauv', '<f8'), ('sigtauv', '<f8')])}}
For each (tstart,tend) the fitting data is stored in this dictionary. This means you can e.g. fit your data from [t0,t1], [t1,t2], etc., plot the complete data and then plot the individual fits on top.
t0fit=pytimber.parsedate("2016-08-24 03:34:00.000")
t1fit=pytimber.parsedate("2016-08-24 03:46:00.000")
t2fit=pytimber.parsedate("2016-08-24 03:50:00.000")
t3fit=pytimber.parsedate("2016-08-24 03:57:00.000")
t4fit=pytimber.parsedate("2016-08-24 04:08:00.000")
Here we perform the fit. The function bsrt.plot(..., fit=True) and bsrt.plot_fit() automatically generate this data, if no entry for the desired timestamp is found in bsrt.emitfit. Just to show it, we use here the underlying function bsrt.fit.
for ts,te in [[t0fit,t1fit],[t1fit,t2fit],[t2fit,t3fit],[t3fit,t4fit]]:
bsrt.fit(ts,te,force=True)
and now we can do the plot
plt.figure()
for slot,c in zip([1062,1074],['b','r']):
# plot the averaged data
bsrt.plot(plane='v',t1=t0fit,t2=t4fit,slots=slot,avg=None,fit=False,color=c)
# now add the fit data with a black line
for ts,te in [[t0fit,t1fit],[t1fit,t2fit],[t2fit,t3fit],[t3fit,t4fit]]:
bsrt.plot_fit(plane='v',t1=ts,t2=te,slots = slot, color=c)