[docs]classAbstractSweep(ABC,Generic[T]):""" Abstract sweep class that defines an interface for concrete sweep classes. """
[docs]@abstractmethoddefget_setpoints(self)->npt.NDArray[T]:""" Returns an array of setpoint values for this sweep. """pass
@property@abstractmethoddefparam(self)->ParameterBase:""" Returns the Qcodes sweep parameter. """pass@property@abstractmethoddefdelay(self)->float:""" Delay between two consecutive sweep points. """pass@property@abstractmethoddefnum_points(self)->int:""" Number of sweep points. """pass@property@abstractmethoddefpost_actions(self)->ActionsT:""" actions to be performed after setting param to its setpoint. """pass@propertydefget_after_set(self)->bool:""" Should we perform a call to get on the parameter after setting it and store that rather than the setpoint value in the dataset? This defaults to False for backwards compatibility but subclasses should overwrite this to implement if correctly. """returnFalse
[docs]classLinSweep(AbstractSweep[np.float64]):""" Linear sweep. Args: param: Qcodes parameter to sweep. start: Sweep start value. stop: Sweep end value. num_points: Number of sweep points. delay: Time in seconds between two consecutive sweep points. post_actions: Actions to do after each sweep point. get_after_set: Should we perform a get on the parameter after setting it and store the value returned by get rather than the set value in the dataset. """def__init__(self,param:ParameterBase,start:float,stop:float,num_points:int,delay:float=0,post_actions:ActionsT=(),get_after_set:bool=False,):self._param=paramself._start=startself._stop=stopself._num_points=num_pointsself._delay=delayself._post_actions=post_actionsself._get_after_set=get_after_set
[docs]defget_setpoints(self)->npt.NDArray[np.float64]:""" Linear (evenly spaced) numpy array for supplied start, stop and num_points. """returnnp.linspace(self._start,self._stop,self._num_points)
[docs]classLogSweep(AbstractSweep[np.float64]):""" Logarithmic sweep. Args: param: Qcodes parameter for sweep. start: Sweep start value. stop: Sweep end value. num_points: Number of sweep points. delay: Time in seconds between two consecutive sweep points. post_actions: Actions to do after each sweep point. get_after_set: Should we perform a get on the parameter after setting it and store the value returned by get rather than the set value in the dataset. """def__init__(self,param:ParameterBase,start:float,stop:float,num_points:int,delay:float=0,post_actions:ActionsT=(),get_after_set:bool=False,):self._param=paramself._start=startself._stop=stopself._num_points=num_pointsself._delay=delayself._post_actions=post_actionsself._get_after_set=get_after_set
[docs]defget_setpoints(self)->npt.NDArray[np.float64]:""" Logarithmically spaced numpy array for supplied start, stop and num_points. """returnnp.logspace(self._start,self._stop,self._num_points)
[docs]classArraySweep(AbstractSweep,Generic[T]):""" Sweep the values of a given array. Args: param: Qcodes parameter for sweep. array: array with values to sweep. delay: Time in seconds between two consecutive sweep points. post_actions: Actions to do after each sweep point. get_after_set: Should we perform a get on the parameter after setting it and store the value returned by get rather than the set value in the dataset. """def__init__(self,param:ParameterBase,array:Sequence[Any]|npt.NDArray[T],delay:float=0,post_actions:ActionsT=(),get_after_set:bool=False,):self._param=paramself._array=np.array(array)self._delay=delayself._post_actions=post_actionsself._get_after_set=get_after_set
[docs]classTogetherSweep:""" A combination of Multiple sweeps that are to be performed in parallel such that all parameters in the `TogetherSweep` are set to the next value before a parameter is read. """def__init__(self,*sweeps:AbstractSweep):iflen(sweeps)==0:raiseValueError("A TogetherSweep must contain at least one sweep.")len_0=sweeps[0].num_pointsforsweepinsweeps:ifsweep.num_points!=len_0:raiseValueError(f"All Sweeps in a TogetherSweep must have the same length."f"Sweep of {sweep.param} had {sweep.num_points} but the "f"first one had {len_0}.")self._sweeps=tuple(sweeps)@propertydefsweeps(self)->tuple[AbstractSweep,...]:returnself._sweeps