Example #1
0
def set_fix_range_all(
    ts,
    crate,
    slot,
    enable=False,
    rangeSet=0
):  # Turn fixed range mode on or off for all QIEs on a given board.
    assert isinstance(rangeSet, int)
    if rangeSet < 0 or rangeSet > 3:
        print ">> ERROR: the range you select with \"RangeSet\" must be an element of {0, 1, 2, 3}."
    else:
        commands = []
        if enable:
            for i_qie in range(1, 25):
                commands.append("put HF{0}-{1}-QIE{2}_FixRange 1".format(
                    crate, slot, i_qie))
                commands.append("put HF{0}-{1}-QIE{2}_RangeSet {3}".format(
                    crate, slot, i_qie, rangeSet))
        else:
            for i_qie in range(1, 25):
                commands.append("put HF{0}-{1}-QIE{2}_FixRange 0".format(
                    crate, slot, i_qie))
                commands.append("put HF{0}-{1}-QIE{2}_RangeSet 0".format(
                    crate, slot, i_qie))

        # This should work, but I've had trouble with these "mass settings" before:
#		if enable:
#			commands.append("put HF{0}-{1}-QIE[1-24]_FixRange 24*1".format(crate, slot))
#			commands.append("put HF{0}-{1}-QIE[1-24]_RangeSet 24*{2}".format(crate, slot, rangeSet))
#		else:
#			commands.append("put HF{0}-{1}-QIE[1-24]_FixRange 24*0".format(crate, slot))
#			commands.append("put HF{0}-{1}-QIE[1-24]_RangeSet 24*0".format(crate, slot))		# Not necessary, but I think it's probably good form.
        raw_output = ngccm.send_commands_fast(ts, commands)["output"]
        #		raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
        return raw_output
Example #2
0
def set_fix_range_all(ts, crate, slot, enable=False, rangeSet=0):		# Turn fixed range mode on or off for all QIEs on a given board.
	assert isinstance(rangeSet, int)
	if rangeSet < 0 or rangeSet > 3: 
		print ">> ERROR: the range you select with \"RangeSet\" must be an element of {0, 1, 2, 3}."
	else:
		commands = []
		if enable:
			for i_qie in range(1, 25):
				commands.append("put HF{0}-{1}-QIE{2}_FixRange 1".format(crate, slot, i_qie))
				commands.append("put HF{0}-{1}-QIE{2}_RangeSet {3}".format(crate, slot, i_qie, rangeSet))
		else:
			for i_qie in range(1, 25):
				commands.append("put HF{0}-{1}-QIE{2}_FixRange 0".format(crate, slot, i_qie))
				commands.append("put HF{0}-{1}-QIE{2}_RangeSet 0".format(crate, slot, i_qie))
		
		# This should work, but I've had trouble with these "mass settings" before:
#		if enable:
#			commands.append("put HF{0}-{1}-QIE[1-24]_FixRange 24*1".format(crate, slot))
#			commands.append("put HF{0}-{1}-QIE[1-24]_RangeSet 24*{2}".format(crate, slot, rangeSet))
#		else:
#			commands.append("put HF{0}-{1}-QIE[1-24]_FixRange 24*0".format(crate, slot))
#			commands.append("put HF{0}-{1}-QIE[1-24]_RangeSet 24*0".format(crate, slot))		# Not necessary, but I think it's probably good form.
		raw_output = ngccm.send_commands_fast(ts, commands)["output"]
#		raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
		return raw_output
Example #3
0
def set_fix_range(
        ts,
        crate,
        slot,
        qie,
        enable=False,
        rangeSet=0):  # Turn fixed range mode on or off for a given QIE.
    assert isinstance(rangeSet, int)
    if rangeSet < 0 or rangeSet > 3:
        print ">> ERROR: the range you select with \"RangeSet\" must be an element of {0, 1, 2, 3}."
    else:
        if enable:
            commands = [
                "put HF{0}-{1}-QIE{2}_FixRange 1".format(crate, slot, qie),
                "put HF{0}-{1}-QIE{2}_RangeSet {3}".format(
                    crate, slot, qie, rangeSet)
            ]
        else:
            commands = [
                "put HF{0}-{1}-QIE{2}_FixRange 0".format(crate, slot, qie)
            ]

        raw_output = ngccm.send_commands_fast(ts, commands)["output"]
        #		raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
        return raw_output
Example #4
0
def set_cal_mode(ts, crate, slot, qie, enable=False):
    value = 1 if enable else 0
    commands = [
        "put HF{0}-{1}-QIE{2}_CalMode {3}".format(crate, slot, qie, value)
    ]
    raw_output = ngccm.send_commands_fast(ts, commands)["output"]
    #	raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
    return raw_output
Example #5
0
def set_cal_mode_all(ts, crate, slot, enable=False):
	commands = []
	value = 1 if enable else 0
	for qie in range(1, 25):
		commands.append("put HF{0}-{1}-QIE{2}_CalMode {3}".format(crate, slot, qie, value))
	raw_output = ngccm.send_commands_fast(ts, commands)["output"]
