Exemplo n.º 1
0
    def int_weights_envelope(self, envelope=None):
        """Set or get the envelope multiplied with the integration
        weights.

        Arguments:
            envelope (list or double): Envelope value or list of values
                to be multiplied with the integration weights. Each
                value must be between 0.0 and 1.0 (default: 1.0).
        Raises:
            ToolkitError: If integration weight envelope is given as a
                list or array but the length of the list does not match
                the integration length.

        """
        if envelope is None:
            return self._int_weights_envelope
        else:
            if isinstance(envelope, list) or isinstance(envelope, np.ndarray):
                if len(envelope) == self._parent.integration_length():
                    for i in range(len(envelope)):
                        envelope[i] = Parse.greater_equal(envelope[i], 0)
                        envelope[i] = Parse.smaller_equal(envelope[i], 1.0)
                else:
                    _logger.error(
                        "The length of `int_weights_envelope` list must be equal to "
                        "integration length.",
                        _logger.ExceptionTypes.ToolkitError,
                    )
            else:
                envelope = Parse.greater_equal(envelope, 0)
                envelope = Parse.smaller_equal(envelope, 1.0)
            self._int_weights_envelope = envelope
            self._set_int_weights()
            return self._int_weights_envelope
Exemplo n.º 2
0
 def _init_sweeper_params(self):
     self.oscillator_gain = Parameter(
         self,
         self._device._get_node_dict(f"qachannels/{self._index}/oscs/0/gain"),
         device=self._device,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, 0.0),
         ],
     )
     self.oscillator_freq = Parameter(
         self,
         self._device._get_node_dict(f"qachannels/{self._index}/oscs/0/freq"),
         device=self._device,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1e9),
             lambda v: Parse.greater_equal(v, 0.0),
         ],
     )
     self.integration_time = Parameter(
         self,
         dict(
             Node=f"{self._device.serial}/qachannels/{self._index}/spectroscopy/length".upper(),
             Description="Sets the integration length in Spectroscopy mode in unit "
             "of seconds. Up to 16.7 ms can be recorded, which "
             "corresponds to 33.5 MSa (2^25 samples).",
             Type="Double",
             Properties="Read, Write, Setting",
             Unit="s",
         ),
         device=self._device,
         set_parser=Parse.shfqa_time2samples,
         get_parser=Parse.shfqa_samples2time,
     )
     self.integration_length = Parameter(
         self,
         self._device._get_node_dict(
             f"qachannels/{self._index}/spectroscopy/length"
         ),
         device=self._device,
         set_parser=[
             lambda v: Parse.greater_equal(v, 4),
             lambda v: Parse.smaller_equal(v, ((2 ** 23) - 1) * 4),
             lambda v: Parse.multiple_of(v, 4, "down"),
         ],
     )
     self.integration_delay = Parameter(
         self,
         self._device._get_node_dict(f"qachannels/{self._index}/spectroscopy/delay"),
         device=self._device,
         set_parser=lambda v: Parse.multiple_of(v, 2e-9, "nearest"),
     )
     self.trigger_source = Parameter(
         self,
         self._device._get_node_dict(
             f"qachannels/{self._index}/spectroscopy/trigger/channel"
         ),
         device=self._device,
         auto_mapping=True,
     )
