From f3f1471a723fc0fb648f4fb9af2d21a1ab1c96dd Mon Sep 17 00:00:00 2001 From: gac-x07ma Date: Wed, 22 Apr 2020 14:35:07 +0200 Subject: [PATCH] --- config/config.properties | 4 ++-- config/mail.properties | 2 +- config/mail.properties.backup | 9 +++++++++ config/mail.properties.template | 9 +++++++++ config/tmp.properties | 9 +++++++++ config/variables.properties | 4 ++-- script/EnergyScan.py | 25 +++++++++++++++++++------ script/HorizontalScan_out_of_focus.py | 24 +++++++++++++----------- script/HystScanStep.py | 1 + script/LaserScan.py | 2 +- script/VerticalScan.py | 18 +++++++++++++----- script/harmonic_v2.py | 3 ++- script/local.py | 25 ++++++++++++++++++++----- 13 files changed, 101 insertions(+), 34 deletions(-) create mode 100644 config/mail.properties.backup create mode 100644 config/mail.properties.template create mode 100644 config/tmp.properties diff --git a/config/config.properties b/config/config.properties index e762647..8628c57 100644 --- a/config/config.properties +++ b/config/config.properties @@ -26,7 +26,7 @@ dataScanPreserveTypes=false logLevel=Fine dataScanFlushRecords=true logPath={logs}/{date}_{time} -dataLayout=ch.psi.fda.LayoutFDA +dataLayout=fda deviceUpdateStrategyFile={config}/update.properties terminalEnabled=true notificationLevel=Error @@ -36,5 +36,5 @@ createSessionFiles=false versionTrackingLogin={context}/svcusr-hlapp_robot scriptType=py versionTrackingRemote=git@git.psi.ch\:pshell_config/x07ma.git -dataProvider=ch.psi.fda.ProviderFDA +dataProvider=fda saveCommandStatistics=false diff --git a/config/mail.properties b/config/mail.properties index 4c235af..0be1e31 100644 --- a/config/mail.properties +++ b/config/mail.properties @@ -5,5 +5,5 @@ host=smtpint.psi.ch port=0 pwd= smsSuffix=@sms.switch.ch -to=jan.dreiser@psi.ch +to=vladyslav.romankov@psi.ch usr= diff --git a/config/mail.properties.backup b/config/mail.properties.backup new file mode 100644 index 0000000..4c235af --- /dev/null +++ b/config/mail.properties.backup @@ -0,0 +1,9 @@ +#Thu Nov 09 14:04:03 CET 2017 +auth=None +from=X07MA-pshell@psi.ch +host=smtpint.psi.ch +port=0 +pwd= +smsSuffix=@sms.switch.ch +to=jan.dreiser@psi.ch +usr= diff --git a/config/mail.properties.template b/config/mail.properties.template new file mode 100644 index 0000000..d8eca7a --- /dev/null +++ b/config/mail.properties.template @@ -0,0 +1,9 @@ +#Thu Nov 09 14:04:03 CET 2017 +auth=None +from=X07MA-pshell@psi.ch +host=smtpint.psi.ch +port=0 +pwd= +smsSuffix=@sms.switch.ch +to=XXXXX +usr= diff --git a/config/tmp.properties b/config/tmp.properties new file mode 100644 index 0000000..a6fed16 --- /dev/null +++ b/config/tmp.properties @@ -0,0 +1,9 @@ +#Thu Nov 09 14:04:03 CET 2017 +auth=None +from=X07MA-pshell@psi.ch +host=smtpint.psi.ch +port=0 +pwd= +smsSuffix=@sms.switch.ch +to=jon.dreiser@psi.ch +usr= diff --git a/config/variables.properties b/config/variables.properties index a0f5919..69d7cc0 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,2 +1,2 @@ -#Tue Mar 17 08:18:17 CET 2020 -FileSequentialNumber=3172 +#Sun Apr 19 01:15:13 CEST 2020 +FileSequentialNumber=3724 diff --git a/script/EnergyScan.py b/script/EnergyScan.py index d15de5b..6e49df2 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -1,5 +1,5 @@ #Script imported from: MgE_plus.xml - +INVOKE_PLOT_UPDATES = True #Parameters """ @@ -25,6 +25,13 @@ def start_plot(): global p p = plot([None, None, None,None, None], ["TEY", "TFY", "TEYraw", "TFYraw", "I0"]) +def _update_plots(p, x, s0, s1, s2, s3, s4): + p[0].getSeries(0).setData(x, s0) + p[1].getSeries(0).setData(x, s1) + p[2].getSeries(0).setData(x, s2) + p[3].getSeries(0).setData(x, s3) + p[4].getSeries(0).setData(x, s4) + def update_plot(): global p c = count.take() @@ -44,11 +51,16 @@ def update_plot(): l = lambda x,y: (0.0 if (y==0.0) else x/y) #truediv tey=map(l, teyr, i0) tfy=map(l, tfyr, i0) - p[0].getSeries(0).setData(x, to_array(tey,'d')) - p[1].getSeries(0).setData(x, to_array(tfy,'d')) - p[2].getSeries(0).setData(x, to_array(teyr,'d')) - p[3].getSeries(0).setData(x, to_array(tfyr,'d')) - p[4].getSeries(0).setData(x, to_array(i0,'d')) + + args = [ p, x, to_array(tey,'d'), + to_array(tfy,'d'), + to_array(teyr,'d'), + to_array(tfyr,'d'), + to_array(i0,'d')] + if INVOKE_PLOT_UPDATES: + invoke([_update_plots, args]) + else: + _update_plots(*args) """ #open shutter @@ -208,6 +220,7 @@ try: raise Exception("Data file not found: " + name) convert_file(name, newName) + log_scan_filename(newName) #mail #plot_file(newName) #print("Success") diff --git a/script/HorizontalScan_out_of_focus.py b/script/HorizontalScan_out_of_focus.py index 13bad3e..ffca9a1 100644 --- a/script/HorizontalScan_out_of_focus.py +++ b/script/HorizontalScan_out_of_focus.py @@ -1,16 +1,16 @@ ##################### ## INPUT PARAMATERS## #open_valve() -POS_START = 102 #Min = 98.0 -POS_END = 112 #Max = 118.0 -POS_STEP = 0.5 +POS_START = 104 #Min = 98.0 +POS_END = 114 #Max = 118.0 +POS_STEP = 0.25 -""" -POS_START =106 #Min = 98.0 -POS_END = 108.7 +#""" +#POS_START =106 #Min = 98.0 +#POS_END = 108.7 #Max = 118.0 -POS_STEP = 0.1 -""" +#POS_STEP = 0.1 +#""" #ENERGIES = [1344.5, 1338] # Ho edge, pre-edge #ENERGIES = [1289.5, 1280] # Dy edge, pre-edge #ENERGIES = [459,455] #Ti @@ -30,8 +30,10 @@ POS_STEP = 0.1 #ENERGIES = [642.0,630.0] # Mn #ENERGIES = [463,457] #ENERGIES = [637.8,638.9,640.1,636.0] # Mn -ENERGIES = [700.0] # Fe +#ENERGIES = [700.0] # Fe +#ENERGIES = [928.2, 925] #CuO #ENERGIES = [931.7, 925] #Cu +#ENERGIES = [929] #Cu #ENERGIES = [402, 397] # Ta #ENERGIES = [777.3,774] # Co #ENERGIES = [778] # Co @@ -50,11 +52,11 @@ ENERGIES = [700.0] # Fe #ENERGIES = [385] # N #ENERGIES = [1563.0,1555.0] # Al #ENERGIES = [1456.9, 1450 ] # Tm -#ENERGIES = [928.3, 925.0] # Cu metal +#ENERGIES = [931.7, 925.0] # Cu metal #ENERGIES = [928.4 ] # Cu1 #ENERGIES = [700.0, 708.0] # Fe #ENERGIES = [696.7, 680.0] # F -#ENERGIES = [692.0] # F +ENERGIES = [692.0] # F #ENERGIES = [782.50, 775.0] # Ba #ENERGIES = [782.50] # Ba #ENERGIES = [1289, 1280] # Dy edge diff --git a/script/HystScanStep.py b/script/HystScanStep.py index 26811d7..1f5e414 100644 --- a/script/HystScanStep.py +++ b/script/HystScanStep.py @@ -84,3 +84,4 @@ for setpoint1 in setpoints: scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm]) after_sample() #To call check_id_error() scan.end() +log_scan_filename() \ No newline at end of file diff --git a/script/LaserScan.py b/script/LaserScan.py index 11b1cc4..62e1338 100644 --- a/script/LaserScan.py +++ b/script/LaserScan.py @@ -131,5 +131,5 @@ while(True): index = index+1 scan.end() - +log_scan_filename() close_valve() \ No newline at end of file diff --git a/script/VerticalScan.py b/script/VerticalScan.py index 8a2d78c..bce1f76 100644 --- a/script/VerticalScan.py +++ b/script/VerticalScan.py @@ -1,7 +1,11 @@ ##################### ## INPUT PARAMETERS## -POS_START = 12 -POS_END = 20 +#POS_START = 5 +#POS_END = 25 +#POS_STEP = 0.5 + +POS_START = 9 +POS_END = 18 POS_STEP = 0.5 #ENERGIES = [532, 523]# O @@ -15,16 +19,19 @@ POS_STEP = 0.5 #ENERGIES = [696.5, 680.0] # F #ENERGIES = [1110,1125.5] #STO #ENERGIES = [397.7,392] # Pc -#ENERGIES = [700.0, 708.0] # Fe +ENERGIES = [700.0]#, 708.0] # Fe #ENERGIES = [530] #O -ENERGIES = [700.0] #Fe +#ENERGIES = [700.0] #Fe + #ENERGIES = [931.7, 925] #Cu +#ENERGIES = [928.2, 925] #CuO +#ENERGIES = [929] #Cu #ENERGIES = [774.0] # Co #ENERGIES = [777.3, 774.0] # Co #ENERGIES = [851.3,842.0] # Ni #ENERGIES = [576.4, 560.0] #Cr #ENERGIES = [485.0,490.0] # Ru -#ENERGIES = [642.0,630.0] # Mn +#ENERGIES = [638.5,630.0] # Mn #ENERGIES = [465.0,450.0] # STO #ENERGIES = [1067, 1076 ] # Sm #ENERGIES = [1170, 1181 ] # Gd @@ -55,6 +62,7 @@ ENERGIES = [700.0] #Fe #ENERGIES = [850.9, 849 ] # Ni #ENERGIES = [516, 503] # V #ENERGIES = [1455,1420] # Se +#ENERGIES = [84.3, 80]# Au4F ##################### #open_valve() diff --git a/script/harmonic_v2.py b/script/harmonic_v2.py index a6dec99..e2e0e92 100644 --- a/script/harmonic_v2.py +++ b/script/harmonic_v2.py @@ -1,4 +1,5 @@ -ID_ENERGY = 640 +ID_ENERGY = 1234 + # energy at which the ID offset should be determined diff --git a/script/local.py b/script/local.py index 5bf0c3a..ee92ce4 100644 --- a/script/local.py +++ b/script/local.py @@ -3,7 +3,7 @@ ################################################################################################### import ch.psi.fda.ProcessorFDA as ProcessorFDA -import ch.psi.fda.LayoutFDA as LayoutFDA +import ch.psi.pshell.data.LayoutFDA as LayoutFDA import ntpath import traceback import ch.psi.pshell.epics.ChannelSettlingCondition as ChannelSettlingCondition @@ -369,6 +369,20 @@ def close_valve(delay = 0.5): #TODO: Check default delay valve_try_open.write(0) def set_energy (value, delay=0.5): + print "Set energy" + timeout_ms = 90000 # 1.5 minutes + tolerance = 0.3 + energy.write(float(value)) + try: + energy_done.waitValue(1, timeout_ms) # timeout is now 60, was -1 + except: + if abs(energy.read() - energy_readback.read()) > tolerance: + throw + time.sleep(float(delay)) + print "Done setting energy" + + +def old_set_energy (value, delay=0.5): """ """ print "Set energy" @@ -614,14 +628,15 @@ def set_au_mesh(value): 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()) +def log_scan_filename(name=None): + if name is None: + name=get_scan_filename() + msg = "Created data file: " + str(name) 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())) + log("Exit slit: "+ str(exit_slit.read()), True) log("Cff: " + str(cff.read())) log("Harm: " + str(harmonic.read())) log("FE: " + str(aperture.read() ))