#	raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
	return raw_output
Example #6
0
def set_cal_mode_all(ts, crate, slot, enable=False):
    commands = []
    value = 1 if enable else 0
    for qie in range(1, 25):
        commands.append("put HF{0}-{1}-QIE{2}_CalMode {3}".format(
            crate, slot, qie, value))
    raw_output = ngccm.send_commands_fast(ts, commands)["output"]
    #	raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
    return raw_output
Example #7
0
def set_ped(ts, crate, slot, i, n):		# Set the pedestal of QIE i to DAC value n.
	assert isinstance(n, int)
	if abs(n) > 31:
		print n
		print ">> ERROR: You must enter a decimal integer between -31 and 31. The pedestals have not been changed."
	else:
		if n <= 0:
			n = abs(n)
		else:
			n = n + 32
		n_str = "{0:#04x}".format(n)		# The "#" prints the "0x". The number of digits to pad with 0s must include these "0x", hence "4" instead of "2".
		commands = ["put HF{0}-{1}-QIE{2}_PedestalDAC {3}".format(crate, slot, i, n_str)]
		raw_output = ngccm.send_commands_fast(ts, commands)["output"]
Example #8
0
def set_fix_range(ts, crate, slot, qie, enable=False, rangeSet=0):		# Turn fixed range mode on or off for a given QIE.
	assert isinstance(rangeSet, int)
	if rangeSet < 0 or rangeSet > 3 : 
		print ">> ERROR: the range you select with \"RangeSet\" must be an element of {0, 1, 2, 3}."
	else:
		if enable:
			commands = [
				"put HF{0}-{1}-QIE{2}_FixRange 1".format(crate, slot, qie),
				"put HF{0}-{1}-QIE{2}_RangeSet {3}".format(crate, slot, qie, rangeSet)
			]
		else :
			commands = ["put HF{0}-{1}-QIE{2}_FixRange 0".format(crate, slot, qie)]
		
		raw_output = ngccm.send_commands_fast(ts, commands)["output"]
#		raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
		return raw_output
Example #9
0
def set_ped_all(ts, crate, slot, n):		# n is the decimal representation of the pedestal register.
	# This function is faster than running "set_ped" 24 times.
	assert isinstance(n, int)
#	for i in range(1, 25):
#		set_ped(ts, crate, slot, i, n)
	if abs(n) > 31:
		print ">> ERROR: You must enter a decimal integer between -31 and 31. The pedestals have not been changed."
	else:
		if n <= 0:
			n = abs(n)
		else:
			n = n + 32
		n_str = "{0:#04x}".format(n)		# The "#" prints the "0x". The number of digits to pad with 0s must include these "0x", hence "4" instead of "2".
		commands = ["put HF{0}-{1}-QIE{2}_PedestalDAC {3}".format(crate, slot, i, n_str) for i in range(1, 25)]
#		print commands
		raw_output = ngccm.send_commands_fast(ts, commands)["output"]
Example #10
0
def set_ped(ts, crate, slot, i,
            n):  # Set the pedestal of QIE i to DAC value n.
    assert isinstance(n, int)
    if abs(n) > 31:
        print n
        print ">> ERROR: You must enter a decimal integer between -31 and 31. The pedestals have not been changed."
    else:
        if n <= 0:
            n = abs(n)
        else:
            n = n + 32
        n_str = "{0:#04x}".format(
            n
        )  # The "#" prints the "0x". The number of digits to pad with 0s must include these "0x", hence "4" instead of "2".
        commands = [
            "put HF{0}-{1}-QIE{2}_PedestalDAC {3}".format(
                crate, slot, i, n_str)
        ]
        raw_output = ngccm.send_commands_fast(ts, commands)["output"]
Example #11
0
def set_ped_all(
        ts, crate, slot,
        n):  # n is the decimal representation of the pedestal register.
    # This function is faster than running "set_ped" 24 times.
    assert isinstance(n, int)
    #	for i in range(1, 25):
    #		set_ped(ts, crate, slot, i, n)
    if abs(n) > 31:
        print ">> ERROR: You must enter a decimal integer between -31 and 31. The pedestals have not been changed."
    else:
        if n <= 0:
            n = abs(n)
        else:
            n = n + 32
        n_str = "{0:#04x}".format(
            n
        )  # The "#" prints the "0x". The number of digits to pad with 0s must include these "0x", hence "4" instead of "2".
        commands = [
            "put HF{0}-{1}-QIE{2}_PedestalDAC {3}".format(
                crate, slot, i, n_str) for i in range(1, 25)
        ]
        #		print commands
        raw_output = ngccm.send_commands_fast(ts, commands)["output"]
Example #12
0
def set_cal_mode(ts, crate, slot, qie, enable=False):
	value = 1 if enable else 0
	commands = ["put HF{0}-{1}-QIE{2}_CalMode {3}".format(crate, slot, qie, value)]
	raw_output = ngccm.send_commands_fast(ts, commands)["output"]
#	raw_output = ngccm.send_commands_parsed(ts, commands)["output"]
	return raw_output