diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 0afbc051..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,99 +0,0 @@ -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - -cache: - paths: - - .cache/pip - - -stages: - - test - - deploy - - -.base: - image: python:3.11 - before_script: - - pip install -U virtualenv - - virtualenv venv - - source venv/bin/activate - - echo "machine git-ce.rwth-aachen.de" > ~/.netrc - - echo "login gitlab-ci-token" >> ~/.netrc - - echo "password ${CI_JOB_TOKEN}" >> ~/.netrc - - -.tox: - extends: - - .base - before_script: - - !reference [.base, before_script] - - pip install tox - - -.test: - extends: - - .tox - stage: test - before_script: - - apt-get update && apt-get install -y xvfb libegl1 libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 x11-utils libxcb-cursor0 - - !reference [.tox, before_script] - coverage: /^TOTAL.+?(\d+%)$/ - artifacts: - when: always - reports: - junit: report.xml - coverage_report: - coverage_format: cobertura - path: coverage.xml - - -pylint: - extends: - - .tox - stage: test - allow_failure: true - script: - - tox -e lint -- --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:codeclimate.json - artifacts: - when: always - reports: - codequality: codeclimate.json - - -py39: - extends: - - .test - image: python:3.9 - script: - - tox -e py39 -- --junitxml=report.xml --cov-report xml - - -py310: - extends: - - .test - image: python:3.10 - script: - - tox -e py310 -- --junitxml=report.xml --cov-report xml - - -py311: - extends: - - .test - image: python:3.11 - script: - - tox -e py311 -- --junitxml=report.xml --cov-report xml - - -pages: - extends: - - .base - stage: deploy - script: - - pip install sphinx sphinx_autodoc_typehints sphinx_autopackagesummary sphinx_rtd_theme - - pip install -e . - - sphinx-build -b html docs public - artifacts: - paths: - - public - only: - - main diff --git a/metadata.yaml b/metadata.yaml deleted file mode 100644 index 05c87013..00000000 --- a/metadata.yaml +++ /dev/null @@ -1,37 +0,0 @@ -!!python/object:qtools_metadata.metadata.Metadata -measurement: !Measurement - name: test-measurement - user: Max Mustermann - datetime: 2022-02-22 - valid: false - device: !Device - name: test-device - description: test device description - layoutParameters: parameters - sample: !Sample - name: test-sample-15 - description: test sample description - creator: Miriam Musterfrau - layout: !SampleLayout "4259afa2-4c41-4ab2-b69a-8b995d3c5fc2" - factory: !Factory "9471ed6c-24ac-443a-b89e-3073ef4cfc52" - wafer: !Wafer "dda3fa0c-fd1b-4561-992d-d7fc197502bf" - layout: !DeviceLayout "7eff5ad7-5933-4731-9f96-9b43ae481cec" - measurementType: !MeasurementType "edeba69c-cfd9-4227-8e0f-e40b63948cd2" - settings: !MeasurementSettings - name: test-settings - settings: "{settings}" - mapping: !MeasurementMapping - name: test-mapping - mapping: "{mapping}" - experimentSetup: !ExperimentSetup - name: ExperimentSetup1 - temperature: "4.0" - instrumentsChannels: "channels" - standardSettings: "settings" - filters: "filters" - series: !MeasurementSeries "9c7cedb3-cf05-45ed-bf8c-8444a320ea8f" - script: !MeasurementScript - name: test-script - language: python - script: "print('Hello')" - data: diff --git a/src/qumada/config.cfg b/src/qumada/config.cfg deleted file mode 100644 index dfc04bce..00000000 --- a/src/qumada/config.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[gate_mapping] -save_directory = C:/Users/till3/Documents/PythonScripts diff --git a/src/qumada/legacy/measurement/gate_mapping.py b/src/qumada/legacy/measurement/gate_mapping.py deleted file mode 100644 index 6c6c2b2e..00000000 --- a/src/qumada/legacy/measurement/gate_mapping.py +++ /dev/null @@ -1,221 +0,0 @@ -# Copyright (c) 2023 JARA Institute for Quantum Information -# -# This file is part of QuMADA. -# -# QuMADA is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# QuMADA is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# QuMADA. If not, see . -# -# Contributors: -# - Daniel Grothe -# - Till Huckeman - - -import json # Used to store mappings until DB is functional -import re - -import qumada.utils.load_save_config as lsc -from qumada.measurement import get_from_station as gfs -from qumada.utils import browsefiles - - -def create_or_load_mapping(mapping): - class MapGenerator: - """ - Decorator used to separate the GateMapping class from the stuff that is - needed to create/load it. Keep in mind, that it will return the - MapGenerator object, to access the GateMapping() object, - usage of .wrap is required (ToDo: Change this) - """ - - def __init__(self, station, **kwargs): - # Get access to GateMapping methods - self.get_method(station) - # self.wrap = mapping(station, **kwargs) - - def get_method(self, station): - """ - User input to decide whether a mapping should be loaded from file - or a new one should be created. DB support to be added - """ - method = input("Do you want to load an existing mapping? (y/n)\n") - if method.lower() == "y": - return self.load_mapping(station) - elif method.lower() == "n": - return self.create_mapping(station) # Create new mapping - else: - print("Please enter y or n") - return self.get_method() - - def create_mapping(self, station): - """ - Create a new GateMapping with user input - """ - self.wrap = mapping(station) - try: - gate_number = int(input("Please enter number of gates:\n")) - except ValueError: - print("Please enter an integer number") - self.create_mapping() - for i in range(0, gate_number): - self.wrap.add_gate() - - def load_mapping(self, station): - """ - Used to load a mapping from file (DB support to be added) - Loading from json files works now, however, a new station object has - to be passed as the original one cannot be saved to a json file. - Should work as long as both station objects contain the same - instruments. - ToDo: Check whether old and new station object are compatible - """ - filename = browsefiles.browsefiles( - filetypes=(("json", ".json"), ("All files", "*.*")), - initialdir=lsc.load_from_config("gate_mapping", "save_directory"), - ) - # Save last directory used in config so you dont have to search for it. - directory = "/".join(filename.split("/")[0:-1]) - lsc.save_to_config("gate_mapping", "save_directory", directory) - try: - with open(filename) as read_file: - loaded_mapping = json.load(read_file) - except OSError: - # TODO: Handle File error - print("An OS error occured. Please check, whether you chose a valid file") - loaded_mapping["station"] = station - self.wrap = mapping(**loaded_mapping) - - return MapGenerator - - -@create_or_load_mapping -class GateMapping: - """ - Mapping of "physical" sample gates to device channels. - Requires qcodes station object as input - Requires user input. - To Do: - - Version without user input - - Measurement device types - - Think about dictionary structure - - Does not fit to our new concept of "Functionalities"- Probably direct - interaction with station object does not belong here anymore. - """ - - def __init__(self, station, **kwargs): - self.station = station - self.gate_number = kwargs.get("gate_number", 0) - self.gates = kwargs.get( - "gates", {} - ) # Mapping gate name <=> list with device channels: [0]=voltage, [1]=current - self.gate_types = kwargs.get("gate_types", self._load_gate_types()) - # self.add_gates() - - def _load_gate_types(self, file="./gate_types.dat"): - """ - Loads list of valid gate types from file. - Will open gui for choosing file if the entered one is not valid. - Todo: - Allow for user input/saving - """ - types = set() - try: - f = open(file) - except OSError: - print("Could not find file with gate types", file) - print("Please select file") - file = browsefiles.browsefiles(filetypes=(("dat", ".dat"), ("txt", ".txt"), ("All files", "*.*"))) - return self._load_gate_types(file=file) - - for line in f: - if line[0] != "#": - types.add(line.rstrip("\n")) - f.close() - return types - - def remove_gate(self, gate=None): - """ - Allows user to delete gates. - ToDo: Show list of available entries - """ - if gate is None: - gate = input("Enter name of gate you want to delete:\n") - try: - del self.gates[gate] - except KeyError: - print("This gate does not exist") - - def add_gate(self): - """ - Method that should be used for adding gates to the mapping. Requires - user input. - """ - key = input("Please enter gate name: ") - gate_type = self._gate_type_validator(self.gate_types) - volt_channel = self._add_volt() - current_channel = self._add_current() - self.gates[key] = {} - self.gates[key]["gate_type"] = gate_type - self.gates[key]["volt"] = volt_channel - self.gates[key]["current"] = current_channel - self.gate_number += 1 - - def _add_current(self): - """ - Add current channel to gate entry - """ - string = "Please select a channel to apply and measure currents for this gate.\n" - string += 'You can skip this by typing "exit"' - current_channel = gfs.select_channel(self.station, information=string) - return current_channel - - def _add_volt(self): - """ - Add volt channel to gate entry - """ - string = "Please select a channel to apply and measure voltages for this gate.\n" - volt_channel = gfs.select_channel(self.station, information=string) - return volt_channel - - def _gate_type_validator(self, gate_types, gate_type=None): - """ - Checks whether chosen gate type is valid. Necessary to rely on gate_type - variable in the measurement script. - """ - print("Valid gate types are:\n %s" % gate_types) - if gate_type in gate_types: - return gate_type - elif gate_type is None: - gate_type = input("Please enter gate type:\n") - return self._gate_type_validator(gate_types, gate_type) - else: - print("Invalid gate type. Known gate types are\n%s" % gate_types) - print("You can use 'other' for unspecified gates. Support for adding new types will be added later") - return self._gate_type_validator(gate_types) - - def save_to_file(self): - """ - Used to store mapping in json file - Not functional yet, have to find a way to store/restore Qcodes - objects like Instruments/Stations beforehand - Could be done via YAML config, check qcodes doc - """ - dictionary = self.__dict__ - dictionary["station"] = None - dictionary["gate_types"] = list(dictionary["gate_types"]) - text = json.dumps(dictionary) - file = browsefiles.browsesavefile( - filetypes=(("Json", "*.json*"), ("All files", "*.*")), - initialdir=lsc.load_from_config("gate_mapping", "save_directory"), - ) - directory = "/".join(file.strip("/")[0:-1]) - lsc.save_to_config("gate_mapping", "save_directory", directory) - file.write(text) - file.close() diff --git a/src/qumada/legacy/measurement/gate_types.dat b/src/qumada/legacy/measurement/gate_types.dat deleted file mode 100644 index 6abe0842..00000000 --- a/src/qumada/legacy/measurement/gate_types.dat +++ /dev/null @@ -1,4 +0,0 @@ -topgate -barriergate -plungergate -ohmic diff --git a/src/qumada/legacy/measurement/get_from_station.py b/src/qumada/legacy/measurement/get_from_station.py deleted file mode 100644 index a509e8eb..00000000 --- a/src/qumada/legacy/measurement/get_from_station.py +++ /dev/null @@ -1,259 +0,0 @@ -# Copyright (c) 2023 JARA Institute for Quantum Information -# -# This file is part of QuMADA. -# -# QuMADA is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# QuMADA is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# QuMADA. If not, see . -# -# Contributors: -# - Daniel Grothe - - -from collections.abc import Mapping - -from tabulate import tabulate - -_FLAG_FIRST = object() - - -def flatten_dict(d, join=lambda a, b: [a, b], lift=lambda x: x): - """ - Flattens nested dictionary - """ - results = [] - - def visit(subdict, results, partial_key): - for k, v in subdict.items(): - new_key = lift(k) if partial_key == _FLAG_FIRST else join(partial_key, lift(k)) - if isinstance(v, Mapping): - visit(v, results, new_key) - else: - results.append(new_key) - - visit(d, results, _FLAG_FIRST) - return results - - -def _find_instr_channel(key, station, last_entry=None, **kwargs): - """ """ - if last_entry is None: - last_entry = [] - dictionary = kwargs.get("dictionary", station.__dict__) - results = kwargs.get("results", []) - f_d = flatten_dict(dictionary, join=lambda a, b: [a, b]) - for entry in f_d: - # Some entries are lists rather than nested dicts. Treat both cases - # separately - if isinstance(entry, list): - for item in entry: - if str(item).find(key) >= 0: - results.append([*last_entry, *entry]) - try: - # Test if we have got an object with a .__dict__ function - # Need try/except as most entries won't have a .__dict__ - if ( - _find_instr_channel(dictionary=get_channel(station, entry).__dict__, key=key, station=station) - != [] - ): - # If true, we continue search inside entry.__dict__ - entry.append("__dict__") - # Do not pass **kwargs here as we don't want to double - # our results list. We still stay inside the main func. - results.append( - _find_instr_channel( - dictionary=get_channel(station, entry), - key=key, - station=station, - last_entry=[*last_entry, *entry], - ) - ) - except Exception: - pass - # Now search the nested dicts - elif isinstance(entry, dict): - if str(entry).find(key) >= 0: - # print('Found something2: ' + str([*last_entry, *entry])) - results.append([*last_entry, *entry]) - return results - - -def find_instr_channels(station, key, submodules=True, **kwargs): - """ - Creates list with all entries to the station that contain the key and does - not stop at the first level, where the key is found (e.g. if you look for - for some module named "key" all submodules of key will be listed as well) - """ - if not submodules: - return flatten_list(_find_instr_channel(key=key, station=station, **kwargs), []) - else: - results = flatten_list(_find_instr_channel(dictionary=station.__dict__, key=key, station=station), []) - # Now append all the results including subparams - for entry in results: - try: - helper = _find_instr_channel(dictionary=get_channel(station, entry).__dict__, station=station, key="") - except Exception: - continue - for result in helper: - if [*entry, "__dict__", *result] not in results: # necessary to avoid doubled entries - results.append([*entry, "__dict__", *result]) - return results - - -def flatten_list(mylist, result=None): - """ - Flattens nested lists. - Necessary to flatten output of find_instr_channel to make it - compatible with get_channel. Note that the result will still be a list of - lists! - """ - if result is None: - result = [] - for elem in mylist: - if not isinstance(elem, list): - if mylist not in result: - result.append(mylist) - break - else: - flatten_list(elem, result) - return result - - -def search_list(ls, key=""): - """ - Creates list with only entries containing the key from a larger list. - Intended to work with flattened results from find_instr_channels - """ - results = [] - keys = key.split(" ") - - def flatten(ls): - # Flatten list recursively if necessary - mylist = "" - for elem in ls: - if isinstance(elem, str): - mylist += elem - else: - return flatten(elem) - return mylist - - for elem in ls: - valid = True - try: - for string in keys: - if flatten(elem).find(string) < 0: - valid = False - break - if valid: - results.append(elem) - except Exception: - print("Skipped " + str(elem)) - continue - return results - - -def choose_result(results, **kwargs): - """ - User can choose result from list, function will return the choice - """ - info_text = kwargs.get("info_text", 'Please select index or enter "exit" to abort: ') - print("There are multiple results in the list:") - print(tabulate(results, tablefmt="psql", showindex=True)) - valid = False - while not valid: - try: - choice = input(info_text) - choice = int(choice) - if choice >= 0 and choice < len(results): - valid = True - else: - print("Please enter an index that corresponds to an entry") - except Exception: - if choice.lower() == "exit": - return None - elif choice.lower() == "again": - return "again" - else: - print("Please enter a number.") - return results[choice] - - -def select_channel(station, **kwargs): - """ - Used to search and select a certain channel/parameter from station object. - Just puts all the other methods in the right order and adds some comments. - Necessary to start new search with different key. - """ - information = kwargs.get("information", "") - silent = kwargs.get("silent", False) - if not silent: - print(information) - info_text = 'Please select index to proceed, enter "again" to start a new search or "exit" to abort. ' - key = kwargs.get("key", input("Please enter key to seach for or exit to skip:\n")) - if key.lower() == "exit": - return None - results = find_instr_channels(station=station, key=key, **kwargs) - while len(results) >= 50: - print("More than 50 results.") - key2 = input( - "Please enter one or more keywords (separated by blanks) for further specification" - ' or "all" to show all entries: ' - ) - if key2.lower() == "all": - break - results = search_list(results, key2) - result = choose_result(results, info_text=info_text, **kwargs) - if result == "again": - return select_channel(station, **kwargs) - else: - return result - - -def get_channel(station, path): - """ - Will return object/component of a qcodes station based on the "path - provided. The path has to be a list of the keys of station.__dict__ leading - to the wanted object. As some instruments may have submodules that are a - subclass/function of the instruments main class (e.g. dac channels), the - list may contain "__dict__" entries. In this case, the function will try to - get the channel/object from the .__dict__ of the object specified so far. - """ - - def level(last_level, item): - """ - Subroutine to allow (pseudo-recursion) to go to arbitrary deep levels - of nested structures. - """ - return last_level[item] - - # Define starting point - last_level = station.__dict__ - # Iterate over all list entries in the path - for i in range(0, len(path)): - # Go into __dict__ of the current object if necessary - if path[i] == "__dict__": - try: - last_level = last_level.__dict__ - except Exception: - print("Error: Could not find " + str(last_level) + ".__dict__.") - else: - # Go to next nested level and continue - last_level = level(last_level, path[i]) - return last_level - - -def get_by_type(mapping, gate_type): - """ """ - results = [] - for key in mapping.gates: - if mapping.gates[key]["gate_type"] == gate_type: - results.append(key) - return results diff --git a/src/qumada/legacy/measurement/measurement_for_immediate_use/SET_testing.py b/src/qumada/legacy/measurement/measurement_for_immediate_use/SET_testing.py deleted file mode 100644 index f605d747..00000000 --- a/src/qumada/legacy/measurement/measurement_for_immediate_use/SET_testing.py +++ /dev/null @@ -1,517 +0,0 @@ -# Copyright (c) 2023 JARA Institute for Quantum Information -# -# This file is part of QuMADA. -# -# QuMADA is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# QuMADA is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# QuMADA. If not, see . -# -# Contributors: -# - 4K User -# - Daniel Grothe -# - Till Huckeman - - -# type: ignore -""" -Due to problems with the "old" qcodes I decided to get the most basic -measurements running with the latest version, to perform measurements until -the QuMADA scripts are working. The measurements routines are not -yet compatible with the planned QuMADA-structure (e.g. functions still need - instrument parameters rather than gate_mapping object) but can be adapted -later on. -""" -# %% -import os -from time import sleep - -import matplotlib.pyplot as plt -import numpy as np -import qcodes as qc -from qcodes import ( - Measurement, - experiments, - initialise_database, - initialise_or_create_database_at, - load_by_guid, - load_by_run_spec, - load_experiment, - load_last_experiment, - load_or_create_experiment, - new_experiment, -) -from qcodes.dataset import do1d, do2d -from qcodes.dataset.plotting import plot_and_save_image, plot_dataset -from qcodes.instrument_drivers.Harvard.Decadac import Decadac -from qcodes.instrument_drivers.stanford_research.SR830 import SR830 -from qcodes.instrument_drivers.tektronix.Keithley_2400 import Keithley_2400 -from qcodes.instrument_drivers.tektronix.Keithley_2450 import Keithley2450 -from qcodes.logger.logger import start_all_logging -from qcodes.tests.instrument_mocks import ( - DummyInstrument, - DummyInstrumentWithMeasurement, -) - -# import src.qumada.utils.browsefiles as bf -# import src.qumada.measurement.gate_mapping as gm - -# %% -start_all_logging() -# %% Add imports here - -# Only dummy instruments available at home :-( -# A dummy instrument dac with two parameters ch1 and ch2 -dac = DummyInstrument("dac2", gates=["ch1", "ch2"]) - -# A dummy instrument that generates some real looking output depending -# on the values set on the setter_instr, in this case the dac -dmm = DummyInstrumentWithMeasurement("dmm", setter_instr=dac) - - -station = qc.Station(dac, dmm) -# %% Setup all instruments needed -qc.Instrument.close_all() - -# dac = Decadac('dac', 'ASRL6::INSTR', default_switch_pos=1) #-1=left, 0=middle, 1=right -dac = Decadac("dac", "ASRL6::INSTR", min_val=-10, max_val=10, terminator="\n") -lockin = SR830("lockin", "GPIB1::12::INSTR") -keithley = Keithley_2400("keithley", "GPIB1::27::INSTR") - -station = qc.Station(dac, lockin, keithley) -# %% define channels here - -sample_name = "AL809789_D2-SD7_QBB36_1_3_SET5" -topgate = keithley -left_barrier = dac.channels[0] -right_barrier = dac.channels[1] -barriers = [left_barrier, right_barrier] -centergate = dac.channels[2] -gate1 = dac.channels[3] -gate2 = dac.channels[4] -gate3 = dac.channels[5] -gate4 = dac.channels[6] -gates = {"centergate": centergate, "gate1": gate1, "gate2": gate2, "gate3": gate3, "gate4": gate4} -source_drain = lockin - - -# %% -def set_db_location(): - """ - Used to create or load the sqlite db used to store the measurement results. - WIP - Todo: - - Use QT based filebrowser instead of TKinter one - - Use filebrowser to specify location for new db (so far user input - in console is necessary) - - Add exception handling - - Add the possibility to abort creation - - Check if database was created successfully - - Creating a new database causes an exception (although the db is - created succesfully) - - Move to utils? - """ - load = input("Do you want to load an existing database? [y/n].\nIf you choose no, a new one will be created.\n") - if load.lower() == "y": - initialise_or_create_database_at(bf.browsefiles()) # filetypes = (("DB files", "*.db*")))) - return True - elif load.lower() == "n": - path = input("Please enter the directory, where you want to create the DB") - file = input("Please enter a name for the DB (without suffix)") + ".db" - initialise_or_create_database_at(path + "\\" + file) - return True - - else: - print("Please enter y or n") - return set_db_location() - - -# %% -path = r"C:\Users\lab2\data\Huckemann\IMEC\4K_Measurements.db" -initialise_or_create_database_at(path) - -# %% - - -def inducing_measurement( - topgate=topgate, - left_barrier=left_barrier, - right_barrier=right_barrier, - source_drain=source_drain, - topgate_range=[0, 3.5], - datapoints=250, - delay=0.1, - barrier_voltage=2, - source_drain_bias=1, - source_drain_frequency=173, - experiment_name="4K_Inducing_measurement", - sample=sample_name, -): - """ - Inducing measurement based on do1d. Writes to database. - Works only if Keithley2400/2401 is used to control the topgate, DecaDac to - control the barriers and Stanford Lockin to apply source-drain bias. - Not yet tested. - """ - - exp = load_or_create_experiment(experiment_name=experiment_name, sample_name=sample) - - for barrier in barriers: - barrier.ramp(barrier_voltage, 0.3) - - topgate.volt.set(0) - centergate.ramp(-1.5, 0.3) - source_drain.amplitude.set(source_drain_bias) - source_drain.frequency.set(source_drain_frequency) - meas = Measurement(exp=exp, station=station) - - dataset_up = do1d( - topgate.volt, - topgate_range[0], - topgate_range[1], - datapoints, - delay, - left_barrier.volt, - right_barrier.volt, - source_drain.R, - source_drain.P, - topgate.curr, - centergate.volt, - show_progress=True, - do_plot=False, - measurement_name="upsweep", - exp=exp, - ) - dataset_down = do1d( - topgate.volt, - topgate_range[1], - topgate_range[0], - datapoints, - delay, - left_barrier.volt, - right_barrier.volt, - source_drain.R, - source_drain.P, - topgate.curr, - centergate.volt, - show_progress=True, - do_plot=False, - measurement_name="downsweep", - exp=exp, - ) - - # for barrier in barriers: - # barrier.ramp(0, 0.3) - # topgate.volt.set(0) - # lockin.amplitude.set(0.004) - - return dataset_up, dataset_down - - -# %% - - -def pinchoff_measurement_1d( - topgate=topgate, - left_barrier=left_barrier, - right_barrier=right_barrier, - barriers=barriers, - topgate_volt=3.0, - barrier_voltage=2.0, - datapoints=350, - delay=0.1, - sweep_range=[0, 2.5], - source_drain=source_drain, - source_drain_bias=1, - source_drain_frequency=173, - experiment_name_prefix="4K_pinchoff_measurement", - sample=sample_name, -): - """ - Performs pinchoff measurements for all barriers listed in "barriers" one - after another. Same requirements as inducing_measurement() - Not yet test. - """ - datasets = [] - topgate.volt.set(topgate_volt) - source_drain.amplitude.set(source_drain_bias) - # Sweep left barrier - left_barrier.ramp(0, 0.3) - right_barrier.ramp(barrier_voltage, 0.3) - centergate.ramp(-1.5, 0.3) - sleep(5) - experiment_name = experiment_name_prefix + "_left_barrier" - exp = load_or_create_experiment(experiment_name, sample_name=sample) - data = do1d( - left_barrier.volt, - sweep_range[0], - sweep_range[1], - datapoints, - delay, - source_drain.R, - source_drain.P, - right_barrier.volt, - topgate.volt, - topgate.curr, - centergate.volt, - show_progress=True, - do_plot=True, - measurement_name="upsweep", - exp=exp, - ) - datasets.append(data) - data = do1d( - left_barrier.volt, - sweep_range[1], - sweep_range[0], - datapoints, - delay, - source_drain.R, - source_drain.P, - right_barrier.volt, - topgate.volt, - topgate.curr, - centergate.volt, - show_progress=True, - do_plot=True, - measurement_name="downsweep", - exp=exp, - ) - # Sweep right barrier - right_barrier.ramp(0, 0.3) - left_barrier.ramp(barrier_voltage, 0.3) - sleep(5) - experiment_name = experiment_name_prefix + "_right_barrier" - exp = load_or_create_experiment(experiment_name, sample_name=sample) - data = do1d( - right_barrier.volt, - sweep_range[0], - sweep_range[1], - datapoints, - delay, - source_drain.R, - source_drain.P, - left_barrier.volt, - topgate.volt, - topgate.curr, - centergate.volt, - show_progress=True, - do_plot=True, - measurement_name="upsweep", - exp=exp, - ) - datasets.append(data) - data = do1d( - right_barrier.volt, - sweep_range[1], - sweep_range[0], - datapoints, - delay, - source_drain.R, - source_drain.P, - left_barrier.volt, - topgate.volt, - topgate.curr, - centergate.volt, - show_progress=True, - do_plot=True, - measurement_name="downsweep", - exp=exp, - ) - - datasets.append(data) - return datasets - - -# %% -def pinchoff_measurement_2d( - topgate=topgate, - left_barrier=left_barrier, - right_barrier=right_barrier, - barriers=barriers, - topgate_volt=3.0, - datapoints=30, - delay=0.1, - sweep_range_lb=[0.55, 0.95], - sweep_range_rb=[0.7, 1.1], - source_drain=source_drain, - source_drain_bias=1, - source_drain_frequency=173, - experiment_name="4K_2D_pinchoff_measurement", - sample_name=sample_name, -): - exp = load_or_create_experiment(experiment_name, sample_name=sample_name) - left_barrier.ramp(sweep_range_lb[0], 0.2) - right_barrier.ramp(sweep_range_rb[0], 0.2) - centergate.ramp(-1.5, 0.3) - topgate.volt.set(topgate_volt) - source_drain.amplitude.set(source_drain_bias) - source_drain.frequency.set(source_drain_frequency) - sleep(5) - data = do2d( - left_barrier.volt, - sweep_range_lb[0], - sweep_range_lb[1], - datapoints, - 10 * delay, - right_barrier.volt, - sweep_range_rb[0], - sweep_range_rb[1], - datapoints, - delay, - source_drain.R, - source_drain.P, - topgate.volt, - topgate.curr, - centergate.volt, - show_progress=True, - measurement_name="2D_Sweep", - exp=exp, - ) - return data - - -# %% - - -def gate_measurement_1d( - topgate=topgate, - left_barrier=left_barrier, - right_barrier=right_barrier, - gates=gates, - centergate=centergate, - gate1=gate1, - gate2=gate2, - gate3=gate3, - gate4=gate4, - topgate_volt=4, - left_barrier_volt=0.855, - right_barrier_volt=0.45, - datapoints=500, - delay=0.1, - sweep_range=[0, 2.5], - source_drain=source_drain, - source_drain_bias=1, - source_drain_frequency=173, - experiment_name_prefix="4K_gate_measurement", - sample=sample_name, -): - """ - Performs gate measurements for all gates listed in "gates" one - after another by sweeping the voltage of the active gate. - """ - datasets = [] - topgate.volt.set(topgate_volt) - source_drain.amplitude.set(source_drain_bias) - - # Sweep active gate - left_barrier.ramp(left_barrier_volt, 0.3) - right_barrier.ramp(right_barrier_volt, 0.3) - - for gate in gates: - gates[gate].ramp(0, 0.3) - - for active_gate in gates: - sleep(5) - experiment_name = experiment_name_prefix + "_" + str(active_gate) - exp = load_or_create_experiment(experiment_name, sample_name=sample) - data = do1d( - gates[active_gate].volt, - sweep_range[0], - sweep_range[1], - datapoints, - delay, - source_drain.R, - source_drain.P, - right_barrier.volt, - left_barrier.volt, - topgate.volt, - topgate.curr, - show_progress=True, - do_plot=True, - measurement_name="upsweep", - exp=exp, - ) - datasets.append(data) - data = do1d( - gates[active_gate].volt, - sweep_range[1], - sweep_range[0], - datapoints, - delay, - source_drain.R, - source_drain.P, - right_barrier.volt, - left_barrier.volt, - topgate.volt, - topgate.curr, - show_progress=True, - do_plot=True, - measurement_name="downsweep", - exp=exp, - ) - datasets.append(data) - - gates[active_gate].ramp(0, 0.3) - - return datasets - - -# %% -times = DummyInstrument("dac_times_1", gates=["ch1"]) - - -# %% -def time_trace_SET( - topgate=topgate, - left_barrier=left_barrier, - right_barrier=right_barrier, - topgate_volt=1.45, - left_barrier_volt=0.4, - right_barrier_volt=0.48, - datapoints=600, - delay=1, - sweep_range=[0, 600], - source_drain=source_drain, - source_drain_bias=1, - source_drain_frequency=173, - experiment_name_prefix="4K_time_trace_measurement", - sample=sample_name, -): - """ - Measures the time trace at a given sensitive point using a Dummy DAC channel as time variable. - """ - - topgate.volt.set(topgate_volt) - source_drain.amplitude.set(source_drain_bias) - - left_barrier.ramp(left_barrier_volt, 0.3) - right_barrier.ramp(right_barrier_volt, 0.3) - sleep(5) - experiment_name = experiment_name_prefix + "_time_trace" - exp = load_or_create_experiment(experiment_name, sample_name=sample) - data = do1d( - times.ch1, - sweep_range[0], - sweep_range[1], - datapoints, - delay, - source_drain.R, - source_drain.P, - right_barrier.volt, - left_barrier.volt, - topgate.volt, - topgate.curr, - show_progress=True, - do_plot=True, - measurement_name="results", - exp=exp, - ) - return data diff --git a/src/qumada/legacy/measurement/measurement_for_immediate_use/__init__.py b/src/qumada/legacy/measurement/measurement_for_immediate_use/__init__.py deleted file mode 100644 index 845c6c32..00000000 --- a/src/qumada/legacy/measurement/measurement_for_immediate_use/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2023 JARA Institute for Quantum Information -# -# This file is part of QuMADA. -# -# QuMADA is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# QuMADA is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# QuMADA. If not, see . -#