Mars 2022

This commit is contained in:
gac-x07ma
2022-03-04 14:47:07 +01:00
parent ca26181ed4
commit 7aff507f60
24 changed files with 457 additions and 175 deletions

View File

@@ -1,3 +1,5 @@
Nd=1003.3
Mg=1310.0
F=695.0
Gd=1189.0
Ba=790.0
@@ -19,7 +21,6 @@ Ni=852.0
O=543.0
Sm=1110.0
V=520.0
W_M45=1850.0
Tb=1250.0
Ti=460.0
Zn=1020.0

View File

@@ -1,83 +1,92 @@
#Tue Aug 31 22:33:17 CEST 2021
Ni-C+=1.0 31.08.21 22\:27
#Mon Feb 28 11:55:31 CET 2022
Ni-C+=1.0 06.02.22 15\:42
W_M45-C-=1.0 26.04.21 15\:51
Cu-C-=4.0 18.08.21 09\:09
Cu-C+=3.0 18.08.21 09\:07
Zn-LV=-8.0 19.04.21 10\:05
V-C-=0.5 19.08.21 20\:31
Ni-C-=2.0 31.08.21 22\:30
N-C+=-0.5 28.11.21 22\:28
Mg-LH=6.5 21.10.21 14\:15
Cu-C-=3.0 24.01.22 11\:16
Zn-LV=3.0 28.02.22 11\:55
Cu-C+=3.5 28.02.22 11\:36
V-C-=1.0 23.02.22 09\:10
Ni-C-=2.0 06.02.22 15\:47
Ho-C+=-5.0 08.03.21 00\:56
Co-LV=3.5 20.08.21 11\:56
Co-LV=3.5 14.12.21 17\:47
Al-LV=-10.0 19.04.21 09\:56
Er-LV=6.0 24.04.21 13\:44
Gd-C-=-1.0 12.06.21 18\:19
Gd-C+=-4.5 12.06.21 18\:22
Ti-LV=2.0 16.08.21 14\:38
Dy-C+=-4.5 05.03.21 15\:58
Gd-C-=-1.0 17.12.21 09\:23
N-C-=-1.0 03.02.22 16\:33
Gd-C+=-3.5 17.12.21 17\:23
Mg-LV=6.5 20.10.21 20\:27
Ti-LV=2.0 24.02.22 10\:19
Dy-C+=-3.0 07.12.21 22\:56
Dy-C-=-1.0 27.01.21 02\:56
Ho-C-=0.0 08.03.21 00\:57
Eu-LH=5.0 06.11.20 15\:11
O-LH=2.5 23.06.21 10\:43
Cr-LH=2.3 23.09.20 13\:31
Eu-LH=4.0 24.02.22 10\:28
O-LH=3.0 07.12.21 22\:27
Cr-LH=2.5 03.11.21 02\:09
W_M45-C+=-1.0 26.04.21 15\:49
Cr-C+=0.0 11.06.21 13\:17
O-C+=-0.5 19.04.21 09\:41
Fe-LH=2.5 31.08.21 17\:44
Eu-LV=6.5 22.10.20 15\:02
Tb-C-=-1.5 21.06.21 09\:51
Cr-C+=-0.5 04.11.21 11\:54
O-C+=3.0 20.09.21 01\:51
Fe-LH=3.0 02.02.22 09\:48
Eu-LV=4.5 24.02.22 10\:30
Tb-C-=0.5 19.09.21 04\:59
W-C-=1.0 22.04.21 09\:51
Tb-C+=-5.0 28.08.21 20\:19
Tb-C+=-3.5 19.09.21 05\:00
Ce-C-=3.5 20.08.21 14\:20
Cr-C-=1.5 11.06.21 13\:18
O-C-=1.5 19.04.21 09\:43
Cr-C-=1.0 04.11.21 11\:52
O-C-=4.5 20.09.21 01\:49
Ce-C+=2.5 20.08.21 14\:23
Ge-LV=6.0 09.09.20 14\:22
Fe-LV=3.0 31.08.21 17\:45
Zn-LH=4.5 01.06.21 21\:25
V-C+=-1.0 19.08.21 09\:43
Fe-LV=3.0 02.02.22 09\:50
Zn-LH=3.0 28.02.22 11\:54
V-C+=-1.0 24.01.22 11\:24
Sm-C+=-5.0 20.08.21 14\:29
Mn-C-=2.0 15.08.21 20\:37
Mn-C+=-0.5 19.08.21 20\:32
Mn-C-=1.0 23.01.22 11\:26
Mn-C+=-1.5 23.01.22 11\:24
Ge-LH=6.0 09.09.20 14\:19
Sm-C-=-1.5 08.09.20 21\:19
Co-LH=3.5 20.08.21 11\:57
Cu-LV=6.0 23.06.21 13\:14
Co-LH=3.5 14.12.21 17\:46
Cu-LV=4.5 28.02.22 11\:39
Zn-C-=10.0 19.04.21 10\:02
V-LV=3.0 28.06.21 10\:08
Ni-LV=3.0 31.08.21 22\:33
V-LV=2.0 23.02.22 19\:29
Ni-LV=4.0 02.11.21 19\:47
Zn-C+=7.5 19.04.21 09\:59
Er-C+=-4.0 18.10.20 10\:34
Co-C-=2.5 20.08.21 12\:03
Co-C-=2.5 14.12.21 17\:44
Er-C-=3.0 17.10.20 10\:50
Co-C+=1.0 20.08.21 11\:59
Co-C+=1.0 14.12.21 17\:43
Ho-LH=7.0 11.03.21 02\:17
C-LV=2.5 06.05.21 03\:41
N-LV=2.0 23.06.21 13\:11
Ti-C+=-0.5 05.05.21 11\:55
Ti-C-=0.5 05.05.21 12\:01
Ni-LH=3.0 31.08.21 22\:32
N-LV=1.5 28.02.22 11\:50
Ti-C+=-0.5 24.02.22 10\:21
Ti-C-=0.5 24.02.22 10\:22
Ni-LH=4.0 02.11.21 19\:46
W-C+=-0.5 22.04.21 09\:53
Dy-LV=6.0 30.01.21 18\:02
Dy-LV=6.5 07.12.21 22\:52
Nd-C-=-2.5 24.09.21 15\:05
Ho-LV=7.0 11.03.21 02\:19
C-LH=2.0 06.05.21 03\:39
Ge-C+=-5.0 09.09.20 14\:23
Dy-LH=6.5 05.03.21 23\:04
Ti-LH=2.0 16.08.21 14\:34
Eu-C-=-0.5 21.04.21 17\:18
Mn-LH=2.5 19.08.21 20\:35
Eu-C+=-5.0 21.04.21 17\:20
Dy-LH=6.5 07.12.21 22\:54
Ti-LH=2.0 24.02.22 10\:17
Ba-LH=5.0 07.12.21 22\:25
Eu-C-=-2.0 24.02.22 10\:25
Nd-C+=-4.5 03.11.21 04\:46
Mn-LH=1.5 23.01.22 11\:20
Eu-C+=-5.5 24.02.22 10\:27
Ce-LV=4.0 20.08.21 14\:27
Sm-LH=4.0 20.08.21 10\:55
O-LV=2.5 23.06.21 10\:42
O-LV=3.0 07.12.21 22\:29
Cr-LV=2.5 03.11.21 02\:10
Ge-C-=0.0 09.09.20 14\:24
Fe-C-=1.5 31.08.21 20\:44
Cu-LH=6.5 23.06.21 13\:15
V-LH=3.0 28.06.21 10\:06
Fe-C-=2.0 02.02.22 09\:47
Cu-LH=4.5 28.02.22 11\:37
V-LH=2.0 23.02.22 19\:27
Ba-LV=5.5 07.12.21 22\:23
Ce-LH=4.5 20.08.21 14\:25
Mn-LV=2.5 15.08.21 20\:31
Mn-LV=1.5 23.01.22 11\:22
Er_C+=-4.3 30.06.20 21\:58
Al-LH=10.0 19.04.21 09\:55
Er-LH=6.0 24.04.21 13\:43
Sm-LV=4.0 20.08.21 10\:57
Fe-C+=-0.5 31.08.21 20\:45
N-LH=2.0 23.06.21 13\:08
Fe-C+=0.0 02.02.22 09\:43
N-LH=1.5 28.02.22 11\:52

