qtt.algorithms package

Methods for analysis of quantom dots and spin-qubits

Submodules

qtt.algorithms.anticrossing module

Functions to analyse anti-crossings in charge stability diagrams.

Created on Wed Jul 12 08:08:57 2017

@author: diepencjv / eendebakpt

qtt.algorithms.anticrossing.fit_anticrossing(dataset, width_guess=None, angles_guess=None, psi=None, w=2.5, diff_dir='dx', plot=False, verbose=1, param={})[source]

Fits an anti-crossing model to a 2D scan.

The model fitted is without tunnel coupling.

Parameters:
  • dataset (qcodes dataset) – the 2D scan measurement dataset
  • width_guess (None or float) – Initial estimate for width of anti-crossing in the same unit as the dataset axis.
  • angles_guess (None or float) – Initial estimate for angles of anti-crossing in radians
  • psi (None or float) – angle for cross section of anti-crossing
  • w (float) – Width of lines in anti-crossing model
  • diff_dir (str) – differentiation direction
  • plot (int) – If non-zero, then plot into specified matplotlib window
  • verbose (int) – verbosity level
  • param (dict) – additional parameters
Returns:

(dict) the parameters describing the fitted anti-cross

optionally the cost for fitting and the figure number

Return type:

anticross_fit

The main fields in the result structure are:

  • centre (2x1 array): position of the fitted anti-crossing
  • fit_params (array): fitting parameters of the model. See fitModel()
  • fitpoints (dict): a dictionary with fitted points. centre is the centre point; left_point and right_point are the corners
    of the anti-crossing. the four lines outwards are define by inner_points and outer_points
qtt.algorithms.anticrossing.plot_anticrossing(ds, afit, fig=100, linewidth=2)[source]

Plot fitted anti-crossing on dataset.

Parameters:
  • 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:

qtt.algorithms.awg_to_plunger module

Functionality to determine the awg_to_plunger ratio.

pieter.eendebak@tno.nl

qtt.algorithms.awg_to_plunger.analyse_awg_to_plunger(result, method='hough', fig=None)[source]
Determine the awg_to_plunger conversion factor from a 2D scan, two possible methods: ‘hough’ it fits the slope
of the addition line and calculates the correction to the awg_to_plunger conversion factor from there. if this doesn’t work for some reason, method ‘click’ can be used to find the addition lines by hand/eye.
Parameters:
  • result (dic) – result dictionary of the function measure_awg_to_plunger, shape: result = {‘type’: ‘awg_to_plunger’, ‘awg_to_plunger’: None, ‘dataset’: ds.location}.
  • method (str) – either ‘hough’ or ‘click’.
  • fig (int or None) – determines of the analysis staps and the result is plotted.
Returns:

including to following entries:

angle (float): angle in radians. angle_degrees (float): angle in degrees. correction of awg_to_plunger (float): correction factor. dataset (str): location where the dataset is stored. type(str): type of calibration, ‘awg_to_plunger’.

Return type:

result (dict)

qtt.algorithms.awg_to_plunger.click_line(fig=None)[source]

Define a line through two points. The points are choosen by clicking on a position in a plot, two times.

Parameters:fig (int or None) – number of figure to plot the points in, when None it will plot a figure.
Returns:offset of the line. slope (float): slope of the line.
Return type:offset (float)
qtt.algorithms.awg_to_plunger.get_dataset(ds)[source]

Get a dataset from a results dict, a string or a dataset.

Parameters:ds (dict, str or qcodes.DataSet) – the data to be put in the dataset.
Returns:ds (qcodes.DataSet) dataset made from the input data.
qtt.algorithms.awg_to_plunger.measure_awg_to_plunger(station, gate, minstrument, scanrange=30, step=0.5)[source]

Performing a scan2Dfast measurement, same gate on both axis, where the one axis is sweeped with the awg and one axis is stepped with the DAC’s. Measurement should be centred around an addition line. From the slope of the addition line the awg to plunger conversion factor can be checked with the function analyse_awg_to_plunger.

Parameters:
  • station (QCoDeS station) – measurement setup.
  • gate (str) – gate for which the awg to plunger conversion.
  • minstrument (str, int) – list with the name of the measurement instrument (str), and the channel number (int).
  • scanrange (float) – sweep- and steprange (mV), making a square 2d measurement.
  • step (float) – stepsize (mV).
Returns:

resultresult (dic): result dictionary of the function measure_awg_to_plunger,

shape: result = {‘type’: ‘awg_to_plunger’, ‘awg_to_plunger’: None, ‘dataset’: ds.location}.

Return type:

result (dict)

qtt.algorithms.awg_to_plunger.plot_awg_to_plunger(result, fig=10)[source]

This function tests the analyse_awg_to_plunger function. Plotting is optional and for debugging purposes.

Parameters:
  • result (dict) – result dictionary from the analyse_awg_to_plunger function.
  • fig (int) – index of matplotlib window.

qtt.algorithms.bias_triangles module

Functionality to analyse bias triangles

@author: amjzwerver

qtt.algorithms.bias_triangles.E_charging(lev_arm, results, fig=None)[source]

Calculates the charging energy of a dot by using charge stability diagrams. Uses currently active figure.

Parameters:
  • lev_arm (float) – lever arm for the gate to the dot.
  • results – dictionary returned from the function perpLineIntersect containing three points, the intersection point between a line through 1,2 and the third point and the length from points 3 to the intersection (horz/vert).
Returns:

the charging energy for the dot.

Return type:

E_charging (float)

qtt.algorithms.bias_triangles.lever_arm(bias, results, fig=None)[source]

Calculates the lever arm of a dot by using bias triangles in charge sensing. Uses currently active figure.

Parameters:
  • bias (float) – bias in uV between source and drain while taking the bias triangles.
  • results (dict) – dictionary returned from the function perpLineIntersect containing three points, the intersection point between a line through 1,2 and the third point and the length from points 3 to the intersection (horz/vert).
  • fig (bool) – adds lever arm to title of already existing figure with points.
Returns:

the lever arm of the assigned dot in uV/mV.

Return type:

lev_arm (float)

qtt.algorithms.bias_triangles.perpLineIntersect(ds, description, vertical=True, points=None, fig=588, diff_dir='xy')[source]

Takes three points in a graph and calculates the length of a linepiece between a line through points 1,2 and a vertical/horizontal line through the third point. Uses the currently active figure.

Parameters:
  • ds (dataset) – dataset with charge stability diagram and gate voltage in mV.
  • description – TODO
  • vertical (bool) – find intersection of point with line vertically (True) or horizontally (False).
  • points (None or array) – if None, then let the user select points.
  • fig (int) – figure number.
  • diff_dir (None or 'xy') – specification of differentiation direction.
Returns:

‘intersection_point’ = intersection point

