<jupyter_start><jupyter_text>Example of extracting the lever arm and the charging energy from bias triangles and addition lines Authors: <NAME> and <NAME>More details on non-equilibrium charge stability measurements can be found in https://doi.org/10.1103/RevModPhys.75.1 (section B) and https://doi.org/10.1063/1.3640236The core functions used in the example are `perpLineIntersect`, `lever_arm` and `E_charging`. Input needed for the code are the non-equilibrium charge stability diagrams of a 1,0-0,1 interdot transition for the lever arm, and a charge stability diagram with the 0-1 and 1-2 charge transitions.<jupyter_code>%matplotlib inline
import os, sys
import qcodes
import qtt
import matplotlib.pyplot as plt
import numpy as np

from qcodes.plots.qcmatplotlib import MatPlot
from qcodes.data.data_set import DataSet
from qtt.data import diffDataset
from qtt.algorithms.bias_triangles import perpLineIntersect, lever_arm, E_charging<jupyter_output><empty_output><jupyter_text>Load datasets<jupyter_code>exampledatadir=os.path.join(qtt.__path__[0],'exampledata','misc')
DataSet.default_io = qcodes.data.io.DiskIO(exampledatadir)
dataset_anticrossing = qcodes.data.data_set.load_data(os.path.join(exampledatadir, r'Lever_arm_Charging_energy', '14-28-52_qtt_scan2Dfast'))
dataset_la = qcodes.data.data_set.load_data(os.path.join(exampledatadir, r'Lever_arm_Charging_energy', '14-33-26_qtt_scan2Dfast'))
dataset_Ec = qcodes.data.data_set.load_data(os.path.join(exampledatadir, r'Lever_arm_Charging_energy', '10-06-59_qtt_scan2Dfast'))<jupyter_output><empty_output><jupyter_text>First, make a double dot and find the (1,0) -- (0,1) anticrossing:<jupyter_code>plt.figure(1); plt.clf()
MatPlot([dataset_anticrossing.measured], num = 1)
_=plt.suptitle('Anti crossing (1,0)--(0,1)')<jupyter_output><empty_output><jupyter_text>Then, apply a bias across the Fermi reservoirs (in the example -800 uV) and scan the anti crossing again. This non-equilibrium regime shows "bias triangles", which can be used to extract the gate-to-dot lever arms. More information on these measurements can be found in the references cited in the introduction of this example.<jupyter_code>plt.figure(1); plt.clf()
MatPlot([dataset_la.measured], num = 1)
_=plt.suptitle('Bias triangle')<jupyter_output><empty_output><jupyter_text>Lever arm The function perpLineIntersect guides you through the process of extracting the lever arm from the bias triangles. To do this, you must include description = 'lever_arm' as input to the function.The function instructs you to click on 3 points in the figure. Point 1 and 2 along the addition line for the dot of which you want to determine the lever arm, the third point on the triple point where both dot levels and reservoir are aligned. The perpLineIntersect function will return a dictionary containing the coordinates of these three points, the intersection point of a horizontal/vertical line of the third point with the (extended) line through point 1 and 2 and the line length from the third point to the intersection.It is important to set the vertical input based on the dot for which the lever arm is being measured. vertical = True (False) to measure the lever arm of the gate in vertical (horizontal) axis.NB: perpLineIntersect makes use of clickable interactive plots. However, the inline plots in this notebook are not interactive, therefore, in this example we provide the function the clicked points as an input. If you want to try and click, restart the notebook and please use '%pylab tk' instead of '%matplotlib inline' and remove the points input from the function call.<jupyter_code>dot = 'P5'

if dot == 'P4':
    vertical = False
elif dot == 'P5':
    vertical = True
else:
    print("Please choose either dot 4 or dot 5")

clicked_pts = np.array([[  24.87913077,   38.63388728,   40.44875099],
       [ 135.28934654,  128.50469446,  111.75508464]])

lev_arm_fit = perpLineIntersect(dataset_la, description = 'lever_arm', vertical = vertical, points = clicked_pts)<jupyter_output>Please click three points;
            Point 1: on the addition line for the dot represented on the vertical axis
            Point 2: further on the addition line for the dot represented on the vertical axis
            Point 3: on the triple point at the addition line for the dot represented on the horizontal axis
            where both dot levels are aligned<jupyter_text>Determine the lever arm ($\mu$V/mV) by dividing the applied bias for the bias triangles by the voltage span determined by perpLineIntersect<jupyter_code>bias = dataset_la.snapshot()['allgatevalues']['O5'] # bias voltage extracted from the dataset
print(bias)
lev_arm = lever_arm(bias, lev_arm_fit, fig = True)
print('''The lever arm of gate %s to dot %s is %.2f ueV/mV'''%(dot, dot[1], lev_arm))<jupyter_output>-800
The lever arm of gate P5 to dot 5 is 50.46 ueV/mV<jupyter_text>Extract addition energyOnce the lever arm is known, the addition energy can be extracted from a charge stability diagram showing 2 addition lines. Again, use the function perpLineIntersect, this time using description = 'E_charging'. The function instructs you to click on the 3 relevant points from which the distance between the 2 addition lines can be measured, and converted to meV using the lever arm.<jupyter_code>plt.figure(3); plt.clf()
MatPlot([dataset_Ec.measured], num = 3)
ax = plt.gca()
_=plt.suptitle('Addition lines') 
clicked_pts = np.array([[ -11.96239499,   24.89272409,    2.56702695],
        [ 202.62140281,  181.56972616,  142.246783  ]])

Ec_fit = perpLineIntersect(dataset_Ec, description = 'E_charging', vertical = vertical, points = clicked_pts)
E_c = E_charging(lev_arm, results = Ec_fit, fig = True)
print('The charging energy of dot %s is %.2f meV' % (dot[1], E_c/1000))<jupyter_output>The charging energy of dot 5 is 2.63 meV
{'fraction_non_alphanumeric': 0.08249013891270794, 'fraction_numerical': 0.03961584633853541, 'mean_word_length': 5.230769230769231, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '13365', 'license': 'MIT', 'n_tokens_mistral': 1934, 'n_tokens_neox': 1770, 'n_words': 680, 'path': 'docs/notebooks/analysis/example_lever_arm_charging_energy.ipynb', 'repo_name': 'philomathie/qtt', 'size': '5853'}