import sys import time from core.tellie_server import SerialCommand from common import parameters as p sc = SerialCommand(p._serial_port) # set in tellie.cfg channels = range(2,17) try: channels = [int(sys.argv[1])] print "RUNNING CHANNEL",channels except: pass print channels widths = range(0,1000,500) sc.select_channel(channels[0]) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_delay(p._pulse_delay) sc.set_pulse_number(p._pulse_num) sc.set_fibre_delay(0) sc.set_trigger_delay(0) sc.disable_external_trigger() sc.set_pulse_width(p._max_pulse_width) sc.fire() time.sleep(p._medium_pause) pin = None while pin==None: pin = sc.read_pin() print "DARK FIRE OVER: PIN",pin time.sleep(p._medium_pause)
import scopes import scope_connections import math import time import utils import optparse from core.tellie_server import SerialCommand from common import parameters as p _boundary = [ 0, 1.5e-3, 3e-3, 7e-3, 15e-3, 30e-3, 70e-3, 150e-3, 300e-3, 700e-3, 1000 ] _v_div = [ 1e-3, 2e-3, 5e-3, 10e-3, 20e-3, 50e-3, 100e-3, 200e-3, 500e-3, 1.0, 1000 ] sc = SerialCommand() def get_min_volt(channel, height, width, delay, scope, scale=None, trigger=None, min_trigger=-0.005): """Gets the trigger settings by firing a single pulse """ sc.select_channel(channel) sc.set_pulse_height(height) sc.set_pulse_width(width)
import time import ROOT from core.tellie_server import SerialCommand from common import parameters as p sc = SerialCommand(p._serial_port) # set in tellie.cfg boxes = range(12) for ibox in boxes: box = ibox+1 #5 probes on each box for iprobe in range(5): probe = None if box<7: probe = ibox*5 + iprobe + 1 else: probe = 32 + (ibox-7)*5 + iprobe + 1 sc.select_temp_probe(probe) temp1 = sc.read_temp() temp2 = sc.read_temp() temp3 = sc.read_temp() print probe,':' print '\t',temp1 print '\t',temp2 print '\t',temp3
try: pin, rms, channel = sc.read_pin_sequence() except TypeError: pin = None except KeyboardInterrupt: print "Keyboard interrupt" except TypeError: pin, rms = read_pin() return int(pin), float(rms) if __name__=="__main__": width = int(sys.argv[1]) delay = float(sys.argv[2]) number = int(sys.argv[3]) channel = int(sys.argv[4]) sc = SerialCommand(p._serial_port) # set in tellie.cfg sc.stop() sc.select_channel(channel) sc.set_trigger_delay(0) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_width(width) sc.set_pulse_delay(delay) sc.set_pulse_number(number) try: sc.fire_sequence() except Exception,e: safe_exit(sc,e) mean = None try: mean, rms = read_pin()
import time import ROOT from core.tellie_server import SerialCommand from common import parameters as p sc = SerialCommand(p._serial_port) # set in tellie.cfg boxes = range(12) for ibox in boxes: box = ibox + 1 #5 probes on each box for iprobe in range(5): probe = None if box < 7: probe = ibox * 5 + iprobe + 1 else: probe = 32 + (ibox - 7) * 5 + iprobe + 1 sc.select_temp_probe(probe) temp1 = sc.read_temp() temp2 = sc.read_temp() temp3 = sc.read_temp() print probe, ':' print '\t', temp1 print '\t', temp2 print '\t', temp3
def safe_exit(sc,e): print "Exit safely" print e sc.stop() sys.exit() if __name__=="__main__": width = sys.argv[1] number = sys.argv[2] channel = sys.argv[3] width = int(width) number = int(number) channel = int(channel) #print width,number,channel sc = SerialCommand(p._serial_port) sc.stop() sc.select_channel(channel) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_width(width) sc.set_pulse_number(number) try: sc.trigger_averaged() except Exception,e: safe_exit(sc,e) mean = None try: print "Waiting for sequence to finish..." while (mean == None): try:
import sys import time from core.tellie_server import SerialCommand from common import parameters as p sc = SerialCommand(p._serial_port) # set in tellie.cfg channels = range(2, 17) try: channels = [int(sys.argv[1])] print "RUNNING CHANNEL", channels except: pass print channels widths = range(0, 1000, 500) sc.select_channel(channels[0]) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_delay(p._pulse_delay) sc.set_pulse_number(p._pulse_num) sc.set_fibre_delay(0) sc.set_trigger_delay(0) sc.disable_external_trigger() sc.set_pulse_width(p._max_pulse_width) sc.fire() time.sleep(p._medium_pause) pin = None while pin == None: pin = sc.read_pin() print "DARK FIRE OVER: PIN", pin time.sleep(p._medium_pause)
except KeyboardInterrupt: safe_exit(sc, "keyboard interrupt") # Get PIN readout mean = None try: mean, rms = read_pin() except Exception, e: safe_exit(sc, e) except KeyboardInterrupt: safe_exit(sc, "keyboard interrupt") print "\nPIN: %s \nRMS: %s\n" % (mean, rms) # Main function has hard-coded values, just for testing at the moment if __name__ == "__main__": sc = SerialCommand(p._serial_port) WIDTH = p._max_pulse_width # IPW (TODO: read from ratDB) RATE = 1000 # Hz (TODO: add parameter) NUM = 1000 # Number of pulses per channel CHAN = (6, 7, 8) # Channels on Sussex test bench print "\nINFO - Will try to pulse each channel %d times at %f Hz\n" % ( NUM, RATE) delay = float(1000. / RATE) # ms for ch in CHAN: print "INFO - Attempting to pulse channel %d\n" % ch pulse_channel(sc, WIDTH, delay, NUM, ch) print "INFO - Successfully pulsed channel %d\n" % ch time.sleep(p._medium_pause) print "INFO - SUCCESS - ALL CHANNELS FIRED\n"
def safe_exit(sc, e): print "Exit safely" print e sc.stop() sys.exit() if __name__ == "__main__": width = sys.argv[1] number = sys.argv[2] channel = sys.argv[3] width = int(width) number = int(number) channel = int(channel) #print width,number,channel sc = SerialCommand(p._serial_port) sc.stop() sc.select_channel(channel) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_width(width) sc.set_pulse_number(number) try: sc.trigger_averaged() except Exception, e: safe_exit(sc, e) mean = None try: print "Waiting for sequence to finish..." while (mean == None): try:
import sys def safe_exit(sc,e): print "Exit safely" print e sc.stop() if __name__=="__main__": width = sys.argv[1] delay = sys.argv[2] channel = sys.argv[3] width = int(width) delay = float(delay) channel = int(channel) print width,delay sc = SerialCommand(p._serial_port) # set in tellie.cfg sc.stop() sc.select_channel(channel) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_width(width) sc.set_pulse_delay(delay) try: sc.fire_continuous() while True: pass except Exception,e: safe_exit(sc,e) except KeyboardInterrupt: safe_exit(sc,"keyboard interrupt")
import time from common import parameters as p def safe_exit(sc,e): print "Exit safely" print e sc.stop() if __name__=="__main__": width = sys.argv[1] channel = sys.argv[2] width = int(width) #rate = float(rate) # external trigger channel = int(channel) #print width sc = SerialCommand(p._serial_port) #sc.stop() print "SELECTING CHANNEL" time.sleep(p._long_pause) sc.select_channel(channel) print "SELECTED CHANNEL" time.sleep(p._long_pause) sc.set_pulse_height(p._max_pulse_height) sc.set_pulse_width(width) try: sc.enable_external_trig() while True: pass except Exception,e: safe_exit(sc,e) except KeyboardInterrupt:
### sends a continuous pulse import sys from core import tellie_exception from common import tellie_logger from core.tellie_server import SerialCommand from common import parameters as p def safe_exit(sc,e): print "Exit safely" print e sc.stop() if __name__=="__main__": sc = SerialCommand(p._serial_port) # set in tellie.cfg sc.stop() logger = tellie_logger.TellieLogger.get_instance() logger.set_debug_mode(True) try: while True: probe = raw_input("Select a sensor to probe: ") try: probe = int(probe) except ValueError: print "Must select a numerical probe!" continue sc.select_temp_probe(probe) try: temp = sc.read_temp() print "Temperature: %s C"%temp except tellie_exception.TellieException,e: print "Error reading temperature"