’distance’ = length of line from 3rd clicked point to line through clicked points 1 and 2 ‘clicked_points’ = coordinates of the three clicked points

Return type:

(dict)

qtt.algorithms.bias_triangles.plotAnalysedLines(clicked_pts, linePoints1_2, linePt3_vert, linePt3_horz, linePt3_ints, intersect_point)[source]

Plots lines based on three points clicked.

Parameters:
  • clicked_pts (array) – lines between the three points (1-2), (2-3).
  • linePoints1_2 (array) – line fitted through points 1 and 2.
  • linePt3_vert (array) – vertical line through point 3.
  • linePt3_horz (array) – horizontal line through point 3.
  • linePt3_ints (array) – line through point 3 and its vert/horz intersection with the line through point 1,2.
  • intersect_point (array) – intersection point point 3, line1_2.

qtt.algorithms.chargesensor module

Analyse effect of sensing dot on fitting of tunnel barrier

@author: eendebakpt

class qtt.algorithms.chargesensor.DataLinearizer(xsr, ysr)[source]

Bases: object

backward_curve(y)[source]

Evaluate a B-spline, see documentation scipy.interpolate.splev

Parameters:y (array) – to be fitted curve
Returns:backward array representing the evaluated spline function
Return type:x (array)
forward(x)[source]

Apply fitted linear transformation to data

Parameters:x (array) – data to be fit
Returns:fitted data
Return type:y (array)
forward_curve(x)[source]

Evaluate a B-spline, see documentation scipy.interpolate.splev

Parameters:x (array) – to be fitted curve
Returns:array representing the evaluated spline function
Return type:y (array)
rectify(y)[source]

Rectify data

Parameters:y (array) –
Returns:corrected data
Return type:yc (array)
show(fig=100)[source]

Plots forward_curve vs. xsr

Parameters:fig (int) – index of matplotlib window
qtt.algorithms.chargesensor.correctChargeSensor(xscan, yscan, xs, ys, fig=None)[source]

Calculate correction for a non-linear charge sensor

Parameters:
  • yscan (xscan,) – data of scan to be corrected
  • ys (xs,) – scan of charge sensor response
Returns:

dictionary with intermediate results

Return type:

results (dict)

qtt.algorithms.coulomb module

Functions to fit and analyse Coulomb peaks

qtt.algorithms.coulomb.analyseCoulombPeaks(all_data, fig=None, verbose=1, parameters=None)[source]

Find Coulomb peaks in a 1D dataset

Parameters:
  • all_data (DataSet) – The data to analyse.
  • fig (int or None) – Figure handle to the plot.
  • parameters (dict) – dictionary with parameters that is passed to subfunctions
Returns:

fitted peaks

Return type:

peaks (list)

qtt.algorithms.coulomb.analyseCoulombPeaksArray(x_data, y_data, fig=None, verbose=1, parameters=None)[source]
Find Coulomb peaks in arrays of data. This is very similar to analyseCoulombPeaks,
but takes arrays of data as input. Hence the y_data can for example be either the I, Q or any combination of both obtained with RF reflectometry.
Parameters:
  • x_data (1D array) – The data of varied parameter.
  • y_data (1D array) – The signal data.
  • fig (None or int) – figure handle
  • parameters (dict) – dictionary with parameters that is passed to subfunctions
Returns:

The detected peaks.

Return type:

(list of dict)

qtt.algorithms.coulomb.analysePeaks(x, y, peaks, verbose=1, doplot=0, typicalhalfwidth=None, parameters=None, istep=None)[source]

Analyse Coulomb peaks

Parameters:
  • x,y – arrays with data data in mV
  • peaks – list of detected peaks to be analysed
  • typicalhalfwidth – float typical width of peak (half side) in mV (mV ??)
qtt.algorithms.coulomb.coulombPeaks(x_data, y_data, verbose=1, fig=None, plothalf=False, sampling_rate=None, parameters=None)[source]

Detects the Coulumb peaks in a 1D scan.

Parameters:
  • y_data (x_data,) – indep
  • verbose (int) –
  • fig (int or None) –
  • sampling_rate (float or None) – The sampling rate in in mV/pixel.
  • parameters (dict) – parameters passed to subfunctions
qtt.algorithms.coulomb.filterOverlappingPeaks(goodpeaks, threshold=0.6, verbose=0)[source]

Filter peaks based on overlap

qtt.algorithms.coulomb.filterPeaks(x, y, peaks, verbose=1, minheight=None)[source]

Filter the detected peaks

Parameters:
  • x (array) – independent variable data
  • y (array) – signal data
  • peaks (list) – list of peaks
Returns:

selected good peaks

Return type:

list

Filtering criteria are:

  • minimal height
  • overlapping of peaks
qtt.algorithms.coulomb.findBestSlope(x, y, minimal_derivative=None, fig=None, verbose=1)[source]

Find good slopes to use in sensing dot

Parameters:
  • x (array) – independent variable data
  • y (array) – dependent variable data
  • minimal_derivative (None or float) – minimal derivative
Returns:

slopes (…) results (object): additional data

qtt.algorithms.coulomb.findSensingDotPosition(x, y, verbose=1, fig=None, plotLabels=True, plotScore=True, plothalf=False, useslopes=True, sampling_rate=None, parameters=None)[source]

Find best position for sensing dot

Parameters:x,y (array) – data

verbose (int): output level

Returns:list of detected positions
Return type:goodpeaks (list)
qtt.algorithms.coulomb.fitCoulombPeaks(x_data, y_data, lowvalue=None, verbose=1, fig=None, sampling_rate=1)[source]

Fit Coulumb peaks in a measurement series.

Parameters:
  • x_data (1D array) – The data of varied parameter.
  • y_data (1D array) – The signal data.
  • sampling_rate (float) – The sampling rate in mV/pixel.
Returns:

A list with detected peaks.

Return type:

(list)

qtt.algorithms.coulomb.fitPeaks(XX, YY, points, fig=None, verbose=0)[source]

Fit Gaussian model on local maxima

Parameters:
  • XX (array) – independent variable data
  • YY (array) – dependent variable data
  • points (list) – indices of points to fit
  • fig (None or int) – if int, plot results
  • verbose – verbosity level
qtt.algorithms.coulomb.gauss(x, p)[source]

Gaussian function with parameters

Parameters:
  • x (array or float) – input variable
  • p (array) – parameters [mean, std. dev., amplitude]
Returns:

calculated Gaussian

Return type:

array or float

qtt.algorithms.coulomb.peakFindBottom(x, y, peaks, fig=None, verbose=1)[source]

Find the left bottom of a detected peak

Parameters:
  • x (array) – independent variable data
  • y (array) – signal data
  • peaks (list) – list of detected peaks
  • fig (None or int) – if integer, then plot results
  • verbose (int) – verbosity level
