qtt.measurements package¶
Contains functions and structures for performing measurements
Subpackages¶
- qtt.measurements.acquisition package
- qtt.measurements.post_processing package
Submodules¶
qtt.measurements.scans module¶
Basic scan functions
This module contains functions for basic scans, e.g. scan1D, scan2D, etc. This is part of qtt.
-
qtt.measurements.scans.acquire_segments(station, parameters, average=True, mV_range=2000, save_to_disk=True, location=None, verbose=True, trigger_re_arm_compensation=False, trigger_re_arm_padding=True)[source]¶ Record triggered segments as time traces into dataset. AWG must be already sending a trigger pulse per segment.
Note that if the requested period is equal or longer than the period on the AWG, then not all trigger events might be used by the M4i.
The saving to disk can take minutes or even longer.
- Parameters
parameters (dict) –
dictionary containing the following compulsory parameters: minstrhandle (instrument handle): measurement instrument handle (m4i digitizer). read_ch (list of int): channel numbers to record. period (float): time in seconds to record for each segment. nsegments (int): number of segments to record. average (bool): if True, dataset will contain a single time trace with the average of all acquired segments;
if False, dataset will contain nsegments single time trace acquisitions.
verbose (bool): print to the console.
- Returns
time trace(s) of the segments acquired.
- Return type
alldata (dataset)
-
qtt.measurements.scans.awgGate(gate, station)[source]¶ Return True if the specified gate can be controlled by the AWG
-
qtt.measurements.scans.checkReversal(im0, verbose=0)[source]¶ Check sign of a current scan
We assume that the current is either zero or positive Needed when the keithley (or some other measurement device) has been reversed
- Parameters
im0 (array) – measured data
- Returns
bool
-
qtt.measurements.scans.createScanJob(g1, r1, g2=None, r2=None, step=- 1, keithleyidx='keithley1')[source]¶ Create a scan job
- Parameters
(str) (g1) –
(array (r2) –
list) (Range to step) –
(str (g2) –
optional) (Step value (default is -1)) –
(array –
list) –
(int (step) –
optional) –
-
qtt.measurements.scans.create_vectorscan(virtual_parameter, g_range=1, sweeporstepdata=None, remove_slow_gates=False, station=None, start=0, step=None)[source]¶ Converts the sweepdata or stepdata of a scanjob in those needed for virtual vector scans
- Parameters
virtual_parameter (obj) – parameter of the virtual gate which is varied
g_range (float) – scan range (total range)
remove_slow_gates – Removes slow gates from the linear combination of gates. Useful if virtual gates include
of slow gates (compensation) –
a fast measurement should be run. (but) –
station (None or qcodes.Station) – Used to access the virtual awg
start (float) – start if the scanjob data
step (None or float) – if not None, then add to the scanning field
- Returns
sweepdata or stepdata needed in the scanjob for virtual vector scans
- Return type
sweep_or_stepdata (dict)
-
qtt.measurements.scans.enforce_boundaries(scanjob, sample_data, eps=0.01)[source]¶ Make sure a scanjob does not go outside sample boundaries
- Parameters
sample_data (sample_data_t) –
-
qtt.measurements.scans.fastScan(scanjob, station)[source]¶ Returns whether we can do a fast scan using an awg
- Parameters
scanjob –
- Returns
f (int): 0: no fast scan possible, 1: scan2Dfast, 2: all axis
-
qtt.measurements.scans.fixReversal(im0, verbose=0)[source]¶ Fix sign of a current scan
We assume that the current is either zero or positive Needed when the keithley (or some other measurement device) has been reversed
-
qtt.measurements.scans.getDefaultParameter(data)[source]¶ Return name of the main array in the dataset
-
qtt.measurements.scans.get_instrument_parameter(handle)[source]¶ Return handle to instrument parameter or channel
-
qtt.measurements.scans.get_measurement_params(station, mparams)[source]¶ Get qcodes parameters from an index or string or parameter
-
qtt.measurements.scans.get_param(gates, sweepgate)[source]¶ Get qcodes parameter from scanjob argument
-
qtt.measurements.scans.get_param_name(gates, sweepgate)[source]¶ Get qcodes parameter name from scanjob argument
-
qtt.measurements.scans.get_sampling_frequency(instrument_handle)[source]¶ Return sampling frequency of acquisition device
-
qtt.measurements.scans.get_uhfli_scope_records(device, daq, scopeModule, number_of_records=1, timeout=30)[source]¶ Obtain scope records from the device using an instance of the Scope Module.
-
qtt.measurements.scans.instrumentName(namebase)[source]¶ Return name for qcodes instrument that is available
- Parameters
namebase (str) –
- Returns
name (str)
-
qtt.measurements.scans.makeDataset_sweep(data, sweepgate, sweeprange, sweepgate_value=None, ynames=None, gates=None, fig=None, location=None, loc_record=None)[source]¶ Convert the data of a 1D sweep to a DataSet.
Note: sweepvalues are only an approximation
- Args:
data (1D array or kxN array) sweepgate (str) sweeprange (float)
- Returns
dataset
-
qtt.measurements.scans.makeDataset_sweep_2D(data, gates, sweepgates, sweepranges, measure_names='measured', location=None, loc_record=None, fig=None)[source]¶ Convert the data of a 2D sweep to a DataSet.
-
qtt.measurements.scans.makeScanjob(sweepgates, values, sweepranges, resolution)[source]¶ Create a scanjob from sweep ranges and a centre
-
qtt.measurements.scans.measure_raw_segment_m4i(digitizer, period, read_ch, mV_range, Naverage=100, verbose=0, trigger_re_arm_compensation=False, trigger_re_arm_padding=True)[source]¶ Record a trace from the digitizer
- Parameters
digitizer (obj) – handle to instrument
period (float) – length of segment to read
read_ch (list) – channels to read from the instrument
mV_range (float) – range for input
Naverage (int) – number of averages to perform
verbose (int) – verbosity level
trigger_arm_compensation (bool) – In block average mode the M4i needs a time of 40 samples + pretrigger to re-arm the triggering. With this option this is compensated for by measuring less samples and padding with zeros.
trigger_re_arm_padding (bool) – If True then remove any samples from the trigger re-arm compensation with zeros.
-
qtt.measurements.scans.measure_segment_scope_reader(scope_reader, waveform, number_of_averages, process=True, **kwargs)[source]¶ Measure block data with scope reader.
- Parameters
scope_reader (AcquisitionScopeInterface) – Instance of scope reader.
waveform (dict) – Information about the waveform that is to be collected.
number_of_averages (int) – Number of times the sample is collected.
process (bool) – If True, cut off the downward sawtooth slopes from the data.
- Returns
An array of arrays, one array per input channel.
- Return type
data (numpy array)
-
qtt.measurements.scans.measure_segment_uhfli(zi, waveform, channels, number_of_averages=100, **kwargs)[source]¶ Measure block data with Zurich Instruments UHFLI
- Parameters
- Returns
An array of arrays, one array per input channel.
- Return type
data (numpy array)
-
qtt.measurements.scans.measuresegment(waveform, Naverage, minstrhandle, read_ch, mV_range=2000, process=True, device_parameters=None)[source]¶ Wrapper to identify measurement instrument and run appropriate acquisition function. Supported instruments: m4i digitizer, ZI UHF-LI
- Parameters
waveform (dict) – waveform specification
Naverage (int) – number of averages to perform
minstrhandle (str or Instrument) – handle to acquisition device
read_ch (list) – channels to read from the instrument
mV_range (float) – range for input
process (bool) – If True, process the segment data from scope reader
device_parameters (dict) – dictionary passed as keyword parameters to the measurement methods
- Returns
recorded and processed data
- Return type
data (numpy array)
-
qtt.measurements.scans.measuresegment_m4i(digitizer, waveform, read_ch, mV_range, Naverage=100, process=False, verbose=0, fig=None, trigger_re_arm_compensation=False, trigger_re_arm_padding=True)[source]¶ Measure block data with M4i
- Parameters
digitizer (object) – handle to instrument
waveform (dict) – waveform specification
read_ch (list) – channels to read from the instrument
mV_range (float) – range for input
Naverage (int) – number of averages to perform
verbose (int) – verbosity level
trigger_re_arm_compensation (bool) – Passed to raw measurement function
trigger_re_arm_padding (bool) – Passed to raw measurement function
- Returns
recorded and processed data
- Return type
data (numpy array)
-
qtt.measurements.scans.parse_minstrument(scanjob)[source]¶ Extract the parameters to be measured from the scanjob
-
qtt.measurements.scans.plotData(alldata, diff_dir=None, fig=1)[source]¶ Plot a dataset and optionally differentiate
-
qtt.measurements.scans.process_1d_sawtooth(data, width, period, samplerate, resolution=None, padding=0, start_zero=False, fig=None, verbose=0)[source]¶ Process data from the M4i and a sawtooth trace
This is done to remove the extra padded data of the digitizer and to extract the forward trace of the sawtooth.
- Parameters
- Returns
processed_data (Nxk array): processed data rr (tuple)
-
qtt.measurements.scans.process_2d_sawtooth(data, period, samplerate, resolution, width, verbose=0, start_zero=True, fig=None)[source]¶ Extract a 2D image from a double sawtooth signal
- Parameters
data (numpy array) – measured trace
period (float) – period of the full signal
samplerate (float) – sample rate of the acquisition device
resolution (list) – resolution nx, ny. The nx corresonds to the fast oscillating sawtooth
width (list of float) – width paramter of the sawtooth signals
verbose (int) – verbosity level
start_zero (bool) – Default is True
Returns
processed_data (list of arrays): the extracted 2D arrays results (dict): contains metadata
-
class
qtt.measurements.scans.sample_data_t[source]¶ Bases:
dictHold all kind of sample specific data
The structure is that of a dictionary. Typical fields:
gate_boundaries (dict): dictionary with gate boundaries
-
qtt.measurements.scans.scan1D(station, scanjob, location=None, liveplotwindow=None, plotparam='measured', verbose=1, extra_metadata=None)[source]¶ Simple 1D scan.
-
qtt.measurements.scans.scan1Dfast(station, scanjob, location=None, liveplotwindow=None, delete=True, verbose=1, plotparam=None, extra_metadata=None)[source]¶ Fast 1D scan. The scan is performed by putting a sawtooth signal on the AWG and measuring with a fast acquisition device.
-
qtt.measurements.scans.scan2D(station, scanjob, location=None, liveplotwindow=None, plotparam='measured', diff_dir=None, write_period=None, update_period=5, verbose=1, extra_metadata=None)[source]¶ Make a 2D scan and create dictionary to store on disk.
For 2D vector scans see also the documentation of the _convert_scanjob_vec method of the scanjob_t class.
- Parameters
station (object) – contains all the instruments
scanjob (scanjob_t) – data for scan
write_period (float) – save-to-disk interval in lines, None for no writing before finished
update_period (float) – liveplot update interval in lines, None for no updates
extra_metadata (None or dict) – additional metadata to be included in the dataset
- Returns
contains the measurement data and metadata
- Return type
alldata (DataSet)
-
qtt.measurements.scans.scan2Dfast(station, scanjob, location=None, liveplotwindow=None, plotparam='measured', diff_dir=None, verbose=1, extra_metadata=None)[source]¶ Make a 2D scan and create qcodes dataset to store on disk.
-
qtt.measurements.scans.scan2Dturbo(station, scanjob, location=None, liveplotwindow=None, delete=True, verbose=1)[source]¶ Perform a very fast 2d scan by varying two physical gates with the AWG.
The function assumes the station contains an acquisition device that is supported by the measuresegment function. The number of the measurement channels is supplied via the minstrument field in the scanjob.
-
class
qtt.measurements.scans.scanjob_t[source]¶ Bases:
dictStructure that contains information about a scan
A typical scanjob contains the following (optional) fields:
- Fields:
sweepdata (dict): stepdata (dict) minstrument (str, Parameter or tuple) wait_time_startscan (float):
The sweepdata and stepdata are structures with the following fields:
param (str, Parameter or dict): parameter to vary start, end, step (float) wait_time (float)
Note: currently the scanjob_t is a thin wrapper around a dict.
-
qtt.measurements.scans.select_digitizer_memsize(digitizer, period, trigger_delay=None, nsegments=1, verbose=1)[source]¶ Select suitable memory size for a given period
-
qtt.measurements.scans.select_m4i_memsize(digitizer, period, trigger_delay=None, nsegments=1, verbose=1, trigger_re_arm_compensation=False)[source]¶ Select suitable memory size for a given period
The selected memory size is the period times the sample rate, but rounded above to a multiple of 16. Additionally, extra pixels are added because of pretrigger_memsize requirements of the m4i.
- Parameters
digitizer (object) –
period (float) – period of signal to measure
trigger_delay (float) – delay in seconds between ingoing signal and returning signal
nsegments (int) – number of segments of period length to fit in memory
trigger_arm_compensation (bool) – In block average mode the M4i needs a time of 40 samples + pretrigger to re-arm the triggering. With this option the segment size is reduced. The signal_end can be larger then the segment size.
- Returns
total memory size selected pre_trigger (int): size of pretrigger selected signal_start (int): starting position of signal in pixels signal_end (int): end position of signal in pixels
- Return type
memsize (int)
-
qtt.measurements.scans.single_shot_readout(minstparams, length, shots, threshold=None)[source]¶ Acquires several measurement traces, averages the signal over the entire trace for each shot and returns the proportion of shots that are above a defined threshold. NOTE: The AWG marker delay should be set so that the triggered acquisition starts at the correct part of the readout pulse.
- Parameters
- Returns
proportion of shots above the threshold allshots (array of floats): average signal of every shot taken
- Return type
proportion (float [0,1])
qtt.measurements.storage module¶
-
qtt.measurements.storage.list_states(verbose=1)[source]¶ List available states of the system
See also
load_state
-
qtt.measurements.storage.load_state(tag=None, station=None, verbose=1, statefile=None)[source]¶ Load state of the system from disk
- Parameters
- Returns
Dictionary with state of the system virtual_gates (None or object): reconstructed virtual gates
- Return type
state (dict)
-
qtt.measurements.storage.save_state(station, tag=None, overwrite=False, virtual_gates=None, data=None, verbose=1, statefile=None)[source]¶ Save current state of the system to disk
- Parameters
Example
save_state(station, tag=’tripledot1’)
The data is written to an HDF5 file. The default location is the user home directory with name qtt_statefile.hdf5.
To install hickle: pip install git+https://github.com/telegraphic/hickle.git@dev
qtt.measurements.ttrace module¶
qtt.measurements.videomode module¶
Contains code for the VideoMode tools
-
class
qtt.measurements.videomode.VideoMode(station, sweepparams=None, sweepranges=None, minstrument=None, nplots=None, Naverage=10, resolution=(96, 96), sample_rate='default', diff_dir=None, verbose=1, dorun=True, show_controls=True, add_ppt=True, crosshair=False, averaging=True, name=None, mouse_click_callback=None, videomode_processor=None)[source]¶ Bases:
objectControls the videomode tool.
The VideoMode tools allows for fast plotting of measurement results. The basic operation of the VideoMode consists of the following stages:
Initialize. For example start a periodic waveform on the AWG
Start the readout. This starts a loop with the following steps: - Measure data - Post-process data - Plot data The loop continues running in the background untill the user aborts the loop.
Stop the readout. This stops the measure-process-plot loop
Stop. This stops all activity (e.g. both the readout loop and and activity on the AWG)
-
station¶ contains all the information about the set-up
- Type
qcodes station
-
videomode_processor¶ class performing the measurements and post-processing
- Type
the number of times the raw measurement data should be averaged
- Type
Parameter
-
enable_averaging_slot(averaging=None, *args, **kwargs)[source]¶ Update the averaging mode of the widget
-
single()[source]¶ Do a single scan with a lot averaging.
Note: this does not yet support the usage of linear combinations of gates (a.k.a. virtual gates).
-
startreadout(callback=None, rate=30, maxidx=None)[source]¶ Start the readout loop
- Parameters
rate (float) – sample rate in ms
-
updatebg()[source]¶ Update function for the tool
Calls the videomode_processor.measure() and videomode_processor.process() and updates the GUI
-
videomode_class_index= 0¶
qtt.measurements.videomode_processor module¶
-
class
qtt.measurements.videomode_processor.DummyVideoModeProcessor(station, verbose=1)[source]¶ Bases:
qtt.measurements.videomode_processor.VideoModeProcessor
-
class
qtt.measurements.videomode_processor.VideoModeProcessor[source]¶ Bases:
abc.ABCBase class for VideoMode processing functionality
-
class
qtt.measurements.videomode_processor.VideomodeSawtoothMeasurement(station, verbose=1)[source]¶ Bases:
qtt.measurements.videomode_processor.VideoModeProcessor