def frequency(self, val): if val not in [100, 120, 1e3, 10e3, "100", "120", "1k", "10k"]: raise ParameterError("Frequency must be either '100', '120', '1k' or '10k'") self._frequency = val try: val = unit_convert(val, 1, 200) except TypeError: pass self._write("FREQ {}".format(val))
def range(self, val): rng = unit_scale(str(val)) if not rng == round(rng, -int(floor(log10(rng)))): raise ParameterError() if str(rng)[0] != "2": raise ParameterError() if not 2000e-9 <= rng <= 200e6: raise ParameterError() self._range = val self._write("RANG {}".format(unit_convert(rng, 2, 2000)))