diff --git a/script/local.py b/script/local.py index f564001..911289a 100644 --- a/script/local.py +++ b/script/local.py @@ -2,3 +2,17 @@ # Deployment specific global definitions - executed after startup.py ################################################################################################### +dtor = math.pi /180.0 + +def A2E(t,h=1.0,k=1.0,l=1.0, deg =True, ln = False): + lncorr= 2.e-4 if ln else 0.0 + d0 =2 * 5.43102 * (1.0-lncorr) / math.sqrt(h**2+k**2+l**2) + tt = (t * dtor) if (deg or (t>1.0)) else t + return 12.39842 / (d0*math.sin(tt)) + +def get_energy(): + t2 = caget("X06DA-OP-MO1:ROX2.RBV",'d') + e = A2E(abs(t2)) + print 'Energy [keV]:'+ str(e) + ' Wavelength [A]:' + str(12.39842/e) + return e + diff --git a/script/rocknroll.py b/script/rocknroll.py new file mode 100644 index 0000000..7d6607f --- /dev/null +++ b/script/rocknroll.py @@ -0,0 +1,14 @@ +ei = get_energy() +if ei < 6.0: + print "No rocking optimization for lower energy for 3rd harmonics rejection' +run("rock") + +#check beam position at EBOX and fbm if needed +time.sleep(2.0) + +by = bpm1.read() +if (math.abs(by) > 0.005): + print by + print 'Beam is not aligned at E-BOX BPM: do fbm.' + run("fbm") +