예제 #1
0
    def get_sensitivity(self, unit='V'):
        """
        Get the current sensitivity, in Volts.

        >>> li.get_sensitivity()
        0.1

        If the `unit` kwarg is specified, the value will
        be converted to the desired unit instead.

        >>> li.get_sensitivity(unit='uV')
        100000.

        Using `unit=True` will return a value in a 2-tuple
        along with the most sensible unit (as a string).

        >>> li.get_sensitivity(unit=True)
        (100, 'mV')

        """
        val = self.bus.ask("SEN")
        q, u = self.sensitivities[int(val)]
        if unit in self._V_scales.keys():
            sens = q * self._V_scales[u] / self._V_scales[unit]
            return sciround(sens, 1)
        else:
            return q, u
예제 #2
0
파일: lockins.py 프로젝트: baldwint/wanglib
    def get_sensitivity(self, unit='V'):
        """
        Get the current sensitivity, in Volts.

        >>> li.get_sensitivity()
        0.1

        If the `unit` kwarg is specified, the value will
        be converted to the desired unit instead.

        >>> li.get_sensitivity(unit='uV')
        100000.

        Using `unit=True` will return a value in a 2-tuple
        along with the most sensible unit (as a string).

        >>> li.get_sensitivity(unit=True)
        (100, 'mV')

        """
        val = self.bus.ask("SEN")
        q,u = self.sensitivities[int(val)]
        if unit in self._V_scales.keys():
            sens = q * self._V_scales[u] / self._V_scales[unit]
            return sciround(sens, 1)
        else:
            return q,u
예제 #3
0
    def set_timediv(self, to):
        """
        Set time per division, in seconds.

        :param to:  Desired seconds per division.
                    Acceptable values range from 10 seconds to 1, 2, or
                    4ns, depending on model, in a 1-2-4 sequence.
        :type to:   float

        """
        to = sciround(to, 1)
        if to in self._acceptable_timedivs:
            self.bus.write('HOR:MAI:SCA %.0E' % to)
        else:
            raise InstrumentError('Timediv not in %s' %
                                  str(self._acceptable_timedivs))
예제 #4
0
    def set_timediv(self, to):
        """
        Set time per division, in seconds.

        :param to:  Desired seconds per division.
                    Acceptable values range from 10 seconds to 1, 2, or
                    4ns, depending on model, in a 1-2-4 sequence.
        :type to:   float

        """
        to = sciround(to, 1)
        if to in self._acceptable_timedivs:
            self.bus.write('HOR:MAI:SCA %.0E' % to)
        else:
            raise InstrumentError('Timediv not in %s' %
                                  str(self._acceptable_timedivs))