def set_averaging(self, averages): """Sets the number of averages and enables/disables averaging. Should be between 1 and 999""" averages = int(averages) if not 1 <= averages <= 999: assert RangeException("Set", averages, "must be in the range 1 to 999") self.averages = averages self.averaging_enabled = (averages > 1)
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_timed_arm(self, interval): """ Sets up the measurement to be taken with the internal trigger at a variable sampling rate defined by the interval in seconds between sampling points """ if interval > 99999.99 or interval < 0.001: raise RangeException("Keithley 2400 can only be time" " triggered between 1 mS and 1 Ms") self.write(":ARM:SOUR TIM;:ARM:TIM %.3f" % interval)
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")
def set_trigger_counts(self, arm, trigger): """ Sets the number of counts for both the sweeps (arm) and the points in those sweeps (trigger), where the total number of points can not exceed 2500 """ if arm * trigger > 2500 or arm * trigger < 0: raise RangeException("Keithley 2400 has a combined maximum " "of 2500 counts") if arm < trigger: self.write(":ARM:COUN %d;:TRIG:COUN %d" % (arm, trigger)) else: self.write(":TRIG:COUN %d;:ARM:COUN %d" % (trigger, arm))
def set_sequence(self, stack, currents, times, multiplier=999999): """ Sets up an arbitrary ramp profile with a list of currents (Amps) and a list of interval times (seconds) on the specified stack number (0-15) """ self.clear_sequence(stack) if min(times) >= 1 and max(times) <= 65535: self.write("SLOW %i" % stack) elif min(times) >= 0.1 and max(times) <= 6553.5: self.write("FAST %i" % stack) times = [0.1 * x for x in times] else: raise RangeException("Timing for Danfysik 8500 ramp sequence is" " out of range") for i in range(len(times)): self.write("WSA %i,%i,%i,%i" % (stack, int(6250 * abs(currents[i])), int(6250 * abs(currents[i + 1])), times[i])) self.write("MULT %i,%i" % (stack, multiplier))
def current_ppm(self, ppm): if abs(ppm) < 0 or abs(ppm) > 1e6: raise RangeException("Danfysik 8500 requires parts per million " "to be an appropriate integer") self.write("DA 0,%d" % ppm)
def current(self, amps): if amps > 160 or amps < -160: raise RangeException("Danfysik 8500 is only capable of sourcing " "+/- 160 Amps") self.current_ppm = int((1e6 / 160) * amps)
def restart_averaging(self, averages): if int(averages) > 999 or int(averages) < 0: raise RangeException("Averaging must be in the range 0 to 999") else: self.write("NUMG%d" % averages)