qtt.algorithms.coulomb.peakOverlap(p1, p2)[source]

Calculate overlap between two peaks or slopes

Parameters:
  • p1 (dict) – Peak object
  • p2 (dict) – Peak object
Returns:

A number representing the amount of overlap. 0: no overlap, 1: complete overlap

Return type:

float

qtt.algorithms.coulomb.peakScores(peaksx, x, y, hwtypical=10, verbose=1, fig=None)[source]

Calculate scores for list of peaks

Parameters:
  • x (array) – independent variable data
  • y (array) – dependent variable data
  • peaksx (list) – list with detected peaks
qtt.algorithms.coulomb.peakdataOrientation(x, y)[source]

For measured 1D scans order the data such that the independent variable is ordered

Parameters:
  • x (array) – independent variable data
  • y (array) – dependent variable data
Returns:

reordered data

Return type:

x,y (array)

qtt.algorithms.coulomb.plotPeaks(x, y, peaks, showPeaks=True, plotLabels=False, fig=10, plotScore=False, plotsmooth=True, plothalf=False, plotbottom=False, plotmarker='.-b')[source]

Plot detected peaks

Parameters:
  • x (array) – independent variable data
  • y (array) – dependent variable data
  • peaks (list) – list of peaks to plot
  • plotLabels, plotScore, plothalf (showPeaks,) – plotting options
Returns:

graphics handles

Return type:

dictionary

qtt.algorithms.coulomb.sort_peaks(peaks)[source]

Sort a list of peaks according to the score field

qtt.algorithms.coulomb.sort_peaks_inplace(peaks)[source]

Sort a list of peaks according to the score field

qtt.algorithms.fitting module

Fitting of Fermi-Dirac distributions.

qtt.algorithms.fitting.fitFermiLinear(x_data, y_data, verbose=0, fig=None, l=1.16, use_lmfit=False)[source]

Fit data to a Fermi-Linear function

Parameters:
  • x_data (array) – independent variable data
  • y_data (array) – dependent variable data
  • verbose (int) – verbosity (0 == silent). Not used
  • fig (int) – figure number
  • l (float) – leverarm passed to FermiLinear function
  • use_lmfit (bool) – If True use lmfit for optimization, otherwise use scipy
Returns:

fitted function parameters results (dict): extra fitting data

Return type:

p (array)

See also

FermiLinear

qtt.algorithms.fitting.fit_addition_line(dataset, trimborder=True)[source]

Fits a FermiLinear function to the addition line and finds the middle of the step.

Parameters:
  • dataset (qcodes dataset) – The 1d measured data of addition line.
  • trimborder (bool) – determines if the edges of the data are taken into account for the fit.
Returns:

x value of the middle of the addition line result_dict (dict): dictionary with the following results

fit parameters (array): fit parameters of the Fermi Linear function parameters initial guess (array): parameters of initial guess dataset fit (qcodes dataset): dataset with fitted Fermi Linear function dataset initial guess (qcodes dataset):dataset with guessed Fermi Linear function

Return type:

m_addition_line (float)

See also: FermiLinear and fitFermiLinear

qtt.algorithms.fitting.fit_addition_line_array(x_data, y_data, trimborder=True)[source]

Fits a FermiLinear function to the addition line and finds the middle of the step.

Note: Similar to fit_addition_line but directly works with arrays of data.

Parameters:
  • x_data (array) – independent variable data
  • y_data (array) – dependent variable data
  • trimborder (bool) – determines if the edges of the data are taken into account for the fit
Returns:

x value of the middle of the addition line pfit (array): fit parameters of the Fermi Linear function pguess (array): parameters of initial guess

Return type:

m_addition_line (float)

qtt.algorithms.fitting.initFermiLinear(x_data, y_data, fig=None)[source]

Initialization of fitting a FermiLinear function.

First the linear part is estimated, then the Fermi part of the function.

Parameters:
  • x_data (array) – data for independent variable
  • y_data (array) – dependent variable
  • fig (int) – figure number
Returns:

linear_part (array) fermi_part (array)

qtt.algorithms.functions module

Mathematical functions and models

qtt.algorithms.functions.Fermi(x, cc, A, T, kb=1)[source]

Fermi distribution

Parameters:
  • x (numpy array) – independent variable
  • cc (float) – center of Fermi distribution
  • A (float) – amplitude of Fermi distribution
  • T (float) – temperature Fermi distribution
  • (float, default (kb) – 1): temperature scaling factor
Returns:

value of the function

Return type:

y (numpy array)

\[y = A*(1/ (1+\exp( (x-cc)/(kb*T) ) ) )\]
qtt.algorithms.functions.FermiLinear(x, a, b, cc, A, T, l=1.16)[source]

Fermi distribution with linear function added

Parameters:
  • x (numpy array) – independent variable
  • b (a,) – coefficients of linear part
  • cc (float) – center of Fermi distribution
  • A (float) – amplitude of Fermi distribution
  • T (float) – temperature Fermi distribution in Kelvin
  • l (float) – leverarm divided by kb
The default value of the leverarm is
(100 ueV/mV)/kb = (100*1e-6*scipy.constants.eV )/kb = 1.16.

For this value the input variable x should be in mV, the temperature T in K. We input the leverarm divided by kb for numerical stability.

Returns:value of the function
Return type:y (numpy array)
\[y = a*x + b + A*(1/ (1+\exp( l* (x-cc)/(T) ) ) )\]
qtt.algorithms.functions.cost_exp_decay(x_data, y_data, params, threshold=None)[source]

Cost function for exponential decay.

Parameters:
  • x_data (array) – the data for the input variable
  • y_data (array) – the data for the measured variable
  • params (array) – parameters of the exponential decay function, [A,B, gamma]
  • threshold (float or None or 'auto') –
    if the difference between data and model is larger then the threshold,
    then the cost penalty is reduced.

    If None use normal cost function. If ‘auto’ use automatic detection (at 95th percentile)

Returns:

value which indicates the difference between the data and the fit

Return type:

cost (float)

qtt.algorithms.functions.cost_gauss_ramsey(x_data, y_data, params, weight_power=0)[source]

Cost function for gauss_ramsey.

Parameters:
  • x_data (array) – the data for the input variable
  • y_data (array) – the data for the measured variable
  • params (array) – parameters of the gauss_ramsey function, [A,C,ramseyfreq,angle,B]
  • weight_power (float) –
Returns:

value which indicates the difference between the data and the fit

Return type:

cost (float)

qtt.algorithms.functions.double_gaussian(x_data, params)[source]

A model for the sum of two Gaussian distributions.

Parameters:
  • x_data (array) – x values of the data
  • params (array) – parameters of the two gaussians, [A_dn, A_up, sigma_dn, sigma_up, mean_dn, mean_up] amplitude of first (second) gaussian = A_dn (A_up) standard deviation of first (second) gaussian = sigma_dn (sigma_up) average value of the first (second) gaussian = mean_dn (mean_up)
Returns:

model of a double gaussian

Return type:

double_gauss (np.array)

qtt.algorithms.functions.estimate_dominant_frequency(signal, sample_rate=1, remove_dc=True, fig=None)[source]

Estimate dominant frequency in a signal

Parameters:
  • signal (array) – Input data
  • sample_rate (float) – Sample rate of the data
  • remove_dc (bool) – If True, then do not estimate the DC component
  • fig (int or None) – Optionally plot the estimated frequency
qtt.algorithms.functions.estimate_parameters_damped_sine_wave(x_data, y_data, exponent=2)[source]

Estimate initial parameters of a damped sine wave

Also see: https://en.wikipedia.org/wiki/Damped_sine_wave

Parameters:exponent – Exponent from the exponential decay factor
Returns:Estimated parameters for gauss_ramsey method
qtt.algorithms.functions.exp_function(x, a, b, c)[source]

Model for exponential function

$$y = a + b * np.exp(-c * x)$$
Parameters:
  • x (array) – x values of the data
  • = offset (a) –
  • = starting value (b) –
  • = 1/typical decay time (c) –
Returns:

model for exponantial decay

Return type:

y (array)

qtt.algorithms.functions.fit_double_gaussian(x_data, y_data, maxiter=None, maxfun=5000, verbose=1, initial_params=None)[source]

Fitting of double gaussian

Fitting the Gaussians and finding the split between the up and the down state, separation between the max of the two gaussians measured in the sum of the std.

Parameters:
  • x_data (array) – x values of the data
  • y_data (array) – y values of the data
  • maxiter (int) – maximum number of iterations to perform
  • maxfun (int) – maximum number of function evaluations to make
  • verbose (int) – set to >0 to print convergence messages
  • initial_params (None or array) – optional, initial guess for the fit parameters: [A_dn, A_up, sigma_dn, sigma_up, mean_dn, mean_up]
Returns:

fit parameters of the double gaussian: [A_dn, A_up, sigma_dn, sigma_up, mean_dn, mean_up] result_dict (dict): dictionary with results of the fit. Fields in the dictionary:

parameters initial guess (array): initial guess for the fit parameters, either the ones give to the function, or generated by the function: [A_dn, A_up, sigma_dn, sigma_up, mean_dn, mean_up] separation (float): separation between the max of the two gaussians measured in the sum of the std split (float): value that separates the up and the down level

Return type:

par_fit (array)

qtt.algorithms.functions.fit_exp_decay(x_data, y_data, maxiter=None, maxfun=5000, verbose=1, initial_params=None, threshold=None, offset_parameter=None)[source]

Fit a exponential decay.

Parameters:
  • x_data (array) – the data for the input variable
  • y_data (array) – the data for the measured variable
  • maxiter (int) – maximum number of iterations to perform
  • maxfun (int) – maximum number of function evaluations to make
  • verbose (int) – set to >0 to print convergence messages
  • initial_params (None or array) – optional, initial guess for the fit parameters: [A,B, gamma]
  • threshold (float or None) – threshold for the cost function. If the difference between data and model is larger then the threshold, these data are not taken into account for the fit. If None use automatic detection (at 95th percentile)
  • offset_parameter (None or float) – if None, then estimate the offset, otherwise fix the offset to the specified value
Returns:

fit parameters of the exponential decay, [A, B, gamma]

Return type:

fitted_parameters (array)

See: exp_function()

qtt.algorithms.functions.fit_gauss_ramsey(x_data, y_data, weight_power=0, maxiter=None, maxfun=5000, verbose=1, initial_params=None)[source]

Fit a gauss_ramsey. The function gauss_ramsey gives a model for the measurement result of a pulse Ramsey sequence while varying the free evolution time, the phase of the second pulse is made dependent on the free evolution time. This results in a gaussian decay multiplied by a sinus. Function as used by T.F. Watson et all., see function ‘gauss_ramsey’ and example in qtt/docs/notebooks/example_fit_ramsey.ipynb

Parameters:
  • x_data (array) – the data for the independent variable
  • y_data (array) – the data for the measured variable
  • weight_power (float) –
  • maxiter (int) – maximum number of iterations to perform
  • maxfun (int) – maximum number of function evaluations to make
  • verbose (int) – set to >0 to print convergence messages
  • initial_params (None or array) – optional, initial guess for the fit parameters: [A,C,ramseyfreq,angle,B]
Returns:

array with the fit parameters: [A,t2s,ramseyfreq,angle,B] result_dict (dict): dictionary containing a description, the par_fit and initial_params

Return type:

par_fit (array)

qtt.algorithms.functions.fit_gaussian(x_data, y_data, maxiter=None, maxfun=5000, verbose=1, initial_params=None)[source]

Fitting of a gaussian, see function ‘gaussian’ for the model that is fitted

Parameters:
  • x_data (array) – x values of the data
  • y_data (array) – y values of the data
  • maxiter (int) – maximum number of iterations to perform
  • maxfun (int) – maximum number of function evaluations to make
  • verbose (int) – set to >0 to print convergence messages
  • initial_params (None or array) – optional, initial guess for the fit parameters: [mean, s, amplitude, offset]
Returns:

fit parameters of the gaussian: [mean, s, amplitude, offset] result_dict (dict): result dictonary containging the fitparameters and the initial guess parameters

Return type:

par_fit (array)

qtt.algorithms.functions.gauss_ramsey(x_data, params)[source]

Model for the measurement result of a pulse Ramsey sequence while varying the free evolution time, the phase of the second pulse is made dependent on the free evolution time. This results in a gaussian decay multiplied by a sinus. Function as used by T.F. Watson et all., example in qtt/docs/notebooks/example_fit_ramsey.ipynb

$$ gauss_ramsey = A * exp(-(x_data/t2s)**2) * sin(2pi*ramseyfreq * x_data - angle) +B $$

Parameters:
  • x_data (array) – the data for the input variable
  • params (array) – parameters of the gauss_ramsey function, [A,t2s,ramseyfreq,angle,B]
Result:
gauss_ramsey (array): model for the gauss_ramsey
qtt.algorithms.functions.gaussian(x, mean, std, amplitude=1, offset=0)[source]

Model for Gaussian function

$$y = offset + amplitude * np.exp(-(1/2)*(x-mean)^2/s^2)$$
Parameters:
  • x (array) – data points
  • std, amplitude, offset (mean,) – parameters
Returns:

y (array)

qtt.algorithms.functions.linear_function(x, a, b)[source]

Linear function with offset

qtt.algorithms.functions.logistic(x, x0=0, alpha=1)[source]

Logistic function

Defines the logistic function

\[y = 1 / (1 + \exp(-2 * alpha * (x - x0)))\]
Parameters:
  • x (array) – Independent data
  • x0 (float) – Midpoint of the logistic function
  • alpha (float) – Growth rate

Example

y = logistic(0, 1, alpha=1)

qtt.algorithms.functions.plot_gauss_ramsey_fit(x_data, y_data, fit_parameters, fig)[source]

Plot Gauss Ramset fit

Parameters:
  • x_data – Input array with time variable
  • y_data – Input array with signal
  • fit_parameters – Result of fit_gauss_ramsey

qtt.algorithms.gatesweep module

Functionality to analyse pinch-off scans

qtt.algorithms.gatesweep.analyseGateSweep(dd, fig=None, minthr=None, maxthr=None, verbose=1, drawsmoothed=False)[source]

Analyse sweep of a gate for pinch value, low value and high value

Parameters:
  • dd (1D qcodes DataSet) – structure containing the scan data
  • fig – TODO
  • minthr (float) – TODO (default: None)
  • maxthr (float) – TODO (default: None)
  • verbose (int) – Verbosity level
  • drawsmoothed (bool) – plot the smoothed data
Returns:

dictionary with analysis results

Return type:

result (dict)

qtt.algorithms.gatesweep.plot_pinchoff(result, ds=None, fig=10, verbose=1)[source]

Plot result of a pinchoff scan

qtt.algorithms.generic module

Various functions

qtt.algorithms.generic.boxcar_filter(signal, kernel_size)[source]

Perform boxcar filtering on an array. At the edges, the edge value is replicated beyond the edge as needed by the size of the kernel. This is the ‘nearest’ mode of scipy.ndimage.convolve. For details, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.convolve.html?highlight=mode

Parameters:
  • signal (array) – An array containing the signal to be filtered.
  • kernel_size (tuple) – Multidimensional size of the filter box. Must have the same number of dimensions as the signal.
Returns:

a numpy array containing the filtered signal.

qtt.algorithms.generic.detect_blobs_binary(bim)[source]

Simple blob detection in binary image

Parameters:bim (numpy array) – binary input image
Output:
xx (numpy array): detected blob centres

Alternative implementation would be through findContours

qtt.algorithms.generic.disk(radius)[source]

Create disk of specified radius

qtt.algorithms.generic.extent2fullextent(extent0, im)[source]

Convert extent to include half pixel border

qtt.algorithms.generic.findCoulombDirection(im, ptx, step, widthmv=8, fig=None, verbose=1)[source]

Find direction of Coulomb peak using second order derivative

qtt.algorithms.generic.flowField(im, fig=None, blocksize=11, ksize=3, resizefactor=1, eigenvec=1)[source]

Calculate flowfield of an image

Parameters:
  • im (numpy array) – input image
  • fig (integer or None) – number of visualization window
Returns:

flow ll (?): ??

Return type:

flow (numpy array)

qtt.algorithms.generic.getValuePixel(imx, pt)[source]

Return interpolated pixel value in an image

Parameters:
  • imx (numpy array) – input image
  • pt (numpy array) – list of points
Returns:

interpolated value

Return type:

vv (numpy array)

qtt.algorithms.generic.issorted(l)[source]

Return True if the argument list is sorted

qtt.algorithms.generic.localMaxima(arr, radius=1, thr=None)[source]

Calculate local maxima in a 2D array

qtt.algorithms.generic.makeCoulombFilter(theta0=-0.7853981633974483, step=1, ne=0, dphi=0.7853981633974483, widthmv=10, lengthmv=50.0, verbose=0, fig=None)[source]

Create filters to detect Coulomb peaks

qtt.algorithms.generic.nonmaxsuppts(v, d, minval=None)[source]

Calculate maximum points in data

qtt.algorithms.generic.rescaleImage(im, imextent, mvx=None, mvy=None, verbose=0, interpolation=None, fig=None)[source]

Scale image to make pixels at specified resolution

Parameters:
  • im (array) – input image
  • imextent (list of 4 floats) – coordinates of image region (x0, x1, y0, y1)
  • mvy (mvx,) – number of units per pixel requested. If None then keep unchanged
Returns:

transformed image H (array): transformation matrix from units to pixels. H is the homogeneous transform from original to

scaled image

mvx (float): internal data mvy (float): internal data fx (float): internal data dy (float): internal data

Return type:

ims (array)

qtt.algorithms.generic.scaleImage(image, display_min=None, display_max=None)[source]

Scale any image into uint8 range

image (numpy array): input image display_min (float): value to map to min output range display_max (float): value to map to max output range

qtt.algorithms.generic.show2Dimage(im, dd, **kwargs)[source]

Show image in window

Parameters:
  • im (array) – image to show
  • dd (dict with scan data) – data is used to scale the image to measurement resolution
qtt.algorithms.generic.showCoulombDirection(ptx, ww, im=None, dd=None, fig=100)[source]

Show direction of Coulomb peak in an image

qtt.algorithms.generic.showFlowField(im, flow, ll=None, ff=None, d=12, fig=-1)[source]

Show flow field

Parameters:
  • im (numpy array) – input image
  • flow (numpy array) – input image
  • fig (integer or None) – number of visualization window
qtt.algorithms.generic.signedabsX(val, w)[source]

Signed absolute value function

qtt.algorithms.generic.signedmin(val, w)[source]

Signed minimum value function

qtt.algorithms.generic.smoothImage(im, k=3)[source]

Super simple image smoothing

Parameters:
  • im (array) – input image
  • k (int) – kernel size
Returns:

smoothed image

Return type:

ims (array)

Example

ims = smoothImage(np.random.rand( 30,40))

qtt.algorithms.generic.subpixelmax(A, mpos, verbose=0)[source]

Calculate maximum position with subpixel accuracy

Parameters:
  • A (1D array) –
  • mpos (array with integer indicess) –
  • verbose (int) –
Returns:

subval (array):

Return type:

subpos (array with subpixel positions)

qtt.algorithms.generic.weightedCentroid(im, contours, contourIdx, fig=None)[source]

Calculate weighted centroid from a contour

The contours are in OpenCV format

qtt.algorithms.images module

Functionality to analyse and pre-process images

@author: eendebakpt

qtt.algorithms.images.straightenImage(im, imextent, mvx=1, mvy=None, verbose=0, interpolation=3)[source]

Scale image to make square pixels

Parameters:
  • im (array) – input image
  • imextend (list of 4 floats) – coordinates of image region (x0, x1, y0, y1)
  • mvy (mvx,) – number of mV per pixel requested
Returns:

  • ims (numpy array) – transformed image
  • (fw, fh, mvx, mvy, H) (data) – H is the homogeneous transform from original to straightened image

qtt.algorithms.markov_chain module

Class to generate signals with continous-time Markov chains

@author: pieter.eendebak@gmail.com

class qtt.algorithms.markov_chain.ChoiceGenerator(number_of_states, cum_weights, block_size=5000)[source]

Bases: object

Class to generate random elements with weighted selection

generate_choice()[source]

Generate a choice

Returns:integer in the range 0 to the number of states
Return type:int
class qtt.algorithms.markov_chain.ContinuousTimeMarkovModel(states, holding_parameters, jump_chain)[source]

Bases: object

generate_sequence(length, delta_time, initial_state=None)[source]

Generate a random sequence with the model

Parameters:
  • length (int) – number of elements in the sequence
  • delta_time (float) – time step to be used. This is equal to one over the samplerate.
  • initial_state (None or int or list) – This parameter determines how the first element of the generated sequence is chosen. If an int, then use that state is initial state. If None then take a random state weighted by the stationary distribution. If the initial_state is a list, then the list is interpreted as a probability distribution and the first element is samples from all possible states according to the distribution specified.
Returns:

generated sequence

Return type:

array

generate_sequences(length, delta_time=1, initial_state=None, number_of_sequences=1)[source]

Generate multiple random sequences with the model

Parameters:
  • length (int) – number of elements in the sequence
  • delta_time (float) – time step to be used
  • initial_state (None or int or list) – This parameter determines how the first element of the generated sequences are chosen. The parameter is passed to the generate_sequence() method.
  • number_of_sequences (int) – Specified the number of sequences to generate
Returns:

generated sequences

Return type:

array

number_of_states()[source]

Return the number of states in the model

stationary_distribution()[source]

Return the stationary distribution of the model

The calculation method is taken from: https://vknight.org/unpeudemath/code/2015/08/01/simulating_continuous_markov_chains.html

stationary_distribution_direct()[source]

Return the stationary distribution of the model

The calculation method is taken from: https://www.probabilitycourse.com/chapter11/11_3_2_stationary_and_limiting_distributions.php, Theorem 11.3

static stationary_distribution_discrete(jump_chain)[source]

Return the stationary distrubution for a Markov chain

transition_matrix(delta_time)[source]

Return the transition matrix for a specified amount of time

update_model(holding_parameters, jump_chain)[source]

Update the model of the markov chain

Parameters:
  • holding_parameters – List with the holding parameters
  • jump_chain – The jump chain or transition matrix

For a detailed description of the parameters see the class documentation.

qtt.algorithms.markov_chain.generate_traces(markov_model, std_gaussian_noise=1, state_mapping=None, *args, **kwargs)[source]

Generate traces for a continuous-time Markov model with added noise

Parameters:
  • markov_model (ContinuousTimeMarkovModel) – model to use for generation of traces
  • std_gaussian_noise (float) – standard deviation of Gaussian noise to add to the output signal
  • state_mapping (None or array) – If not None, replace each state in the generated trace by the corresponding element in the array
  • **kwargs (*args,) –

    passed to the generate_sequences function of the model

The traces are generated by the generate_sequences method from the model.

qtt.algorithms.misc module

Misc algorithms

Created on Wed Aug 31 16:19:30 2016

@author: eendebakpt

qtt.algorithms.misc.fillPoly(im, poly_verts, color=None)[source]

Fill a polygon in an image with the specified color

Replacement for OpenCV function cv2.fillConvexPoly

Parameters:
  • im (array) – array to plot into
  • poly_verts (kx2 array) – polygon vertices
  • color (array or float) – color to fill the polygon
Returns:

resulting array

Return type:

grid (array)

qtt.algorithms.misc.point_in_poly(x, y, poly)[source]

Return true if a point is contained in a polygon

Parameters:
  • x (float) –
  • y (float) –
  • poly (kx2 array) – polygon vertices
Returns:

True if the point is inside the polygon

Return type:

inside (bool)

qtt.algorithms.misc.points_in_poly(points, poly_verts)[source]

Determine whether points are contained in a polygon or not

Parameters:
  • points (kx2 array) –
  • poly_verts (array) –
qtt.algorithms.misc.polyarea(p)[source]

Return signed area of polygon

Parameters:p (2xN array or list of vertices) – vertices of polygon
Returns:area – area of polygon
Return type:float
>>> polyarea( [ [0,0], [1,0], [1,1], [0,2]] )
1.5
qtt.algorithms.misc.polyfit2d(x, y, z, order=3)[source]

Fit a polynomial on 2D data

Parameters:
  • x (array) – 1D array
  • y (array) – 1D array
  • z (array) – 2D array with data
  • order (int) – order of polynomial to fit
Returns:

order of the polynomial

Return type:

m (array)

qtt.algorithms.misc.polyval2d(x, y, m)[source]

Evaluate a 2D polynomial

Parameters:
  • x (array) –
  • y (array) –
  • m (array) – coefficients of polynomial
Returns:

z (array)

qtt.algorithms.ohmic module

Functionality to fit scans of ohmic contacts

qtt.algorithms.ohmic.fitOhmic(ds, verbose=1, fig=None, gainy=1e-07, gainx=1e-06)[source]

Fit data to a linear function

Parameters:
  • ds (dataset) – independent and dependent variable data
  • gainy (float) – conversion factor from y-data to Ampere
  • gainx (float) – conversion factor from x-data to Volt
  • verbose (int) –
  • fig (None or int) – if an integer, plot the fitted data
Returns:

fitted function parameters

Return type:

analysis_data (dict)

See also

linear_function

qtt.algorithms.onedot module

Functionality for analysis of single quantum dots

For more details see https://arxiv.org/abs/1603.02274

qtt.algorithms.onedot.costscoreOD(a, b, pt, ww, verbose=0, output=False)[source]

Cost function for simple fit of one-dot open area

Parameters:
  • a,b (float) – position along axis (a is the x-axis)
  • pt (numpy array) – point in image
  • ww (array) –
  • verbose (int) –
  • output (bool) –
Returns:

cost (float)

qtt.algorithms.onedot.onedotGetBalance(dataset, verbose=1, fig=None, drawpoly=False, polylinewidth=2, linecolor='c', full_output=False, od=None)[source]

Determine tuning point from a 2D scan of a 1-dot

This function performs a simple fitting of the open (conducting region).

Parameters:
  • od (one-dot structure or None) – data for one-dot
  • dd (2D dataset) – data containing charge stability diagram
Returns:

dictionary with fitting results od (obj): modified one-dot object

Return type:

fitresults (dict)

qtt.algorithms.onedot.onedotGetBalanceFine(impixel=None, dd=None, verbose=1, fig=None, baseangle=-0.7853981633974483, units=None, full_output=False)[source]

Determine central position of Coulomb peak in 2D scan

The position is determined by scanning with Gabor filters and then performing blob detection

The image should be in pixel coordinates

Returns:detected point results (dict): dictionary with all results
Return type:pt (array)
qtt.algorithms.onedot.plot_onedot(results, ds=None, verbose=2, fig=100, linecolor='c', ims=None, extentImageMatlab=None, lv=None)[source]

Plot results of a barrier-barrier scan of a single dot

Parameters:
  • results (dict) – results of the onedotGetBalance function
  • ds (None or DataSet) – dataset to use for plotting
  • fig (int or None) – figure window to plot to

qtt.algorithms.pat_fitting module

Functionality to fit PAT models

For more details see: https://arxiv.org/abs/1803.10352

@author: diepencjv / eendebakpt

qtt.algorithms.pat_fitting.detect_peaks(x_data, y_data, imx, sigmamv=0.25, fig=400, period=0.001, model='one_ele')[source]

Detect peaks in sensor signal, e.g. from a pat scan.

Parameters:
  • x_data (array) – detuning (mV)
  • y_data (array) – frequencies (Hz)
  • imx (array) – sensor signal of PAT scan, background is usually already subtracted
Returns:

coordinates of detected peaks results (dict): additional fitting data

Return type:

detected_peaks (array)

qtt.algorithms.pat_fitting.fit_pat(x_data, y_data, z_data, background, trans='one_ele', period=0.001, even_branches=[True, True, True], par_guess=None, xoffset=None, verbose=1)[source]

Wrapper for fitting the energy transitions in a PAT scan.

For more details see: https://arxiv.org/abs/1803.10352

Parameters:
  • x_data (array) – detuning (mV)
  • y_data (array) – frequencies (Hz)
  • z_data (array) – sensor signal of PAT scan
  • background (array) – sensor signal of POL scan
  • trans (str) – can be ‘one_ele’ or ‘two_ele’
  • even_branches (list of booleans) – indicated which branches of the model to use for fitting
Returns:

fitted xoffset (mV), leverarm (ueV/mV) and t (ueV) results (dict): contains keys par_guess (array), imq (array) re-scaled and re-centered sensor signal, imextent (array), xd, yd, ydf

Return type:

pp (array)

qtt.algorithms.pat_fitting.fit_pat_to_peaks(pp, xd, yd, trans='one_ele', even_branches=[True, True, True], weights=None, xoffset=None, verbose=1, branch_reduction=None)[source]

Core fitting function for PAT measurements, based on detected resonance peaks (see detect_peaks).

Parameters:
  • pp (array) – initial guess of fit parameters
  • xd (array) – x coordinates of peaks in sensor signal (mV)
  • yd (array) – y coordinates of peaks in sensor signal (Hz)
  • trans (string) – ‘one_ele’ or ‘two_ele’
  • xoffset (float) – the offset from zero detuning in voltage. If this has been determined before, then fixing this parameter reduces the fitting time.
qtt.algorithms.pat_fitting.one_ele_pat_model(x_data, pp)[source]

Model for one electron pat

This is \(\phi=\sqrt{ { ( leverarm * (x-x_0) ) }^2 + 4 t^2 } \mathrm{ueV2Hz}\)

Parameters:
  • x_data (array) – detuning (mV)
  • pp (array) – xoffset (mV), leverarm (ueV/mV) and t (ueV)

For more details see: https://arxiv.org/abs/1803.10352

class qtt.algorithms.pat_fitting.pat_score(even_branches=[True, True, True], branch_reduction=None)[source]

Bases: object

pat_one_ele_score(xd, yd, pp, weights=None, thr=2000000000.0)[source]

Calculate score for pat one electron model

Parameters:
  • xd (array) – x coordinates of peaks in sensor signal
  • yd (array) – y coordinates of peaks in sensor signal
  • pp (array) – model parameters
pat_two_ele_score(xd, yd, pp, weights=None, thr=2000000000.0)[source]

Calculate score for pat two electron model

Parameters:
  • xd (array) – x coordinates of peaks in sensor signal
  • yd (array) – y coordinates of peaks in sensor signal
  • pp (array) – model parameters
qtt.algorithms.pat_fitting.plot_pat_fit(x_data, y_data, z_data, pp, trans='one_ele', fig=400, title='Fitted model', label='model')[source]

Plot the fitted model of the PAT transition(s)

Parameters:
  • x_data (array) – detuning in millivolts
  • y_data (array) – frequencies
  • z_data (array) – sensor signal of PAT scan
  • pp (array) – xoffset (mV), leverarm (ueV/mV) and t (ueV)
  • model (function) – model describing the PAT transitions
qtt.algorithms.pat_fitting.pre_process_pat(x_data, y_data, background, z_data, fig=None)[source]

Pre-process a pair of background and sensor signal from a pat scan.

Parameters:
  • x_data (array) – detuning (mV)
  • y_data (array) – frequency (Hz)
  • background (array) – e.g. sensor signal of POL scan
  • z_data (array) – sensor signal of PAT scan
  • fig (None or int) –
Returns:

imx (array) imq (array) backgr_sm (array)

qtt.algorithms.pat_fitting.show_traces(x_data, z_data, fig=100, direction='h', title=None)[source]

Show traces of an image

Parameters:
  • x_data (array) – detuning in millivolts
  • z_data (array) – input image. rows are taken as the traces
  • fig (int) – number for figure window to use
  • direction (str) – can be ‘h’ or ‘v’
qtt.algorithms.pat_fitting.two_ele_pat_model(x_data, pp)[source]

Model for two electron pat

This is phi = pm frac{leverarm}{2} (x - x0) +
frac{1}{2} sqrt{( leverarm (x - x0) )^2 + 8 t^2 }
Parameters:
  • x_data (array) – detuning (mV)
  • pp (array) – xoffset (mV), leverarm (ueV/mV) and t (ueV)

qtt.algorithms.random_telegraph_signal module

Functionality to analyse random telegraph signals

Created on Wed Feb 28 10:20:46 2018

@author: riggelenfv

exception qtt.algorithms.random_telegraph_signal.FittingException[source]

Bases: Exception

Fitting exception in RTS code

qtt.algorithms.random_telegraph_signal.generate_RTS_signal(number_of_samples=100000, std_gaussian_noise=0.1, uniform_noise=0.05, rate_up=10000.0, rate_down=15000.0, samplerate=1000000.0)[source]

Generate a RTS signal

Parameters:
  • number_of_samples (int) – Length the the trace to be generated
  • std_normal_noise (float) – std of Gaussian noise added to the signal
  • uniform_noise (float) – uniform noise in the range +- uniform_noise/2 is added to the signal
  • rate_up (float) – rate from down to up
  • rate_down (float) – rate from up to down
  • samplerate (float) – The samplerate of the signal to be generated
Returns:

generated signal (0 is down, 1 is up)

Return type:

array

qtt.algorithms.random_telegraph_signal.plot_two_level_threshold(results, fig=100, plot_initial_estimate=False)[source]
qtt.algorithms.random_telegraph_signal.transitions_durations(data, split)[source]

