This commit is contained in:
sfop
2017-04-25 13:59:03 +02:00
parent 4c66ec7b6f
commit 0cc8ec5c9e
12 changed files with 683 additions and 383 deletions

View File

@@ -167,6 +167,17 @@ elements = (
(DBPM, "SARBD02-DBPM040", 598.3943),
)
def get_section(element):
return element[1:3]
def get_section_type(element):
section = get_section(element)
if section == "AR": return "ARAMIS"
if section == "AT": return "ATH0S"
if section == "IN": return "INJECTOR"
if section in["10", "20", "30"] : return "LINAC"
return None
def get_bpms():
ret = []
@@ -184,17 +195,20 @@ def get_wire_scans():
def get_wire_scans_bpms(wire_scans):
def get_wire_scans_bpms(wire_scan):
last = None
ret = []
for element in elements:
if element[0]==DWSC and element[1] == wire_scans:
if element[0]==DWSC and element[1] == wire_scan:
ret = [last,]
else:
if len(ret) > 0:
return [ret[0],element[1]]
last = element[1]
if get_section_type(element[1]) == get_section_type(wire_scan):
if len(ret) > 0:
return [ret[0],element[1]]
last = element[1]
return None
#for w in get_wire_scans():
# print w, get_wire_scans_bpms(w)

View File

@@ -12,8 +12,8 @@ start = args[2] if is_panel else -200
end = args[3] if is_panel else 200
cycles = args[4] if is_panel else 5
velocity = args[5] if is_panel else 200
bpm3 = args[6] if is_panel else None
print "WireScan parameters: ", prefix, sel, start, end, cycles, cycles, bpm3
bpms = args[6] if is_panel else get_wire_scans_bpms(prefix)
print "WireScan parameters: ", prefix, sel, start, end, cycles, cycles, bpms
#Creating WireScanner object
print "Creating scanner..."
@@ -27,11 +27,8 @@ scanner.waitValue("At start", 60000)
channels = [("w_pos", scanner.motor_bs_readback.get_name()),
("cur_cycle", scanner.curr_cycl.get_name()),
("scanning", scanner.status_channels[0].get_name())]
bpms = get_wire_scans_bpms(prefix)
if bpms is None:
raise Exception("Cannot determine wire scan bpms: " + prefix)
if bpm3 is not None:
bpms.append(bpm3)
#bpms = ["SINDI01-DBPM060", "SINDI02-DBPM010"] #For testing
for i in range (len(bpms)):
for sensor in BPM_SENSORS:

View File

@@ -1,33 +1,34 @@
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
import ch.psi.pshell.epics.Camtool as Camtool
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
import ch.psi.pshell.epics.Camtool as Camtool
if get_exec_pars().source == CommandSource.ui:
start = 55.0
stop = 75.0
start = -34.0
stop = -14.0
step = 2.0
nb = 5
lat = 0.5
disp = caget("SINBD01-DSCR010:DISPERSION")
energy0 = caget("SINBD01-DSCR010:ENERGY")
nb = 1
lat = 0.3
disp = -0.32
energy0 = 7.1
else:
start = args[0]
stop = args[1]
step = args[2]
nb = int(args[3])
lat = args[4]
start = args[0]
stop = args[1]
step = args[2]
nb = int(args[3])
lat = args[4]
disp = args[5]
energy0 = args[6]
#phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase.config.minValue =-180.0
phase.config.maxValue = 180.0
phase.config.maxValue = 360.0
phase.config.precision = 3
phase.config.resolution = 1.0
phase.config.save()
phase.initialize()
#kill_camtool()
phase0 = phase.read()
kill_camtool()
check_camtool()
camtool.start("SINBD01-DSCR010")
wait_camtool_message()
@@ -44,6 +45,7 @@ try:
E = [energy0 * (1 + val.mean / 1e6 / disp) for val in r.getReadable(0)]
dE = [energy0 * ( val.mean / 1e6 / disp) for val in r.getReadable(1)]
finally:
phase.write(phase0)
phase.close()
camtool.stop() # stops camtool but does not close it camtool is a global object

View File

@@ -13,10 +13,9 @@ else:
nb = int(args[3])
lat = args[4]
#phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase.config.minValue =-180.0
phase.config.maxValue = 180.0
phase.config.maxValue = 360.0
phase.config.precision = 3
phase.config.resolution = 1.0
phase.config.save()
@@ -24,7 +23,7 @@ phase.initialize()
#st = Stream("ICTstream", dispatcher)
#q = st.addScalar("Charge", "SINEG01-DICT215:B1_CHARGE", 1, 0)
#st.initialize()
#st.start(True)
#st.start()
q = Channel("SINEG01-DICT215:B1_CHARGE", type = 'd', alias='ICT-Q')
phase0 = phase.read()
@@ -44,8 +43,8 @@ finally:
q.close()
#Setting the return value
y = charge
x = rf_phase
y = charge
index_max = y.index(max(y))
phase_ref = x[index_max] - 80