This commit is contained in:
X11MA
2016-02-10 17:53:43 +01:00
parent 86668ddee4
commit 3f1dcc2b4f
+51 -16
View File
@@ -3,7 +3,7 @@ import traceback
import math
print "\nStarting delay scan - Parameters: ",
print START,END,SIZE,ENERGIES
print START,END,SIZE,ENERGIES,RUNTYPE
###############################################################################
# Preparing for the Scan
@@ -16,6 +16,16 @@ elif ID2 == 1:
else:
caput ("X11PHS-E:OPT","PGM+ID1+ID2")'''
file_prefix = time.strftime("%y%m%d")
input_path = "/sls/X11MA/Data1/public/X11MA/temp/"+file_prefix+"/"
output_path = input_path
x=ENERGIES
y = []
x=x.split(',')
for i in x:
y.append(float(i))
def switchpol(activeID, runtype):
global pol_str
if activeID == 1:
@@ -35,7 +45,13 @@ def switchpol(activeID, runtype):
else:
raise Exception("Invalid parameter")
LPP_DELAY_NEW = 0
LPP_FINE_DELAY_NEW = 0
def Convert_LPP_Delays(NewDelay):
global LPP_DELAY_NEW, LPP_FINE_DELAY_NEW
LPP_DELAY_NEW = math.trunc(((NewDelay*100.0+DELAY*BucketSize.read()*100+FINEDELAY)/100.0)/BucketSize.read())
LPP_FINE_DELAY_NEW = math.trunc(NewDelay*100.0+DELAY*BucketSize.read()*100+FINEDELAY-LPP_DELAY_NEW*BucketSize.read()*100.0)
pol_str = None
polswitch = 1
number_of_scans = 1
@@ -70,25 +86,37 @@ time.sleep(1.0)
caput (TIME_DELAY_SET, START)
caput (TIME_DELAY_START, 1)
'''if TIME_DELAY_SET == 0:
if TIME_DELAY_SET == 0:
caput (LPP_DELAY, DELAY)
caput (LPP_FINE_DELAY, FINE_DELAY)
else
'''
timeout_1= (caget TIME_DELAY_SET)/(caget TIME_DELAY_VAL)
print timeout_1
wait_channel(TIME_DELAY_COMPLETE, 'SCAN Complete', timeout=10)
else:
Convert_LPP_Delays(caget(TIME_DELAY_SET, type='d'))
caput (LPP_DELAY, LPP_DELAY_NEW)
caput (LPP_FINE_DELAY, LPP_FINE_DELAY_NEW)
wait_channel(TIME_DELAY_COMPLETE, 'SCAN Complete', timeout= abs((caget(TIME_DELAY_SET, type='d')-caget(TIME_DELAY_VAL, type='d')))*10)
def Timing(Step_size):
New_Time = caget(TIME_DELAY_VAL, type='d') + Step_Size
caput (TIME_DELAY_SET, New_Time)
caput (TIME_DELAY_START, 1)
Convert_LPP_Delays(New_Time)
caput (LPP_DELAY, LPP_DELAY_NEW)
caput (LPP_FINE_DELAY, LPP_FINE_DELAY_NEW)
wait_channel(TIME_DELAY_COMPLETE, 'SCAN Complete', timeout= abs((caget(TIME_DELAY_SET, type='d')-caget(TIME_DELAY_VAL, type='d')))*10)
###############################################################################
# Plotting
# Scanning
###############################################################################
"""
task = None
running = False
'''task = None
running = False'''
MCP1 = []
MCP2 = []
sep = "\t"
line_sep = "\r\n"
def _startPlot(type):
'''def _startPlot(type):
global running
sep = "\t"
line_sep = "\r\n"
@@ -101,7 +129,12 @@ def _startPlot(type):
while running:
try:
if otf_start.read() == 0:
break
break'''
Delay_Time = START
'''for Delay_Time in xrange(START, END+0.1, STEP):
e = energy.read()
if (MCP_1 == 1 or MCP_2 == 1):
aK1=keithley_1a.read()
@@ -205,6 +238,8 @@ def _startPlot(type):
MCP2out.write(sMCP2out)
MCP2out.close()
print "Saved MCP I_0 data"
'''
'''
def startPlot(type = 1):
global task
task = fork((_startPlot,(type,)),)
@@ -213,7 +248,7 @@ def stopPlot():
global task, running
running = False
ret = join(task)
"""
'''