In [9]:
from numpy import *
from os import path, listdir
import plotly.plotly as py
from plotly.graph_objs import *
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
from myfunctions import analyze, plotS21
In [32]:
def plot_disp_shift(sample):
datapath = '\\\\128.230.72.36\labshare\Experiments\JPM\\' + sample
files = listdir(datapath)
data = []
layout = dict(
title="Dispersive shift of " + sample,
xaxis=dict(title="Frequency (GHz)"),
yaxis=dict(title="S21 (dB)"),
annotations = []
)
for f in files:
if f.endswith('.s2p'):
result = analyze(path.join(datapath, f));
data.append(Scatter(
x = result['freq'],
y = result['dBm'],
name = f))
descr = "$F_0 = " + str(round(result['f0']/1e9, 6)) + "\\text{GHz}\quad "
descr = descr + "Q = " + str(round(result['Q'], 3)) + "\quad "
descr = descr + "\kappa = " + str(round(result['kappa']/(2*pi*1e6), 3)) + "\\text{MHz}$"
layout['annotations'].append(dict(
text=descr,
x=result['f0'],
y=max(result['dBm']),
xref='x',
yref='y'))
fig = Figure(data=data, layout=layout)
iplot(fig)
In [33]:
plot_disp_shift("CH002")
In [31]:
plot_disp_shift("CH003")
In [ ]: