qtt package¶
Quantum Technology Toolbox
The QTT package contains functionality for the tuning and calibration of spin-qubits. The package is divided into subpackages:
- Measurements: functionality to perform measurements on devices
- Algorithms: functionality to analyse measurements
- Simulation: contains simulations of quantum dot systems
- Tools: misc tools
- Gui: Several gui element for visualization of data
- Instrument drivers: contains QCoDeS drivers for various instruments
For more information see https://github.com/qutech-delft/qtt
-
qtt.abort_measurements(value=None)¶ Return True if the currently running measurement should be aborted
-
qtt.check_version(version, module=<module 'qcodes' from '/home/docs/checkouts/readthedocs.org/user_builds/qtt/envs/fix-read_the_docs/lib/python3.6/site-packages/qcodes/__init__.py'>, optional=False, install_message=None)[source]¶ Check whether a module has the corret version
-
qtt.liveValue(var='qtt_live_value1')¶ Return live control value retrieved from redis server and convert to string
-
qtt.liveValueSet(value, var='qtt_live_value1')¶ Set live control value on redis server
Subpackages¶
- qtt.algorithms package
- Submodules
- qtt.algorithms.anticrossing module
- qtt.algorithms.awg_to_plunger module
- qtt.algorithms.bias_triangles module
- qtt.algorithms.chargesensor module
- qtt.algorithms.coulomb module
- qtt.algorithms.fitting module
- qtt.algorithms.functions module
- qtt.algorithms.gatesweep module
- qtt.algorithms.generic module
- qtt.algorithms.images module
- qtt.algorithms.markov_chain module
- qtt.algorithms.misc module
- qtt.algorithms.ohmic module
- qtt.algorithms.onedot module
- qtt.algorithms.pat_fitting module
- qtt.algorithms.random_telegraph_signal module
- qtt.algorithms.tunneling module
- qtt.deprecated package
- qtt.gui package
- qtt.instrument_drivers package
- Subpackages
- qtt.instrument_drivers.adapters package
- qtt.instrument_drivers.virtualAwg package
- Subpackages
- Submodules
- qtt.instrument_drivers.virtualAwg.sequencer module
- qtt.instrument_drivers.virtualAwg.serializer module
- qtt.instrument_drivers.virtualAwg.settings module
- qtt.instrument_drivers.virtualAwg.templates module
- qtt.instrument_drivers.virtualAwg.virtual_awg module
- Submodules
- qtt.instrument_drivers.BlueforsMonitor module
- qtt.instrument_drivers.DistributedInstrument module
- qtt.instrument_drivers.FPGA_ave module
- qtt.instrument_drivers.ILM200 module
- qtt.instrument_drivers.TimeStamp module
- qtt.instrument_drivers.gates module
- qtt.instrument_drivers.parameter_scaler module
- qtt.instrument_drivers.simulation_instruments module
- qtt.instrument_drivers.virtual_awg module
- qtt.instrument_drivers.virtual_gates module
- qtt.instrument_drivers.virtual_instruments module
- Subpackages
- qtt.measurements package
- Subpackages
- qtt.measurements.acquisition package
- qtt.measurements.post_processing package
- Submodules
- qtt.measurements.scans module
- qtt.measurements.storage module
- qtt.measurements.ttrace module
- qtt.measurements.videomode module
- qtt.measurements.videomode_processor module
- Subpackages
- qtt.simulation package
- qtt.utilities package
Submodules¶
qtt.data module¶
Utilities to work with data and datasets
-
qtt.data.compare_dataset_metadata(dataset1, dataset2, metakey='allgatevalues', verbose=1)[source]¶ Compare metadata from two different datasets.
Outputs the differences in metadata from dataset1 to dataset2. For now, only comparisons for the key ‘allgatevalues’ has been implemented.
Parameters: - dataset1 (DataSet) – first dataset to compare
- dataset2 (DataSet) – second dataset to compare
- metakey (str) – key in the DataSet metadata to compare
-
qtt.data.dataset1Ddata(alldata)[source]¶ Parse a dataset into the x and y scan values
Returns: x (array) y (array)
-
qtt.data.dataset1Dmetadata(alldata, arrayname=None, verbose=0)[source]¶ Extract metadata from a 1D scan
Returns: x1,x2 g0 (string): step gate vstep (array): step values istep (float) arrayname (string): identifier of the main array Return type: extent (list)
-
qtt.data.dataset2Dmetadata(alldata, arrayname=None, verbose=0)[source]¶ Extract metadata from a 2D scan
Returns: x1,x2,y1,y2 g0 (str): step gate (array_id) g1 (str): sweep gate (array_id) vstep (array): step values vsweep (array): sweep values arrayname (string): identifier of the main array Return type: extent (list)
-
qtt.data.dataset2image(dataset, arrayname=None, unitsperpixel=None, mode='pixel')[source]¶ Extract image from a dataset
Parameters: Returns: im (numpy array) tr (image_transform object)
-
qtt.data.dataset2image2(dataset, arrayname=None)[source]¶ Extract image from dataset
Parameters: dataset (DataSet) – measured data Returns: raw image impixel (array): image in pixel coordinates tr (image_transform object): transformation object Return type: imraw (array) See also: dataset2image
-
qtt.data.datasetCentre(ds, ndim=None)[source]¶ Return centre position for dataset :param ds: :type ds: DataSet
Returns: centre position Return type: cc (list of floats)
-
qtt.data.dataset_labels(alldata, tag=None, add_unit=False)[source]¶ Return label for axis of dataset
Parameters:
-
qtt.data.dataset_to_dictionary(data_set, include_data=True, include_metadata=True)[source]¶ Convert DataSet to dictionary.
Parameters: Returns: dictionary containing the serialized data.
Return type:
-
qtt.data.default_setpoint_array(dataset, measured_name='measured')[source]¶ Return the default setpoint array for a dataset
-
qtt.data.determine_parameter_unit(parameter)[source]¶ Determine unit associated with a parameter
Parameters: parameter (Any) – the parameter to get the unit from Returns: The unit associated with the parameter when the parameter is a qcodes parameter, otherwise None
-
qtt.data.dictionary_to_dataset(data_dictionary)[source]¶ Convert dictionary to DataSet.
Parameters: data_dictionary (dict) – data to convert Returns: converted data. Return type: DataSet
-
qtt.data.diffDataset(alldata, diff_dir='y', sigma=2, fig=None, meas_arr_name='measured')[source]¶ Differentiate a dataset and plot the result.
Parameters:
-
qtt.data.drawCrosshair(ds, ax=None, ndim=None)[source]¶ Draw a crosshair on the centre of the dataset
Parameters:
-
qtt.data.experimentFile(outputdir: str = '', tag=None, dstr=None, bname=None)[source]¶ Format experiment data file for later analysis
-
qtt.data.getDateString(t=None, full=False)[source]¶ Return date string
Parameters: t – datetime.datetime time
-
qtt.data.get_dataset(dataset_handle)[source]¶ Get a dataset from a results dictionary, a string or a dataset.
Parameters: dataset_handle (str, dict or DataSet) – either location of dataset, the dataset itself or a calibration structure. Returns: The dataset from the handle. Return type: DataSet
-
class
qtt.data.image_transform(dataset=None, arrayname=None, mode='pixel', unitsperpixel=None, verbose=0)[source]¶ Bases:
object-
matplotlib_image_extent()[source]¶ Return matplotlib style image extent
Returns: - x1, x2, y1, y2
- the y1 value is bottom left
Return type: extentImage (4 floats)
-
pixel2scan(pt)[source]¶ Convert pixels coordinates to scan coordinates (mV) :param pt: points in pixel coordinates (x,y) :type pt: array
Returns: ptx (array) Return type: point in scan coordinates (sweep, step)
-
scan2pixel(pt)[source]¶ Convert scan coordinates to pixel coordinates :param pt: points in scan coordinates :type pt: array :param Returns: ptpixel (ndaray): points in pixel coordinates
-
-
qtt.data.loadDataset(path)[source]¶ Wrapper function
Parameters: path – filename without extension Returns dateset, metadata:
-
qtt.data.load_dataset(location, io=None, verbose=0)[source]¶ Load a dataset from storage
An attempt is made to automatically detect the formatter. Supported are currently qcodes GNUPlotFormat, qcodes HDF5Format and json format.
Parameters: Returns: dataset (DataSet or None)
-
qtt.data.load_example_dataset(filename, verbose=0)[source]¶ Return an example dataset from qtt
Parameters: - filename – Name of the dataset
- verbose – Verbosity level
Returns: Example dataset or None of no dataset can be found
-
qtt.data.makeDataSet1D(p, yname='measured', y=None, location=None, loc_record=None, return_names=False)[source]¶ Make DataSet with one or multiple 1D arrays and one setpoint array.
Parameters: - p (qcodes.SweepFixedValues) – the setpoint array of data
- yname (str or list of str or Parameter or list of Parameter) – when type is str or list of str : the name of measured array(s) when type is parameter or list of parameter: the measured Parameters
- y (array or list of array or None) – optional (measured) data to fill the DataSet
- location (str, callable, bool or None) –
If you provide a string, it must be an unused location in the io manager. Can also be: - a callable location provider with one required parameter
(the io manager), and one optional (record dict), which returns a location string when called.- False - denotes an only-in-memory temporary DataSet.
- loc_record (dict or None) – If location is a callable, this will be passed to it as record.
- return_names (bool) – if True return array names in output
Raises: - See _make_data_set for the ValueError and TypeError exceptions that can be raised
- See _check_parameter for the TypeError exceptions that can be raised
Returns: - Depending on parameter return_names
True: The resulting dataset and a tuple with the names of the added arrays (setpoint and measurements). False: The resulting dataset.
-
qtt.data.makeDataSet1Dplain(xname, x, yname, y=None, xunit=None, yunit=None, location=None, loc_record=None)[source]¶ Make DataSet with one 1D array and one setpoint array
Parameters: - xname (string) – the name of the setpoint array
- x (array or ndarray or list) – the setpoint data
- yname (str or qcodes.Parameter or list) – the name of the measured array
- y (array or ndarray or list) – the measured data
- xunit (str or None) – optional, the unit of the values stored in x array.
- yunit (str or None) – optional, the unit of the values stored in y array.
- location (str, callable, bool or None) –
If you provide a string, it must be an unused location in the io manager. Can also be: - a callable location provider with one required parameter
(the io manager), and one optional (record dict), which returns a location string when called.- False - denotes an only-in-memory temporary DataSet.
- loc_record (dict or None) – If location is a callable, this will be passed to it as record.
Raises: See _make_data_set for the ValueError and TypeError exceptions that can be raised
Returns: The resulting dataset.
-
qtt.data.makeDataSet2D(p1, p2, measure_names='measured', location=None, loc_record=None, preset_data=None, return_names=False)[source]¶ Make DataSet with one or multiple 2D array and two setpoint arrays.
If the preset_data is used for multiple 2D arrays, then the order of measure_names should match the order of preset_data.
Parameters: - p1 (qcodes.SweepFixedValues) – first setpoint array of data
- p2 (qcodes.SweepFixedValues) – second setpoint array of data
- measure_names (str or list) – name(s) of measured array(s)
- location (str, callable, bool or None) –
If you provide a string, it must be an unused location in the io manager. Can also be: - a callable location provider with one required parameter
(the io manager), and one optional (record dict), which returns a location string when called.- False - denotes an only-in-memory temporary DataSet.
- loc_record (dict or None) – If location is a callable, this will be passed to it as record.
- preset_data (array or ndarray or list or None) – optional array to fill the DataSet
- return_names (bool) – if True return array names in output
Raises: - See _make_data_set for the ValueError and TypeError exceptions that can be raised
- See _check_parameter for the TypeError exceptions that can be raised
Returns: True: The resulting dataset and a tuple with the names of the added arrays (setpoint and measurements). False: The resulting dataset.
Return type: Depending on parameter return_names
-
qtt.data.makeDataSet2Dplain(xname, x, yname, y, zname='measured', z=None, xunit=None, yunit=None, zunit=None, location=None, loc_record=None)[source]¶ Make DataSet with one 2D array and two setpoint arrays
Parameters: - xname (string) – the name of the setpoint x array.
- x (array or ndarray or list) – the x setpoint data.
- yname (string) – the name of the setpoint y array.
- y (array or ndarray or list) – the y setpoint data.
- zname (str or list of str) – the name of the measured array.
- z (array or list or None) – optional the measured data.
- xunit (str or None) – optional, the unit of the values stored in x.
- yunit (str or None) – optional, the unit of the values stored in y.
- zunit (str or None) – optional, the unit of the measured data.
- location (str, callable, bool or None) –
If you provide a string, it must be an unused location in the io manager. Can also be: - a callable location provider with one required parameter
(the io manager), and one optional (record dict), which returns a location string when called.- False - denotes an only-in-memory temporary DataSet.
- loc_record (dict or None) – If location is a callable, this will be passed to it as record.
Raises: See _make_data_set for the ValueError and TypeError exceptions that can be raised
Returns: The resulting dataset.
-
qtt.data.plot_dataset(dataset: qcodes.data.data_set.DataSet, parameter_names: Optional[list] = None, fig: Optional[int] = 1) → None[source]¶ Plot a dataset to matplotlib figure window
Parameters: - dataset – DataSet to be plotted
- parameter_names – List of arrays to be plotted
- fig – Specification if Matplotlib figure window
-
qtt.data.show2D(dd, impixel=None, im=None, fig=101, verbose=1, dy=None, sigma=None, colorbar=False, title=None, midx=2, units=None)[source]¶ Show result of a 2D scan
Parameters:
-
qtt.data.store_latest_decorator(function, obj)[source]¶ Decorator to store latest result of a function in an object
-
qtt.data.uniqueArrayName(dataset, name0)[source]¶ Generate a unique name for a DataArray in a dataset
qtt.dataset_processing module¶
-
qtt.dataset_processing.average_dataset(dataset: qcodes.data.data_set.DataSet, axis: Union[str, int] = 'vertical') → qcodes.data.data_set.DataSet[source]¶ Calculate the mean signal of a 2D dataset over the specified axis
Parameters: - dataset – DataSet to be processed
- axis – Specification of the axis
Returns: Dataset with averaged signal
-
qtt.dataset_processing.average_multirow_dataset(dataset: qcodes.data.data_set.DataSet, number_of_repetitions: int, new_values=None, parameter_name: str = 'signal', output_parameter_name: str = 'signal') → qcodes.data.data_set.DataSet[source]¶ Calculate the averaged signal from a 2D dataset with repeated rows
Parameters: - dataset – Dataset containing the data to be averaged
- number_of_repetitions – Number of rows over which to average
- new_values – Optional new values for the averaged axis
- parameter_name – Name of data array to process
- output_parameter_name – Name of output array
Returns: Averaged dataset
-
qtt.dataset_processing.dataset_dimension(dataset: qcodes.data.data_set.DataSet) → int[source]¶ Return dimension of DataSet
-
qtt.dataset_processing.process_dataarray(dataset: qcodes.data.data_set.DataSet, input_array_name: str, output_array_name: str, processing_function: Callable, label: Optional[str] = None, unit: Optional[str] = None) → qcodes.data.data_set.DataSet[source]¶ Apply a function to a DataArray in a DataSet
Parameters: - dataset – Input dataset containing the data array
- input_array_name – Name of the data array to be processed
- output_array_nane – Name of the output array or None to operate in place
- processing_function – Method to apply to the data array
- label – Label for the output array
- unit – Unit for the output array
-
qtt.dataset_processing.resample_dataset(dataset: qcodes.data.data_set.DataSet, sample_rate: Tuple[int], copy_metadata: bool = False, output_parameter_name: Optional[str] = None) → qcodes.data.data_set.DataSet[source]¶ Given a dataset resample the measurement array
Parameters: - dataset – Dataset to be slice
- sample_rate – Tuple with for each axis the sample rate. Must be a postive integer
- copy_metadata – If True then copy the metadata of the input dataset
- output_parameter_name – Name of the output array
Returns: Dataset with sliced data
-
qtt.dataset_processing.slice_dataset(dataset: qcodes.data.data_set.DataSet, window: Sequence[float], axis: int = 0, verbose: int = 0, copy_metadata: bool = False, output_parameter_name=None) → qcodes.data.data_set.DataSet[source]¶ Given a dataset and a window for the horizontal axis return the dataset with selected window
Parameters: - dataset – Dataset to be slice
- window – Specification of the window to be selected
- axis – Axis used for slicing
- verbose – Verbosity level
- copy_metadata – If True then copy the metadata of the input dataset
- output_parameter_name – Name of the output array
Returns: Dataset with sliced data
qtt.exceptions module¶
-
exception
qtt.exceptions.CalibrationException[source]¶ Bases:
BaseExceptionException thrown for a bad calibration
-
exception
qtt.exceptions.MissingOptionalPackageWarning[source]¶ Bases:
UserWarning,ValueErrorAn optional package is missing
-
exception
qtt.exceptions.PackageVersionWarning[source]¶ Bases:
UserWarningAn package has the incorrect version
qtt.instrument_storage module¶
Functionality to store instrument data in a configuration file
-
qtt.instrument_storage.load_instrument(instr, ifile, verbose=1)¶ Load instrument configuration from configparser structure
Parameters: - instr (Instrument) – instrument to apply settings to
- ifile (str) – configuration file
-
qtt.instrument_storage.load_instrument_configparser(instr, ifile, verbose=1)[source]¶ Load instrument configuration from configparser structure
Parameters: - instr (Instrument) – instrument to apply settings to
- ifile (str) – configuration file
-
qtt.instrument_storage.load_instrument_json(instr, ifile, verbose=1)[source]¶ Load instrument configuration from json
-
qtt.instrument_storage.save_instrument(instr, ifile, verbose=1)¶ Save instrument configuration to configparser structure
Parameters: - instr (Instrument) – instrument to apply settings to
- ifile (str) – configuration file
qtt.legacy module¶
Legacy functions (do not use)
-
qtt.legacy.cmap_discretize(cmap, N, m=1024)[source]¶ Return a discrete colormap from the continuous colormap cmap.
cmap: colormap instance, eg. cm.jet. N: number of colors.- Example
- x = resize(arange(100), (5,100)) djet = cmap_discretize(cm.jet, 5) imshow(x, cmap=djet)
-
qtt.legacy.cmap_map(function, cmap)[source]¶ Applies function (which should operate on vectors of shape 3: [r, g, b], on colormap cmap. This routine will break any discontinuous points in a colormap.
-
qtt.legacy.createDoubleDotJobs(two_dots, one_dots, resultsdir, basevalues={}, sdinstruments=[], fig=None, verbose=1)[source]¶ Create settings for a double-dot from scans of the individual one-dots
-
qtt.legacy.filterGabor(im, theta0=-0.39269908169872414, istep=1, widthmv=2, lengthmv=10, gammax=1, cut=None, verbose=0, fig=None)[source]¶ Filter image with Gabor
step is in pixel/mV
Parameters: - im (array) – input image
- theta0 (float) – angle of Gabor filter (in radians)
-
qtt.legacy.plotCircle(pt, radius=11.5, color='r', alpha=0.5, linewidth=3, **kwargs)[source]¶ Plot a circle in a matplotlib figure
Parameters:
-
qtt.legacy.positionScanjob(scanjob, pt)[source]¶ Helper function
Changes an existing scanjob to scan at the centre of the specified point
-
qtt.legacy.saveImage(resultsdir, name, fig=None, dpi=300, ext='png', tight=False)[source]¶ Save matplotlib figure to disk
Parameters: name (str) – name of file to save Returns: imfilerel, imfile – filenames Return type: string
qtt.live module¶
qtt.live_plotting module¶
qtt.pgeometry module¶
pgeometry¶
A collection of usefull functions.
For additional options also see numpy and matplotlib.
| platform: | Unix, Windows |
|---|
- Additions:
- Copyright 2012-2016 TNO
- Original code:
- Copyright 2011 Pieter Eendebak <pieter.eendebak@gmail.com>
@author: eendebakpt
-
qtt.pgeometry.T2opencv(T)[source]¶ Convert transformation to OpenCV rvec, tvec pair
Example
>>> rvec, tvec = T2opencv(np.eye(4))
-
qtt.pgeometry.addfigurecopy(fig=None)[source]¶ Add callback to figure window
By pressing the ‘c’ key figure is copied to the clipboard
-
qtt.pgeometry.angleDiff(x, y)[source]¶ Return difference between two angles in radians modulo 2* pi
>>> d=angleDiff( 0.01, np.pi+0.02) >>> d=angleDiff( 0.01, 2*np.pi+0.02)
-
qtt.pgeometry.angleDiffOri(x, y)[source]¶ Return difference between two angles in radians modulo pi
>>> d=angleDiff( 0.01, np.pi+0.02) >>> d=angleDiff( 0.01, 2*np.pi+0.02)
-
qtt.pgeometry.auto_canny(image, sigma=0.33)[source]¶ Canny edge detection with automatic parameter detection
>>> imc=auto_canny(np.zeros( (200,300)).astype(np.uint8))
Parameters: image (array) – input image Returns: edged – detected edges Return type: array
-
qtt.pgeometry.blur_measure(im, verbose=0)[source]¶ Calculate bluriness for an image
Parameters: im (array) – input image
-
qtt.pgeometry.breakLoop(wk=None, dt=0.001, verbose=0)[source]¶ Break a loop using OpenCV image feedback
-
qtt.pgeometry.cfigure(*args, **kwargs)[source]¶ Create Matplotlib figure with copy to clipboard functionality
By pressing the ‘c’ key figure is copied to the clipboard
-
qtt.pgeometry.checkmodule(module_name, verbose=1)[source]¶ Return location of module based on module name
Parameters: module_name (str) – name of module to inspect - Returns
- obj: module specification
-
qtt.pgeometry.choose(n, k)[source]¶ Binomial coefficients Return the n!/((n-k)!k!)
Parameters: - -- Integer (k) –
- -- Integer –
Returns: The bionomial coefficient n choose k
Example
>>> choose(6,2) 15
-
qtt.pgeometry.circular_mean(weights, angles)[source]¶ Calculate circular mean of a set of 2D vectors
-
qtt.pgeometry.decomposeProjectiveTransformation(H, verbose=0)[source]¶ Decompose projective transformation H is decomposed as H = Hs*Ha*Hp with
- Hs = [sR t]
- [0 1]
- Ha = [K 0]
- [0 1]
- Hp = [I 0]
- [v’ eta]
If H is 3-dimensional, then R = [ cos(phi) -sin(phi); sin(phi) cos(phi)];
For more information see “Multiple View Geometry”, paragraph 1.4.6.
>>> Ha, Hs, Hp, rest = decomposeProjectiveTransformation( np.eye(3) )
-
qtt.pgeometry.detect_local_minima(arr, thr=None)[source]¶ Takes an array and detects the troughs using the local maximum filter. Returns a boolean mask of the troughs (i.e. 1 when the pixel’s value is the neighborhood maximum, 0 otherwise)
Parameters: arr (array) – input array
-
qtt.pgeometry.dir2R(d, a=None)[source]¶ Convert direction to rotation matrix
Note: numerically not stable near singular points!
Parameters: - d (numpy array of size 3) – direction to rotation to a
- a (numpy array of size 3) – target direction
Returns: matrix R such that R*a = d
Return type: R (3x3 numpy array)
Example:
>>> d = np.array([0, 1, 0]); a = np.array([0, -1, 0]) >>> R = dir2R(d, a)
Pieter Eendebak <pieter.eendebak@tno.nl>
-
qtt.pgeometry.directionMean(vec)[source]¶ Calculate the mean of a set of directions
The initial direction is determined using the oriented direction. Then a non-linear optimization is done.
Parameters: vec – List of directions - Returns
- Angle of mean of directions
>>> vv=np.array( [[1,0],[1,0.1], [-1,.1]]) >>> a=directionMean(vv)
-
qtt.pgeometry.enlargelims(factor=1.05)[source]¶ Enlarge the limits of a plot
Parameters: factor (float or list of float) – Factor to expand the limits of the current plot Example
>>> enlargelims(1.1)
-
qtt.pgeometry.euler2RBE(theta)[source]¶ Convert Euler angles to rotation matrix
Example
>>> np.set_printoptions(precision=4, suppress=True) >>> euler2RBE( [0,0,np.pi/2] ) array([[ 0., -1., 0.], [ 1., 0., 0.], [-0., 0., 1.]])
-
qtt.pgeometry.findImageHandle(fig, verbose=0, otype=<class 'matplotlib.image.AxesImage'>)[source]¶ Search for specific type of object in Matplotlib figure
-
qtt.pgeometry.findfilesR(p, patt, show_progress=False)[source]¶ Get a list of files (recursive)
Parameters: - p (string) – directory
- patt (string) – pattern to match
- show_progress (bool) –
Returns: lst (list of str)
-
qtt.pgeometry.fitPlane(X)[source]¶ Determine plane going through a set of points
Parameters: X (array) – aray of size Nxk. Points in affine coordinates Returns: fitted plane in homogeneous coordinates Return type: array Example
>>> X=np.array([[1,0,0 ], [0,1,0], [1,1,0], [2,2,0]]) >>> t=fitPlane(X)
-
qtt.pgeometry.freezeclass(cls)[source]¶ Decorator to freeze a class
This means that no attributes can be added to the class after instantiation.
-
qtt.pgeometry.gaborFilter(ksize, sigma, theta, Lambda=1, psi=0, gamma=1, cut=None)[source]¶ Create a Gabor filter of specified size
Parameters: - ksize (integer) – kernel size in pixels
- theta, Lambda, psi (sigma,) – parameters of Gabor function
- cut (boolean) – if True cut off the angular component after specified distance (in radians)
Returns: g – constructed kernel
Return type: array
Example
>>> g = gaborFilter(ksize=15, sigma=2,theta=2,Lambda=1, gamma=1)
-
qtt.pgeometry.ginput(n=1, drawmode='', **kwargs)[source]¶ Select points from figure
Press middle mouse button to stop selection
Parameters: - - number of points to select (n) –
- - style to plot selected points (drawmode) –
- kwargs – arguments passed to plot function
-
qtt.pgeometry.histogram(x, nbins=30, fig=1)[source]¶ Return histogram of data
>>> _=histogram(np.random.rand(1,100))
-
qtt.pgeometry.hom(x)[source]¶ Create affine to homogeneous coordinates
Parameters: x (kxN array) – affine coordinates Returns: homogeneous coordinates Return type: h ( (k+1xN) array)
-
qtt.pgeometry.intersect2lines(l1, l2)[source]¶ Calculate intersection between 2 lines
Parameters: - l1 (array) – first line in homogeneous format
- l2 (array) – first line in homogeneous format
Returns: intersection in homogeneous format. To convert to affine coordinates use dehom
Return type: array
-
qtt.pgeometry.list_objects(objectype=None, objectclassname='__123', verbose=1)[source]¶ List all objects in memory of a specific type or with a specific class name
Parameters: Returns: list of objects found
Return type: ll (list)
-
qtt.pgeometry.logistic(x, x0=0, alpha=1)[source]¶ Simple logistic function
Parameters: x (float or array) – >>> t=np.arange(0,600,1.) >>> _ = plt.plot(t, logistic(t, 300, alpha=1./100),'.b')
-
qtt.pgeometry.memory()[source]¶ Return the memory usage in MB
Returns: memory usage in mb Return type: float
-
qtt.pgeometry.minAlg_5p4(A)[source]¶ Algebraic minimization function
Function computes the vector x that minimizes ||Ax|| subject to the condition ||x||=1. Implementation of Hartley and Zisserman A5.4 on p593 (2nd Ed)
Usage: [x,V] = minAlg_5p4(A) :param A: The constraint matrix, ||Ax|| to be minimized :type A: numpy array
Returns: - x - The vector that minimizes ||Ax|| subject to the
- condition ||x||=1
-
qtt.pgeometry.modulepath(m)[source]¶ Return path for module
Parameters: m (str or module) – module to return path Returns: path of module Return type: str
-
qtt.pgeometry.mpl2clipboard(event=None, verbose=1, fig=None)[source]¶ Copy current Matplotlib figure to clipboard
-
qtt.pgeometry.opencv_draw_points(bgr, imgpts, drawlabel=True, radius=3, color=(255, 0, 0), thickness=-1, copyimage=True)[source]¶ Draw points on image with opencv
Parameters: - bgr (numpy array) – image to draw points into
- impts (array) – locations of points to plot
-
qtt.pgeometry.orthogonal_proj(zfront, zback)[source]¶ see http://stackoverflow.com/questions/23840756/how-to-disable-perspective-in-mplot3d
-
qtt.pgeometry.otsu(im, fig=None)[source]¶ Calculate threshold on data using Otsu’s method
Parameters: - im (array) – data to be processed
- fig (number, optional) – If set to a number show results in a histogram
Returns: thr – The threshold value
Return type: Examples
>>> thr = otsu(np.random.rand( 2000), fig=100)
-
qtt.pgeometry.partiala(method, **kwargs)[source]¶ Function to perform functools.partial on named arguments
-
qtt.pgeometry.pcolormesh_centre(x, y, im, *args, **kwargs)[source]¶ Wrapper for pcolormesh to plot pixel centres at data points
-
qtt.pgeometry.pg_scaling(scale, cc=None)[source]¶ Create scaling with specified centre
Example
>>> pg_scaling( [1.,2]) array([[ 1., 0., 0.], [ 0., 2., 0.], [ 0., 0., 1.]])
-
qtt.pgeometry.pg_transl2H(tr)[source]¶ Convert translation to homogeneous transform matrix
>>> pg_transl2H( [1,2]) array([[ 1., 0., 1.], [ 0., 1., 2.], [ 0., 0., 1.]])
-
qtt.pgeometry.plot2Dline(line, *args, **kwargs)[source]¶ Plot a 2D line in a matplotlib figure
Parameters: line (3x1 array) – line to plot >>> plot2Dline([-1,1,0], 'b')
-
class
qtt.pgeometry.plotCallback(func=None, xdata=None, ydata=None, scale=[1, 1], verbose=0)[source]¶ Bases:
object
-
qtt.pgeometry.plotCostFunction(fun, x0, fig=None, marker='.', scale=1, c=None)[source]¶ Plot a cost function on specified data points
Example with variation of Booth’s function:
>>> fun = lambda x: 2*(x[0]+2*x[1]-7)**2 + (2*x[0]+x[1]-5)**2 >>> plotCostFunction(fun, np.array([1,3]), fig=100, marker='-')
-
qtt.pgeometry.plotLabels(xx, *args, **kwargs)[source]¶ Plot labels next to points
Parameters: - xx (2xN array) – points to plot
- *kwargs – arguments past to plotting function
Example: >>> xx=np.random.rand(2, 10) >>> fig=plt.figure(10); plt.clf() >>> _ = plotPoints(xx, ‘.b’); _ = plotLabels(xx)
-
qtt.pgeometry.plotPoints(xx, *args, **kwargs)[source]¶ Plot 2D or 3D points
Parameters: - xx (array) – array of points to plot
- *args – arguments passed to the plot function of matplotlib
- **kwargs – arguments passed to the plot function of matplotlib
Example: >>> plotPoints(np.random.rand(2,10), ‘.-b’)
-
qtt.pgeometry.plotPoints3D(xx, *args, **kwargs)[source]¶ Plot 3D points
Parameters: xx (3xN array) – the 3D data points Example
>> ax=plotPoints3D(np.random.rand(3, 1) ,’.r’, markersize=10, fig=12)
-
qtt.pgeometry.point_in_polygon(pt, pp)[source]¶ Return True if point is in polygon
Parameters: - pt (1x2 array) – point
- pp (Nx2 array) – polygon
Returns: 1.0 if point is inside 1.0, otherwise -1.0
Return type: r (float)
-
qtt.pgeometry.points_in_polygon(pts, pp)[source]¶ Return all points contained in a polygon
Parameters: - pt (Nx2 array) – points
- pp (Nxk array) – polygon
Returns: rr (bool array)
-
qtt.pgeometry.polyarea(p)[source]¶ Return signed area of polygon
Parameters: p (Nx2 numpy 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.pgeometry.polyintersect(x1, x2)[source]¶ Intersection of two polygons
>>> x1=np.array([(0, 0), (1, 1), (1, 0)] ) >>> x2=np.array([(1, 0), (1.5, 1.5), (.5, 0.5)]) >>> x=polyintersect(x1, x2) >>> _=plt.figure(10); plt.clf() >>> plotPoints(x1.T, '.-r' ) >>> plotPoints(x2.T, '.-b' ) >>> plotPoints(x.T, '.-g' , linewidth=2)
-
qtt.pgeometry.projectiveTransformation(H, x)[source]¶ Apply a projective transformation to a kxN array
>>> y = projectiveTransformation( np.eye(3), np.random.rand( 2, 10 ))
-
qtt.pgeometry.robustCost(x, thr, method='L1')[source]¶ Robust cost function
Parameters: Example
>>> robustCost([2,3,4],thr=2.5) array([ 2. , 2.5, 2.5]) >>> robustCost(2, thr=1) 1 >>> methods=robustCost(np.arange(-5,5,.2), thr=2, method='show')
-
qtt.pgeometry.rot2D(phi)[source]¶ Return 2x2 rotation matrix from angle
Parameters: phi (float) – Angle in radians Returns: R – The 2x2 rotation matrix Return type: array Examples
>>> R = rot2D(np.pi)
-
qtt.pgeometry.save(pkl_file, *args)[source]¶ Save objects to file
Parameters: - pkl_file (string) – filename
- *args (anything) – Python objects to save
-
qtt.pgeometry.scaleImage(image, display_min=None, display_max=None)[source]¶ Scale any image into uint8 range
Parameters: Returns: the scaled image
Return type: image (numpy array)
Example
>>> im=scaleImage(255*np.random.rand( 30,40), 40, 100)
Code modified from: https://stackoverflow.com/questions/14464449/using-numpy-to-efficiently-convert-16-bit-image-data-to-8-bit-for-display-with?noredirect=1&lq=1
-
qtt.pgeometry.setFontSizes(labelsize=20, fsize=17, titlesize=None, ax=None)[source]¶ Update font sizes for a matplotlib plot
-
qtt.pgeometry.setWindowRectangle(x, y=None, w=None, h=None, fig=None, mngr=None)[source]¶ Position the current Matplotlib figure at the specified position
Parameters: Usage: setWindowRectangle([x,y,w,h])
-
qtt.pgeometry.setregion(im, subim, pos, mask=None, clip=False)[source]¶ Set region in Numpy image
Parameters: - im (Numpy array) – image to fill region in
- subim (Numpy array) – subimage
- pos (array) – position to place image
- (None or array) (mask) –
- (bool) (clip) –
-
class
qtt.pgeometry.signalTest[source]¶ Bases:
PyQt5.QtCore.QObjectHelper function for Qt signals
-
s¶
-
-
qtt.pgeometry.signedmin(val, w)[source]¶ Signed minimum value function
>>> signedmin(-3, 5) -3 >>> signedmin(-10, 5) -5
-
qtt.pgeometry.signedsqrt(val)[source]¶ Signed square root function
>>> signedsqrt([-4.,4,0]) array([-2., 2., 0.]) >>> signedmin(-10, 5) -5
-
qtt.pgeometry.smoothstep(x, x0=0, alpha=1)[source]¶ Smooth step function
>>> t=np.arange(0,600,1.) >>> _ = plt.plot(t, smoothstep(t, 300, alpha=1./100),'.b')
-
qtt.pgeometry.static_var(varname, value)[source]¶ Helper function to create a static variable
Parameters: - varname (str) –
- value (anything) –
-
qtt.pgeometry.tilefigs(lst, geometry=[2, 2], ww=None, raisewindows=False, tofront=False, verbose=0, monitorindex=None)[source]¶ Tile figure windows on a specified area
Parameters: - lst (list) – list of figure handles or integers
- geometry (2x1 array) – layout of windows
- (None or int) (monitorindex) –
- (None or list) (ww) –
qtt.structures module¶
Contains code for various structures
-
class
qtt.structures.CombiParameter(name, params, label=None, unit='a.u.', **kwargs)[source]¶ Bases:
qcodes.instrument.parameter.ParameterCreate a parameter which is a combination of multiple other parameters, which are always set to the same value.
The get function returns the mean of the individual parameters.
-
get_raw()[source]¶ get_rawis called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifget_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide agetmethod on the parameter instance.
-
set_raw(value)[source]¶ set_rawis called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifset_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide asetmethod on the parameter instance.
-
-
class
qtt.structures.MultiParameter(name, params, label=None, unit=None, **kwargs)[source]¶ Bases:
qcodes.instrument.parameter.ParameterCreate a parameter which is a combination of multiple other parameters.
-
get_raw()[source]¶ get_rawis called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifget_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide agetmethod on the parameter instance.
-
set_raw(values)[source]¶ set_rawis called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifset_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide asetmethod on the parameter instance.
-
-
class
qtt.structures.VectorParameter(name, comb_map, **kwargs)[source]¶ Bases:
qcodes.instrument.parameter.ParameterCreate parameter which controls linear combinations.
-
class
qtt.structures.onedot_t(gates, name=None, data=None, station=None, transport_instrument=None)[source]¶ Bases:
dictClass representing a single quantum dot
-
class
qtt.structures.sensingdot_t(gate_names, gate_values=None, station=None, index=None, minstrument=None, virt_gates=None)[source]¶ Bases:
object-
autoTune(scanjob=None, fig=200, outputdir=None, step=-2.0, max_wait_time=1.0, scanrange=300, add_slopes=False)[source]¶ Automatically determine optimal value of plunger
-
detuning_scan(stepsize=2, nsteps=5, verbose=1, fig=None)[source]¶ Optimize the sensing dot by making multiple plunger scans for different detunings
Parameters: Returns: list of optimal detuning and sd plunger value results (dict)
Return type: best (list)
-
fastTune(Naverage=90, sweeprange=79, period=0.0005, location=None, fig=201, sleeptime=2, delete=True, add_slopes=False, invert=False, verbose=1)[source]¶ Fast tuning of the sensing dot plunger.
If the sensing dot object is initialized with a virtual gates object the virtual plunger will be used for the sweep.
Parameters: Returns: value of plunger alldata (dataset): measured data
Return type: plungervalue (float)
-