[docs]classAcquisitionType(Enum):"""Data acquisition from hardware."""DISCRIMINATION=auto()"""Demodulate, integrate the waveform and discriminate among states based on the voltages."""INTEGRATION=auto()"""Demodulate and integrate the waveform."""RAW=auto()"""Acquire the waveform as it is."""
[docs]classAveragingMode(Enum):"""Data averaging modes from hardware."""CYCLIC=auto()"""Better averaging for short timescale noise."""SINGLESHOT=auto()"""SINGLESHOT: No averaging."""SEQUENTIAL=auto()"""SEQUENTIAL: Worse averaging for noise[Avoid]"""@propertydefaverage(self)->bool:"""Whether an average is performed or not."""returnselfisnotAveragingMode.SINGLESHOT
Update=dict[str,Any]ConfigUpdate=dict[str,Update]"""Update for component configs.Maps component name to corresponding update, which in turn is a map fromconfig property name that needs an update to its new value."""# TODO: replace with https://docs.python.org/3/reference/compound_stmts.html#type-paramsT=TypeVar("T")# TODO: lift for general usage in Qibolabdefdefault(value:Optional[T],default:T)->T:"""None replacement shortcut."""returnvalueifvalueisnotNoneelsedefault
[docs]classExecutionParameters(Model):"""Data structure to deal with execution parameters."""nshots:Optional[int]=None"""Number of shots to sample from the experiment. Default is the runcard value. """relaxation_time:Optional[int]=None"""Time to wait for the qubit to relax to its ground Sample between shots in ns. Default is the runcard value. """fast_reset:bool=False"""Enable or disable fast reset."""acquisition_type:AcquisitionType=AcquisitionType.DISCRIMINATION"""Data acquisition type."""averaging_mode:AveragingMode=AveragingMode.SINGLESHOT"""Data averaging mode."""updates:list[ConfigUpdate]=Field(default_factory=list)"""List of updates for component configs. Later entries in the list take precedence over earlier ones (if they happen to update the same thing). These updates will be applied on top of platform defaults. """
[docs]defresults_shape(self,sweepers:list[ParallelSweepers],samples:int=-1)->tuple[int,...]:"""Compute the expected shape for collected data."""inner={AcquisitionType.DISCRIMINATION:(),AcquisitionType.INTEGRATION:(2,),AcquisitionType.RAW:(samples,2),}[self.acquisition_type]returnself.bins(sweepers)+inner