コード例 #1
0
ファイル: edge.py プロジェクト: MichaelSasser/ds2000
    def set_level(self, level: float = 0.0) -> None:
        """
        **Rigol Programming Guide**

        **Syntax**

        :TRIGger:EDGe:LEVel <level>
        :TRIGger:EDGe:LEVel?

        **Description**

        Set the trigger level of edge trigger and the unit is the same with the
        current amplitude unit.
        Query the current trigger level of edge trigger.

        **Parameter**

        ======== ===== =========================== =======
        Name     Type  Range                       Default
        ======== ===== =========================== =======
        <level>  Real  ± 5 × VerticalScale from    0
                       the screen center - OFFSet
        ======== ===== =========================== =======

        Note:
        For the VerticalScale, refer to the :CHANnel<n>:SCALe command.
        For the OFFSet, refer to the :CHANNel<n>:OFFSet command.

        **Return Format**

        The query returns the trigger level in scientific notation.

        **Example**

        :TRIGger:EDGe:LEVel 0.16
        The query returns 1.600000e-01.
        """
        # ToDo: What is with ext and acline? Is this the center?
        scale: float = -1.0
        offset: float = -1.0
        source = self.source.status()
        if source == "channel 1":
            scale = self.subdevice.device.channel1.get_scale()
            offset = self.subdevice.device.channel1.get_offset()
        elif source == "channel 2":
            scale = self.subdevice.device.channel2.scale()
            offset = self.subdevice.device.channel2.get_offset()
        else:
            DS2000StateError("The level coul'd only be set, if the source is"
                             "Channel 1 or Channel 2.")  # ToDo: Right??

        check_level(level, scale, offset)
        self.subdevice.device.ask(f":TRIGger:EDGe:LEVel {level}")
コード例 #2
0
    def set_lower_limit_trigger_level(self, level: float = 0.0) -> None:
        """
        **Rigol Programming Guide**

        **Syntax**

        :TRIGger:RUNT:BLEVel <level>
        :TRIGger:RUNT:BLEVel?

        **Description**

        Set the lower limit of the trigger level in runt trigger and the unit
        is the same with the current amplitude unit.

        Query the current lower limit of the trigger level in runt trigger.

        **Parameter**

        ======== ===== =========================== =======
        Name     Type  Range                       Default
        ======== ===== =========================== =======
        <level>  Real  ± 5 × VerticalScale from    0
                       the screen center - OFFSet
        ======== ===== =========================== =======

        Note:
        For the VerticalScale, refer to the :CHANnel<n>:SCALe command.
        For the OFFSet, refer to the :CHANNel<n>:OFFSet command.

        **Return Format**

        The query returns the lower limit of the trigger level in scientific
        notation.

        **Example**

        :TRIGger:RUNT:BLEVel 0.16
        The query returns 1.600000e-01.
        """
        scale: float = -1.0
        offset: float = -1.0
        channel: str = self.get_source()
        if channel == "CHANnel1":
            scale = self.subdevice.device.channel1.get_scale()
            offset = self.subdevice.device.channel1.get_offset()
        elif channel == "CHANnel2":
            scale = self.subdevice.device.channel2.scale()
            offset = self.subdevice.device.channel2.get_offset()
        else:
            raise RuntimeError("The oscilloscope returned an unknown channel")
        check_level(level, scale, offset)
        self.subdevice.device.ask(f":TRIGger:RUNT:BLEVel {level}")
コード例 #3
0
    def set_level(self, channel: int = 1, level: float = 0) -> None:
        """
        **Rigol Programming Guide**

        **Syntax**

        :TRIGger:PATTern:LEVel <chan>,<level>
        :TRIGger:PATTern:LEVel? <chan>

        **Description**

        Set the trigger level of each channel in pattern trigger and the unit
        is the same with the current amplitude unit.
        Query the current trigger level of each channel in pattern trigger.

        **Parameter**

        ======== ========= ========================= ========
        Name     Type      Range                     Default
        ======== ========= ========================= ========
        <chan>   Discrete  {CHANnel1|CHANnel2}       CHANnel1
        <level>  Real      ± 5 × VerticalScale from  0
                           the screen - OFFSet
        ======== ========= ========================= ========

        Note:
        For the VerticalScale, refer to the :CHANnel<n>:SCALe command.
        For the OFFSet, refer to the :CHANNel<n>:OFFSet command.

        **Return Format**

        The query returns the trigger level in scientific notation.

        **Example**

        :TRIGger:PATTern:LEVel CHANnel2,0.16
        The query returns 1.600000e-01.
        """
        scale: float = -1.0
        offset: float = -1.0
        if channel == 1:
            scale = self.subdevice.device.channel1.get_scale()
            offset = self.subdevice.device.channel1.get_offset()
        elif channel == 2:
            scale = self.subdevice.device.channel2.scale()
            offset = self.subdevice.device.channel2.get_offset()
        else:
            raise RuntimeError("The oscilloscope returned an unknown channel")
        check_level(level, scale, offset)
        self.subdevice.device.ask(f":TRIGger:PATTern:LEVel CHANnel{channel},",
                                  f"{level}")