Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _plot_dataset(dataset, fig):
plt.figure(fig); plt.clf()
m=qcodes.MatPlot(dataset.default_parameter_array(), num=fig)
return m
print('analyse_awg_to_plunger: calculated angle: ? [deg]' )
else:
print('analyse_awg_to_plunger: calculated angle: %.3f [deg]' % np.rad2deg(angle))
if angle is None:
result['awg_to_plunger_correction'] = None
else:
scanratio = tr.istep_step()/tr.istep_sweep()
if verbose>=2:
print('analyse_awg_to_plunger: scanratio: %.3f' % scanratio)
result['awg_to_plunger_correction'] = np.tan(angle)
if fig is not None:
plt.figure(fig)
plt.clf()
MatPlot(ds.default_parameter_array(), num=fig)
if 0:
yy = []
for ii in np.arange(-1, 2):
theta = angle_pixel
c = np.cos(theta)
s = np.sin(theta)
xpix = np.array([[-s*ii], [c*ii]])
tmp = qtt.pgeometry.projectiveTransformation(
np.linalg.inv(H), xpix)
xscan = tr.pixel2scan(tmp)
yy += [xscan]
if xscan is not None:
v = xscan
rho = v[0]*np.cos(angle)-np.sin(angle)*v[1]
"""
if not result.get('type', None)=='awg_to_plunger':
raise Exception('calibration result not of correct type ')
angle = result['angle']
ds = get_dataset(result)
im, tr = qtt.data.dataset2image(ds)
xscan = tr.pixel2scan(np.array([[0],[0]]))
plt.figure(fig)
plt.clf()
MatPlot(ds.default_parameter_array(), num=fig)
if angle is not None:
rho = -(xscan[0]*np.cos(angle)-np.sin(angle)*xscan[1])
for offset in [-20, 0, 20]:
label = None
if offset is 0:
label = 'detected angle'
qtt.pgeometry.plot2Dline(
[np.cos(angle), -np.sin(angle), rho+offset], '--m', alpha=.6, label=label)
plt.title('Detected line direction')
Args:
afit (dict): fit data from fit_anticrossing
ds (None or DataSet): dataset to show
fig (int): index of matplotlib window
linewidth (integer): plot linewidth, default = 2
Returns:
-
"""
fitpoints = afit['fitpoints']
plt.figure(fig)
plt.clf()
if ds is not None:
MatPlot(ds.default_parameter_array('diff_dir_g'), num=fig)
cc = fitpoints['centre']
plt.plot(cc[0], cc[1], '.m', markersize=12, label='fit centre')
lp = fitpoints['left_point']
hp = fitpoints['right_point']
op = fitpoints['outer_points'].T
ip = fitpoints['inner_points'].T
plt.plot([float(lp[0]), float(hp[0])], [float(lp[1]), float(hp[1])], '.--m',
linewidth=linewidth, markersize=10, label='transition line')
for ii in range(4):
if ii == 0:
lbl = 'electron line'
else:
lbl = None
plt.plot([op[ii, 0], ip[ii, 0]], [op[ii, 1], ip[ii, 1]], '.-',
def plot_pinchoff(result, ds=None, fig=10, verbose=1):
""" Plot result of a pinchoff scan """
if ds is None:
ds = qtt.data.get_dataset(result)
if not result.get('type', 'none') in ['gatesweep', 'pinchoff']:
raise Exception('calibration result of incorrect type')
if fig is not None:
plt.figure(fig)
plt.clf()
qcodes.MatPlot(ds.default_parameter_array(), num=fig)
lowvalue = result['lowvalue']
highvalue = result['highvalue']
pinchoff_point = result['pinchoff_point']
midpoint = result['midpoint']
midvalue = result['midvalue']
plot2Dline([0, -1, lowvalue], '--c', alpha=.5, label='low value')
plot2Dline([0, -1, highvalue], '--c', alpha=.5, label='high value')
plot2Dline([-1, 0, midpoint], ':m', linewidth=2, alpha=0.5, label='midpoint')
if verbose >= 2:
plt.plot(midpoint, midvalue, '.m', label='midpoint')
plot2Dline([-1, 0, pinchoff_point], '--g', linewidth=1, alpha=0.5, label='pinchoff_point')
#%%
if 0:
scanjob = dict({'sweepdata': dict({'gate': 'R', 'start': -420, 'end': 220, 'step': 2.5}), 'delay': .01})
data = scan1D(scanjob, station, location='testsweep4')
plotQ.add(data.amplitude)
#%%
plotQ.add(np.array(data.amplitude) + .2)
#%%
datax = qc.DataSet('testsweep3', mode=qcodes.DataMode.LOCAL)
fig = qc.MatPlot(datax.amplitude)
import pmatlab
pmatlab.tilefigs([fig.fig], [2, 2])
#%%
if __name__ == '__main__':
scanjob = dict({'sweepdata': dict({'gate': 'R', 'start': 220, 'end': -220, 'step': 3.5}), 'delay': .01})
data = scan1D(scanjob, station, location=None, qcodesplot=plotQ)
print(data)
if __name__ == '__main__':
dd = data