def outputs(self, value=None): """Sets both signal outputs simultaneously. Keyword Arguments: value (tuple): Tuple of values {'on', 'off'} for channel 1 and 2 (default: None). Returns: A tuple with the states {'on', 'off'} for the two output channels if the keyword argument is not given. """ if value is None: return self.output1(), self.output2() else: if isinstance(value, tuple) or isinstance(value, list): if len(value) != 2: raise ToolkitError( "The values should be specified as a tuple, e.g. ('on', 'off')." ) self.output1(value[0]) self.output2(value[1]) else: raise ToolkitError( "The value must be a tuple or list of length 2!")
def _apply_sequence_settings(self, **kwargs): if "sequence_type" in kwargs.keys(): t = SequenceType(kwargs["sequence_type"]) allowed_sequences = [ SequenceType.NONE, SequenceType.SIMPLE, SequenceType.READOUT, SequenceType.CW_SPEC, SequenceType.PULSED_SPEC, SequenceType.CUSTOM, ] if t not in allowed_sequences: raise ToolkitError( f"Sequence type {t} must be one of {[s.value for s in allowed_sequences]}!" ) # apply settings depending on sequence type elif t == SequenceType.CW_SPEC: self._apply_cw_settings() elif t == SequenceType.PULSED_SPEC: self._apply_pulsed_settings() elif t == SequenceType.READOUT: self._apply_readout_settings() else: self._apply_base_settings() # apply settings dependent on trigger type if "trigger_mode" in kwargs.keys(): if TriggerMode( kwargs["trigger_mode"]) == TriggerMode.EXTERNAL_TRIGGER: self._apply_trigger_settings()
def connect_device(self, device: BaseInstrument) -> None: """Connects a device to the :class:`MultiDeviceConnection`. Adds a device to the :class:`MultiDeviceConnection` and connects the device to the shared Data Server. Depending on the device type, the device is added to respective dictionary and can then be accessed from there. Arguments: device (BaseInstrument): the device to be added to the MultiDeviceConnection, has to be one of :class:`HDAWG`, :class:`UHFQA`, :class:`UHFLI`, :class:`MFLI`, :class:`PQSC` Raises: ToolkitError: if the device is not recognized """ if isinstance(device, HDAWG): self._hdawgs[device.name] = device elif isinstance(device, UHFQA): self._uhfqas[device.name] = device elif isinstance(device, PQSC): self._pqsc = device elif isinstance(device, UHFLI): self._uhflis = device elif isinstance(device, MFLI): self._mflis = device else: raise ToolkitError("This device is not recognized!") device.setup(connection=self._shared_connection) device.connect_device()
def _apply_sequence_settings(self, **kwargs): # apply settings depending on the sequence type if "sequence_type" in kwargs.keys(): t = SequenceType(kwargs["sequence_type"]) allowed_sequences = [ SequenceType.NONE, SequenceType.PULSETRAIN, SequenceType.SIMPLE, SequenceType.READOUT, SequenceType.CW_SPEC, SequenceType.PULSED_SPEC, SequenceType.CUSTOM, ] if t not in allowed_sequences: raise ToolkitError( f"Sequence type {t} must be one of {[s.value for s in allowed_sequences]}!" ) elif t == SequenceType.CW_SPEC: self._apply_cw_settings() elif t == SequenceType.PULSED_SPEC: self._apply_pulsed_settings() elif t == SequenceType.READOUT: self._apply_readout_settings() else: self._apply_base_settings() # apply settings dependent on trigger mode if "trigger_mode" in kwargs.keys(): t = TriggerMode(kwargs["trigger_mode"]) allowed_trigger_modes = [ TriggerMode.NONE, TriggerMode.SEND_TRIGGER, TriggerMode.EXTERNAL_TRIGGER, TriggerMode.RECEIVE_TRIGGER, TriggerMode.SEND_AND_RECEIVE_TRIGGER, TriggerMode.ZSYNC_TRIGGER, ] if t not in allowed_trigger_modes: raise ToolkitError( f"Trigger mode {t} must be one of {[s.value for s in allowed_trigger_modes]}!" ) elif t in [TriggerMode.EXTERNAL_TRIGGER, TriggerMode.RECEIVE_TRIGGER]: self._apply_receive_trigger_settings() elif t == TriggerMode.ZSYNC_TRIGGER: self._apply_zsync_trigger_settings()
def update_readout_params(self) -> None: """Updates the sequence parameters for 'Simple' sequence with values from the readout channels.""" if self.sequence_params["sequence_type"] == SequenceType.READOUT: freqs = [] amps = [] phases = [] for ch in self._parent.channels: if ch.enabled(): freqs.append(ch.readout_frequency()) amps.append(ch.readout_amplitude()) phases.append(ch.phase_shift()) self.set_sequence_params( readout_frequencies=freqs, readout_amplitudes=amps, phase_shifts=phases, ) else: raise ToolkitError("AWG Sequence type needs to be 'Readout'")
def _apply_sequence_settings(self, **kwargs): if "sequence_type" in kwargs.keys(): t = SequenceType(kwargs["sequence_type"]) allowed_sequences = [ SequenceType.NONE, SequenceType.SIMPLE, SequenceType.RABI, SequenceType.T1, SequenceType.T2, SequenceType.CUSTOM, SequenceType.TRIGGER, ] if t not in allowed_sequences: raise ToolkitError( f"Sequence type {t} must be one of {allowed_sequences}!") if "trigger_mode" in kwargs.keys(): if TriggerMode( kwargs["trigger_mode"]) == TriggerMode.EXTERNAL_TRIGGER: self._apply_trigger_settings()
def _apply_sequence_settings(self, **kwargs): if "sequence_type" in kwargs.keys(): t = SequenceType(kwargs["sequence_type"]) allowed_sequences = [ SequenceType.NONE, SequenceType.PULSETRAIN, SequenceType.CUSTOM, ] if t not in allowed_sequences: raise ToolkitError( f"Sequence type {t} must be one of {[s.value for s in allowed_sequences]}!" ) # apply settings depending on sequence type self._apply_base_settings() # apply settings dependent on trigger type if "trigger_mode" in kwargs.keys(): if TriggerMode( kwargs["trigger_mode"]) == TriggerMode.EXTERNAL_TRIGGER: self._apply_trigger_settings()
def awg(self): if "AWG" not in self._options: raise ToolkitError("The AWG option is not installed.") return self._awg