12
config/scicat.properties Normal file → Executable file
View File

@@ -1,10 +1,10 @@
#Tue Aug 31 11:31:23 CEST 2021
#Tue Oct 19 11:57:18 CEST 2021
environment=prod
testParameters=-testenv -user slssim\:slssim
sourceFolder=/sls/X07MA/Data1/x07maop
prodParameters=\ -user slssim\:slssim
devParameters=-devenv -user slssim\:slssim
ownerGroup=P1000
testParameters=-testenv -user slsxtreme\:kyzWxAfqu6
sourceFolder=/sls/X07MA/Data1/e19389
prodParameters=\ -user slsxtreme\:kyzWxAfqu6
devParameters=-devenv -user slsxtreme\:kyzWxAfqu6
ownerGroup=
type=raw
parameters=-ingest -allowexistingsource -noninteractive -autoarchive
creationLocation=/PSI/SLS/XTREME

0
config/session_metadata.properties Normal file → Executable file
View File

4
config/sessions.properties Normal file → Executable file
View File

@@ -1,2 +1,2 @@
#Tue Aug 31 11:40:30 CEST 2021
SessionCounter=3
#Tue Oct 19 11:55:58 CEST 2021
SessionCounter=6

View File

@@ -1,2 +1,2 @@
#Tue Aug 31 15:35:20 CEST 2021
#Thu Nov 04 12:26:22 CET 2021
FdaBrowser=false