For data of a two level system (up and down), this funtion determines which datapoints belong to which level and finds the transitions, in order to determines how long the system stays in these levels.

Parameters:
  • data (numpy array) – data from the two level system
  • split (float) – value that separates the up and down level
Returns:

array of the durations (unit: data points) in the down level duration_up (numpy array): array of durations (unit: data points) in the up level

Return type:

duration_dn (numpy array)

qtt.algorithms.random_telegraph_signal.tunnelrates_RTS(data, samplerate=None, min_sep=2.0, max_sep=7.0, min_duration=5, num_bins=None, plungers=None, fig=None, ppt=None, verbose=0)[source]

This function takes an RTS dataset, fits a double gaussian, finds the split between the two levels, determines the durations in these two levels, fits a decaying exponential on two arrays of durations, which gives the tunneling frequency for both the levels. If the number of datapoints is too low to get enough points per bin for the exponential fit (for either the up or the down level), this analysis step is passed over. tunnelrate_dn and tunnelrate_up are returned as None, but similar information can be substracted from parameters[‘down_segments’] and parameters[‘up_segments’].

Parameters:
  • data (array) – qcodes DataSet (or 1d data array) with the RTS data
  • samplerate (float) – sampling rate of the acquisition device, optional if given in the metadata of the measured data
  • min_sep (float) – if the separation found for the fit of the double gaussian is less then this value, the fit probably failed and a FittingException is raised
  • max_sep (float) – if the separation found for the fit of the double gaussian is more then this value, the fit probably failed and a FittingException is raised
  • min_duration (int) – minimal number of datapoints a duration should last to be taking into account for the analysis
  • num_bins (int or None) – number of bins for the histogram of signal values. If None, then determine based on the size of the data
  • fig (None or int) – shows figures and sends them to the ppt when is not None
  • ppt (None or int) – determines if the figures are send to a powerpoint presentation
  • verbose (int) – prints info to the console when > 0
Returns:

tunneling rate of the down level to the up level (kHz) or None in case of

not enough datapoints

tunnelrate_up (numpy.float64): tunneling rate of the up level to the down level (kHz) or None in case of

not enough datapoints

parameters (dict): dictionary with relevent (fit) parameters. this includes:

tunnelrate_down (float): tunnel rate in Hz tunnelrate_up (float): tunnel rate up in Hz

Return type:

tunnelrate_dn (numpy.float64)

qtt.algorithms.random_telegraph_signal.two_level_threshold(data, number_of_bins=40) → dict[source]

Determine threshold for separation of two-level signal

Typical examples of such a signal are an RTS signal or Elzerman readout.

Parameters:
  • traces – Two dimensional array with single traces
  • number_of_bins – Number of bins to use for calculation of double histogram
Returns:

Dictionary with results. The key readout_threshold contains the calculated threshold

qtt.algorithms.tunneling module

Functionality for analysing inter-dot tunnel frequencies.

@author: diepencjv

qtt.algorithms.tunneling.data_to_exc_ch(x_data, y_data, pol_fit)[source]

Convert y_data to units of excess charge.

Note: also re-centers to zero detuning in x-direction.

Parameters:
  • x_data (1 x N array) – chemical potential difference in ueV.
  • y_data (1 x N array) – sensor data, e.g. from a sensing dot or QPC.
  • pol_fit (1 x 6 array) – fit parameters, see polmod_all_2slopes().
qtt.algorithms.tunneling.fit_pol_all(x_data, y_data, kT, model='one_ele', maxiter=None, maxfun=5000, verbose=1, par_guess=None, method='fmin')[source]

Polarization line fitting.

The default value for the maxiter argument of scipy.optimize.fmin is N*200 the number of variables, i.e. 1200 in our case. :param x_data: chemical potential difference in ueV. :type x_data: 1 x N array :param y_data: sensor data, e.g. from a sensing dot or QPC. :type y_data: 1 x N array :param kT: temperature in ueV. :type kT: float

Returns:fitted parameters, see polmod_all_2slopes(). par_guess (1 x 6 array): initial guess of parameters for fitting, see polmod_all_2slopes(). results (dictionary): dictionary with fitting results.
Return type:par_fit (1 x 6 array)
qtt.algorithms.tunneling.fit_pol_all_2(x_data, y_data, kT, model='one_ele', maxiter=None, maxfun=5000, verbose=1, par_guess=None, method='fmin', returnextra=False)[source]
qtt.algorithms.tunneling.plot_polarization_fit(detuning, signal, results, fig, verbose=1)[source]

Plot the results of a polarization line fit.

Parameters:
  • detuning (array) – detuning in ueV.
  • signal (array) – measured signal.
  • results (dict) – results of fit_pol_all.
  • fig (int or None) – figure handle.
  • verbose (int) – Verbosity level.
qtt.algorithms.tunneling.pol_mod_two_ele_boltz(x_data, par, kT)[source]

Model of the inter-dot transition with two electron spin states, also taking into account thermal occupation of the triplets.

qtt.algorithms.tunneling.polmod_all_2slopes(x_data, par, kT, model=None)[source]

Polarization line model.

This model is based on [DiCarlo2004, Hensgens2017]. For an example see: https://github.com/VandersypenQutech/qtt/blob/master/examples/example_polFitting.ipynb

Parameters:
  • x_data (1 x N array) – chemical potential difference in ueV.
  • par (1 x 6 array) – parameters for the model - par[0]: tunnel coupling in ueV - par[1]: offset in x_data for center of transition - par[2]: offset in background signal - par[3]: slope of sensor signal on left side - par[4]: slope of sensor signal on right side - par[5]: height of transition, i.e. sensitivity for electron transition.
  • kT (float) – temperature in ueV.
  • () (model) – Not used.
Returns:

sensor data, e.g. from a sensing dot or QPC.

Return type:

y_data (array)

qtt.algorithms.tunneling.polweight_all_2slopes(x_data, y_data, par, kT, model='one_ele')[source]

Cost function for polarization fitting. :param x_data: chemical potential difference in ueV. :type x_data: 1 x N array :param y_data: sensor data, e.g. from a sensing dot or QPC. :type y_data: 1 x N array :param par: see polmod_all_2slopes. :type par: 1 x 6 array :param kT: temperature in ueV. :type kT: float

Returns:sum of residues.
Return type:total (float)
qtt.algorithms.tunneling.polweight_all_2slopes_2(x_data, y_data, par, kT, model='one_ele')[source]

Cost function for polarization fitting. :param x_data: chemical potential difference in ueV. :type x_data: 1 x N array :param y_data: sensor data, e.g. from a sensing dot or QPC. :type y_data: 1 x N array :param par: see polmod_all_2slopes. :type par: 1 x 6 array :param kT: temperature in ueV. :type kT: float

Returns:sum of residues.
Return type:total (float)