384 lines
12 KiB
Python
384 lines
12 KiB
Python
#Script imported from: Swiv.xml
|
|
|
|
numberOfExecutions = 3
|
|
#TODO: Support to multiple iterations is partial: check if logic is ok
|
|
#for iteration in range(numberOfExecutions):
|
|
iteration=0
|
|
#Pre-actions
|
|
caput('X10DA-SITORO:CollectMode', '0')
|
|
sleep(0.1)
|
|
caput('X10DA-ES1:START-CSMPL', '0')
|
|
sleep(0.1)
|
|
caput('X10DA-OP-MO3:KohzuModeBO.VAL', 'Auto')
|
|
sleep(0.1)
|
|
caput('X10DA-SITORO:PresetReal', '0')
|
|
sleep(0.1)
|
|
|
|
#TODO: Set the diplay names of positioners and detectors
|
|
scan = ManualScan(['posX'], ['Fluo-Ketek1', 'SAI01-MEAN', 'SAI02-MEAN', 'SAI03-MEAN', 'Ring-current', 'IntegrTimeSet', 'IntegrTimeGet', 'Timestamp', 'dead_time', 'Fluo-Ketek2', 'Sca1', 'ScaICR1', 'ScaOCR1', 'ERTM1', 'Sca2', 'ScaICR2', 'ScaOCR2', 'ERTM2', 'Sca3', 'ScaICR3', 'ScaOCR3', 'ERTM3', 'Sca4', 'ScaICR4', 'ScaOCR4', 'ERTM4', 'Sca5', 'ScaICR5', 'ScaOCR5', 'ERTM5', 'TrueFluoChannel1', 'TrueFluoChannel2', 'TrueFluoChannel3', 'TrueFluoChannel4', 'TrueFluoChannel5', 'TotalFluo', 'TotalFluoXAS', 'XAS-refer'] , [0.3], [1.0], [70])
|
|
scan.start()
|
|
|
|
#Creating channels: dimension 1
|
|
#RegionPositioner posX
|
|
posX = Channel('X10DA-ES1-PP1:MOT4', type = 'd')
|
|
posXReadback = Channel('X10DA-ES1-PP1:MOT4.VAL', type = 'd')
|
|
#ScalarDetector Fluo-Ketek1
|
|
#ScalarDetector SAI01-MEAN
|
|
SAI01-MEAN = Channel('X10DA-ES1-SAI_01:MEAN', type = 'd')
|
|
#ScalarDetector SAI02-MEAN
|
|
SAI02-MEAN = Channel('X10DA-ES1-SAI_02:MEAN', type = 'd')
|
|
#ScalarDetector SAI03-MEAN
|
|
SAI03-MEAN = Channel('X10DA-ES1-SAI_03:MEAN', type = 'd')
|
|
#ScalarDetector Ring-current
|
|
Ring-current = Channel('ARIDI-PCT:CURRENT', type = 'd')
|
|
#ScalarDetector IntegrTimeSet
|
|
IntegrTimeSet = Channel('X10DA-ES1:TOTAL-CYCLES', type = 'd')
|
|
#ScalarDetector IntegrTimeGet
|
|
IntegrTimeGet = Channel('X10DA-ES1:INTR-COUNT', type = 'd')
|
|
#Timestamp Timestamp
|
|
#ScalarDetector dead_time
|
|
dead_time = Channel('X10DA-SITORO:mca1.DTIM', type = 'd')
|
|
#ScalarDetector Fluo-Ketek2
|
|
Fluo-Ketek2 = Channel('X10DA-SITORO:CNT2_R1', type = 'd')
|
|
#ScalarDetector Sca1
|
|
Sca1 = Channel('X10DA-SITORO:mca1.R1', type = 'd')
|
|
#ScalarDetector ScaICR1
|
|
ScaICR1 = Channel('X10DA-SITORO:dxp1:InputCountRate', type = 'd')
|
|
#ScalarDetector ScaOCR1
|
|
ScaOCR1 = Channel('X10DA-SITORO:dxp1:OutputCountRate', type = 'd')
|
|
#ScalarDetector ERTM1
|
|
ERTM1 = Channel('X10DA-SITORO:mca1.ERTM', type = 'd')
|
|
#ScalarDetector Sca2
|
|
Sca2 = Channel('X10DA-SITORO:mca2.R1', type = 'd')
|
|
#ScalarDetector ScaICR2
|
|
ScaICR2 = Channel('X10DA-SITORO:dxp2:InputCountRate', type = 'd')
|
|
#ScalarDetector ScaOCR2
|
|
ScaOCR2 = Channel('X10DA-SITORO:dxp2:OutputCountRate', type = 'd')
|
|
#ScalarDetector ERTM2
|
|
ERTM2 = Channel('X10DA-SITORO:mca2.ERTM', type = 'd')
|
|
#ScalarDetector Sca3
|
|
Sca3 = Channel('X10DA-SITORO:mca3.R1', type = 'd')
|
|
#ScalarDetector ScaICR3
|
|
ScaICR3 = Channel('X10DA-SITORO:dxp3:InputCountRate', type = 'd')
|
|
#ScalarDetector ScaOCR3
|
|
ScaOCR3 = Channel('X10DA-SITORO:dxp2:OutputCountRate', type = 'd')
|
|
#ScalarDetector ERTM3
|
|
ERTM3 = Channel('X10DA-SITORO:mca3.ERTM', type = 'd')
|
|
#ScalarDetector Sca4
|
|
Sca4 = Channel('X10DA-SITORO:mca4.R1', type = 'd')
|
|
#ScalarDetector ScaICR4
|
|
ScaICR4 = Channel('X10DA-SITORO:dxp4:InputCountRate', type = 'd')
|
|
#ScalarDetector ScaOCR4
|
|
ScaOCR4 = Channel('X10DA-SITORO:dxp4:OutputCountRate', type = 'd')
|
|
#ScalarDetector ERTM4
|
|
ERTM4 = Channel('X10DA-SITORO:mca4.ERTM', type = 'd')
|
|
#ScalarDetector Sca5
|
|
Sca5 = Channel('X10DA-SITORO:mca5.R1', type = 'd')
|
|
#ScalarDetector ScaICR5
|
|
ScaICR5 = Channel('X10DA-SITORO:dxp5:InputCountRate', type = 'd')
|
|
#ScalarDetector ScaOCR5
|
|
ScaOCR5 = Channel('X10DA-SITORO:dxp5:OutputCountRate', type = 'd')
|
|
#ScalarDetector ERTM5
|
|
ERTM5 = Channel('X10DA-SITORO:mca5.ERTM', type = 'd')
|
|
|
|
#Dimension 1
|
|
#RegionPositioner posX
|
|
for setpoint1 in frange(0.3, 1.0, 0.01, True):
|
|
#Region 1 pre-actions
|
|
if setpoint1 == 0.3:
|
|
caput('X10DA-ES1:TOTAL-CYCLES', 2)
|
|
posX.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
|
|
readback1 = posXReadback.get()
|
|
if abs(readback1 - setpoint1) > 0.005 : # TODO: Check accuracy
|
|
raise Exception('Actor posX could not be set to the value ' + str(setpoint1))
|
|
sleep( 0.3 ) # Settling time
|
|
#Dimension Actions
|
|
caputq('X10DA-SITORO:EraseStart', '1')
|
|
sleep(0.1)
|
|
cawait('X10DA-SITORO:Acquiring', 'Acquiring', type = 's')
|
|
caput('X10DA-ES1:SMPL', '1')
|
|
sleep(0.6)
|
|
cawait('X10DA-ES1:SMPL-DONE', 1, type = 'l')
|
|
sleep(0.2)
|
|
caput('X10DA-SITORO:StopAll', '1')
|
|
sleep(0.1)
|
|
cawait('X10DA-SITORO:Acquiring', 'Done', type = 's')
|
|
#Detector Fluo-Ketek1
|
|
detector1 = Fluo-Ketek1.get()
|
|
#Detector SAI01-MEAN
|
|
detector2 = SAI01-MEAN.get()
|
|
#Detector SAI02-MEAN
|
|
detector3 = SAI02-MEAN.get()
|
|
#Detector SAI03-MEAN
|
|
detector4 = SAI03-MEAN.get()
|
|
#Detector Ring-current
|
|
detector5 = Ring-current.get()
|
|
#Detector IntegrTimeSet
|
|
detector6 = IntegrTimeSet.get()
|
|
#Detector IntegrTimeGet
|
|
detector7 = IntegrTimeGet.get()
|
|
#Detector Timestamp
|
|
detector8 = float(java.lang.System.currentTimeMillis())
|
|
#Detector dead_time
|
|
detector9 = dead_time.get()
|
|
#Detector Fluo-Ketek2
|
|
detector10 = Fluo-Ketek2.get()
|
|
#Detector Sca1
|
|
detector11 = Sca1.get()
|
|
#Detector ScaICR1
|
|
detector12 = ScaICR1.get()
|
|
#Detector ScaOCR1
|
|
detector13 = ScaOCR1.get()
|
|
#Detector ERTM1
|
|
detector14 = ERTM1.get()
|
|
#Detector Sca2
|
|
detector15 = Sca2.get()
|
|
#Detector ScaICR2
|
|
detector16 = ScaICR2.get()
|
|
#Detector ScaOCR2
|
|
detector17 = ScaOCR2.get()
|
|
#Detector ERTM2
|
|
detector18 = ERTM2.get()
|
|
#Detector Sca3
|
|
detector19 = Sca3.get()
|
|
#Detector ScaICR3
|
|
detector20 = ScaICR3.get()
|
|
#Detector ScaOCR3
|
|
detector21 = ScaOCR3.get()
|
|
#Detector ERTM3
|
|
detector22 = ERTM3.get()
|
|
#Detector Sca4
|
|
detector23 = Sca4.get()
|
|
#Detector ScaICR4
|
|
detector24 = ScaICR4.get()
|
|
#Detector ScaOCR4
|
|
detector25 = ScaOCR4.get()
|
|
#Detector ERTM4
|
|
detector26 = ERTM4.get()
|
|
#Detector Sca5
|
|
detector27 = Sca5.get()
|
|
#Detector ScaICR5
|
|
detector28 = ScaICR5.get()
|
|
#Detector ScaOCR5
|
|
detector29 = ScaOCR5.get()
|
|
#Detector ERTM5
|
|
detector30 = ERTM5.get()
|
|
#Manipulation TrueFluoChannel3
|
|
#Variable Mappings
|
|
a = detector19
|
|
b = detector20
|
|
c = detector21
|
|
d = detector22
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
DeadTime = 1.182e-7
|
|
ICR = b
|
|
OCR = c
|
|
|
|
if (OCR) == 0:
|
|
box = 0
|
|
TrueFluoChannel3 = box
|
|
if (ICR) == 0:
|
|
box = 0
|
|
TrueFluoChannel3 = box
|
|
|
|
Test = 1.e8
|
|
TestICR = ICR
|
|
n = 0
|
|
while ((Test > DeadTime) and (n < 30)):
|
|
TrueICR = ICR * math.exp(TestICR * DeadTime)
|
|
Test = (TrueICR - TestICR) / TestICR
|
|
TestICR = TrueICR
|
|
n = n + 1
|
|
if (OCR*d) <> 0:
|
|
box = a * TrueICR / OCR / d
|
|
if (OCR*d) == 0:
|
|
box=0.0
|
|
TrueFluoChannel3 = box
|
|
#Manipulation TrueFluoChannel4
|
|
#Variable Mappings
|
|
a = detector23
|
|
b = detector24
|
|
c = detector25
|
|
d = detector26
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
DeadTime = 1.182e-7
|
|
ICR = b
|
|
OCR = c
|
|
|
|
if (OCR) == 0:
|
|
box = 0
|
|
TrueFluoChannel4 = box
|
|
if (ICR) == 0:
|
|
box = 0
|
|
TrueFluoChannel4 = box
|
|
|
|
Test = 1.e8
|
|
TestICR = ICR
|
|
n = 0
|
|
while ((Test > DeadTime) and (n < 30)):
|
|
TrueICR = ICR * math.exp(TestICR * DeadTime)
|
|
Test = (TrueICR - TestICR) / TestICR
|
|
TestICR = TrueICR
|
|
n = n + 1
|
|
if (OCR*d) <> 0:
|
|
box = a * TrueICR / OCR / d
|
|
if (OCR*d) == 0:
|
|
box=0.0
|
|
TrueFluoChannel4 = box
|
|
#Manipulation TrueFluoChannel1
|
|
#Variable Mappings
|
|
a = detector11
|
|
b = detector12
|
|
c = detector13
|
|
d = detector14
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
DeadTime = 1.182e-7
|
|
ICR = b
|
|
OCR = c
|
|
|
|
if (OCR) == 0:
|
|
box = 0
|
|
TrueFluoChannel1 = box
|
|
if (ICR) == 0:
|
|
box = 0
|
|
TrueFluoChannel1 = box
|
|
|
|
Test = 1.e8
|
|
TestICR = ICR
|
|
n = 0
|
|
while ((Test > DeadTime) and (n < 30)):
|
|
TrueICR = ICR * math.exp(TestICR * DeadTime)
|
|
Test = (TrueICR - TestICR) / TestICR
|
|
TestICR = TrueICR
|
|
n = n + 1
|
|
if (OCR*d) <> 0:
|
|
box = a * TrueICR / OCR / d
|
|
if (OCR*d) == 0:
|
|
box=0.0
|
|
TrueFluoChannel1 = box
|
|
#Manipulation TrueFluoChannel2
|
|
#Variable Mappings
|
|
a = detector15
|
|
b = detector16
|
|
c = detector17
|
|
d = detector18
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
DeadTime = 1.182e-7
|
|
ICR = b
|
|
OCR = c
|
|
|
|
if (OCR) == 0:
|
|
box = 0
|
|
TrueFluoChannel2 = box
|
|
if (ICR) == 0:
|
|
box = 0
|
|
TrueFluoChannel2 = box
|
|
|
|
Test = 1.e8
|
|
TestICR = ICR
|
|
n = 0
|
|
while ((Test > DeadTime) and (n < 30)):
|
|
TrueICR = ICR * math.exp(TestICR * DeadTime)
|
|
Test = (TrueICR - TestICR) / TestICR
|
|
TestICR = TrueICR
|
|
n = n + 1
|
|
if (OCR*d) <> 0:
|
|
box = a * TrueICR / OCR / d
|
|
if (OCR*d) == 0:
|
|
box=0.0
|
|
TrueFluoChannel2 = box
|
|
#Manipulation TotalFluo
|
|
#Variable Mappings
|
|
a = TrueFluoChannel1
|
|
b = TrueFluoChannel2
|
|
c = TrueFluoChannel3
|
|
d = TrueFluoChannel4
|
|
e = TrueFluoChannel5
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
SUM_DET = 0.
|
|
SUM_DET = SUM_DET + a
|
|
SUM_DET = SUM_DET + b
|
|
SUM_DET = SUM_DET + c
|
|
SUM_DET = SUM_DET + d
|
|
SUM_DET = SUM_DET + e
|
|
TotalFluo = SUM_DET
|
|
#Manipulation TrueFluoChannel5
|
|
#Variable Mappings
|
|
a = detector27
|
|
b = detector28
|
|
c = detector29
|
|
d = detector30
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
DeadTime = 1.182e-7
|
|
ICR = b
|
|
OCR = c
|
|
|
|
if (OCR) == 0:
|
|
box = 0
|
|
TrueFluoChannel5 = box
|
|
if (ICR) == 0:
|
|
box = 0
|
|
TrueFluoChannel5 = box
|
|
|
|
Test = 1.e8
|
|
TestICR = ICR
|
|
n = 0
|
|
while ((Test > DeadTime) and (n < 30)):
|
|
TrueICR = ICR * math.exp(TestICR * DeadTime)
|
|
Test = (TrueICR - TestICR) / TestICR
|
|
TestICR = TrueICR
|
|
n = n + 1
|
|
if (OCR*d) <> 0:
|
|
box = a * TrueICR / OCR / d
|
|
if (OCR*d) == 0:
|
|
box=0.0
|
|
TrueFluoChannel5 = box
|
|
#Manipulation TotalFluoXAS
|
|
#Variable Mappings
|
|
c = TrueFluoChannel1
|
|
d = detector2
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
TotalFluoXAS = c/d
|
|
#Manipulation XAS-refer
|
|
#Variable Mappings
|
|
a = detector2
|
|
b = detector3
|
|
#TODO: Move, if needed, this import to the file header: import math
|
|
XAS-refer = math.log(math.fabs(a) /math.fabs(b))
|
|
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, detector11, detector12, detector13, detector14, detector15, detector16, detector17, detector18, detector19, detector20, detector21, detector22, detector23, detector24, detector25, detector26, detector27, detector28, detector29, detector30, TrueFluoChannel3, TrueFluoChannel4, TrueFluoChannel1, TrueFluoChannel2, TotalFluo, TrueFluoChannel5, TotalFluoXAS, XAS-refer])
|
|
|
|
#Closing channels
|
|
posX.close()
|
|
posXReadback.close()
|
|
Fluo-Ketek1.close()
|
|
SAI01-MEAN.close()
|
|
SAI02-MEAN.close()
|
|
SAI03-MEAN.close()
|
|
Ring-current.close()
|
|
IntegrTimeSet.close()
|
|
IntegrTimeGet.close()
|
|
dead_time.close()
|
|
Fluo-Ketek2.close()
|
|
Sca1.close()
|
|
ScaICR1.close()
|
|
ScaOCR1.close()
|
|
ERTM1.close()
|
|
Sca2.close()
|
|
ScaICR2.close()
|
|
ScaOCR2.close()
|
|
ERTM2.close()
|
|
Sca3.close()
|
|
ScaICR3.close()
|
|
ScaOCR3.close()
|
|
ERTM3.close()
|
|
Sca4.close()
|
|
ScaICR4.close()
|
|
ScaOCR4.close()
|
|
ERTM4.close()
|
|
Sca5.close()
|
|
ScaICR5.close()
|
|
ScaOCR5.close()
|
|
ERTM5.close()
|
|
|
|
scan.end()
|