def sample_frequency(self, frequency): """Sets the sample frequency in Hz (None is Trigger)""" assert type(frequency) in [float, int, type(None)] if frequency is None: index = 14 # Trigger else: frequency = discreteTruncate(frequency, SR830.SAMPLE_FREQUENCIES) index = SR830.SAMPLE_FREQUENCIES.index(frequency) self.write("SRAT%f" % index)
def set_IF_bandwidth(self, bandwidth): """ Sets the resolution bandwidth (IF bandwidth) """ allowedBandwidth = [10, 30, 100, 300, 1000, 3000, 3700, 6000] bandwidth = discreteTruncate(bandwidth, allowedBandwidth) if bandwidth: self.write("IFBW%d" % bandwidth) else: raise RangeException("Maximum IF bandwidth (6000) for Agilent " "8722ES exceeded")
def set_scaling(self, channel, precent, expand=0): """ Sets the offset of a channel (X=1, Y=2, R=3) to a certain precent (-105% to 105%) of the signal, with an optional expansion term (0, 10=1, 100=2) """ if channel not in self.CHANNELS: raise ValueError('SR830 channel is invalid') channel = self.CHANNELS.index(channel) + 1 expand = discreteTruncate(expand, self.EXPANSION_VALUES) self.write("OEXP %i,%.2f,%i" % (channel, precent, expand))
def scan_points(self, points): """ Sets the number of scan points, truncating to an allowed value if not properly provided """ points = discreteTruncate(points, Agilent8722ES.SCAN_POINT_VALUES) if points: self.write("POIN%d" % points) else: raise RangeException("Maximum scan points (1601) for" " Agilent 8722ES exceeded")