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, list) (r2) –
- (str, optional) (g2) –
- (array, list) –
- (int, optional) (step) –
-
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 compensation ofn slow gates, but a fast measurement should be run.
- 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: sweeporstepdata (dict)
-
qtt.measurements.scans.enforce_boundaries(scanjob, sample_data, eps=0.01)[source]¶ Make sure a scanjob does not go outside sample boundaries
Parameters: - scanjob (scanjob_t or dict) –
- 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(instr, station=None)[source]¶ Return handle to instrument
Parameters: instr (str, Instrument, tuple, list) – name of instrument or handle or pair (handle, channel)
-
qtt.measurements.scans.get_instrument_parameter(handle)[source]¶ Return handle to instrument parameter or channel
Parameters: Returns: h (object)
-
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
Parameters: instrument_handle (str or Instrument) – handle to instrument Returns: sampling frequency Return type: float
-
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.lin_comb_type¶ alias of
builtins.dict
-
qtt.measurements.scans.loadOneDotPinchvalues(od, outputdir, verbose=1)[source]¶ Load the pinch-off values for a one-dot
Parameters: - od (dict) – one-dot structure
- outputdir (string) – location of the data
-
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
- verbose (int) – verbosity level
- 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
- fig (int or None) – figure handle
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.
Parameters: Returns: contains the measurement data and metadata
Return type: alldata (DataSet)
-
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.
Parameters: Returns: contains the measurement data and metadata
Return type: DataSet
-
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.
Parameters: Returns: contains the measurement data and metadata
Return type: alldata (DataSet)
-
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.
Parameters: Returns: contains the measurement data and metadata
Return type: alldata (DataSet)
-
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
Parameters: Returns: memsize (int)
-
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
Parameters: verbose (int) – Returns: List of string tags Return type: states (list) 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: - station (qcodes station) –
- tag (str or None) –
- overwrite (bool) – If True overwrite existing data, otherwise raise error
- virtual_gates (None or virtual_gates) – virtual gates object to store
- data (None or object) – optional extra data
- verbose (int) – verbosity level
- statefile (str) – file with the state of the system
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¶
Code for creating and parsing t-traces
@author: eendebakpt (houckm)
-
class
qtt.measurements.ttrace.MultiTracePlot(nplots, ncurves=1, title='Multi trace plot', station=None)[source]¶ Bases:
object
-
qtt.measurements.ttrace.add_fill(awg_element, tag, channels=None, refpulse=None, fillperiod=1e-07, start=0, refpoint='start', verbose=0)[source]¶ Add filling period to an element
Parameters:
-
qtt.measurements.ttrace.create_ttrace(station, virtualgates, vgates, scanrange, sweepgates, param={})[source]¶ Define amplitudes and frequencies of Toivo traces according to the given virtual gate map
-
qtt.measurements.ttrace.create_virtual_matrix_dict(virt_basis, physical_gates, c=None, verbose=1)[source]¶ Converts the virtual gate matrix into a virtual gate mapping
Parameters: Returns: dictionary, mapping of the virtual gates
Return type: virtual_matrix (dict)
-
qtt.measurements.ttrace.create_virtual_matrix_dict_inv(cc_basis, physical_gates, c, verbose=1)[source]¶ Converts the virtual gate matrix into a virtual gate mapping needed for the ttraces :param cc_basis: containing all the virtual gates in the setup :type cc_basis: list :param physical_gates: containing all the physical gates in the setup :type physical_gates: list :param c: inverse virtual gate matrix :type c: array or None
Returns: dictionary, mapping of the virtual gates needed for the ttraces Return type: virtual_matrix (dict)
-
qtt.measurements.ttrace.define_awg5014_channels(pulsar, marker1highs=0.25, marker2highs=2.6)[source]¶ Helper function
-
qtt.measurements.ttrace.fix_ttrace_seq_mode(vawg)[source]¶ Fix the sequence mode of the virtual awg
Upstream pycqed assumes sychronization with a clock sync, but we use the event input.
-
qtt.measurements.ttrace.lasttime(filler_element)[source]¶ Return stop time of last pulse from a sequence
-
qtt.measurements.ttrace.parse_data(data_raw, ttraces, ttrace, clockbias=1, verbose=1)[source]¶ Read the data, split them in the different dimension sweeps
Parameters: - data_raw – the raw readout data
- ttraces,ttrace – information of the ttraces put on the AWG in order to now how to split the data
Returns: containing information of the timing of the function datax: tx: the actual signal which is can be used for further purposes
Return type: tt
-
qtt.measurements.ttrace.plot_ttraces(ttraces)[source]¶ Plots the ttraces which are put on the AWG
Parameters: ttraces – information of the ttraces put on the AWG
-
qtt.measurements.ttrace.read_FPGA_line(station, idx=None, Naverage=26)[source]¶ Reads the raw data
Parameters: - station – station at leas containing the FPGA
- idx – indexes of channels used
- Naverage – averaging filter over the readout function
Returns: the raw readout data
Return type: data_raw
-
qtt.measurements.ttrace.read_trace_m4i(station, ttrace_elements, read_ch=[1], Naverage=20, verbose=0, fig=None, drate=2000000.0)[source]¶ Read data from m4i device
TODO: merge with measuresegment function…
-
qtt.measurements.ttrace.run_ttrace(virtualawg, pulsar_objects, ttrace, ttrace_elements, sequence_name='ttrace')[source]¶ Send the waveforms to the awg and run the awgs
-
qtt.measurements.ttrace.set_awg_trace(virtualawg, clock=10000000.0, verbose=0)[source]¶ Set the virtual awg in ttrace mode
Parameters: - virtualawg (virtual awg object) –
- clock (float) – clock speed to set
-
qtt.measurements.ttrace.show_data(tt, tx, data_raw, ttrace, tf=1000.0, fig=10, labels=None)[source]¶ Plot the raw data and the parsed data of the resulting signal
Parameters: - tt (obj) – parsed data including timing
- tx (obj) – the actual signal
- data_raw (obj) – raw readout data
- ttrace (obj) – data about the traces put on the AWG
-
qtt.measurements.ttrace.show_element(elmnt, fig=100, keys=None, label_map=None)[source]¶ Show pycqed waveform element
Parameters:
-
qtt.measurements.ttrace.show_ttrace_elements(ttrace_elements, fig=100, tracedata=None)[source]¶ Show ttrace elements
-
qtt.measurements.ttrace.ttrace2waveform(ttrace, pulsars, name='ttrace', verbose=1, awg_map=None, markeridx=1)[source]¶ Create a Toivo trace
Parameters: Returns: ttraces (waveforms) ttrace
-
class
qtt.measurements.ttrace.ttrace_t[source]¶ Bases:
dictStructure that contains information about ttraces
- Fields:
- period (float): the time of the trace for each dot markerperiod (float): ? fillperiod (float): the time it takes to come to the start voltage of the relevant signal end to go back to the initial value afterwards period0:time before the trace sequence starts alpha (float): fpga_delay (float): delay time between the actual signal and the readout of the FPGA samplingfreq: readout frequency of the acquisition device awgclock: clock frequency of the AWG traces: contains the extrema the traces have to have ….
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: VideoModeProcessor
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