Exemplo n.º 3
0
 def _init_qachannel_params(self):
     self.input = Parameter(
         self,
         self._parent._get_node_dict(f"qachannels/{self._index}/input/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.input_range = Parameter(
         self,
         self._parent._get_node_dict(
             f"qachannels/{self._index}/input/range"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.greater_equal(v, -50),
             lambda v: Parse.smaller_equal(v, 10),
             lambda v: Parse.multiple_of(v, 5, "nearest"),
         ],
     )
     self.output = Parameter(
         self,
         self._parent._get_node_dict(f"qachannels/{self._index}/output/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.output_range = Parameter(
         self,
         self._parent._get_node_dict(
             f"qachannels/{self._index}/output/range"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.greater_equal(v, -50),
             lambda v: Parse.smaller_equal(v, 10),
             lambda v: Parse.multiple_of(v, 5, "nearest"),
         ],
     )
     self.center_freq = Parameter(
         self,
         self._parent._get_node_dict(
             f"qachannels/{self._index}/centerfreq"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.greater_equal(v, 1e9),
             lambda v: Parse.smaller_equal(v, 8e9),
             lambda v: Parse.multiple_of(v, 100e6, "nearest"),
         ],
     )
     self.mode = Parameter(
         self,
         self._parent._get_node_dict(f"qachannels/{self._index}/mode"),
         device=self._parent,
         auto_mapping=True,
     )
Exemplo n.º 4
0
 def _init_params(self):
     """Initialize parameters associated with device nodes."""
     super()._init_params()
     self.ref_clock = Parameter(
         self,
         self._get_node_dict(f"system/clocks/referenceclock/in/source"),
         device=self,
         auto_mapping=True,
     )
     self.ref_clock_actual = Parameter(
         self,
         self._get_node_dict(
             f"system/clocks/referenceclock/in/sourceactual"),
         device=self,
         auto_mapping=True,
     )
     self.ref_clock_status = Parameter(
         self,
         self._get_node_dict(f"system/clocks/referenceclock/in/status"),
         device=self,
         get_parser=Parse.get_locked_status,
     )
     self.progress = Parameter(
         self,
         self._get_node_dict(f"execution/progress"),
         device=self,
     )
     self._enable = Parameter(
         self,
         self._get_node_dict(f"execution/enable"),
         device=self,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.repetitions = Parameter(
         self,
         self._get_node_dict(f"execution/repetitions"),
         device=self,
         set_parser=[
             lambda v: Parse.greater_equal(v, 1),
             lambda v: Parse.smaller_equal(v, 2**32 - 1),
         ],
     )
     self.holdoff = Parameter(
         self,
         self._get_node_dict(f"execution/holdoff"),
         device=self,
         set_parser=[
             lambda v: Parse.greater_equal(v, 100e-9),
             lambda v: Parse.multiple_of(v, 100e-9, "nearest"),
         ],
     )
Exemplo n.º 5
0
    def readout_amplitude(self, amp=None):
        """Sets or gets the readout amplitude for this channel.

        The amplitude of the readout pulse is used for signal
        generation of the readout tone if the channel is enabled and if
        the AWG :class:`SequenceProgram` is of type *'Readout'*
        (default: 1.0).

        """
        if amp is None:
            return self._readout_amplitude
        else:
            Parse.smaller_equal(amp, 1.0)
            Parse.greater_equal(amp, -1.0)
            self._readout_amplitude = amp
            return self._readout_amplitude
Exemplo n.º 6
0
 def _init_awg_params(self):
     self._enable = Parameter(
         self,
         self._parent._get_node_dict(f"awgs/0/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.output1 = Parameter(
         self,
         self._parent._get_node_dict("sigouts/0/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.output2 = Parameter(
         self,
         self._parent._get_node_dict("sigouts/1/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.gain1 = Parameter(
         self,
         self._parent._get_node_dict("awgs/0/outputs/0/amplitude"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, -1.0),
         ],
     )
     self.gain2 = Parameter(
         self,
         self._parent._get_node_dict("awgs/0/outputs/1/amplitude"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, -1.0),
         ],
     )
     self.single = Parameter(
         self,
         self._parent._get_node_dict("awgs/0/single"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
Exemplo n.º 7
0
 def _init_scope_params(self):
     self._enable = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.single = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/single"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.length = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/length"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.greater_equal(v, 4096),
             lambda v: Parse.smaller_equal(v, 128000000),
             lambda v: Parse.multiple_of(v, 16, "down"),
         ],
     )
     self._channel = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channel"),
         device=self._parent,
     )
     self.trigger_source = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/trigchannel"),
         device=self._parent,
         auto_mapping=True,
     )
     self.trigger_level = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/triglevel"),
         device=self._parent,
     )
     self.trigger_enable = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/trigenable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.trigger_reference = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/trigreference"),
         device=self._parent,
     )
     self.trigger_holdoff = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/trigholdoff"),
         device=self._parent,
     )
Exemplo n.º 8
0
 def _init_params(self):
     """Initialize parameters associated with device nodes."""
     super()._init_params()
     self.integration_time = Parameter(
         self,
         dict(
             Node=f"{self.serial}/qas/0/integration/length".upper(),
             Description=
             "The integration time of all weighted integration units "
             "specified in seconds. In Standard mode, a maximum of 4096 "
             "samples can be integrated, which corresponds to 2.3 µs. "
             "In Spectroscopy mode, a maximum of 16.7 MSa can be "
             "integrated, which corresponds to ~10 ms.",
             Type="Double",
             Properties="Read, Write, Setting",
             Unit="s",
         ),
         device=self,
         set_parser=Parse.uhfqa_time2samples,
         get_parser=Parse.uhfqa_samples2time,
     )
     self.integration_length = Parameter(
         self,
         self._get_node_dict("qas/0/integration/length"),
         device=self,
         set_parser=[
             lambda v: Parse.greater_equal(v, 4),
             lambda v: Parse.multiple_of(v, 4, "down"),
         ],
     )
     self.result_source = Parameter(
         self,
         self._get_node_dict("qas/0/result/source"),
         device=self,
         mapping=MAPPINGS["result_source"],
     )
     self.averaging_mode = Parameter(
         self,
         self._get_node_dict("qas/0/result/mode"),
         device=self,
         mapping=MAPPINGS["averaging_mode"],
     )
     self.ref_clock = Parameter(
         self,
         self._get_node_dict(f"system/extclk"),
         device=self,
         auto_mapping=True,
     )
