From 06508fcbe3f8439e2237b3cd5757455c45431f2c Mon Sep 17 00:00:00 2001 From: panepucci Date: Fri, 27 Nov 2015 18:24:32 +0100 Subject: [PATCH] Startup --- script/rock.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ script/seti0.py | 18 ++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 script/rock.py create mode 100644 script/seti0.py diff --git a/script/rock.py b/script/rock.py new file mode 100644 index 0000000..c2be86e --- /dev/null +++ b/script/rock.py @@ -0,0 +1,44 @@ +""" +PRO ROCK, axis,SILENT = silent,FFAIL = ffail,TIME = tt, SETI0 = seti0, DTHETA = dx, NOREF = noref +Parameters: +axis +""" + +def rock(axis = th1, ffail = False, tt = 0.2, seti0 = False, dx = None, noref = False): + + #Set MONOBEAM to negative value until rock succeeds + #MONOBEAM channel used as token by ECX-feedback to stop corrections + #until MONOBEAM NE -1 + if !noref: + caput('X06DA-OP-MO:MONOBEAM', -1 ) + e = get_energy() + if dx is None: + dx = 7.5e-2/e + + # reinforce theta1 and 2 setting (setting could be RDBD 0.0001 and RTRY 1 when seteq does not finish nicely) + # put 'Retry deadband' to 0.00004 and 'Retries Max' to 5 + time.sleep(0.2) + caput('X06DA-OP-MO1:ROX1.RDBD',0.00004) + caput('X06DA-OP-MO1:ROX2.RDBD',0.00004) + caputT('X06DA-OP-MO1:ROX1.RTRY',5) + caput('X06DA-OP-MO1:ROX2.RTRY',5) + + #time stamp + print time.strftime('%X %x') + + + #MVR,axis,-dx + #SCAN,axis,0,2*dx,20,/fit,/centre,SILENT = silent,FFAIL = ffail,time=tt,/deriv,$ + #data=d + LSCAN() + + if seti0 and not ffail: + time.sleep(2) + run("setI0") + + #add after_rock BPM1:SUM as reference for monitoring monochromator thermal drift + if (noref==False) and not ffail: + ime.sleep(3) # wait a bit until mono theta finish moving + beam_ref = caget('X06DA-OP-BPM1:SUM', 'd') + caput('X06DA-OP-MO:MONOBEAM', beam_ref) + print 'rock_success new mono beam at ' + str(beam_ref) + ' at' + str(e) + ' keV' diff --git a/script/seti0.py b/script/seti0.py new file mode 100644 index 0000000..613cc96 --- /dev/null +++ b/script/seti0.py @@ -0,0 +1,18 @@ +s = [] +v = [] +t = [] +for i in range(10): + s.append(caget('X06SA-OP-BPM3:SUM')) + v.append(caget ('X06SA-OP-BPM3:POSV')) + t.append(caget('X06SA-OP-MO:TC3')) + time.sleep(0.09) + +""" +#TODO +!x06saopbpm3y = MEAN(v) +#dum = NEWCAPUT('X06SA-OP1-MI:BPM_IO',MEAN(S)) +""" + +print 'Setting I0 to '+ str(mean(s))+' +/- '+str(stdev(s))+' nA' +print 'Setting BPM3_Y to'+ str(mean(v))+' +/- '+str(stdev(v))+' mm' +print 'Setting TC3 to '+ str(mean(t))+' +/- '+str(stdev(t))+' mm' \ No newline at end of file