View File

@@ -1,5 +1,5 @@
#Wed Sep 01 10:20:33 CEST 2021
LastRunDate=210901
#Mon Feb 28 18:57:33 CET 2022
LastRunDate=220228
SessionCounter=0
FileSequentialNumber=13754
DaySequentialNumber=14
FileSequentialNumber=17477
DaySequentialNumber=98

146
script/EnergyScan_topup.py Normal file
View File

@@ -0,0 +1,146 @@
'''
#Parameters
E1 = 630
E2 = 685
TIME = 1 #min
DELAY = 0.0 #s
MODE = 'LINEAR' #'CIRC +'
OFFSET = None
FOLDER = '2021_03/20210330'
FILE = 'Test'
ALPHA=0 #None
'''
set_exec_pars (reset=True)
print "wait 0.5 seconds..."
time.sleep(0.5) # delay to avoid immediate commands to ID after completion of last scan
#print "\nCheck temperature"
#wait_temp()
#print "\nTemperature ok"
print "\nStart energy scan..."
#print E1,E2,TIME,DELAY,str(MODE) ,str(OFFSET) ,str(FOLDER) ,str(FILE) ,str(ALPHA)
if MODE == "LINEAR":
print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE),str(ALPHA),"deg"
else:
print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE)
folder = os.path.expanduser("~/Data1/") + FOLDER + "/";
set_exec_pars(name= FILE)
#Pre-actions
if NO_BEAM_CHECK == False:
print "Wait beam"
wait_beam()
if MODE is not None:
print "Set polarization"
pol_mode.write(MODE)
if MODE == 'LINEAR':
if ALPHA is not None:
pol_angle.write(ALPHA)
wait_pol_done(1.0) # new script to wait for polarization. Wait_device does not work for this channel
print "Set Energy"
if OFFSET is not None:
pol_offset.write(OFFSET) #TODO: CAPUT
#time.sleep(0.5)
#wait_device(pol_done, "DONE")
energy.write(float(E1)) # no need to add wait command. This commands sets and waits.
print "Energy setting done"
caput('X07MA-PGM:CERBK.N',10) # set energy readback averaging to 10 pts
caput('E1', E1)
caput('E2', E2)
caput('TIME', TIME)
#caput('FOLDER', FOLDER)
caput('FOLDER', "OTF/" + FOLDER)
caput('FILE', FILE)
time.sleep(0.1)
#open_valve()
#open_valve(0.0) #TODO: WHY WRITING AGAIN???
time.sleep(DELAY)
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
topup_thresh=402.1
print('wait for topup')
while(caget('ARIDI-PCT:CURRENT') < topup_thresh):
sleep(0.3)
pass;
print('topup done')
scan_completed = False
try:
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
caput('START', '1')
write_logs()
waiting = True
class Time(Readable):
def __init__(self):
self.start = time.time()
def read(self):
return time.time()-self.start
class NORMtey(Readable):
def read(self):
return float(CADC1.take())/float(CADC2.take())
class NORMdiode(Readable):
def read(self):
return float(CADC3.take())/float(CADC2.take())
pol = pol_angle if (pol_mode.readback.read() == "LINEAR") else pol_mode #Fixed, should be an attribute, not a column
sensors = [Ecrbk, CADC1, CADC2, CADC3,CADC4,CADC5,current,Time(),FieldX,FieldZ,pol, Temperature, NORMtey(), NORMdiode()]
def monitoring_task():
global scan_completed
time.sleep(1.0)
try:
plot_titles = ["TEY raw", "I0", "diode_raw", "TEY_norm", "diode_norm"]
for index, title in enumerate(plot_titles, start=0): get_plots()[index].title = title
except:
pass
wait_channel('START', 'STOP', type = 's')
scan_completed = True
get_exec_pars().currentScan.abort()
ret = fork(monitoring_task)
current.alias="MCurr"
pol.alias="Pol"
print "Scanning...",
try:
mscan(Ecrbk, sensors, -1, None, range="auto", domain_axis="Ecrbk", enabled_plots = ["NORMtey", "NORMdiode", CADC1,CADC3, CADC2], )
finally:
ret[0].cancel(True)
current.alias=None
pol.alias=None
#time.sleep(2.0)
print "Finished Energy scan."
if after_sample(): #Repeat if id error
break
except:
if not scan_completed:
print sys.exc_info()
print("Aborting...")
while caget('START') == 'START':
caput('START', '0')
time.sleep(0.1)
#if get_exec_pars().source != CommandSource.plugin:
# show_message(str(ex))
raise

View File

