diff --git a/config/devices.properties b/config/devices.properties index ca9456b..ee1109e 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,3 +1,4 @@ +ThetaCurVal=ch.psi.pshell.epics.ChannelDouble|X11MA-ES2:Theta-Cur.VAL|Read||true BucketSize=ch.psi.pshell.epics.ChannelDouble|ACORF-FILL:MRF-INTEG|Read||true FillingPattern=ch.psi.pshell.epics.ChannelDoubleArray|ACORF-FILL:UnsortComp|Read||true MCPArray1=ch.psi.pshell.epics.ChannelIntegerArray|X11MA-ES4:PHC-CTRWF1|Read||true diff --git a/script/DelayScan.py b/script/DelayScan.py index c4fce1c..d6615ae 100644 --- a/script/DelayScan.py +++ b/script/DelayScan.py @@ -5,7 +5,72 @@ import math print "\nStarting delay scan - Parameters: ", print START,END,SIZE,ENERGIES +############################################################################### +# Preparing for the Scan +############################################################################### +'''if ID1 == 1: + caput ("X11PHS-E:OPT","PGM+ID1") +elif ID2 == 1: + caput ("X11PHS-E:OPT","PGM+ID2") +else: + caput ("X11PHS-E:OPT","PGM+ID1+ID2")''' + +number_of_scans = 1 +if RUNTYPE in ["+/-", "+", "-"]: + caput(OTF_MODE1,1) # circ + in ID1 + caput(OTF_MODE2,2) # circ - in ID2 + wait_channel(OTF_DONE, 1, type = 'i') + if RUNTYPE == "+/-": + number_of_scans = 2 * ROUNDS + else: + number_of_scans = ROUNDS +elif RUNTYPE in ["LH/LV", "LH", "LV"]: + caput(OTF_MODE1,0) + caput(OTF_MODE2,0) + wait_channel(OTF_DONE, 1, type = 'i') + caput(OTF_ALPHA1, 0.0) # LH in ID1 + caput(OTF_ALPHA2, 90.0) # LV in ID2 + wait_channel(OTF_DONE, 1, type = 'i') + if RUNTYPE == "LH/LV": + number_of_scans = 2 * ROUNDS + else: + number_of_scans = ROUNDS +else: + raise Exception("Invalid run type: " + RUNTYPE) + +if RUNTYPE in ["-", "LV"]: + switchpol(2, RUNTYPE) # tune ID2 --> polarization: C- or LV + polswitch = 0 +elif RUNTYPE in ["+/-", "+", "LH/LV", "LH"]: + switchpol(1, RUNTYPE) # tune ID1 --> polarization: C+ or LH +time.sleep(1.0) + +def switchpol(activeID, runtype): + global pol_str + if activeID == 1: + caput(OTF_OFF1,OFFSET1) + caput(OTF_OFF2,OFFSET2-40) #detune ID2 + if runtype in ["+/-", "+"]: + pol_str = "circ +" + elif runtype in ["LH/LV", "LH"]: + pol_str = "Lin. Horizontal" + elif activeID == 2: + caput(OTF_OFF1,OFFSET1-40) #detune ID1 + caput(OTF_OFF2,OFFSET2) + if runtype in ["+/-", "-"]: + pol_str = "circ -" + elif runtype in ["LH/LV", "LV"]: + pol_str = "Lin. Vertical" + else: + raise Exception("Invalid parameter") + + +pol_str = None +polswitch = 1 + +caput (TIME_DELAY_SET, START) +caput (TIME_DELAY_START, 1) ############################################################################### # Plotting ###############################################################################