Skip to content
Snippets Groups Projects
Commit 8bcd4978 authored by Stephan Philips's avatar Stephan Philips
Browse files

úpdates

parent 13d8b008
No related branches found
No related tags found
No related merge requests found
from core_tools.job_mgnt.calibrations.calibration_single import calibration_generic, CalibrationError
from core_tools.job_mgnt.calibrations.utility import param_mngr
from core_tools.GUI.keysight_videomaps.data.scan_generator_Virtual import construct_1D_scan_fast
SD_gates = {'SD_1':'SD1_P', 'SD_2':'SD2_P', 'SD_2':'SD2_P'}
class SD_cal(calibration_generic):
def __init__(self):
self.update_interval = 30
self.auto_update = True
self.getter = param_mngr('SD', unit='mV') + SL.SD
def calibrate(self):
for param in getter:
SD_gate = SD_gates[param.name]
# construct global cal_mgmt --> enable RF readout at dot 1
CAL_MGRG.rf_readout(['dot_1'], enable=True)
scan_obj = construct_1D_scan_fast(SD_gate, swing=5, n_pt=100, t_step=5, biasT_corr=10, pulse_lib, digitizer)
fit_voltage = fit_SD(scan_obj)
if abs(fit_voltage) < 2:
SD_gate_dc = self.station.gates.getattr()
SD_gate_dc.(SD_gate_dc.get + fit_voltage)
self.save_data(param, SD_gate_dc(), state=self.SUCCESS)
else:
self.save_data(param, state=self.FAIL)
raise CalibrationError('finding most sensitive spot of SD failed.')
# repeat 3 times to move toward (in case there is a slight mismatch between DC/AC conversion)
self.reiterate(3)
\ No newline at end of file
from core_tools.job_mgnt.calibrations.calibration_single import calibration_generic, CalibrationError
from core_tools.job_mgnt.calibrations.utility import param_mngr
from core_tools.GUI.keysight_videomaps.data.scan_generator_Virtual import construct_1D_scan_fast
SD_gates = {'SD_1':'SD1_P', 'SD_2':'SD2_P', 'SD_2':'SD2_P'}
class SD_cal(calibration_generic):
@dataclass
class SD_data:
v_peak : float
v_off : float
sigma : float
amp : float
_units = {'v_peak'='mV', 'v_off' = 'mV', 'sigma' = 'mV', 'amp' = 'mV'}
def __init__(self):
self.update_interval = 30
self.auto_update = True
self.getter = param_mngr('transition_line_lock_P', unit='mV') + SL.dots + SD_data
def calibrate(self, param):
pass
from calibration_data import data_mgr from calibration_data import data_mgr
import qcodes as qc
class CalibrationError(Exception): class CalibrationError(Exception):
pass pass
...@@ -21,17 +21,23 @@ def calibration_wrapper(cls, function): ...@@ -21,17 +21,23 @@ def calibration_wrapper(cls, function):
return run_function return run_function
class calibration_generic(): class calibration_generic():
def __init__(self): FAIL = 0
SUCCES = 1
station = qc.Station.default
def __new__(self):
self.update_interval = 0 # 0 for do not update self.update_interval = 0 # 0 for do not update
self.auto_update = False # automatically rerun the last calibration after the update intercal exceeded self.auto_update = False # automatically rerun the last calibration after the update intercal exceeded
self.prioritize = True # first calibration or first measurement self.prioritize = True # first calibration or first measurement
self.dependencies = dep_mgr() self.dependencies = dep_mgr()
self.data_mgr = data_mgr() self.data_mgr = data_mgr(self, 'todo')
# iteration variables # iteration variables
self._N_rep = 0 self._N_rep = 0
self._n = 0 self._n = 0
return self
def get_data(self, parameters ,set_vals = dict()): def get_data(self, parameters ,set_vals = dict()):
self.data_mgr.get(set_vals) self.data_mgr.get(set_vals)
...@@ -40,15 +46,20 @@ class calibration_generic(): ...@@ -40,15 +46,20 @@ class calibration_generic():
def reiterate(self, N=1): def reiterate(self, N=1):
''' '''
call this function in the call this function in to reiterature the same calibration N times.
''' '''
self._N_rep = N+1 self._N_rep = N+1
self._n = 0 self._n = 0
class ExampleCal(calibration_generic):
def ExampleCal(calibration_generic):
def __init__(self): def __init__(self):
self.dependencies += my_cals.readout_of_dot_1 self.dependencies += my_cals.readout_of_dot_1
self.dependencies += (my_cals.readout_of_dot_2, my_cals.tc_res) self.dependencies += (my_cals.readout_of_dot_2, my_cals.tc_res)
\ No newline at end of file
self.setters = ...
self.getters = ...
if __name__ == '__main__':
test = ExampleCal()
print(test)
print(test.update_interval)
\ No newline at end of file
from typing import Union from typing import Union
import numpy as np import numpy as np
from qcodes import Parameter
class SampleLayoutField(): class param_mngr(list):
'''
mangagment class for parameters, allows for easy extending of multiple param if needed.
'''
def __init__(self,name, unit='a.u.'):
super().__init__()
param = Parameter(name, label=name, unit=unit)
self.base_param = param
self.append(param)
def __add__(self, other):
if isinstance(other, SampleLayoutField):
for i in other:
if self[0] == self.base_param:
self.pop(0)
name = self.base_param.name + i
self += [Parameter(name, label=name, unit=self.base_param.unit)]
else:
raise ValueError('please add up the type SampleLayoutField')
return self
class SampleLayoutField(list):
# formatter for a single field of the sample layout class # formatter for a single field of the sample layout class
def __init__(self, std_field_name = '', input_names = tuple()): def __init__(self, std_field_name = '', input_names = list()):
''' '''
Args: Args:
std_field_name (str) : standard name to append before the input name std_field_name (str) : standard name to append before the input name
input_names (tuple<str>) : input names input_names (list<str>) : input names
''' '''
self.variable_names = list() super().__init__(input_names)
self.std_field_name = '_' if std_field_name == '' else "_" + std_field_name + '_' self.std_field_name = '_' if std_field_name == '' else "_" + std_field_name + '_'
self += input_names
def __add__(self, other): def __add__(self, other):
if isinstance(other, Union[str, int, float].__args__): if isinstance(other, Union[str, int, float].__args__):
...@@ -20,18 +43,12 @@ class SampleLayoutField(): ...@@ -20,18 +43,12 @@ class SampleLayoutField():
if isinstance(other, Union[list, tuple, np.ndarray, range].__args__): if isinstance(other, Union[list, tuple, np.ndarray, range].__args__):
for var in other: for var in other:
self.variable_names += [self.std_field_name + str(var)] self.append(self.std_field_name + str(var))
return self return self
raise ValueError('type not recognized?') raise ValueError('type not recognized?')
def __radd__(self, other): def __iadd__(self, other):
if isinstance(other, str): return self.__add__(other)
return_var = tuple()
for var in self.variable_names:
return_var += (other + var,)
return return_var
raise ValueError('type for adding not recognized. Only strings are supported')
class MyExampleSampleLayout(): class MyExampleSampleLayout():
def __init__(self): def __init__(self):
...@@ -51,7 +68,7 @@ if __name__ == '__main__': ...@@ -51,7 +68,7 @@ if __name__ == '__main__':
# example usage of layout class # example usage of layout class
SL = MyExampleSampleLayout() SL = MyExampleSampleLayout()
print('FREQ' + SL.qubits) # use in combination with param manager to easily generate paramter object.
print('J' + SL.qubit_pairs) FREQ = param_mngr('FREQ', 'Hz') + SL.qubits
print('SD' + SL.SD) for f in FREQ:
print('tc_res' + SL.res_barrier) print(f)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment