From a72079f33c396fefd54d410a45ba1f4d820a9ce9 Mon Sep 17 00:00:00 2001 From: gac-x07ma Date: Tue, 17 Mar 2020 10:13:45 +0100 Subject: [PATCH] --- config/config.properties | 2 +- config/mail.properties | 6 ++-- config/variables.properties | 4 +-- script/EnergyScan.py | 2 +- script/HorizontalScan_infocus.py | 5 +-- script/HorizontalScan_out_of_focus.py | 22 ++++++++------ script/HystScan.py | 2 ++ script/HystScanMult.py | 44 +++++++++++++++++++++++---- script/VerticalScan.py | 27 +++++++++------- script/harmonic_v2.py | 4 +-- script/local.py | 10 +++++- script/test/TestScanFilename.py | 24 +++++++++++++++ 12 files changed, 114 insertions(+), 38 deletions(-) create mode 100644 script/test/TestScanFilename.py diff --git a/config/config.properties b/config/config.properties index 81f50fa..e762647 100644 --- a/config/config.properties +++ b/config/config.properties @@ -29,7 +29,7 @@ logPath={logs}/{date}_{time} dataLayout=ch.psi.fda.LayoutFDA deviceUpdateStrategyFile={config}/update.properties terminalEnabled=true -notificationLevel=null +notificationLevel=Error terminalPort=3579 tasksFile={config}/tasks.properties createSessionFiles=false diff --git a/config/mail.properties b/config/mail.properties index 0229056..4c235af 100644 --- a/config/mail.properties +++ b/config/mail.properties @@ -1,9 +1,9 @@ #Thu Nov 09 14:04:03 CET 2017 auth=None -from= -host= +from=X07MA-pshell@psi.ch +host=smtpint.psi.ch port=0 pwd= smsSuffix=@sms.switch.ch -to= +to=jan.dreiser@psi.ch usr= diff --git a/config/variables.properties b/config/variables.properties index bf50cee..a0f5919 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,2 +1,2 @@ -#Tue Feb 18 16:00:59 CET 2020 -FileSequentialNumber=2126 +#Tue Mar 17 08:18:17 CET 2020 +FileSequentialNumber=3172 diff --git a/script/EnergyScan.py b/script/EnergyScan.py index 9737a75..d15de5b 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -208,7 +208,7 @@ try: raise Exception("Data file not found: " + name) convert_file(name, newName) - mail + #mail #plot_file(newName) #print("Success") #"PlotDomain", "Ecrbk" diff --git a/script/HorizontalScan_infocus.py b/script/HorizontalScan_infocus.py index 2a93988..d1dfff9 100644 --- a/script/HorizontalScan_infocus.py +++ b/script/HorizontalScan_infocus.py @@ -2,8 +2,8 @@ ## INPUT PARAMETERS## #POS_START = 158.4 #Min = 150.0 #POS_END = 159.9 #Max = 170.0 -POS_START = 153.0 #Min = 150.0 -POS_END = 161.0 #Max = 170.0 +POS_START = 157.0 #Min = 150.0 +POS_END = 162.0 #Max = 170.0 POS_STEP = 0.25 @@ -17,6 +17,7 @@ POS_STEP = 0.25 ENERGIES = [851.3,845]#[851.2,848.0] # Ni #ENERGIES = [280,292] #C #ENERGIES = [772,776.7] # Co +#ENERGIES = [642.0,630.0] # Mn diff --git a/script/HorizontalScan_out_of_focus.py b/script/HorizontalScan_out_of_focus.py index 0ebb3aa..13bad3e 100644 --- a/script/HorizontalScan_out_of_focus.py +++ b/script/HorizontalScan_out_of_focus.py @@ -1,9 +1,9 @@ ##################### ## INPUT PARAMATERS## #open_valve() -POS_START =101 #Min = 98.0 -POS_END = 110 #Max = 118.0 -POS_STEP = 0.25 +POS_START = 102 #Min = 98.0 +POS_END = 112 #Max = 118.0 +POS_STEP = 0.5 """ POS_START =106 #Min = 98.0 @@ -11,11 +11,13 @@ POS_END = 108.7 #Max = 118.0 POS_STEP = 0.1 """ +#ENERGIES = [1344.5, 1338] # Ho edge, pre-edge +#ENERGIES = [1289.5, 1280] # Dy edge, pre-edge #ENERGIES = [459,455] #Ti #ENERGIES = [363.2, 356.0]# Nb #ENERGIES = [260.0]# C #ENERGIES = [285.0,280]# C -#ENERGIES = [401.1,403] #Mo +#ENERGIES = [395,390] #Mo #ENERGIES = [780.0,777.0] #ENERGIES = [396.0] # N #ENERGIES = [385.0]# C @@ -25,11 +27,12 @@ POS_STEP = 0.1 #ENERGIES = [397.7,392] # Pc #ENERGIES = [399.1,392] # TCNQ #ENERGIES = [700] #Ti -ENERGIES = [642.0,630.0] # Mn +#ENERGIES = [642.0,630.0] # Mn #ENERGIES = [463,457] #ENERGIES = [637.8,638.9,640.1,636.0] # Mn -#ENERGIES = [700.0] # Fe -#ENERGIES = [910.0] #Cu +ENERGIES = [700.0] # Fe +#ENERGIES = [931.7, 925] #Cu +#ENERGIES = [402, 397] # Ta #ENERGIES = [777.3,774] # Co #ENERGIES = [778] # Co #ENERGIES = [851.3,845.0] # Ni @@ -54,12 +57,13 @@ ENERGIES = [642.0,630.0] # Mn #ENERGIES = [692.0] # F #ENERGIES = [782.50, 775.0] # Ba #ENERGIES = [782.50] # Ba -#ENERGIES = [1265] # Dy pre-edge +#ENERGIES = [1289, 1280] # Dy edge #ENERGIES = [660.0, 665.0] # In #ENERGIES = [1850, 1820]# Si #ENERGIES = [1125.6]# Eu #ENERGIES = [850.9, 849 ] # Ni -#ENERGIES = [520.0] # V +#ENERGIES = [516, 503] # V +#ENERGIES = [1455,1420] # Se ##################### open_valve() diff --git a/script/HystScan.py b/script/HystScan.py index b88ff27..b640760 100644 --- a/script/HystScan.py +++ b/script/HystScan.py @@ -180,6 +180,8 @@ while(True): scan.end() +log_scan_filename() + if RAMP_RATE is not None: if FIELD == "Hz": print "Reset ramp rate-z" diff --git a/script/HystScanMult.py b/script/HystScanMult.py index d648e73..a02906e 100644 --- a/script/HystScanMult.py +++ b/script/HystScanMult.py @@ -43,12 +43,27 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES: #ramp_rate.write(RAMP_RATE) if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION: ramp_rate.write(2.0) - print "Setting start field: ", START_FIELD - field.write(START_FIELD) - time.sleep(3.0) + field.write(START_FIELD) + #if iPS == True: + #caput("X07MA-PC-MAG:X:DMD",float(START_FIELD)) + + if field_done is None: + #ramp_rate.write(2.0) + ramp_rate.waitInPosition(2.0,10000) + time.sleep(1.0) + caput("X07MA-ES1-IPS:ACTION", 1) + time.sleep(3.0) + wait_device_in_range(field, START_FIELD, FIELD_PRECISION) + print "Waiting field done..." + while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 : + time.sleep(0.1) + print "Done waiting" + else: + time.sleep(3.0) + wait_device(field_done, 1) #ramp_done.wait_for_value(1.0) + - wait_device(field_done, 1) #ramp_done.wait_for_value(1.0) - wait_device(pol_done, "DONE") + #open_valve(2.0) @@ -68,8 +83,23 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES: #TODO: change to Controlled variable? readback2 = energy_readback.read() #EnergyReadback.get() + #if abs(readback2 - setpoint2) > 0.5 : # TODO: Check accuracy + # raise Exception('Energy could not be set to the value ' + str(setpoint2)) + + #while abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy + #print "Energy could not be set to the value ", setpoint2, "Readback:", readback2 + #time.sleep(2.0) + #energy.write(setpoint2) + #sleep( ENERGY_CHANGE_SLEEP ) # Settling time + #readback2 = energy_readback.read() + + + #readback2 = energy_readback.read() #EnergyReadback.get() if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy - raise Exception('Energy could not be set to the value ' + str(setpoint2)) + #raise Exception('Energy could not be set to the value ' + str(setpoint2)) + #print 'Energy could not be set to the value, try again. ' + str(setpoint2) + energy.write(setpoint2) + sleep( ENERGY_CHANGE_SLEEP ) # Settling time #Detector field readback field_readback = field.readback.read() #fieldReadback.get() @@ -101,6 +131,8 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES: scan.end() +log_scan_filename() + if RAMP_RATE is not None: if FIELD == "Hz": print "Reset ramp rate-z" diff --git a/script/VerticalScan.py b/script/VerticalScan.py index 699f9ea..8a2d78c 100644 --- a/script/VerticalScan.py +++ b/script/VerticalScan.py @@ -1,8 +1,8 @@ ##################### ## INPUT PARAMETERS## POS_START = 12 -POS_END = 22.0 -POS_STEP = 0.25 +POS_END = 20 +POS_STEP = 0.5 #ENERGIES = [532, 523]# O #ENERGIES = [363.2, 356]# Nb @@ -10,18 +10,18 @@ POS_STEP = 0.25 #ENERGIES = [397.6, 396.0] # N #ENERGIES = [401.1,403] #Mo285 #ENERGIES = [577.0, 573.0] # Cr -ENERGIES = [457,452] #Ti +#ENERGIES = [457,452] #Ti #ENERGIES = [692.0] # F #ENERGIES = [696.5, 680.0] # F #ENERGIES = [1110,1125.5] #STO #ENERGIES = [397.7,392] # Pc #ENERGIES = [700.0, 708.0] # Fe #ENERGIES = [530] #O -#ENERGIES = [700.0] #Fe -#ENERGIES = [910.0] #Cu +ENERGIES = [700.0] #Fe +#ENERGIES = [931.7, 925] #Cu #ENERGIES = [774.0] # Co #ENERGIES = [777.3, 774.0] # Co -#ENERGIES = [851.3,845.0] # Ni +#ENERGIES = [851.3,842.0] # Ni #ENERGIES = [576.4, 560.0] #Cr #ENERGIES = [485.0,490.0] # Ru #ENERGIES = [642.0,630.0] # Mn @@ -33,12 +33,14 @@ ENERGIES = [457,452] #Ti #ENERGIES = [1390.0,1400.6] #Er2 #ENERGIES = [1300, 1312 ] # Mg #ENERGIES = [1457.8] # Dy -#ENERGIES = [1292.0] # Dy +#ENERGIES = [1290.0, 1280.0] # Dy #ENERGIES = [1344.2, 1346 ] # Ho #ENERGIES = [1456.9, 1450 ] # Tm -#ENERGIES = [1563.0,1555.0] # Al +#ENERGIES = [1566.0,1554.0] # Al #ENERGIES = [1850, 1820]# Si -#ENERGIES = [928.3, 925.0] # Cu metal +#ENERGIES = [931.7, 925] # Cu metal +#ENERGIES = [402, 397] # Ta +#ENERGIES = [395,390] #Mo #ENERGIES = [928.6]# Cu1 #ENERGIES = [782.50, 775.0] # Ba #ENERGIES = [782.50] # Ba @@ -46,10 +48,13 @@ ENERGIES = [457,452] #Ti #ENERGIES = [976, 970] # Nd #ENERGIES = [1185] # Gd #ENERGIES = [405.5, 390] # Sc -#ENERGIES = [1265] # Dy pre-edge +#ENERGIES = [1289.5, 1280] # Dy edge, pre-edge +#ENERGIES = [1345, 1338] # Ho edge, pre-edge +#ENERGIES = [1290] # Dy #ENERGIES = [1125.6]# Eu #ENERGIES = [850.9, 849 ] # Ni -#ENERGIES = [520.0] # V +#ENERGIES = [516, 503] # V +#ENERGIES = [1455,1420] # Se ##################### #open_valve() diff --git a/script/harmonic_v2.py b/script/harmonic_v2.py index 060ad88..a6dec99 100644 --- a/script/harmonic_v2.py +++ b/script/harmonic_v2.py @@ -1,9 +1,9 @@ -ID_ENERGY = 928 +ID_ENERGY = 640 # energy at which the ID offset should be determined #======================== -HALFWIDTH = 5 +HALFWIDTH = 10 STEP = 0.5 #======================== diff --git a/script/local.py b/script/local.py index 9384911..5bf0c3a 100644 --- a/script/local.py +++ b/script/local.py @@ -610,7 +610,15 @@ def set_au_mesh(value): print "Set Au mesh positon" au_mesh.move(value) print "Done setting Au mesh" - + +def get_scan_filename(): + return str(get_exec_pars().output) + str(get_exec_pars().scanPath) + ".txt" + +def log_scan_filename(): + msg = "Created data file: " + str(get_scan_filename()) + print msg + log(msg) + def write_logs(): set_exec_pars(open = True) #Compensade bug on log function, which should open persistence context log("Exit slit: "+ str(exit_slit.read())) diff --git a/script/test/TestScanFilename.py b/script/test/TestScanFilename.py new file mode 100644 index 0000000..46e08f7 --- /dev/null +++ b/script/test/TestScanFilename.py @@ -0,0 +1,24 @@ +ENERGIES = [800,810] + +set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm']) +set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1}) + +scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \ + "field_var", 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1]) +scan.start() + + + +index = 0 +while(True): + for en in ENERGIES: + scan.append ([index, en], [index, en], [5, 6, 7, 8, 9, 10, 11, 12, 1.0/(index+1)+en, 1.0/(index+en)]) + + if index>50: + break + index = index+1 + +scan.end() + + +log_scan_filename() \ No newline at end of file