@@ -12,6 +12,12 @@ ALPHA=0 #None
'''
set_exec_pars (reset=True)
print "wait 0.5 seconds..."
time.sleep(0.5) # delay to avoid immediate commands to ID after completion of last scan
#print "\nCheck temperature"
#wait_temp()
#print "\nTemperature ok"
print "\nStart energy scan..."
#print E1,E2,TIME,DELAY,str(MODE) ,str(OFFSET) ,str(FOLDER) ,str(FILE) ,str(ALPHA)
@@ -35,9 +41,7 @@ if MODE is not None:
if MODE == 'LINEAR':
if ALPHA is not None:
pol_angle.write(ALPHA)
time.sleep(0.5) # TIME SLEEP IS NECESSARY. OTHERWISE NEXT COMMAND WILL NOT WAIT FOR POLARIZATION SETTING. ADDED BY CP ON 07.02.2020
wait_device(pol_done, "DONE") # Oct. 2019 added wait to try avoid taper error
print "Polarization setting done"
wait_pol_done(1.0) # new script to wait for polarization. Wait_device does not work for this channel
print "Set Energy"
if OFFSET is not None:

View File

@@ -1,25 +1,32 @@
open_valve()
#####################
## INPUT PARAMETERS##
POS_START = 157 #Minn = 150.0
POS_END = 163 #Max = 170.0
POS_STEP = 0.05
POS_START = 157.5 #Minn = 150.0
POS_END = 165 #Max = 170.0
POS_STEP = 0.25
SETTLING_TIME = 0.1
#ENERGIES = [543] # O
#ENERGIES = [461] # Ti
#ENERGIES = [1611] # Tb
#ENERGIES = [1190] # Gd
#ENERGIES = [570.0]#, 577.0] # Cr
#ENERGIES = [461] #Ti
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [774. 0] # Co
#ENERGIES = [573.0, 577.0] # Cr
#ENERGIES = [778.0,778.3] # Co
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [931.7]# 925.0 ] # Cu
#ENERGIES = [931.7, 925.0 ] # Cu
#ENERGIES = [928.4] #Cu
#ENERGIES = [928.4, 707.5] #Cu Fe, special
#ENERGIES = [572.0]
#ENERGIES = [706]#,708.3,704.0] # Fe
#ENERGIES = [851.3 ,845]#[851.2,848.0] # Ni
#ENERGIES = [851.3 ,845]
#ENERGIES = [851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [776.9,774] # Co
ENERGIES = [639.5,630.0] # Mn
#ENERGIES = [776.7,774] # Co
#ENERGIES = [639.5,630.0] # Mn
ENERGIES = [459.7,456] #Ti
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [516.0, 503.0] # V

View File

@@ -1,18 +1,21 @@
#####################
## INPUT PARAMATERS##
#open_valve()
#X07MA-ES1-SHUTTER:TRZ1.VAL
#POS_START = 107 #Min = 98.0
#POS_END = POS_START + 6 #Max = 118.0
#caput("X07MA-ES1-SHUTTER:TRZ1.VAL", POS_START - 108.0 + 40.5)
POS_START = 108.5 #Min = 98.0
POS_END = 110.5 #Max = 118.0
POS_STEP = 0.01
POS_START = 98 #Min = 98.0
POS_END = 114 #Max = 118.0
POS_STEP = 0.2
SETTLING_TIME = 0.0
#POS_START = 100 #Min = 98.0
#POS_END = 117 #Max = 118.0
#POS_STEP = 0.25
#caput("X07MA-ES1-SHUTTER:TRZ1.VAL", POS_START - 108.0 + 40.5)
#36: 106.25
@@ -27,8 +30,11 @@ SETTLING_TIME = 0.0
#Max = 118.0
#POS_STEP = 0.1
#"""
#ENERGIES = [458.4,454] #Ti
ENERGIES = [929.2,920] # test
#ENERGIES = [774.0,779.5] # Co
#ENERGIES = [776.0,778.0] # Co
#ENERGIES = [459.7,456] #Ti
#ENERGIES = [1128, 1120 ]# Eu
#ENERGIES = [285.3, 280.0]# C
#ENERGIES = [1030,1015] #Zn
#ENERGIES = [485.0,490.0] # Ru
@@ -45,22 +51,22 @@ SETTLING_TIME = 0.0
#ENERGIES = [385.0]# C
#ENERGIES = [570.0,576.3] #Cr
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [530] #O
#ENERGIES = [532.3, 525.0] #O
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [399.1,392] # TCNQ
#ENERGIES = [700] #Ti
#ENERGIES = [638.8,633.0] # Mn
#ENERGIES = [459.7,456] #Ti
#ENERGIES = [639.0] # Mn
#ENERGIES = [848.5, 842.0] # La
#ENERGIES = [463,457]
#ENERGIES = [638.8,636.6] # Mn
#ENERGIES = [707., 704.] # Fe
#ENERGIES = [639.1,636.6] # Mn
#ENERGIES = [707.0, 704.0] # Fe
#ENERGIES = [708.3]
ENERGIES = [928.4] #CuO
#ENERGIES = [927, 929] #Cu
#ENERGIES = [929.5, 925] #Cu
#ENERGIES = [928.4] #CuO
#ENERGIES = [929.0, 925.0] #Cu
#ENERGIES = [927, 929] #Cu
#ENERGIES = [402, 397] # Ta
#ENERGIES = [777., 774.0] # Co
#ENERGIES = [783.15,774] # Ba
#ENERGIES = [777.3, 774.0] # Co
#ENERGIES = [782.5,775] # Ba
#ENERGIES = [778] # Co
#ENERGIES = [848.5, 842] # La
#ENERGIES = [465.0,450.0] # STO
@@ -69,7 +75,7 @@ ENERGIES = [928.4] #CuO
#ENERGIES = [1235.0, 1228.0 ] #Er? Dy?
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [ 1185 ] # Gd
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1300, 1312] # Mg
#ENERGIES = [1457.8] # Tm
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1400.5,1395.0] #Er
@@ -77,23 +83,23 @@ ENERGIES = [928.4] #CuO
#ENERGIES = [385] # N
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [931.7, 925.0] # Cu metal
#ENERGIES = [928.5, 925.0] # Cu metal
#ENERGIES = [920.0 ] # Cu1
#ENERGIES = [708.6, 704] # Fe
#ENERGIES = [706.5, 704] # Fe
#ENERGIES = [706.6, 704] # Fe metal
#ENERGIES = [706.6]
#ENERGIES = [700.0]
#ENERGIES = [352, 340.0] # Ca
#ENERGIES = [1125.4, 1120] # Eu
#ENERGIES = [1126.16, 1120] # Eu
#ENERGIES = [696.7, 680.0] # F
#ENERGIES = [692.0] # F
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1289.5, 1282.0] # Dy
#ENERGIES = [1289.4] # Dy
#ENERGIES = [660.0, 665.0] # In
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [1125.6]# Eu
#ENERGIES = [850.9, 842] # Ni
#ENERGIES = [517.5, 510] # V
#ENERGIES = [514.1, 510] # V
#ENERGIES = [1455,1420] # Se
#ENERGIES = [1181.0,1173.0]
#ENERGIES = [285.3, 280.0]# C

View File

@@ -47,7 +47,9 @@ print "OK"
# ramp_rate.write(RAMP_RATE)
# ramp_rate.waitInPosition(RAMP_RATE,10000)
print "Check temperature"
wait_temp()
print "Temperature ok"
if len(ENERGIES) ==2:
# dif_series = plot([],"Dif", get_context()="Dif")[0].getSeries(0)
@@ -128,7 +130,8 @@ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
#wait_device(pol_done, "DONE")
wait_pol_done(1.0)
#if WAIT_STABLE_TEMPERATURE == True:

View File

@@ -21,7 +21,8 @@ if MODE is not None:
if OFFSET is not None:
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
wait_device(pol_done,"DONE", -1)
#wait_device(pol_done,"DONE", -1)
wait_pol_done(1.0)
setpoints = []
for r in RANGES:

View File

@@ -118,11 +118,13 @@ print "Set energy..."
setpoint2 = ENERGIES[0]
print setpoint2
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
# 2022: comment out, since write apparantly already waits for it to finish
#sleep( ENERGY_CHANGE_SLEEP ) # Settling time
wait_device(energy_done, 1 )
#wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
#wait_device(pol_done, "DONE")
wait_pol_done(1.0) # 2022: new script to wait for polarization. Wait_device does not work for this channel
# new mid 2021: monitor the UW reflected power
act_stamp = time.strftime('%Y%m%d_%H%M%S') + '_'

View File

@@ -6,7 +6,7 @@ POS_STEP = 0.5
#ENERGIES = [704.0,708.7] # Fe
ENERGIES = [530] #
ENERGIES = [460] #
#####################

View File

@@ -125,11 +125,14 @@ print "Set energy..."
setpoint2 = ENERGIES[0]
print setpoint2
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
# 2022: comment out, since write apparantly already waits for it to finish
#sleep( ENERGY_CHANGE_SLEEP ) # Settling time
wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
#wait_device(energy_done, 1 )
print "done energy"
#wait_device(pol_done, "DONE")
wait_pol_done(1.0) # 2022: new script to wait for polarization. Wait_device does not work for this channel
print "done pol"
#if WAIT_STABLE_TEMPERATURE == True:
@@ -163,8 +166,10 @@ while(True):
#Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
else:
sleep( 0.25 ) # TODO: Check
else:
#pass
#sleep( 0.25 ) # TODO: Check
sleep( 0.3 ) # TODO: Check
#TODO: change to Controlled variable?
readback2 = energy_readback.read() #EnergyReadback.get()
@@ -185,7 +190,14 @@ while(True):
detector4 = pol_mode_buffer #float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle_buffer #pol_angle.read() #polAngle.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
# once in a single time, there was an error in a script related to this command, namely
# Error creating channel: ARIDI-PCT:CURRENT [current] in <script>
# eventually, there was a restart in epics from the machine side, even though the control room could not confirm that
# so, well try: except it for this (super rare!) exception
try:
detector7 = current.read()
except:
pass
detector8 = signal_field_analog_z.read() if FIELD =="Hz" else signal_field_analog_x.read() # fieldAnalogX.get()
# ESR HACK
detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector

View File

@@ -1,34 +1,45 @@
#####################
## INPUT PARAMETERS##
#POS_START = 1
#POS_END = 30 # 25.2
POS_START = 17
POS_END = 20.5
POS_STEP = 0.05 #0.25
POS_START = 0.5
POS_END = 32
#POS_START = 22.5
#POS_END = 24.5
#POS_START =4.5
#POS_END = 7
#POS_STEP = 0.1
POS_STEP =0.25
#POS_START =10
#POS_END = 16
#POS_STEP = 0.25
#"""
#POS_START = 7
#POS_END = 15
#POS_STEP = 0.25
#"""
#ENERGIES = [458.4] #Ti
#ENERGIES = [458.4,454] #Ti
#ENERGIES = [774.0,779.5] # Co
#ENERGIES = [532.3, 525.0] # O
#ENERGIES = [570.0]#, 577.5] # Cr
#ENERGIES = [1241] # Tb
#ENERGIES = [1241] # Tb
#ENERGIES = [1190] # Gd
#ENERGIES = [778.0] # Co
#ENERGIES = [461] #Ti
#ENERGIES = [459.7,456] #Ti
#ENERGIES = [1128, 1120 ]# Eu
#ENERGIES = [1030, 1015]# Zn
#ENERGIES = [532, 523]#
#ENERGIES = [363.2, 356]# Nb
#ENERGIES = [782.50, 775.0]
#ENERGIES = [395.0, 410] # N
#ENERGIES = [401.1,403] #Mo285
#ENERGIES = [573.0] # Cr
#ENERGIES = [572.0]
#ENERGIES = [692.0] # F
#ENERGIES = [696.7, 680.0] # F
#ENERGIES = [690.5, 685.0] # F
#ENERGIES = [1110,1125.5] #STO
#ENERGIES = [397.6,395] # N
#ENERGIES = [708.1, 704] # Fe
#ENERGIES = [706.4] # Fe
#ENERGIES = [783.15,771.0] # Ba
#ENERGIES = [700.0]
#ENERGIES = [530] #O
@@ -39,16 +50,16 @@ POS_STEP = 0.05 #0.25
#ENERGIES = [928.4, 925] #CuO
#ENERGIES = [928.4] #Cu
#ENERGIES = [928.4, 707.5] #Cu, Fe special
#ENERGIES = [927, 929] #Cu
#ENERGIES = [929.0, 925.0] #Cu
#ENERGIES = [774.0] # Co
#ENERGIES = [777., 774.0] # Co
#ENERGIES = [776.7, 774.0] # Co
#ENERGIES = [851.3,842.0] # Ni
ENERGIES = [639.5,630.0] # Mn
#ENERGIES = [639.5, 630.0] # Mn
#ENERGIES = [848.5, 842.0] # La
#ENERGIES = [576.4, 560.0] #Cr
#ENERGIES = [573.0,576.3] #Cr
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [638.8,636.6] # Mn
#ENERGIES = [639.1,636.6] # Mn
#ENERGIES = [459.5,455] #Ti
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
@@ -57,14 +68,14 @@ ENERGIES = [639.5,630.0] # Mn
#ENERGIES = [300.0,280]# C
#ENERGIES = [1370.0,1380.0] #Er??
#ENERGIES = [1400.6,1395.0] #Er
#ENERGIES = [1390.0] #Er
#ENERGIES = [1395.0] #Er
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1289.5, 1282.5] # Dy
#ENERGIES = [1344.2, 1338 ] # Ho
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [1566.0,1554.0] # Al
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [931.7, 925] # Cu metal
#ENERGIES = [928.5, 925] # Cu metal
#ENERGIES = [402, 397] # Ta
#ENERGIES = [395,390] #Mo
#ENERGIES = [928.6,925]# Cu1
@@ -74,18 +85,18 @@ ENERGIES = [639.5,630.0] # Mn
#ENERGIES = [976, 970] # Nd
#ENERGIES = [1185] # Gd
#ENERGIES = [405.5, 390] # Sc
#ENERGIES = [1289.5, 1282] # Dy edge, pre-edge
#ENERGIES = [1289.4] # Dy edge, pre-edge
#ENERGIES = [1345, 1338] # Ho edge, pre-edge
#ENERGIES = [1290] # Dy
#ENERGIES = [1125.6]# Eu
#ENERGIES = [1289.1, 1280] # Dy
#ENERGIES = [1126.16, 1120] # Eu
#ENERGIES = [774,777.6] # Co
#ENERGIES = [517.5, 503] # V
#ENERGIES = [514.1, 510] # V
#ENERGIES = [510] # V predge
#ENERGIES = [1455,1420] # Se
#ENERGIES = [285.3, 280.0]# C
#ENERGIES = [368, 367] # Ag
#ENERGIES = [1076.0]
ENERGIES = [920]
#####################

View File

@@ -1,4 +1,4 @@
ID_ENERGY = 852
ID_ENERGY = 780

View File

@@ -20,6 +20,9 @@ LayoutFDA.setFilePrefix("{date}_{hour}{min}_{name}")
energy.setBlockingWrite(True)
pol_mode.setpoint.setBlockingWrite(True)
pol_offset.setBlockingWrite(True)
pol_angle.setBlockingWrite(True)
energy_id.setSettlingCondition(ChannelSettlingCondition("X07MA-ID:DONE", 'DONE'))
@@ -299,20 +302,26 @@ def set_hx(field, timeout = -1):
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
print 'difference after resetting is ',difference,' Tesla...'
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
print 'difference after resetting is ',difference,' Tesla...'
last_difference = difference
print 'difference after resetting is ',difference,' Tesla...'
#print 'difference after resetting is ',difference,' Tesla...'
print 'Finished while loop'
if iPS == True:
field_x_ips_output.waitValue(0,timeout)
while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
time.sleep(0.1)
else:
field_x_done.waitValue(1,timeout)
#else: # removed else since loop above already checks if field is done. Had crash already by timeout below. CP 7.09.21
# extra safety
#try:
#field_x_done.waitValue(1,timeout)
#except:
#pass
print "Done setting magnetic field"
@@ -340,10 +349,7 @@ def set_pol_cplus(offset = None, timeout = -1):
pol_mode.write("CIRC +")
if offset is not None:
pol_offset.write(float(offset))
time.sleep(0.5)
pol_done.update()
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs.Must use wait_device. CP June 21
wait_pol_done(1.0)
print "Done setting x-ray polarization"
def set_pol_cminus(offset = None, timeout = -1):
@@ -355,9 +361,7 @@ def set_pol_cminus(offset = None, timeout = -1):
if offset is not None:
pol_offset.write(float(offset))
time.sleep(0.5)
pol_done.update()
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs. Must use wait_device. CP June 21
wait_pol_done(1.0)
print "Done setting x-ray polarization"
def set_pol_lin(angle, offset = None, timeout = -1):
@@ -369,9 +373,7 @@ def set_pol_lin(angle, offset = None, timeout = -1):
pol_angle.write(float(angle))
if offset is not None:
pol_offset.write(float(offset))
time.sleep(0.5)
pol_done.update()
wait_device(pol_done, "DONE")
wait_pol_done(1.0)
#pol_done.waitValue("DONE",timeout) # it hangs.Must use wait_device. CP June 21
print "Done setting x-ray polarization"
@@ -396,28 +398,30 @@ def open_valve(delay = 0.75, timeout=500.0):
print "Opening valve"
start = time.time()
valve_try_open.write(1) #TODO: CAPUT
time.sleep(0.1)
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 5 :
if (timeout>0) and (time.time()-start > timeout):
raise Exception("Timeout opening the valve")
time.sleep(0.1)
#print "Retry open valve"
#if (timeout>0) and (time.time()-start > timeout):
#raise Exception("Timeout opening the valve") # it happened that script crashed at this point so commenting out. CP Sept/21
print "Retry open valve"
valve_try_open.write(1)
#print "Valve opened"
time.sleep(1.0)
print "Valve opened"
def close_valve(delay = 0.5, timeout=10.0): #TODO: Check default delay
"""
"""
print "Closing valve"
valve_try_open.write(0)
time.sleep(0.1)
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 2 :
if (timeout>0) and (time.time()>timeout):
raise Exception("Timeout opening the valve")
time.sleep(0.1)
#print "Retry close valve"
#if (timeout>0) and (time.time()>timeout):
#raise Exception("Timeout opening the valve")
print "Retry close valve"
valve_try_open.write(0)
#print "Valve closed"
time.sleep(1.0)
print "Valve closed"
def close_shutter(delay = 0.5): #TODO: Check default delay
"""
@@ -429,14 +433,15 @@ def close_shutter(delay = 0.5): #TODO: Check default delay
def set_energy (value, delay=0.5):
print "Set energy"
time.sleep(float(delay))
timeout_ms = 90000 # 1.5 minutes
tolerance = 0.3
energy.write(float(value))
try:
energy_done.waitValue(1, timeout_ms) # timeout is now 90 sec, was -1
except:
if abs(energy.read() - energy_readback.read()) > tolerance:
throw
#try:
#energy_done.waitValue(1, timeout_ms) # timeout is now 90 sec, was -1
#except:
#if abs(energy.read() - energy_readback.read()) > tolerance:
#throw
time.sleep(float(delay))
print "Done setting energy"
@@ -611,6 +616,22 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n
#run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
run("EnergyScan_v2", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf_topup(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None):
"""
"""
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
if len(name)> 38:
name = name[:38]
print('WARNING: Sample name too long. Name has been truncated.')
#run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
run("EnergyScan_topup", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf2(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None):
"""
"""
@@ -717,6 +738,19 @@ def set_au_mesh(value):
au_mesh.move(value)
print "Done setting Au mesh"
def wait_pol_done(delay=1.0):
print "Waiting for pol done"
time.sleep(delay) #Make sure value changed
while True:
try:
if caget("X07MA-ID:DONE") == "DONE":
break
except:
print "Error reading pol done"
time.sleep(0.5)
print "Done"
def get_scan_filename():
return str(get_exec_pars().output) + str(get_exec_pars().scanPath) + ".txt"

View File

@@ -11,14 +11,14 @@ if (sp<2.0):
needle.write(50.0)
print "Wait 1.0 min ..."
time.sleep(60)
print "Wait until T< 4K"
print "Wait until T < 4K"
while True:
time.sleep(2)
t=temperature.readback.read()
if t < 4:
break
print "Wait 10 min ..."
time.sleep(600)
print "Wait 6 min ..."
time.sleep(360)
print "Set needle valve to 0%"
needle.write(0.0)
print "Wait temperature stabilization"

4
script/restore/local.py Executable file → Normal file
View File

@@ -20,7 +20,9 @@ LayoutFDA.setFilePrefix("{date}_{hour}{min}_{name}")
energy.setBlockingWrite(True)
pol_mode.setBlockingWrite(True)
pol_offset.setBlockingWrite(True)
pol_angle.setBlockingWrite(True)
energy_id.setSettlingCondition(ChannelSettlingCondition("X07MA-ID:DONE", 'DONE'))
energy_id.settlingCondition.latency = 10

View File

@@ -0,0 +1,33 @@
ENERGIES = [845.0, 852.0]
ACC_TIME = 1.0
ACC_SAMPLES = 100
cadc1_av = create_averager(CADC1, ACC_SAMPLES, interval = ACC_TIME/100, name = "CADC1", monitored=-1)
cadc2_av = create_averager(CADC2, ACC_SAMPLES, interval = ACC_TIME/100, name = "CADC2", monitored=-1)
cadc3_av = create_averager(CADC3, ACC_SAMPLES, interval = ACC_TIME/100, name = "CADC3", monitored=-1)
class TeyNorm(Readable):
def read(self):
return cadc1_av.take().doubleValue() / cadc2_av.take().doubleValue()
class DiodeNorm(Readable):
def read(self):
return cadc3_av.take().doubleValue() / cadc2_av.take().doubleValue()
sensors = [cadc1_av, cadc2_av, cadc3_av, TeyNorm(),DiodeNorm(), energy_readback,Temperature]
def after_readout(record, scan):
pass
def before_pass(pass_num):
print "pass: ",pass_num
en = ENERGIES[((pass_num-1)%2)]
set_energy(en)
time.sleep(ACC_TIME)
ret= tscan(sensors, 1, 0, passes = 1000, before_pass = before_pass, after_read=after_readout)

View File

@@ -1 +1 @@
set_hx(0.1)
set_temp(4.0)

View File

@@ -70,6 +70,9 @@ cawait('X07MA-FE-PH1:MS2', 1)
print "\n shutter is open"
"""
#print "\nCheck temperature"
#wait_temp()
print "\nStart energy scan..."
#print E1,E2,TIME,DELAY,str(MODE) ,str(OFFSET) ,str(FOLDER) ,str(FILE) ,str(ALPHA)
if MODE == "LINEAR":
@@ -100,6 +103,7 @@ if NO_BEAM_CHECK == False:
print "Wait beam"
wait_beam()
time.sleep(0.5) # Nov. 2021 added wait to try avoid taper error
if MODE is not None:
print "Set polarization"
@@ -114,11 +118,18 @@ if MODE is not None:
print "Set Energy"
if OFFSET is not None:
time.sleep(0.5) # Nov. 2021 added wait to try avoid taper error
pol_offset.write(OFFSET) #TODO: CAPUT
#time.sleep(0.5)
#wait_device(pol_done, "DONE")
time.sleep(0.5) # Nov. 2021 added wait to try avoid taper error
pol_done.update()
wait_device(pol_done, "DONE") # Nov. 2021 added wait to try avoid taper error
time.sleep(0.5) # Nov. 2021 added wait to try avoid taper error
energy.write(float(E1)) # no need to add wait command. This commands sets and waits.
time.sleep(0.5) # Nov. 2021 added wait to try avoid taper error
pol_done.update()
wait_device(pol_done, "DONE") # Nov. 2021 added wait to try avoid taper error
print "Energy setting done"
#################
"""