Exemplo n.º 9
0
 def _init_awg_params(self):
     self._enable = Parameter(
         self,
         self._parent._get_node_dict(f"awgs/{self._index}/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.output1 = Parameter(
         self,
         self._parent._get_node_dict(f"sigouts/{2*self._index}/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.output2 = Parameter(
         self,
         self._parent._get_node_dict(f"sigouts/{2*self._index+1}/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.modulation_freq = Parameter(
         self,
         self._parent._get_node_dict(f"oscs/{4 * self._index}/freq"),
         device=self._parent,
         set_parser=lambda v: Parse.greater(v, 0),
     )
     self.modulation_phase_shift = Parameter(
         self,
         self._parent._get_node_dict(
             f"sines/{2 * self._index + 1}/phaseshift"),
         device=self._parent,
         set_parser=Parse.phase,
     )
     self.gain1 = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/outputs/0/gains/0"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, -1.0),
         ],
     )
     self.gain2 = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/outputs/1/gains/1"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, -1.0),
         ],
     )
     self.single = Parameter(
         self,
         self._parent._get_node_dict(f"awgs/{self._index}/single"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.zsync_register_mask = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/register/mask"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 15),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_register_shift = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/register/shift"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 3),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_register_offset = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/register/offset"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1023),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_decoder_mask = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/decoder/mask"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 255),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_decoder_shift = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/decoder/shift"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 7),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_decoder_offset = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/decoder/offset"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1023),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
Exemplo n.º 10
0
 def _init_scope_params(self):
     self._enable = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.channel1 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/0/enable"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.channel2 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/1/enable"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.channel3 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/2/enable"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.channel4 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/3/enable"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.input_select1 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/0/inputselect"),
         device=self._parent,
         auto_mapping=True,
     )
     self.input_select2 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/1/inputselect"),
         device=self._parent,
         auto_mapping=True,
     )
     self.input_select3 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/2/inputselect"),
         device=self._parent,
         auto_mapping=True,
     )
     self.input_select4 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/3/inputselect"),
         device=self._parent,
         auto_mapping=True,
     )
     self._wave1 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/0/wave"),
         device=self._parent,
     )
     self._wave2 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/1/wave"),
         device=self._parent,
     )
     self._wave3 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/2/wave"),
         device=self._parent,
     )
     self._wave4 = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/channels/3/wave"),
         device=self._parent,
     )
     self.trigger_source = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/trigger/channel"),
         device=self._parent,
         auto_mapping=True,
     )
     self.trigger_delay = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/trigger/delay"),
         device=self._parent,
         set_parser=lambda v: Parse.multiple_of(v, 2e-9, "nearest"),
     )
     self.length = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/length"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.greater_equal(v, 16),
             lambda v: Parse.smaller_equal(v, 2 ** 18),
             lambda v: Parse.multiple_of(v, 16, "down"),
         ],
     )
     self.time = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/time"),
         device=self._parent,
         auto_mapping=True,
     )
     self._segments_enable = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/segments/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self._segments_count = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/segments/count"),
         device=self._parent,
         set_parser=lambda v: Parse.greater(v, 0),
     )
     self._averaging_enable = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/averaging/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self._averaging_count = Parameter(
         self,
         self._parent._get_node_dict(f"scopes/0/averaging/count"),
         device=self._parent,
         set_parser=lambda v: Parse.greater(v, 0),
     )
Exemplo n.º 11
0
 def _init_awg_params(self):
     self._enable = Parameter(
         self,
         self._parent._get_node_dict(f"awgs/{self._index}/enable"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.output1 = Parameter(
         self,
         self._parent._get_node_dict(f"sigouts/{2*self._index}/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     self.output2 = Parameter(
         self,
         self._parent._get_node_dict(f"sigouts/{2*self._index+1}/on"),
         device=self._parent,
         set_parser=Parse.set_on_off,
         get_parser=Parse.get_on_off,
     )
     # If the HDAWG has the MF option, the oscillator assignment
     # per core is different
     if "MF" in self._parent.options:
         oscs_multiplier = 4
     else:
         oscs_multiplier = 1
     self.modulation_freq = Parameter(
         self,
         self._parent._get_node_dict(
             f"oscs/{oscs_multiplier* self._index}/freq"),
         device=self._parent,
         set_parser=lambda v: Parse.greater(v, 0),
     )
     self.modulation_phase_shift = Parameter(
         self,
         self._parent._get_node_dict(
             f"sines/{2 * self._index + 1}/phaseshift"),
         device=self._parent,
         set_parser=Parse.phase,
     )
     self.gain1 = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/outputs/0/gains/0"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, -1.0),
         ],
     )
     self.gain2 = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/outputs/1/gains/1"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1.0),
             lambda v: Parse.greater_equal(v, -1.0),
         ],
     )
     self.single = Parameter(
         self,
         self._parent._get_node_dict(f"awgs/{self._index}/single"),
         device=self._parent,
         set_parser=Parse.set_true_false,
         get_parser=Parse.get_true_false,
     )
     self.zsync_register_mask = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/register/mask"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 15),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_register_shift = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/register/shift"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 3),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_register_offset = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/register/offset"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1023),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_decoder_mask = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/decoder/mask"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 255),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_decoder_shift = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/decoder/shift"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 7),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )
     self.zsync_decoder_offset = Parameter(
         self,
         self._parent._get_node_dict(
             f"awgs/{self._index}/zsync/decoder/offset"),
         device=self._parent,
         set_parser=[
             lambda v: Parse.smaller_equal(v, 1023),
             lambda v: Parse.greater_equal(v, 0),
         ],
     )