No exception on ID errors

This commit is contained in:
gac-x07ma
2020-02-18 13:34:57 +01:00
parent 31879d6ae2
commit 62e0a83275
112 changed files with 3024 additions and 728 deletions
+32 -26
View File
@@ -1,34 +1,40 @@
#Wed Feb 08 11:09:37 CET 2017
autoSaveScanData=true
createSessionFiles=false
dataLayout=ch.psi.fda.LayoutFDA
dataPath={data}/{year}_{month}/{date}
dataProvider=ch.psi.fda.ProviderFDA
dataScanFlushRecords=true
dataScanPreserveTypes=false
dataScanReleaseRecords=false
dataServerPort=-1
devicePoolFile={config}/devices.properties
deviceUpdateStrategyFile={config}/update.properties
#Thu Nov 07 15:03:54 CET 2019
hostName=null
userManagement=false
imageSourcesFile={config}/imaging.properties
instanceName=
logDaysToLive=-1
logLevel=Fine
logLevelConsole=Off
logPath={logs}/{date}_{time}
scanStreamerPort=-1
scanStreamingPort=-1
scriptType=py
serverEnabled=false
serverPort=8080
autoSaveScanData=true
simulation=false
tasksFile={config}/tasks.properties
terminalEnabled=true
terminalPort=3579
userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\://d.psi.ch | d.psi.ch | users.psi
userManagement=false
dataServerPort=-1
hideServerMessages=false
serverPort=8080
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}
serverEnabled=false
commandExecutionEvents=false
logDaysToLive=50
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
logLevel=Fine
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
dataLayout=ch.psi.fda.LayoutFDA
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=true
notificationLevel=null
userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\://d.psi.ch | d.psi.ch | users.psi
logLevelConsole=Off
terminalPort=3579
tasksFile={config}/tasks.properties
scanStreamerPort=-1
parallelInitialization=false
createSessionFiles=false
scanStreamingPort=-1
versionTrackingLogin={context}/svcusr-hlapp_robot
devicePoolFile={config}/devices.properties
scriptType=py
versionTrackingManual=true
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07ma.git
dataProvider=ch.psi.fda.ProviderFDA
saveCommandStatistics=false
+16 -6
View File
@@ -1,11 +1,15 @@
gold_mesh=ch.psi.pshell.epics.Motor|X07MA-OP-IO1:TR1|||
gold_mesh2=ch.psi.pshell.epics.Motor|X07MA-OP-IO2:TR1|||
current=ch.psi.pshell.epics.ChannelDouble|ARIDI-PCT:CURRENT|Read||
energy_id=ch.psi.pshell.epics.ChannelDouble|X07MA-ID:ENERGY|||
count=ch.psi.pshell.epics.ChannelInteger|COUNT|Read||true
data=ch.psi.pshell.epics.ChannelDoubleArray|DATA 3|Read||
edata=ch.psi.pshell.epics.ChannelDoubleArray|EDATA 3|Read||
idata=ch.psi.pshell.epics.ChannelDoubleArray|IDATA 3|Read||
fdata=ch.psi.pshell.epics.ChannelDoubleArray|FDATA 3|Read||
data=ch.psi.pshell.epics.ChannelDoubleArray|DATA 6|Read||
edata=ch.psi.pshell.epics.ChannelDoubleArray|EDATA 6|Read||
idata=ch.psi.pshell.epics.ChannelDoubleArray|IDATA 6|Read||
fdata=ch.psi.pshell.epics.ChannelDoubleArray|FDATA 6|Read||
field_x=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-PS2:M:GO.A X07MA-PC-PS2:STS:PMCURRENT|||true
field_x_done=ch.psi.pshell.epics.ChannelInteger|X07MA-PC-MAG:X:RAMP:DONE|Read||true
field_x_ips_output=ch.psi.pshell.epics.ChannelInteger|X07MA-ES1-IPS:OUTPUT_RBV|Read||true
field_z=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-PS1:M:GO.A X07MA-PC-PS1:STS:PMCURRENT|||true
field_z_done=ch.psi.pshell.epics.ChannelInteger|X07MA-PC-MAG:Z:RAMP:DONE|Read||true
field_x_ips=ch.psi.pshell.epics.ControlledVariable|X07MA-ES1-IPS:FIELD X07MA-ES1-IPS:FIELD_RBV|||true
@@ -16,28 +20,34 @@ pol_done=ch.psi.pshell.epics.ChannelString|X07MA-ID:DONE|Read||true
#pol_done_pos=ch.psi.pshell.epics.BinaryPositioner|X07MA-ID:DONE|Read||
ramp_rate_x=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM X07MA-PC-PS2:STS:RAMPRATE:TPM|||true
ramp_rate_z=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-PS1:SET:DMD:RAMPRATE:TPM X07MA-PC-PS1:STS:RAMPRATE:TPM|||true
ramp_rate_x_ips=ch.psi.pshell.epics.ControlledVariable|X07MA-ES1-IPS:FRAMP X07MA-ES1-IPS:FRAMP_RBV|||true
ramp_rate_x_ips=ch.psi.pshell.epics.ControlledVariable|X07MA-ES1-IPS:RAMP-MAX X07MA-ES1-IPS:RAMP-MAX|||true
sample_hor=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRZ1|||true
sample_vert=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRY1|||true
sample_rot=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:ROY1|||true
au_mesh=ch.psi.pshell.epics.Motor|X07MA-OP-IO1:TR1|||true
needle=ch.psi.pshell.epics.ProcessVariable|X07MA-PC-TC:DMD:LOOP2:MANUAL|||
temperature=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-TC:DMD:LOOP1:SETPOINT X07MA-PC-TC:STS:T1|||true
#temperature_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:STS:T1|Read||
temperature_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:STS:T1|Read||
valve_try_open=ch.psi.pshell.epics.ChannelInteger|X07MA-OP-VG13:WT_SET|||
energy=ch.psi.pshell.epics.ChannelDouble|X07MA-PHS-E:GO.A|||
energy_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:CERBK|Read||
energy_done=ch.psi.pshell.epics.ChannelInteger|X07MA-PHS:alldone|Read||true
cff=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:cff.A|||
exit_slit=ch.psi.pshell.epics.ProcessVariable|X07MA-OP-SL1SV1:TR_AP|||true
temp_status=ch.psi.pshell.epics.ChannelInteger|X07MA-ES1-TEMP:STATUS|||true
harmonic=ch.psi.pshell.epics.ChannelInteger|X07MA-ID:HARMONIC|||
signal_tey=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL0|Read||true
signal_i0=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL1|Read||true
signal_trans=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL2|Read||true
signal_field_analog_x=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL4|Read||
signal_field_analog_z=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL3|Read||
#signal_diode_electro=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI10:READOUT|||false
adc6=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL5|Read||true
adc7=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL6|Read||true
#k10=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI10:SETVOLTAGE|||
#k11=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI11:SETVOLTAGE|||
#k24=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI2400:setVoltAO|||
aperture=ch.psi.pshell.epics.DiscretePositioner|X07MA-FE-DSAPER|||true
beam_status=ch.psi.pshell.epics.DiscretePositioner|ACOAU-ACCU:OP-MODE|Read||true
sample=ch.psi.pshell.imaging.MjpegSource|http://x07ma-cam-5/axis-cgi/mjpg/video.cgi||-100|
id_error=ch.psi.pshell.epics.ChannelInteger|X07MA-ID-PLC:ERROR|||true
+11 -4
View File
@@ -1,7 +1,14 @@
Al=1545.0;1610.0;3.0;5.0;-7.0;-1.5;0.0;0.0
C=250.0;350.0;2.0;5.0;0.0;0.0;0.0;0.0
Co=760.0;820.0;3.0;10.0;0.0;2.0;0.0;0.0
Tb=1215.0;1300.0;3.0;10.0;-7.5;-3.5;0.0;0.0
Mn=620.0;670.0;2.0;5.0;0.0;0.0;0.0;0.0
Fe=690.0;755.0;2.0;10.0;0.0;2.0;2.0;2.0
Ti=400.0;475.0;2.0;10.0;0.0;2.0;2.0;2.0
Cr=565.0;595.0;3.0;5.0;-0.5;1.0;5.6;0.6
Cu=925.0;965.0;2.0;0.0;0.0;0.0;0.0;0.0
Er=1380.0;1470.0;3.0;10.0;-9.0;-4.0;3.0;3.0
Fe=690.0;755.0;2.0;10.0;0.0;2.0;2.0;2.0
Mn=630.0;685.0;2.0;5.0;0.0;0.0;0.0;0.0
Ni=840.0;885.0;2.0;0.0;0.0;0.0;0.0;0.0
O=530.0;550.0;2.0;0.0;0.0;0.0;0.0;0.0
Ru=440.0;510.0;3.0;0.0;-1.0;0.0;0.0;0.0
Ta=1700.0;1820.0;3.0;10.0;-11.0;-5.5;4.0;4.0
Tb=1215.0;1300.0;3.0;10.0;-7.5;-3.5;0.0;0.0
Ti=450.0;485.0;2.0;10.0;0.0;2.0;2.0;2.0
+3 -2
View File
@@ -1,6 +1,6 @@
#Mon Nov 28 10:21:13 CET 2016
#Tue Aug 21 18:28:14 CEST 2018
ch.psi.jcae.ContextFactory.maxArrayBytes=10000000
ch.psi.jcae.ChannelFactory.timeout=500
ch.psi.jcae.ChannelFactory.timeout=2000
ch.psi.jcae.ChannelFactory.retries=1
ch.psi.jcae.ChannelBeanFactory.timeout=10000
ch.psi.jcae.ChannelBeanFactory.waitTimeout=1800000
@@ -15,3 +15,4 @@ ch.psi.jcae.ContextFactory.serverPort=
ch.psi.jcae.ContextFactory.autoAddressList=true
ch.psi.jcae.ContextFactory.useShellVariables=false
ch.psi.jcae.ContextFactory.addLocalBroadcastInterfaces=false
ch.psi.jcae.ContextFactory.maxSendArrayBytes=
+9
View File
@@ -0,0 +1,9 @@
#Thu Nov 09 14:04:03 CET 2017
auth=None
from=
host=
port=0
pwd=
smsSuffix=@sms.switch.ch
to=
usr=
+14 -12
View File
@@ -1,20 +1,22 @@
#Thu Sep 15 16:33:25 CEST 2016
configFile={config}/config.properties
configFileDevices={config}/devices.properties
#Fri Sep 20 16:53:43 CEST 2019
scriptPath={home}/script
sessionsPath={home}/sessions
configFileImageSources={config}/imaging.properties
pluginsPath={home}/plugins
configFileDevices={config}/devices.properties
libraryPath={script}; {script}/Lib
configFilePlugins={config}/plugins.properties
configFileTasks={config}/tasks.properties
contextPath={home}/context
extensionsPath={home}/extensions
configFileUpdateStrategy={config}/update.properties
configPath={home}/config
contextPath={home}/context
dataPath=/sls/X07MA/data/x07maop/Data1
devicesPath={home}/devices
extensionsPath={home}/extensions
imagesPath={outp}/images
libraryPath={script}; {script}/Lib
configFileVariables={config}/variables.properties
configFileSettings={config}/settings.properties
logPath={home}/log
pluginsPath={home}/plugins
scriptPath={home}/script
scriptType=py
sessionsPath={home}/sessions
wwwPath={home}/www
configFile={config}/config.properties
imagesPath={outp}/images
scriptType=py
configFileTasks={config}/tasks.properties
+2
View File
@@ -0,0 +1,2 @@
#Tue Feb 18 13:31:48 CET 2020
FileSequentialNumber=2114
+14 -10
View File
@@ -1,14 +1,18 @@
#Wed Jan 18 15:01:23 CET 2017
defaultSpeed=1.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=NaN
maxValue=250.0
minSpeed=0.1
minValue=-250.0
#Fri Sep 20 16:53:49 CEST 2019
offset=0.0
maxValue=250.0
precision=6
resolution=3.0E-4
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=3.0E-4
homingType=None
startRetries=1
minValue=-250.0
unit=mm
defaultSpeed=1.0
hasEnable=false
sign_bit=0
monitorByPosition=false
minSpeed=0.1
+9
View File
@@ -0,0 +1,9 @@
#Tue Aug 28 15:15:59 CEST 2018
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
unit=null
+2 -1
View File
@@ -1,8 +1,9 @@
#Mon Dec 14 09:30:44 CET 2015
#Wed Mar 06 10:06:34 CET 2019
maxValue=NaN
minValue=NaN
offset=0.0
precision=6
resolution=NaN
scale=1.0
sign_bit=0
unit=um
+2 -1
View File
@@ -1,8 +1,9 @@
#Fri Dec 11 16:10:48 CET 2015
#Wed Mar 06 10:06:34 CET 2019
maxValue=20.0
minValue=-20.0
offset=0.0
precision=-6
resolution=NaN
scale=1.0
sign_bit=0
unit=T
+2 -1
View File
@@ -1,8 +1,9 @@
#Fri Nov 18 10:12:40 CET 2016
#Wed Mar 06 10:06:34 CET 2019
maxValue=6.85
minValue=-6.85
offset=0.0
precision=4
resolution=0.005
scale=1.0
sign_bit=0
unit=T
+3 -2
View File
@@ -1,8 +1,9 @@
#Fri Dec 11 16:10:56 CET 2015
#Wed Mar 06 10:06:34 CET 2019
maxValue=20.0
minValue=-20.0
offset=0.0
precision=0
precision=-6
resolution=NaN
scale=1.0
sign_bit=0
unit=T
+18
View File
@@ -0,0 +1,18 @@
#Fri Sep 20 16:53:49 CEST 2019
offset=0.0
maxValue=250.0
precision=6
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=3.0E-4
homingType=None
startRetries=1
minValue=-250.0
unit=mm
defaultSpeed=1.0
hasEnable=false
sign_bit=0
monitorByPosition=false
minSpeed=0.1
+18
View File
@@ -0,0 +1,18 @@
#Fri Sep 20 16:53:49 CEST 2019
offset=0.0
maxValue=250.0
precision=6
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=3.0E-4
homingType=None
startRetries=1
minValue=-250.0
unit=mm
defaultSpeed=1.0
hasEnable=false
sign_bit=0
monitorByPosition=false
minSpeed=0.1
+3 -1
View File
@@ -1,4 +1,4 @@
#Mon Aug 24 09:08:52 CEST 2015
#Fri Nov 23 10:44:58 CET 2018
accessType=ReadWrite
defaultSpeed=1.0
estbilizationDelay=0
@@ -9,5 +9,7 @@ minValue=-10.0
offset=0.0
precision=2
resolution=NaN
rotation=false
scale=1.0
startRetries=1
unit=mm
+3 -1
View File
@@ -1,4 +1,4 @@
#Mon Aug 24 09:08:52 CEST 2015
#Fri Nov 23 10:44:58 CET 2018
accessType=ReadWrite
defaultSpeed=1.0
estbilizationDelay=0
@@ -9,5 +9,7 @@ minValue=-10.0
offset=0.0
precision=2
resolution=NaN
rotation=false
scale=1.0
startRetries=1
unit=mm
+2 -1
View File
@@ -1,8 +1,9 @@
#Fri Dec 11 17:22:43 CET 2015
#Wed Mar 06 10:06:34 CET 2019
maxValue=100.0
minValue=0.0
offset=0.0
precision=3
resolution=NaN
scale=1.0
sign_bit=0
unit=%
+2 -1
View File
@@ -1,8 +1,9 @@
#Wed Jan 20 14:25:45 CET 2016
#Fri Nov 23 10:44:58 CET 2018
maxValue=1000.0
minValue=0.0
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
unit=mm
+2 -1
View File
@@ -1,8 +1,9 @@
#Tue Jun 21 16:17:54 CEST 2016
#Wed Mar 06 10:06:34 CET 2019
maxValue=2.0
minValue=0.0
offset=0.0
precision=6
resolution=0.1
scale=1.0
sign_bit=0
unit=T/min
+2 -1
View File
@@ -1,8 +1,9 @@
#Fri Nov 18 10:11:03 CET 2016
#Wed Mar 06 10:06:34 CET 2019
maxValue=2.0
minValue=0.0
offset=0.0
precision=4
resolution=NaN
scale=1.0
sign_bit=0
unit=T/min
+2 -1
View File
@@ -1,8 +1,9 @@
#Tue Jun 21 16:17:55 CEST 2016
#Wed Mar 06 10:06:34 CET 2019
maxValue=2.0
minValue=0.0
offset=0.0
precision=6
resolution=0.1
scale=1.0
sign_bit=0
unit=T/min
+14 -10
View File
@@ -1,14 +1,18 @@
#Fri Dec 11 17:18:59 CET 2015
defaultSpeed=0.5
estbilizationDelay=0
hasEnable=true
homingType=None
maxSpeed=NaN
maxValue=170.0
minSpeed=0.02
minValue=150.0
#Fri Sep 20 16:53:49 CEST 2019
offset=0.0
maxValue=170.0
precision=6
resolution=6.23E-4
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=6.23E-4
homingType=None
startRetries=1
minValue=98.0
unit=mm
defaultSpeed=0.5
hasEnable=true
sign_bit=0
monitorByPosition=false
minSpeed=0.02
+14 -10
View File
@@ -1,14 +1,18 @@
#Fri Dec 11 17:19:07 CET 2015
defaultSpeed=2.0
estbilizationDelay=0
hasEnable=true
homingType=None
maxSpeed=NaN
maxValue=121.08000000000001
minSpeed=0.4
minValue=-241.92
#Fri Sep 20 16:53:49 CEST 2019
offset=0.0
maxValue=121.08000000000001
precision=6
resolution=0.0018
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=0.0018
homingType=None
startRetries=1
minValue=-241.92
unit=deg
defaultSpeed=2.0
hasEnable=true
sign_bit=0
monitorByPosition=false
minSpeed=0.4
+14 -10
View File
@@ -1,14 +1,18 @@
#Fri Dec 11 17:19:03 CET 2015
defaultSpeed=0.2
estbilizationDelay=0
hasEnable=true
homingType=None
maxSpeed=NaN
maxValue=45.0
minSpeed=0.02
minValue=0.5
#Fri Sep 20 16:53:49 CEST 2019
offset=0.0
maxValue=45.0
precision=6
resolution=1.3E-4
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=1.3E-4
homingType=None
startRetries=1
minValue=0.1
unit=mm
defaultSpeed=0.2
hasEnable=true
sign_bit=0
monitorByPosition=false
minSpeed=0.02
+2 -1
View File
@@ -1,8 +1,9 @@
#Wed Feb 08 10:43:58 CET 2017
#Wed Mar 06 10:06:34 CET 2019
maxValue=380.0
minValue=1.0
offset=0.0
precision=3
resolution=0.5
scale=1.0
sign_bit=0
unit=
+9
View File
@@ -0,0 +1,9 @@
#Tue Mar 27 16:11:14 CEST 2018
maxValue=0.0
minValue=0.0
offset=0.0
precision=4
resolution=NaN
rotation=false
scale=1.0
unit=T/min
+129 -50
View File
@@ -1,5 +1,6 @@
#Script imported from: MgE_plus.xml
#Parameters
"""
E1 = 710
@@ -13,13 +14,13 @@ FILE = 'Fe_plus'
ALPHA=0
"""
count.initialize()
data.initialize()
fdata.initialize()
idata.initialize()
edata.initialize()
p=None
def start_plot():
global p
@@ -50,95 +51,173 @@ def update_plot():
p[3].getSeries(0).setData(x, to_array(tfyr,'d'))
p[4].getSeries(0).setData(x, to_array(i0,'d'))
"""
#open shutter
print "\n try open shutter"
caput('X07MA-FE-PH1:CLOSE4BL',1)
cawait('X07MA-FE-PH1:MS2', 1)
print "\n shutter is open"
"""
print "\nStarting energy scan - Parameters: ",
print E1,E2,TIME,DELAY,str(MODE) ,str(OFFSET) ,str(FOLDER) ,str(FILE) ,str(ALPHA)
print pol_mode
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)
start = time.localtime()
folder = os.path.expanduser("~/Data1/") + FOLDER + "/";
#print "folder = ",folder
def getNewestFile():
global folder
import glob
try:
return max(glob.iglob(folder+'/*.txt'), key=os.path.getctime)
# print glob.glob(folder+'/*.txt')
# print max(glob.glob(folder+'/*.txt'), key=os.path.getctime)
return max(glob.glob(folder+'/*.txt'), key=os.path.getctime)
except:
return None
newest = getNewestFile()
#print "newest = ",newest
#Pre-actions
if NO_BEAM_CHECK == False:
wait_beam()
wait_beam()
if MODE is not None:
pol_mode.write(MODE) #caput('X07MA-ID:MODE', MODE) #TODO: CAPUT
# time.sleep(0.5) #TODO: Needed?
print "Set polarization"
pol_mode.write(MODE)
if MODE == 'LINEAR':
if ALPHA is not None:
pol_angle.write(ALPHA) #TODO: CAPUT
# time.sleep(0.5)
#wait_device(pol_done, "DONE") #TODO: NEEDED?
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"
print "Set Energy"
if OFFSET is not None:
pol_offset.write(OFFSET) #TODO: CAPUT
# time.sleep(0.5)
#wait_device(pol_done, "DONE")
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"
#################
"""
print "Moving down energy in steps."
while True:
en = caget("X07MA-PGM:CERBK")
if en > 350.0:
estep = 20.0
else:
estep = 5.0
if abs(en - E1) < estep:
estep = abs(en - E1)
if en > float(E1):
set_energy( en - estep )
else:
break
print "It is done."
############
"""
caput('E1', E1)
#print "caput E1" #add for debug
caput('E2', E2)
#print "caput E2" #add for debug
caput('TIME', TIME)
#print "caput TIME" #add for debug
caput('FOLDER', FOLDER)
set_energy (E1)
#print "caput FOLDER" #add for debug
#set_energy (E1)
caput('FILE', FILE)
#print "caput FILE" #add for debug
time.sleep(0.1)
#open_valve()
#open_valve(0.0) #TODO: WHY WRITING AGAIN???
#print "before delay" #add for debug
time.sleep(DELAY)
#print "after delay" #add for debug
#print 'ldfkj;fjk'
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
caput('START', '1')
try:
write_logs()
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
caput('START', '1')
#print "caput START" #add for debug
write_logs()
waiting = True
def plot_task():
global waiting
pos=count.take()
start_plot()
#print "start_plot" # added for debug
while waiting:
if count.take() != pos:
update_plot()
pos = count.take()
time.sleep(2.0)
ret = fork(plot_task)
try:
print "Scanning...",
#Post-actions
wait_channel('START', 'STOP', type = 's')
time.sleep(2.0)
print "Finished Energy scan."
finally:
waiting = False
join(ret)
#print "Joined "
if after_sample(): #Repeat if id error
break
waiting = True
def plot_task():
global waiting
pos=count.take()
start_plot()
while waiting:
if count.take() != pos:
update_plot()
pos = count.take()
time.sleep(2.0)
ret = fork(plot_task)
try:
#Post-actions
wait_channel('START', 'STOP', type = 's')
time.sleep(2.0)
print "Finished Energy scan"
finally:
waiting = False
join(ret)
#File convertion
newName = folder + time.strftime("%Y%m%d_%H%M%S_", start) + FILE + "_0000.txt";
name = getNewestFile()
#newName = folder + time.strftime("%Y%m%d_%H%M%S_", start) + FILE + "_0000.txt";
newName = folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt";
name = getNewestFile()
# print "newest file:"
# print name
#print "newest variable"
#print newest
if name == newest:#TODO: WHY WRITING AGAIN???
raise Exception("Data file not created")
#if name == newest:#TODO: WHY WRITING AGAIN??? # commented on June 20th 2019
#print "Risk of overwriting. " + name + " same as " + newest
#raise Exception("Data file not created.")
if not os.path.isfile(name):
raise Exception("Data file not found: " + name)
convert_file(name, newName)
log("Created data file: " + newName)
#plot_file(newName)
print("Success")
except:
while caget('START') == 'START':
print("Aborting...")
#print("Success")
#"PlotDomain", "Ecrbk"
except:
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
+113
View File
@@ -0,0 +1,113 @@
#Fe XMCD
off_plus = 0.0
off_minus = 2.0
Estart = 630
Eend = 670
sample_name = 'Mn'
nr_loops=1
set_range('k1', 10)
set_range('k2', 10)
set_au_mesh(125.0)
set_har(1)
set_slit(3.0)
set_energy(Estart)
open_valve()
for i in range(nr_loops):
wait_temp()
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
close_valve()
#Fe hyst
off_plus = 0.0
off_minus = 2.0
sample_name = 'Mn'
rrate = 0.7 # ramping speed of mag field
e1 = 639 # energy 1 (usually on edge)
e2 = 637 # energy 2 (pre edge)
B1 = 6.8 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
set_range('k1', 10)
set_range('k2', 10)
set_au_mesh(125.0)
set_har(1)
set_slit(3.0)
set_energy(e1)
open_valve()
for i in range(nr_loops):
set_pol_cplus(offset = off_plus)
set_file(sample_name + '_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1, e2])
set_pol_cminus(offset = off_minus)
set_file(sample_name + '_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1, e2])
set_pol_cminus(offset = off_minus)
set_file(sample_name + '_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1,e2])
set_pol_cplus(offset = off_plus)
set_file(sample_name + '_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1,e2])
print "Loop # ",i+1," finished."
close_valve()
#Fe XMCD
off_plus = 0.0
off_minus = 2.0
Estart = 630
Eend = 670
sample_name = 'Mn'
nr_loops=1
set_range('k1', 10)
set_range('k2', 10)
set_au_mesh(125.0)
set_har(1)
set_slit(3.0)
set_energy(Estart)
open_valve()
for i in range(nr_loops):
wait_temp()
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
close_valve()
+50
View File
@@ -0,0 +1,50 @@
# runs a series of harmonic scans
# in the _0000 file the result of processed scans for each id energy is saved.
# columns: 1- ID energy; 2 - calculated energy of harmonic peak from fit; 3 - energy of harm peak from finding the minimum; 4 - peak flux
import mathutils
ID_ENERGIES = range(1250,1350,10)
#ID_ENERGIES = [250, 960, 20]
HALFWIDTH = 8.0
STEP = 0.25
def runInnerScan():
global HALFWIDTH, STEP
idenergy = int(energy_id.read())
print "idenergy=",idenergy
def before(position, scan):
wait_device(energy_done, 1 )
sleep( 0.2 ) # Settling time
#return lscan(energy, [signal_i0,'ca://X07MA-PC-K428:2:getTotalGain', 'ca://X07MA-ID:MODE?type=d', pol_angle, current, energy, pol_offset, 'ca://X07MA-ID-GAP:READ','ca://X07MA-ID-SHIFT:READ'], idenergy-HALFWIDTH, idenergy+HALFWIDTH, STEP, latency = 0.3)
return lscan(energy, [signal_i0,'ca://X07MA-PC-K428:2:getTotalGain', 'ca://X07MA-ID:MODE?type=d', pol_angle, current, energy, pol_offset, 'ca://X07MA-ID-GAP:READ','ca://X07MA-ID-SHIFT:READ'], idenergy-HALFWIDTH, idenergy+HALFWIDTH, STEP, before_read = before)
class HarmonicMin(Readable):
def read(self):
global tag_prefix
ret= runInnerScan()
xdata = ret.getPositions(0)
ydata = ret.getReadable(0)
coefs = (a0, a1, a2) = mathutils.fit_polynomial(ydata, xdata, 2)
xmin = -0.5 * a1 / a2
ymin = min(ydata)
xminmin = xdata[ydata.index(min(ydata))]
print "xmin=",xmin,"xminmin = ",xminmin,"ymin = ",ymin
return (xmin, xminmin, ymin)
sensor= HarmonicMin()
#Pre-actions
caput('X07MA-PHS-E:OPT', 'PGM')
pol_offset.write(0.0)
print "List of ID energies: ",ID_ENERGIES
vscan(energy_id, sensor, ID_ENERGIES)
caput('X07MA-PHS-E:OPT', 'PGM+ID')
+57
View File
@@ -0,0 +1,57 @@
#####################
## 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_STEP = 0.25
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [774.0] # Co
#ENERGIES = [577.0, 573.0] # Cr
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [928.4, 925.0 ] # Cu
#ENERGIES = [700.0]
#ENERGIES = [706.7,708.3,704.0] # Fe
ENERGIES = [851.3,845]#[851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [772,776.7] # Co
#####################
#open_valve()
sensors = [tey_norm,signal_tey, signal_i0, signal_trans, trans_norm, sample_vert, energy_readback]
#TODO: #Why must set range to "auto"?
'''
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
'''
#Setting a different color for each pass: must manage plots manually
#del name
print tey_norm.name
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
ret= lscan(sample_hor,sensors, POS_START, POS_END, POS_STEP, latency = 0.0, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+97
View File
@@ -0,0 +1,97 @@
#####################
## INPUT PARAMATERS##
#open_valve()
POS_START =101 #Min = 98.0
POS_END = 110 #Max = 118.0
POS_STEP = 0.25
"""
POS_START =106 #Min = 98.0
POS_END = 108.7
#Max = 118.0
POS_STEP = 0.1
"""
#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 = [780.0,777.0]
#ENERGIES = [396.0] # N
#ENERGIES = [385.0]# C
#ENERGIES = [576.3, 560.0] #Cr
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [530] #O
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [399.1,392] # TCNQ
#ENERGIES = [700] #Ti
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 = [777.3,774] # Co
#ENERGIES = [778] # Co
#ENERGIES = [851.3,845.0] # Ni
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1234.5, 1225 ] # Tb
#ENERGIES = [976, 970] # Nd
#ENERGIES = [1235.0, 1228.0 ] #Er? Dy?
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [ 1185 ] # Gd
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1457.8] # Tm
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1400.5,1395.0] #Er
#ENERGIES = [1395.0] #Er
#ENERGIES = [385] # N
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [928.3, 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 = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1265] # Dy pre-edge
#ENERGIES = [660.0, 665.0] # In
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [1125.6]# Eu
#ENERGIES = [850.9, 849 ] # Ni
#ENERGIES = [520.0] # V
#####################
open_valve()
sensors = [tey_norm,signal_tey, signal_i0, signal_trans, trans_norm, sample_vert, energy_readback]
#TODO: #Why must set range to "auto"?
'''
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
'''
#Setting a different color for each pass: must manage plots manually
#del name
print tey_norm.name
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
ret= lscan(sample_hor,sensors, POS_START, POS_END, POS_STEP, latency = 0.0, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+68 -29
View File
@@ -11,7 +11,14 @@ OFFSET = -1.0
"""
iPS = False
iPS = False # false for old power supply, True for new (Oxford Instr) supply
#close_shutter_at_zero = False # True to close shutter during B field scan when it is close to 0 T
#signal_field_analog_x
if iPS == True:
caput('X07MA-ES1-IPS:RAMP-ENBL', 1) # enable non-overshoot mode
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
@@ -21,13 +28,19 @@ ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_
#Pre-actions
#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
wait_beam()
if NO_BEAM_CHECK == False:
wait_beam()
if MODE is not None:
pol_mode.write(MODE)
if OFFSET is not None:
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
caputq('X07MA-PC:CSCALER.INPB', '1')
# open shutter
caput('X07MA-FE-PH1:CLOSE4BL',1)
cawait('X07MA-FE-PH1:MS2', 1)
#if RAMP_RATE is not None:
# ramp_rate.write(RAMP_RATE)
@@ -44,7 +57,9 @@ else:
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', 'fieldAnalogX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
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()
write_logs()
@@ -54,6 +69,9 @@ print "Waiting for start field"
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
ramp_rate.write(2.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)
@@ -72,16 +90,23 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
#open_valve(2.0)
print "Set energy"
print "Set energy..."
setpoint2 = ENERGIES[0]
print setpoint2
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
if RAMP_RATE is not None:
ramp_rate.write(RAMP_RATE)
ramp_rate.waitInPosition(RAMP_RATE,10000)
@@ -89,6 +114,9 @@ if RAMP_RATE is not None:
print "Set end field"
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
if iPS == True:
caput("X07MA-PC-MAG:X:DMD",float(END_FIELD))
index = 0
@@ -107,33 +135,38 @@ while(True):
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))
print 'Energy could not be set to the value, try again. ' + 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()
detector1 = signal_tey.read() #TEY.get()
detector2 = signal_i0.read() #I0.get()
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
tey_norm = detector1/detector2
trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = tey_norm
else:
dif = tey_norm-first
dif_series.appendData(field_readback,dif)
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
#Detector field readback
field_readback = field.readback.read() #fieldReadback.get()
detector1 = signal_tey.read() #TEY.get()
detector2 = signal_i0.read() #I0.get()
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_z.read() if FIELD =="Hz" else signal_field_analog_x.read() # fieldAnalogX.get()
_tey_norm = detector1/detector2
_trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = _tey_norm
else:
dif = _tey_norm-first
dif_series.appendData(field_readback,dif)
if after_sample(): #To call check_id_error()
break
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm])
#if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
#if abs(field_readback - END_FIELDafter) < 0.007: REMOVED by Jan
if abs(field_readback - END_FIELD) < 0.007:
if iPS==True:
print "Waiting field done..."
@@ -148,6 +181,12 @@ while(True):
scan.end()
if RAMP_RATE is not None:
ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
if FIELD == "Hz":
print "Reset ramp rate-z"
ramp_rate.write(0.35)
ramp_rate.waitInPosition(0.35,10000)
else:
print "Reset ramp rate-x"
ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
+59 -16
View File
@@ -8,12 +8,19 @@ MODE = 'CIRC +'
OFFSET = -1.0
"""
iPS = False # false for old power supply, True for new (Oxford Instr) supply
if iPS == True:
caput('X07MA-ES1-IPS:RAMP-ENBL', 1) # enable non-overshoot mode
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
field = field_z if FIELD == "Hz" else field_x
field_done = field_z_done if FIELD == "Hz" else field_x_done
ramp_rate = ramp_rate_z if FIELD == "Hz" else ramp_rate_x
field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
field_done = field_z_done if FIELD == "Hz" else (None if iPS else field_x_done)
ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_rate_x)
START_FIELD=RANGES[0][0] # ADDED BY CP ON 7.2.2020
#Pre-actions
#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
@@ -32,23 +39,54 @@ else:
set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
print "Set energy..."
setpoint2 = ENERGIES[0]
print setpoint2
energy.write(setpoint2)
#sleep( ENERGY_CHANGE_SLEEP ) # Settling time
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan.start()
write_logs()
for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
ramp_rate.write(RAMP_RATE)
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
print "Setting start field: ", START_FIELD
field.write(START_FIELD)
time.sleep(3.0)
#for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
#ramp_rate.write(RAMP_RATE)
# if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
# print "Setting start field: ", START_FIELD
# field.write(START_FIELD)
# time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
wait_device(pol_done, "DONE")
#wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
ramp_rate.write(2.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)
#open_valve(2.0)
wait_device(pol_done, "DONE")
ramp_rate.write(RAMP_RATE)
print "Set end field: ", END_FIELD
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
@@ -76,16 +114,17 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
tey_norm = detector1/detector2
trans_norm = detector3/detector2
_tey_norm = detector1/detector2
_trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = tey_norm
first = _tey_norm
else:
dif = tey_norm-first
dif = _tey_norm-first
dif_series.appendData(field_readback,dif)
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm])
after_sample() #To call check_id_error()
if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
print "Reached end field. Readback=", field_readback
@@ -93,3 +132,7 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
index = index+1
scan.end()
if RAMP_RATE is not None:
ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
+4 -4
View File
@@ -79,8 +79,8 @@ for setpoint1 in setpoints:
detector6 = temperature.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
tey_norm = detector1/detector2
trans_norm = detector3/detector2
scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
_tey_norm = detector1/detector2
_trans_norm = detector3/detector2
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()
+49
View File
@@ -0,0 +1,49 @@
#####################
## INPUT PARAMETERS##
POS_START = -85
POS_END = -60
POS_STEP = 0.5
ENERGIES = [704.0,708.7] # Fe
#####################
#open_valve()
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#sensors = [ signal_tey, signal_i0, sample_hor, energy_readback]
#sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
#sensors_name = ['signal_tey', 'signal_i0', 'sample_hor', 'energy_readback']
#TODO: #Why must set range to "auto"?
"""
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
"""
#Setting a different color for each pass: must manage plots manually
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
ret70= lscan(gold_mesh2,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+135
View File
@@ -0,0 +1,135 @@
#Parameters
FILE = '3-Er_test'
START_LAMBDA = 1536.00 # in nm
END_LAMBDA = 1540.00 # in nm
SWEEP_RATE = 0.01 # in nm/sec
#ENERGIES = (1300.90, 1302.90) # X-ray energy in eV
ENERGIES = [ 1400.6 ] # X-ray energy in eV
ENERGY_CHANGE_SLEEP = 0.5
MODE = 'CIRC +'
OFFSET = -5.0
set_slit(30.0)
set_har(3.0)
if NO_BEAM_CHECK == False:
wait_beam()
if MODE is not None:
pol_mode.write(MODE)
if OFFSET is not None:
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
caputq('X07MA-PC:CSCALER.INPB', '1')
# open shutter
#caput('X07MA-FE-PH1:CLOSE4BL',1)
#cawait('X07MA-FE-PH1:MS2', 1)
if len(ENERGIES) ==2:
# dif_series = plot([],"Dif", get_context()="Dif")[0].getSeries(0)
dif_series = plot([],"Dif")[0].getSeries(0)
else:
dif_series = None
set_preference(Preference.ENABLED_PLOTS, ['wavelength', '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', 'fieldAnalogX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan = ManualScan(['Wavelength', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'fieldX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan.start()
write_logs()
print "Setting laser wavelength..."
caput("X07MA-ES1-DLCP:SPEED",SWEEP_RATE)
caput("X07MA-ES1-DLCP:WAVELENGTH",START_LAMBDA)
caput("X07MA-ES1-DLCP:BEGIN",START_LAMBDA)
caput("X07MA-ES1-DLCP:END",END_LAMBDA)
open_valve()
time.sleep(5.0)
while True:
time.sleep(0.5)
lambda_readback = caget("X07MA-ES1-DLCP:WAVELENGTH_RBV")
if abs(lambda_readback - START_LAMBDA) < 0.02:
print "Start wavelength reached."
break
#open_valve(2.0)
print "Set energy..."
setpoint2 = ENERGIES[0]
print setpoint2
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
print "Start laser scan..."
caput("X07MA-ES1-DLCP:CONTROL",3)
index = 0
while(True):
#Dimension 2START_FIELD = -0.2
#ArrayPositioner Energy
for setpoint2 in ENERGIES:
if len (ENERGIES)>1:
#Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
else:
sleep( 0.25 ) # TODO: Check
#TODO: change to Controlled variable?
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))
#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
lambda_readback = caget("X07MA-ES1-DLCP:WAVELENGTH_RBV")
#field_readback = field.readback.read() #fieldReadback.get()
detector1 = signal_tey.read() #TEY.get()
detector2 = signal_i0.read() #I0.get()
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
detector9 = field_x.read()
_tey_norm = detector1/detector2
_trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = _tey_norm
else:
dif = _tey_norm-first
dif_series.appendData(field_readback,dif)
scan.append ([lambda_readback, setpoint2], [lambda_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, _tey_norm, _trans_norm])
after_sample() #To call check_id_error()
if abs(lambda_readback - END_LAMBDA) < 0.02:
print "Target wavelength has been reached, breaking execution."
break
index = index+1
scan.end()
close_valve()
+167
View File
@@ -0,0 +1,167 @@
set_temp(100.0)
open_valve()
set_hx(6.5)
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
#set_range('k1', 9)
set_vert(6.0)
set_hor(102.0)
sample_name = 'Mn_20NNOLSMO_25K_6p5T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(6.0)
set_hor(102.0)
sample_name = 'Ni_5NNOLSMO_100K_6p5T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
set_hx(0.0)
'''
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(6.0)
set_hor(102.0)
sample_name = 'Mn_5NNOLSMO_100K_0T'
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
loop_count = loop_count + 1
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(6.0)
set_hor(102.0)
sample_name = 'Ni_5NNOLSMO_100K_0T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
loop_count = loop_count + 1
'''
set_hx(-6.5)
set_hx(0.0)
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(12.0)
set_hor(102.0)
sample_name = 'Mn_10NNOLSMO_100K_0T'
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
loop_count = loop_count + 1
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(12.0)
set_hor(102.0)
sample_name = 'Ni_10NNOLSMO_100K_0T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
loop_count = loop_count + 1
'''
close_valve()
+337
View File
@@ -0,0 +1,337 @@
#set_temp(150.0)
#time.sleep(300)
'''
open_valve()
set_hx(6.5)
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(6.0)
set_hor(102.0)
sample_name = 'Mn_5NNOLSMO_150K_6p5T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(6.0)
set_hor(102.0)
sample_name = 'Ni_5NNOLSMO_150K_6p5T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(12.0)
set_hor(102.0)
sample_name = 'Mn_10NNOLSMO_150K_6p5T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(12.0)
set_hor(102.0)
sample_name = 'Ni_10NNOLSMO_150K_6p5T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(17.5)
set_hor(102.0)
sample_name = 'Ni_20NNOLSMO_150K_6p5T'
set_range('k1', 10)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(24.0)
set_hor(102.0)
sample_name = 'Ni_30NNOLSMO_150K_6p5T'
set_range('k1', 10)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
'''
set_hx(0.0)
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(6.0)
set_hor(102.0)
sample_name = 'Mn_5NNOLSMO_150K_0T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(6.0)
set_hor(102.0)
sample_name = 'Ni_5NNOLSMO_150K_0T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
'''
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(12.0)
set_hor(102.0)
sample_name = 'Mn_10NNOLSMO_150K_0T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(12.0)
set_hor(102.0)
sample_name = 'Ni_10NNOLSMO_150K_0T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(17.5)
set_hor(102.0)
sample_name = 'Ni_20NNOLSMO_150K_0T'
set_range('k1', 10)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(24.0)
set_hor(102.0)
sample_name = 'Ni_30NNOLSMO_150K_0T'
set_range('k1', 10)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
'''
set_hx(-6.5)
set_hx(0.0)
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(6.0)
set_hor(102.0)
sample_name = 'Mn_5NNOLSMO_150K_0T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(6.0)
set_hor(102.0)
sample_name = 'Ni_5NNOLSMO_150K_0T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
'''
#Mn
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
set_range('k1', 9)
set_vert(12.0)
set_hor(102.0)
sample_name = 'Mn_10NNOLSMO_150K_0T'
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(12.0)
set_hor(102.0)
sample_name = 'Ni_10NNOLSMO_150K_0T'
set_range('k1', 9)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(17.5)
set_hor(102.0)
sample_name = 'Ni_20NNOLSMO_150K_0T'
set_range('k1', 10)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
#Ni
off_plus=1.8
off_minus=3.3
Estart=840
Eend=895
set_vert(24.0)
set_hor(102.0)
sample_name = 'Ni_30NNOLSMO_150K_0T'
set_range('k1', 10)
#run("users/Cinthia/xmcd_6")
#otf(start=Estart, end=Eend, time=3, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
run("users/Cinthia/xmcd_6")
run("users/Cinthia/MnNi_XMCD_175K")
'''
close_valve()
+82
View File
@@ -0,0 +1,82 @@
#####################
## INPUT PARAMETERS##
POS_START = -0.26
POS_END = -0.14
POS_STEP = 0.005
#ENERGIES = [782.50, 775.0]
#ENERGIES = [400.7, 390.0]
#ENERGIES = [401.1,403] #Mo
#ENERGIES = [530]
#ENERGIES = [692.0] # F
#ENERGIES = [692.0, 680.0] # F
#ENERGIES = [1110,1125.5] #STO
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [700.0, 708.0] # Fe
#ENERGIES = [700.0] #Fe
#ENERGIES = [772,776.7] # Co
ENERGIES = [851.8,848.5] # Ni
#ENERGIES = [574.1, 560.0] #Cr
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [630.0,640.0] # Mn
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [1170, 1180 ] # Gd
#ENERGIES = [260.0] #C
#ENERGIES = [1370.0,1380.0] #Er
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1288.8, 1280.0 ] # Dy
#ENERGIES = [1292.0] # Dy
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [928.4, 925.0]# Cu
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1233.7, 1225] # Tb
#ENERGIES = [1265] # Dy pre-edge
#####################
#open_valve()
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#sensors = [ signal_tey, signal_i0, sample_hor, energy_readback]
#sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
#sensors_name = ['signal_tey', 'signal_i0', 'sample_hor', 'energy_readback']
#TODO: #Why must set range to "auto"?
"""
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
"""
#Setting a different color for each pass: must manage plots manually
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
#ret70= lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
ret70= lscan("ca://X07MA-OP-RMU:tRy.A",sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+82
View File
@@ -0,0 +1,82 @@
#####################
## INPUT PARAMETERS##
POS_START = -0.26
POS_END = -0.14
POS_STEP = 0.005
#ENERGIES = [782.50, 775.0]
#ENERGIES = [400.7, 390.0]
#ENERGIES = [401.1,403] #Mo
#ENERGIES = [530]
#ENERGIES = [692.0] # F
#ENERGIES = [692.0, 680.0] # F
#ENERGIES = [1110,1125.5] #STO
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [700.0, 708.0] # Fe
#ENERGIES = [700.0] #Fe
#ENERGIES = [772,776.7] # Co
ENERGIES = [851.8,848.5] # Ni
#ENERGIES = [574.1, 560.0] #Cr
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [630.0,640.0] # Mn
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [1170, 1180 ] # Gd
#ENERGIES = [260.0] #C
#ENERGIES = [1370.0,1380.0] #Er
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1288.8, 1280.0 ] # Dy
#ENERGIES = [1292.0] # Dy
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [928.4, 925.0]# Cu
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1233.7, 1225] # Tb
#ENERGIES = [1265] # Dy pre-edge
#####################
#open_valve()
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#sensors = [ signal_tey, signal_i0, sample_hor, energy_readback]
#sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
#sensors_name = ['signal_tey', 'signal_i0', 'sample_hor', 'energy_readback']
#TODO: #Why must set range to "auto"?
"""
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
"""
#Setting a different color for each pass: must manage plots manually
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
#ret70= lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
ret70= lscan("ca://X07MA-OP-RMU:tRy.A",sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+82
View File
@@ -0,0 +1,82 @@
#####################
## INPUT PARAMETERS##
POS_START = -0.5
POS_END = 0.5
POS_STEP = 0.05
#ENERGIES = [782.50, 775.0]
#ENERGIES = [400.7, 390.0]
#ENERGIES = [401.1,403] #Mo
#ENERGIES = [530]
#ENERGIES = [692.0] # F
#ENERGIES = [692.0, 680.0] # F
#ENERGIES = [1110,1125.5] #STO
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [700.0, 708.0] # Fe
#ENERGIES = [700.0] #Fe
#ENERGIES = [772,776.7] # Co
#ENERGIES = [851.8,848.5] # Ni
#ENERGIES = [574.1, 560.0] #Cr
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [630.0,640.0] # Mn
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [1170, 1180 ] # Gd
#ENERGIES = [260.0] #C
#ENERGIES = [1370.0,1380.0] #Er
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1288.8, 1280.0 ] # Dy
#ENERGIES = [1292.0] # Dy
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1850, 1820]# Si
ENERGIES = [928.4, 925.0]# Cu
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1233.7, 1225] # Tb
#ENERGIES = [1265] # Dy pre-edge
#####################
#open_valve()
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#sensors = [ signal_tey, signal_i0, sample_hor, energy_readback]
#sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
#sensors_name = ['signal_tey', 'signal_i0', 'sample_hor', 'energy_readback']
#TODO: #Why must set range to "auto"?
"""
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
"""
#Setting a different color for each pass: must manage plots manually
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
#ret70= lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
ret70= lscan("ca://X07MA-OP-RMU:tRz.A",sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+27
View File
@@ -0,0 +1,27 @@
#####################
## INPUT PARAMETERS##
POS_START_V = 12.5
POS_END_V = 16.5
POS_STEP_V = 0.1
POS_START_H = 153.50
POS_END_H = 158.0
POS_STEP_H = 0.1
ENERGY = 774.0
set_energy(ENERGY)
open_valve()
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#ret= ascan([sample_hor,sample_vert] ,sensors, [POS_START_H, POS_START_V], [POS_END_H, POS_END_V], [POS_STEP_H, POS_STEP_V], \
# latency = 0.2, passes = 1, enabled_plots = [tey_norm,trans_norm ])
ret= ascan([sample_vert, sample_hor] ,sensors, [POS_START_V, POS_START_H], [POS_END_V, POS_END_H ], [POS_STEP_V, POS_STEP_H], \
latency = 0.2, passes = 1, zigzag = True, enabled_plots = [tey_norm,trans_norm ])
close_valve()
+27
View File
@@ -0,0 +1,27 @@
#####################
## INPUT PARAMETERS##
POS_START_V = 16.5 #Rz
POS_END_V = 20.5
POS_STEP_V = 0.05
POS_START_H = 156.5 #Ry
POS_END_H = 159.25
POS_STEP_H = 0.05
ENERGY = 851.75
set_energy(ENERGY)
open_valve()
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#ret= ascan([sample_hor,sample_vert] ,sensors, [POS_START_H, POS_START_V], [POS_END_H, POS_END_V], [POS_STEP_H, POS_STEP_V], \
# latency = 0.2, passes = 1, enabled_plots = [tey_norm,trans_norm ])
ret= ascan(["ca://X07MA-OP-RMU:tRz.A", "ca://X07MA-OP-RMU:tRy.A"] ,sensors, [POS_START_V, POS_START_H], [POS_END_V, POS_END_H ], [POS_STEP_V, POS_STEP_H], \
latency = 0.2, passes = 1, zigzag = True, enabled_plots = [tey_norm,trans_norm ])
close_valve()
+14 -24
View File
@@ -2,6 +2,9 @@
import os,time,subprocess
# this checks whether the T control is running or not
# it returns True if T control script is running AND the control is switched ON
# if the script is not running OR the control is switched OFF then this check will return False
def check_Tcontrol_on():
prog = os.popen("caget -noname -num -nostat X07MA-ES1-TEMP:CONTROL")
sp=prog.read()
@@ -16,16 +19,15 @@ def check_Tcontrol_on():
# print "Tctrl on =",Tcontrol_on
return Tcontrol_on
#def check_Tcontrol_on():
# return (caget('X07MA-ES1-TEMP:CONTROL','i') == 1)
Tctrl = check_Tcontrol_on()
if Tctrl == False :
print 'T auto control not running.'
prog2 = os.popen("caget -plain X07MA-PC-TC:DMD:LOOP1:SETPOINT")
sp=prog2.read()
#print "sp= "+str(sp)
sp=float(sp)
sp = caget("X07MA-PC-TC:DMD:LOOP1:SETPOINT")
# path contains the path of the refill log file
path1=time.strftime("%Y_%m", time.localtime())
@@ -33,34 +35,22 @@ if Tctrl == False :
path="/sls/X07MA/data/x07maop/Data1/"+path1+"/"+path2 +"/"+"refill.log"
if (sp<2.0):
prog = os.popen("caget -plain X07MA-PC-TC:STS:T1")
t=prog.read()
print "t= "+str(t)
t=float(t)
prog2 = os.popen("caget -plain X07MA-PC-HE:LEVELB")
hl=prog2.read()
print "hl= "+str(hl)
hl=float(hl)
t = caget("X07MA-PC-TC:STS:T1",'d')
print "t= ",t
hl = caget("X07MA-PC-HE:LEVELB",'d')
print "hl= ",hl
if (t > 3.7):
#prc = subprocess.Popen("/sls/X07MA/data/x07maop/python/refill_1kpot.py",shell=True)
#prc.wait()
run("refill_1kpot")
else:
print 'T auto control is running.'
print 'T auto control is running. Waiting for temperature to stabilize...'
while True:
prog = os.popen("caget -noname -num -nostat X07MA-ES1-TEMP:STATUS")
sp = prog.read()
if sp !='':
sp = float(sp)
else:
break
st = caget("X07MA-ES1-TEMP:STATUS",'i')
# if temperature is stable
if sp == 1:
if st == 1:
print "T is now stable."
break
+20
View File
@@ -0,0 +1,20 @@
#set vert 14
#set pol c+ off -0.5
#otf 505 550 3 delay 5
#file V_plus
#start
sample_vert.move(14)
set_pol_cplus(offset = -0.5)
wait_beam()
set_file('V_plus')
otf(start=505, end=550, time=3, delay=5)
#set pol c- off 1
#otf 505 550 3 delay 5
#file V_minus
#start
set_pol_cminus(offset = 1)
wait_beam()
set_file('V_minus')
otf(start=505, end=550, time=3, delay=5)
+92
View File
@@ -0,0 +1,92 @@
#####################
## INPUT PARAMETERS##
POS_START = 12
POS_END = 22.0
POS_STEP = 0.25
#ENERGIES = [532, 523]# O
#ENERGIES = [363.2, 356]# Nb
#ENERGIES = [782.50, 775.0]
#ENERGIES = [397.6, 396.0] # N
#ENERGIES = [401.1,403] #Mo285
#ENERGIES = [577.0, 573.0] # Cr
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 = [774.0] # Co
#ENERGIES = [777.3, 774.0] # Co
#ENERGIES = [851.3,845.0] # Ni
#ENERGIES = [576.4, 560.0] #Cr
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [642.0,630.0] # Mn
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [1170, 1181 ] # Gd
#ENERGIES = [285] #C
#ENERGIES = [1370.0,1380.0] #Er
#ENERGIES = [1390.0,1400.6] #Er2
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1457.8] # Dy
#ENERGIES = [1292.0] # Dy
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [928.3, 925.0] # Cu metal
#ENERGIES = [928.6]# Cu1
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1233.7, 1225] # Tb
#ENERGIES = [976, 970] # Nd
#ENERGIES = [1185] # Gd
#ENERGIES = [405.5, 390] # Sc
#ENERGIES = [1265] # Dy pre-edge
#ENERGIES = [1125.6]# Eu
#ENERGIES = [850.9, 849 ] # Ni
#ENERGIES = [520.0] # V
#####################
#open_valve()
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
#sensors = [ signal_tey, signal_i0, sample_hor, energy_readback]
#sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
#sensors_name = ['signal_tey', 'signal_i0', 'sample_hor', 'energy_readback']
#TODO: #Why must set range to "auto"?
"""
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
"""
#Setting a different color for each pass: must manage plots manually
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
ret70= lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+136
View File
@@ -0,0 +1,136 @@
#XAS YBCO with XMCD 0T
#set_vert(7.5)
#set_hor(107.5)
#O K edge
off_LH=2.0
off_LV=2.0
Estart=520
Eend=550
sample_name = 'O_5YBCO5LSMO5_100K'
#set_slit(20)
#set_har(1.0)
#set_au_mesh(125.0)
set_energy(Estart)
open_valve()
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=0.0, offset = off_LH, name = sample_name + '_LH')
# otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LIN_90')
# otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LIN_90')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LV')
loop_count = loop_count + 1
close_valve()
#Mn L2,3 edge with XMCD 0T
off_LH=0.5 #0 deg
off_LV=0.5 #90 deg
Estart=630
Eend=685
sample_name = 'Mn_5YBCO5LSMO5_100K'
#set_slit(20)
#set_har(1.0)
#set_au_mesh(125.0)
set_energy(Estart)
open_valve()
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=0.0, offset = off_LH, name = sample_name + '_LH')
# otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LIN_90')
# otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LIN_90')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LV')
loop_count = loop_count + 1
'''
set_hx(0.0)
off_plus=-0.2
off_minus=1.8
Estart=630
Eend=685
#set_range('k1', 10)
sample_name = 'Mn_5LSMO5YBCO5LSMO_1K_0T'
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
loop_count = loop_count + 1
'''
close_valve()
#Cu L2,3 edge with XMCD 0T
off_LH=2.0
off_LV=2.5
Estart=920
Eend=970
sample_name = 'Cu_5YBCO5LSMO5_100K'
#set_slit(20)
#set_har(1.0)
#set_au_mesh(125.0)
set_energy(Estart)
open_valve()
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=0.0, offset = off_LH, name = sample_name + '_LH')
# otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LIN_90')
# otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LIN_90')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "LINEAR", alpha=90.0, offset = off_LV, name = sample_name+ '_LV')
loop_count = loop_count + 1
'''
set_hx(0.0)
off_plus=3
off_minus=5
#set_range('k1', 10)
sample_name = 'Cu_5LSMO5YBCO5LSMO_1K_0T'
nr_loops=1
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name)
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name)
loop_count = loop_count + 1
'''
close_valve()
+45
View File
@@ -0,0 +1,45 @@
#set pol c+ off -1
#otf 560 625 3
#file Cr_dummy
#start
set_pol_cplus(offset = -1)
wait_beam()
set_file('Cr_dummy')
otf(start=560, end=625, time=3)
#set pol c+ off -1
#otf 560 625 6 delay 10
#file Cr_plus
#start
set_pol_cplus(offset = -1)
wait_beam()
set_file('Cr_plus')
otf(start=560, end=625, time=6, delay=10)
#set pol c- off 0.5
#otf 560 625 6 delay 10
#file Cr_minus
#start
set_pol_cminus(offset = 0.5)
wait_beam()
set_file('Cr_minus')
otf(start=560, end=625, time=6, delay=10)
#set pol c- off 0.5
#otf 560 625 6 delay 10
#file Cr_minus
#start
set_pol_cminus(offset = 0.5)
wait_beam()
set_file('Cr_minus')
otf(start=560, end=625, time=6, delay=10)
#set pol c+ off -1
#otf 560 625 6 delay 10
#file Cr_plus
#start
set_pol_cplus(offset = -1)
wait_beam()
set_file('Cr_plus')
otf(start=560, end=625, time=6, delay=10)
View File
+80
View File
@@ -0,0 +1,80 @@
idenergy = 770
############################################################3
#Pre-actions
caput('X07MA-ID:ENERGY', idenergy)
cawait('X07MA-ID:DONE', 'DONE', type = 's')
caput('X07MA-PHS-E:OPT', 'PGM')
halfwidth = 10.0
step = 0.5#1.0
try:
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['PGMenergy'], ['I0', 'polarization', 'polangle', 'ringCurrent', 'SetEnergy', 'offset'] , [idenergy-halfwidth], [idenergy+halfwidth], [20])
scan.start()
#Creating channels: dimension 1
#RegionPositioner PGMenergy
PGMenergy = Channel('X07MA-PHS-E:GO.A', type = 'd')
PGMenergyReadback = Channel('X07MA-PGM:CERBK', type = 'd')
#ScalarDetector I0
I0 = Channel('X07MA-ES1-AI:SIGNAL1', type = 'd')
#ScalarDetector polarization
polarization = Channel('X07MA-ID:MODE', type = 'd')
#ScalarDetector polangle
polangle = Channel('X07MA-ID:ALPHA', type = 'd')
ringCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd')
#ScalarDetector SetEnergy
SetEnergy = Channel('X07MA-PHS-E:GO.A', type = 'd')
#ScalarDetector offset
offset = Channel('X07MA-ID:ENERGY-OFFS', type = 'd')
#Dimension 1
#RegionPositioner PGMenergy
for setpoint1 in frange(idenergy-halfwidth, idenergy+halfwidth, step, True):
PGMenergy.put(setpoint1, timeout=180.) # Feb. 2019, changed timeout from 60 to 180s. CP
wait_device(energy_done, 1 )
sleep( 0.5 ) # Settling time
readback1 = PGMenergyReadback.get()
#if abs(readback1 - setpoint1) > 0.5 : # TODO: Check accuracy
#raise Exception('Actor PGMenergy could not be set to the value ' + str(setpoint1))
sleep( 0.5 ) # Settling time
#Detector I0
detector2 = I0.get()
#Detector polarization
detector3 = polarization.get()
#Detector polangle
detector4 = polangle.get()
#Detector ringCurrent
detector6 = ringCurrent.get()
#Detector SetEnergy
detector7 = SetEnergy.get()
#Detector offset
detector10 = offset.get()
scan.append ([setpoint1], [readback1], [detector2, detector3, detector4, detector6, detector7, detector10])
#Closing channels
PGMenergy.close()
PGMenergyReadback.close()
I0.close()
polarization.close()
polangle.close()
ringCurrent.close()
SetEnergy.close()
offset.close()
scan.end()
#Post-actions
caput('X07MA-PHS-E:OPT', 'PGM+ID')
except:
print("Aborting...")
caput('X07MA-PHS-E:OPT', 'PGM+ID')
#if get_exec_pars().source != CommandSource.plugin:
# show_message(str(ex))
raise
+19
View File
@@ -0,0 +1,19 @@
set_range('k1', 9)
set_range('k2', 9)
set_range('k3', 10)
set_pol_cplus(offset = -0.7)
set_file('2076_Mn_hyst_plus')
hyst_cont(field='Hx', init_field=-6.0, final_field=6.0, ramp_speed=1.0, energies=[640.8, 634.8])
set_file('2076_Mn_hyst_plus')
hyst_cont(field='Hx', init_field=6.0, final_field=-6.0, ramp_speed=1.0, energies=[640.8, 634.8])
set_pol_cminus(offset = 1.5)
set_file('2076_Mn_hyst_minus')
hyst_cont(field='Hx', init_field=-6.0, final_field=6.0, ramp_speed=1.0, energies=[640.8, 634.8])
set_file('2076_Mn_hyst_minus')
hyst_cont(field='Hx', init_field=6.0, final_field=-6.0, ramp_speed=1.0, energies=[640.8, 634.8])
+13
View File
@@ -0,0 +1,13 @@
#set pol lin 90 off 2.0
#otf 620 670 2 delay 5
#file MnE_lin90
#start
#set_pol_lin(angle = 90, offset = 2.0)
counter = 0
wait_beam()
wait_temp()
+25
View File
@@ -0,0 +1,25 @@
#####################
## INPUT PARAMETERS##
POS_START = 8.0
POS_END = 28.0
POS_STEP = 1.0
#ENERGIES = [639,632]
#ENERGIES = [458.5,463.5]
#ENERGIES = [397.7,392] # Pc
ENERGIES = [700.0,708.0] # STO
#####################
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
sensors = [tey_norm, signal_tey, signal_i0, trans_norm, sample_hor, energy_readback]
sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
#Setting a different color for each pass: must manage plots manually
plots = plot([None]*len(sensors), name = [d for d in sensors_name])
print sensors
+31
View File
@@ -0,0 +1,31 @@
ID_ENERGY = 928
# energy at which the ID offset should be determined
#========================
HALFWIDTH = 5
STEP = 0.5
#========================
try:
caput('X07MA-PHS-E:OPT', 'PGM')
energy_id.write(ID_ENERGY)
wait_device(energy_done, 1 )
def before(position, scan):
#wait_device(energy_done, 1 )
sleep( 0.3 ) # Settling time
#ret = lscan(energy, [signal_i0, signal_tey, 'ca://X07MA-PC-K428:2:getTotalGain', 'ca://X07MA-ID:MODE?type=d', pol_angle, current, energy, pol_offset, 'ca://X07MA-ID-GAP:READ','ca://X07MA-ID-SHIFT:READ'], ID_ENERGY-HALFWIDTH, ID_ENERGY+HALFWIDTH, STEP, before_read = before)
ret = lscan(energy, [signal_i0, signal_tey, 'ca://X07MA-PC-K428:2:getTotalGain', energy], ID_ENERGY-HALFWIDTH, ID_ENERGY+HALFWIDTH, STEP, before_read = before)
xdata = ret.getPositions(0)
ydata = ret.getReadable(0)
ymin = min(ydata)
xminmin = xdata[ydata.index(min(ydata))]
print "Emin=",xminmin,"ymin = ",ymin
caput('X07MA-PHS-E:OPT', 'PGM+ID')
except:
print("Aborting...")
caput('X07MA-PHS-E:OPT', 'PGM+ID')
raise
-30
View File
@@ -1,30 +0,0 @@
def dyotfplus():
global off_plus
otf(start=1265, end=1355, time=3, delay=5, mode = "CIRC +", offset = off_plus, alpha = None, name = 'Dy_plus')
def dyotfminus():
global off_minus
otf(start=1265, end=1355, time=3, delay=5, mode = "CIRC -", offset = off_minus, alpha = None, name = 'Dy_minus')
def dyxmcd_pmmp():
dyotfplus()
dyotfminus()
dyotfminus()
dyotfplus()
off_plus = -6.5
off_minus = -2.5
set_pol_cplus(offset = off_plus)
set_slit(50.0)
open_valve()
dyotfplus()
dyotfminus()
dyotfminus()
dyotfplus()
close_valve()
-23
View File
@@ -1,23 +0,0 @@
def dyotflin0():
global off_l0
otf(start=1265, end=1355, time=3, delay=5, mode = "LINEAR", offset = off_l0, alpha = 0, name = 'DyE_0')
def dyotflin90():
global off_l90
otf(start=1265, end=1355, time=3, delay=5, mode = "LINEAR", offset = off_l90, alpha = 90, name = 'DyE_90')
####################################################3
# specify offsets here
####################################################3
off_l0 = 4.0
off_l90 = 4.5
set_slit(10)
open_valve()
dyotflin0()
dyotflin90()
dyotflin90()
dyotflin0()
close_valve()
-36
View File
@@ -1,36 +0,0 @@
def Notfplus():
global off_plus
wait_temp()
otf(start=385, end=440, time=2, delay=5, mode = "CIRC +", offset = off_plus, alpha = None, name = 'NE_plus')
def Notfminus():
global off_minus
wait_temp()
otf(start=385, end=440, time=2, delay=5, mode = "CIRC -", offset = off_minus, alpha = None, name = 'NE_minus')
def N_xmcd_pmmp():
for i in range(4):
Notfplus()
Notfminus()
Notfminus()
Notfplus()
off_plus = -1.0
off_minus = 0.0
set_pol_cplus(offset = off_plus)
set_slit(30.0)
open_valve()
set_hx(-2.0)
N_xmcd_pmmp()
set_hx(2.0)
N_xmcd_pmmp()
set_hx(-2.0)
N_xmcd_pmmp()
close_valve()
-22
View File
@@ -1,22 +0,0 @@
set_pol_cplus(offset = None)
wait_temp()
wait_beam()
set_file('Ni_plus')
open_valve()
otf(start=840, end=895, time=2, delay=5)
set_pol_cminus(offset = None)
wait_beam()
set_file('Ni_minus')
otf(start=840, end=895, time=2, delay=5)
set_pol_cminus(offset = None)
wait_beam()
set_file('Ni_minus')
otf(start=840, end=895, time=2, delay=5)
set_pol_cplus(offset = None)
wait_beam()
set_file('Ni_plus')
otf(start=840, end=895, time=2, delay=5)
close_valve()
-37
View File
@@ -1,37 +0,0 @@
off_cplus = -7.5
off_cminus = -3.0
rrate = 2.0 # ramping speed of mag field
e1 = 1290.0 # energy 1 (usually on edge)
e2 = 1283.0 # energy 2 (pre edge)
B1 = 4.0 # field span
B2 = -B1
nr_loops = 2 # number of loops to acquire
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Dy_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1, e2])
set_pol_cminus(offset = off_cminus)
set_file('Dy_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1, e2])
set_pol_cminus(offset = off_cminus)
set_file('Dy_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1, e2])
set_pol_cplus(offset = off_cplus)
set_file('Dy_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1, e2])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
-43
View File
@@ -1,43 +0,0 @@
off_cplus = -7.5
off_cminus = -3.0
rrate = 2.0 # ramping speed of mag field
# normal incidence
#e1 = 1290.2 # energy 1 (usually on edge)
#e2 = 1283.0 # energy 2 (pre edge)
# grazing incidence
e1 = 1290.1 # energy 1 (usually on edge)
e2 = 1283.0 # energy 2 (pre edge)
B1 = 4.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Dy_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Dy_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Dy_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cplus(offset = off_cplus)
set_file('Dy_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
-42
View File
@@ -1,42 +0,0 @@
off_cplus = -7.5
off_cminus = -3.0
rrate = 2.0 # ramping speed of mag field
e1 = 1286.0 # energy
B1 = 4.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
#while temperature.readback.read() > 1.9:
# time.sleep(1)
open_valve()
time.sleep(10)
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Dy_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cplus(offset = off_cplus)
set_file('Dy_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Dy_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Dy_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
-21
View File
@@ -1,21 +0,0 @@
open_valve()
set_pol_cplus(offset = 0)
set_file('Co_hyst_plus')
hyst_cont(field_x, 6.8, -6.8, 2.0, [777.14, 774.0])
set_pol_cminus(offset = 1.5)
set_file('Co_hyst_minus')
hyst_cont(field_x, -6.8, 6.8, 2.0, [777.14, 774.0])
set_pol_cminus(offset = 1.5)
set_file('Co_hyst_minus')
hyst_cont(field_x, 6.8, -6.8, 2.0, [777.14, 774.0])
set_pol_cplus(offset = 0)
set_file('Co_hyst_plus')
hyst_cont(field_x, -6.8, 6.8, 2.0, [777.14, 774.0])
close_valve()
-37
View File
@@ -1,37 +0,0 @@
off_cplus = -0.25
off_cminus = 1.75
rrate = 1.0 # ramping speed of mag field
e1 = 706.85 # energy
B1 = 5.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Fe_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cplus(offset = off_cplus)
set_file('Fe_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Fe_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Fe_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
-27
View File
@@ -1,27 +0,0 @@
off_cplus = -6.0
off_cminus = -2.0
rrate = 2.0 # ramping speed of mag field
e1 = 1235.6 # energy 1 (usually on edge)
e2 = 1227.6 # energy 2 (pre edge)
B1 = 4.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1,e2])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
-39
View File
@@ -1,39 +0,0 @@
off_cplus = -6.0
off_cminus = -2.0
rrate = 2.0 # ramping speed of mag field
e1 = 1235.6 # energy 1 (usually on edge)
e2 = 1227.6 # energy 2 (pre edge)
B1 = 4.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1,e2])
set_pol_cminus(offset = off_cminus)
set_file('Tb_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1,e2])
set_pol_cminus(offset = off_cminus)
set_file('Tb_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1,e2])
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1,e2])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
-37
View File
@@ -1,37 +0,0 @@
off_cplus = -6.0
off_cminus = -2.0
rrate = 2.0 # ramping speed of mag field
e1 = 1235.6 # energy
B1 = 4.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Tb_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1])
set_pol_cminus(offset = off_cminus)
set_file('Tb_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
+170 -77
View File
@@ -3,39 +3,33 @@
###################################################################################################
import ch.psi.fda.ProcessorFDA as ProcessorFDA
import ch.psi.fda.LayoutFDA as LayoutFDA
import ntpath
def run_fda(file_name, arguments={}):
"""
Run FDA loop
"""
ProcessorFDA().execute(file_name,arguments)
import traceback
import ch.psi.pshell.epics.ChannelSettlingCondition as ChannelSettlingCondition
WAIT_STABLE_TEMPERATURE = True # True : before energy scan and hyst scan the routine wait_temp() is launched
NO_BEAM_CHECK = False # setting this to true disables the waiting for the beam before starting energy or hyst scan
ABORT_ON_ID_ERROR = True
_SAMPLE_NAME = "DUMMY"
#As the folder is shared to all daily datasets, then configuration must be set to {data}/{year}_{month}/{date}
#and the file prefix manually set as:
LayoutFDA.setFilePrefix("{date}_{hour}{min}_{name}")
energy.setBlockingWrite(True)
energy_id.setSettlingCondition(ChannelSettlingCondition("X07MA-ID:DONE", 'DONE'))
energy_id.settlingCondition.latency = 10
#If True, then wait_beam will not check machine status
maintenance_mode = False
#now using ch.psi.fda.LayoutFDA
"""
#The persistence strategy is overriden to adjust file names
import ch.psi.pshell.data.LayoutTable
class DataLayout( ch.psi.pshell.data.LayoutTable):
def getLogFileName(self):
return time.strftime('%Y%m%d_%H%M') + '_' + get_exec_pars().name + '_logs'
def getDatasetName(self, scan):
print get_exec_pars().count
data_file = time.strftime('%Y%m%d_%H%M') + '_' + get_exec_pars().name + '_' + str(get_exec_pars().count).zfill(4)
print "Opened data file: " + get_exec_pars().path + "/" + data_file
return data_file
get_context().dataManager.setLayout(DataLayout())
"""
#Reading Energy Scan configuration file
def getPars(element):
f = open(get_context().setup.getConfigPath() + '/energy_scan.properties')
@@ -52,9 +46,17 @@ def getPars(element):
f.close()
raise Exception ("Invalid element: " + str(element))
def is_id_error():
return (id_error.read()==0)
def check_id_error():
if is_id_error():
raise Exception ("ID error: check ID status")
###################################################################################################
# PSeudo-devices
# Pseudo-devices
###################################################################################################
sim_energy = None
class SimulatedEnergy(Writable):
@@ -101,6 +103,13 @@ add_device(TransNorm("trans_norm"), True)
# Utilities
###################################################################################################
def run_fda(file_name, arguments={}):
"""
Run FDA loop
"""
ProcessorFDA().execute(file_name,arguments)
run ("Accumulator")
def get_next_fid(folder, prefix):
@@ -114,24 +123,25 @@ def get_next_fid(folder, prefix):
return 0
def wait_channel(name, value, timeout=None, type='s'):
print "Waiting " + str(name) + " = " + str(value)
print "Waiting " + str(name) + " = " + str(value),"... "
cawait(name, value, timeout = timeout, type=type)
print "Done waiting"
# print "Done waiting."
def wait_device(dev, value, timeout=-1):
timeout = int(timeout *1000) if timeout>0 else timeout
print "Waiting " + dev.getName() + " = " + str(value)
#print "Waiting " + dev.getName() + " = " + str(value),"... "
dev.waitValue(value,timeout)
print "Done waiting"
# print "Done waiting."
def wait_device_in_range(dev, value, range, timeout=-1):
timeout = int(timeout *1000) if timeout>0 else timeout
print "Waiting " + dev.getName() + " = " + str(value)
print "Waiting " + dev.getName() + " = " + str(value),"... "
dev.waitValueInRange(value, range, timeout)
print "Done waiting"
# print "Done waiting."
def convert_file(input_file_name, output_file_name, pol = None):
print "Converting data file: " + input_file_name + " to " + output_file_name
#print "Converting data file: " + input_file_name + " to " + output_file_name
print "File converted to: ",output_file_name
sep = "\t"
line_sep = "\n"
MODE = pol_mode.read()
@@ -209,78 +219,123 @@ def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context(
return ret
###################################################################################################
# Controller state listener
#Default scan callbacks
###################################################################################################
#class Listener(ControllerListener):
# def onControllerStateChanged(self, state, former):
# global FILENAME
# if former == State.Busy:
# FILENAME = None
#get_context().addListener(Listener()) #Old listeners are cleande in startup
def before_sample(position, scan):
pass
def after_sample(record=None, scan=None):
if ABORT_ON_ID_ERROR:
check_id_error()
return True
if is_id_error():
if (record is not None):
record.invalidate()
print "ID error, waiting..."
while is_id_error():
time.sleep(1.0)
print "ID OK"
return False
return True
###################################################################################################
#Definitions for importing text batch files
###################################################################################################
#TODO: Should set devices? K10, k11, k24 seem not to be defined....
keithleys = {
#name:[Setpoint, range, Readback] #TODO
"k1": [None , 'X07MA-PC-K428:1:setGain', 'X07MA-PC-K428:1:getGain'],
"k2": [None , 'X07MA-PC-K428:2:setGain', 'X07MA-PC-K428:2:getGain'],
"k3": [None , 'X07MA-PC-K428:3:setGain', 'X07MA-PC-K428:3:getGain'],
"k10":['X07MA-KEI10:SETVOLTAGE' , 'X07MA-KEI10:RANGE', None],
"k11":['X07MA-KEI11:SETVOLTAGE' , 'X07MA-KEI11:RANGE', None],
"k24":['X07MA-KEI2400:setVoltAO', None, None]
# "k1": [None , 'X07MA-PC-K428:1:setGain', 'X07MA-PC-K428:1:getGain'],
# "k2": [None , 'X07MA-PC-K428:2:setGain', 'X07MA-PC-K428:2:getGain'],
# "k3": [None , 'X07MA-PC-K428:3:setGain', 'X07MA-PC-K428:3:getGain'],
"k1": [None , 'X07MA-PC-K428:1:setGain', 'X07MA-PC-K428:1:getGain','X07MA-PC-K428:1:setGain10x','X07MA-PC-K428:1:getGain10x'],
"k2": [None , 'X07MA-PC-K428:2:setGain', 'X07MA-PC-K428:2:getGain','X07MA-PC-K428:2:setGain10x','X07MA-PC-K428:2:getGain10x'],
"k3": [None , 'X07MA-PC-K428:3:setGain', 'X07MA-PC-K428:3:getGain','X07MA-PC-K428:3:setGain10x','X07MA-PC-K428:3:getGain10x'],
"k10":['X07MA-KEI10:SETVOLTAGE' , 'X07MA-KEI10:RANGE', None, None, None],
"k11":['X07MA-KEI11:SETVOLTAGE' , 'X07MA-KEI11:RANGE', None, None, None],
"k24":['X07MA-KEI2400:setVoltAO', None, None, None, None]
}
def set_hx(field, timeout = -1):
"""
"""
timeout = int(timeout *1000) if timeout>0 else timeout
field_x.write(float(field))
field_x_done.waitValue(1,timeout)
#Only test x today
def setHz(field, timeout = -1):
iPS = False # false for old (Cryogenics) power supply, True for new (Oxford Instr) supply
fieldx = field_x_ips if iPS else field_x
field_done = None if iPS else field_x_done
FIELD_PRECISION = 0.01
# line below was field.readback.read(). Changed on Feb. 12 2019 because of error message that no readback was found
if abs(field_x.readback.read() - field) > FIELD_PRECISION: # added in Feb. 2019 to avoid hanging when setting to current field
timeout = int(timeout *1000) if timeout>0 else timeout
fieldx.write(float(field))
if iPS == True:
caput("X07MA-PC-MAG:X:DMD",float(field))
print 'Setting Hx to',field,'Tesla...'
time.sleep(3.0) # wait 3s
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)
print "Done setting magnetic field"
def set_hz(field, timeout = -1):
"""
"""
timeout = int(timeout *1000) if timeout>0 else timeout
field_z.write(float(field))
print 'Setting Hz to',field,'Tesla...'
time.sleep(3.0) # wait 3s
field_z_done.waitValue(1,timeout)
print "Done setting magnetic field"
def set_pol_cplus(offset = None, timeout = -1):
"""
"""
print "Set x-ray polarization to c+"
timeout = int(timeout *1000) if timeout>0 else timeout
pol_mode.write("CIRC +")
if offset is not None:
pol_offset.write(float(offset))
pol_done.waitValue("DONE",timeout)
pol_done.waitValue("DONE",timeout)
print "Done setting x-ray polarization"
def set_pol_cminus(offset = None, timeout = -1):
"""
"""
print "Set x-ray polarizaton to c-"
timeout = int(timeout *1000) if timeout>0 else timeout
pol_mode.write("CIRC -")
if offset is not None:
pol_offset.write(float(offset))
pol_done.waitValue("DONE",timeout)
pol_done.waitValue("DONE",timeout)
print "Done setting x-ray polarization"
def set_pol_lin(angle, offset = None, timeout = -1):
"""
"""
print "Set x-ray polarization to linear"
timeout = int(timeout *1000) if timeout>0 else timeout
pol_mode.write("LINEAR")
pol_angle.write(float(angle))
if offset is not None:
pol_offset.write(float(offset))
pol_done.waitValue("DONE",timeout)
pol_done.waitValue("DONE",timeout)
print "Done setting x-ray polarization"
def set_temp(value, in_position_band = None):
"""
"""
print "Set sample temperature"
temperature.write(float(value))
if in_position_band is None:
in_position_band = temperature.getResolution()
@@ -288,25 +343,39 @@ def set_temp(value, in_position_band = None):
#cawait("X07MA-ES1-TEMP:STATUS", "Stable")
#return
temperature.readback.waitValueInRange(float(value), in_position_band, -1)
time.sleep(600.0) # wait 10min
print "Done setting temperature"
def open_valve(delay = 5.0):
def open_valve(delay = 0.75):
"""
"""
print "Open valve"
valve_try_open.write(1) #TODO: CAPUT
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 5 :
time.sleep(0.1)
# print "Retry open valve"
valve_try_open.write(1)
def close_valve(delay = 0.0): #TODO: Check default delay
def close_valve(delay = 0.5): #TODO: Check default delay
"""
"""
print "Close valve"
valve_try_open.write(0)
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 2 :
time.sleep(0.1)
# print "Retry close valve"
valve_try_open.write(0)
def set_energy (value, delay=0.5):
"""
"""
print "Set energy"
energy.write(float(value))
energy_done.waitValue(1, -1)
energy_done.waitValue(1, -1) # timeout is now 60, was -1
time.sleep(float(delay))
print "Done setting energy"
def set_cff (value):
"""
@@ -324,7 +393,9 @@ def set_slit(value):
def set_har(value):
"""
"""
print "Set harmonic"
harmonic.write(float(value))
print "Done setting harmonic"
#Not connected
def set_volt(keithley, value, delay=0.1):
@@ -339,13 +410,25 @@ def set_volt(keithley, value, delay=0.1):
def set_range(keithley, value):
"""
"""
print "Set Keithley range"
if not keithley in keithleys.keys(): raise Exception("Invalid keithley: " + keithley)
v='10^'+str(value)
while True:
caput(keithleys[keithley][1], v)
time.sleep(1.0)
if caget(keithleys[keithley][2],'s') == v:
break
v='10^'+str(value)
if value==11:
while True:
caput(keithleys[keithley][1], '10^10')
caput(keithleys[keithley][3], '10x')
time.sleep(1.0)
if (caget(keithleys[keithley][2],'s') == '10^10') and (caget(keithleys[keithley][4],'s') == '10x'):
break
else:
while True:
caput(keithleys[keithley][1], v)
caput(keithleys[keithley][3], '1x')
time.sleep(1.0)
if (caget(keithleys[keithley][2],'s') == v) and (caget(keithleys[keithley][4],'s') == '1x'):
break
print "Done setting Keithley range"
def set_fe(opening):
"""
@@ -384,7 +467,9 @@ def wait_temp():
# if (t > 3.7):
# print "Refilling 1K pot..."
# refill_1k()
print "Check temperature"
run("TEMP_wait_fill.py")
print "Temperature OK"
def rampdown():
"""
@@ -407,13 +492,13 @@ def has_beam():
def wait_beam():
"""
"""
print "Waiting for beam..."
print "Waiting for beam... ",
while not has_beam():
if maintenance_mode:
print "Maintenence mode: disregarding beam state"
return
sleep(0.1)
print "Beam OK"
print "Beam OK."
def wait_inj (value, delay=0.5):
"""
@@ -426,8 +511,8 @@ def wait_inj (value, delay=0.5):
def set_file(file_name):
"""
"""
set_exec_pars(name = file_name) #Increment index for each scan, and keep timestamp
#set_exec_pars(name = file_name, reset=True) #Different timestamp for each scan, index set to 0
#set_exec_pars(name = file_name) #Increment index for each scan, and keep timestamp
set_exec_pars(name = file_name, reset=True) #Different timestamp for each scan, index set to 0
class pol_mod(Readable):
def read(self):
@@ -445,7 +530,8 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":alpha})
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})
def hyst_cont(field, init_field, final_field, ramp_speed, energies):
"""
@@ -476,7 +562,7 @@ def scan_e(start, end, step, settling_time = 0, accumulation_time = None, name =
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
detectors = acc.getSensors() + [polmod, pol_angle, temperature.readback, current]
set_preference(Preference.ENABLED_PLOTS, acc.getSensors())
lscan(energy, detectors, float(start), float(end), float(step), latency = settling_time)
lscan(energy, detectors, float(start), float(end), float(step), latency = settling_time, before_read=before_sample, after_read=after_sample)
def scan_e_mult(ranges, settling_time = 0, accumulation_time = None, name = None):
"""
@@ -487,7 +573,7 @@ def scan_e_mult(ranges, settling_time = 0, accumulation_time = None, name = None
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
detectors = acc.getSensors() + [polmod, pol_angle, temperature.readback, current]
set_preference(Preference.ENABLED_PLOTS, acc.getSensors())
rscan(energy, detectors, ranges, latency = settling_time)
rscan(energy, detectors, ranges, latency = settling_time, before_read=before_sample, after_read=after_sample)
#not connected
def scan_v(keithley,start, end, step):
@@ -495,29 +581,35 @@ def scan_v(keithley,start, end, step):
"""
setpoint = Channel (keithleys[keithley][0], 'd')
readback = Channel (keithleys[keithley][2], 'd')
lscan(setpoint, readback, float(start), float(end), float(step), latency = 0.1)
lscan(setpoint, readback, float(start), float(end), float(step), latency = 0.1, before_read=before_sample, after_read=after_sample)
def set_hor(value):
"""
"""
sample_hor.move(value)
print "Set sample horizontal positon"
sample_hor.move(float(value))
print "Done setting horizontal position"
def set_vert(value):
"""
"""
sample_vert.move(value)
print "Set sample vertical position"
sample_vert.move(float(value))
print "Done setting vertical position"
def set_rot(value):
"""
"""
sample_rot.move(value)
sample_rot.move(float(value))
def set_au_mesh(value):
"""
"""
print "Set Au mesh positon"
au_mesh.move(value)
print "Done setting Au mesh"
def write_logs():
set_exec_pars(open = True) #Compensade bug on log function, which should open persistence context
@@ -525,6 +617,7 @@ def write_logs():
log("Cff: " + str(cff.read()))
log("Harm: " + str(harmonic.read()))
log("FE: " + str(aperture.read() ))
log("Au mesh: " + str(au_mesh.read() ))
log("Sample temperature: " + str(temperature.readback.read() ) )
log("Sample coord. HOR; VERT; ROT: " + str(sample_hor.read()) + "; " + str(sample_vert.read()) + "; " + str(sample_rot.read()) )
log("Gain sample: " + str(caget(keithleys["k1"][2])))
+105
View File
@@ -0,0 +1,105 @@
#Tb_hyst
off_cplus = -6.5
off_cminus = -2.5
rrate = 1.0 # ramping speed of mag field
e1 = 1235.8 # energy 1 (usually on edge)
e2 = 1229 # energy 2 (pre edge)
B1 = -4.0 # field span
B2 = -B1
nr_loops = 1 # number of loops to acquire
set_slit(50.0)
set_har(3.0)
set_range('k1', 10)
set_range('k2', 10)
open_valve()
loop_count = 0
while loop_count < nr_loops:
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B1, B2, rrate, [e1,e2])
set_pol_cminus(offset = off_cminus)
set_file('Tb_hyst_minus')
hyst_cont(field_x, B2, B1, rrate, [e1,e2])
set_pol_cminus(offset = off_cminus)
set_file('Tb_hyst_minus')
hyst_cont(field_x, B1, B2, rrate, [e1,e2])
set_pol_cplus(offset = off_cplus)
set_file('Tb_hyst_plus')
hyst_cont(field_x, B2, B1, rrate, [e1,e2])
loop_count = loop_count + 1
print "Loop # ",loop_count," finished."
close_valve()
#XMCD in remanence after -4T
#Fe XMCD
off_plus=-0.5
off_minus=2.0
Estart = 690
Eend = 750
sample_name = 'Fe'
nr_loops=1
set_har(1.0)
set_slit(5.0)
set_range('k1', 9)
set_range('k2', 9)
open_valve()
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=2, delay=5, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
loop_count = loop_count + 1
close_valve()
#Tb XMCD
off_plus=-6.5
off_minus=-2.5
Estart=1215
Eend=1300
sample_name = 'Tb'
nr_loops=2
set_slit(50.0)
set_har(3.0)
set_range('k1', 10)
set_range('k2', 10)
open_valve()
loop_count = 0
while loop_count < nr_loops:
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC +", offset = off_plus, name = sample_name + '_plus')
otf(start=Estart, end=Eend, time=3, delay=10, mode = "CIRC -", offset = off_minus, name = sample_name + '_minus')
loop_count = loop_count + 1
close_valve()
+2 -2
View File
@@ -17,8 +17,8 @@ if (sp<2.0):
t=temperature.readback.read()
if t < 4:
break
print "Wait 5 min ..."
time.sleep(300)
print "Wait 7 min ..."
time.sleep(420)
print "Set needle valve to 0%"
needle.write(0.0)
print "Wait temperature stabilization"
+1 -13
View File
@@ -1,13 +1 @@
#set pol lin 90 off 2.0
#otf 620 670 2 delay 5
#file MnE_lin90
#start
#set_pol_lin(angle = 90, offset = 2.0)
counter = 0
wait_beam()
wait_temp()
print('ttttt')
+3
View File
@@ -0,0 +1,3 @@
tscan(count, 10, 0.1, before_read=before_sample, after_read=after_sample)
+69
View File
@@ -0,0 +1,69 @@
def runInnerScan():
idenergy = int(energy_id.read())
halfwidth = 13.0
step = 1.0
try:
set_exec_pars(range="auto")
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['PGMenergy'], ['I0', 'polarization', 'polangle', 'ringCurrent', 'SetEnergy', 'offset'] , [idenergy-halfwidth], [idenergy+halfwidth], [20])
scan.start()
#Creating channels: dimension 1
#RegionPositioner PGMenergy
PGMenergy = Channel('X07MA-PHS-E:GO.A', type = 'd')
PGMenergyReadback = Channel('X07MA-PGM:CERBK', type = 'd')
#ScalarDetector I0
I0 = Channel('X07MA-ES1-AI:SIGNAL1', type = 'd')
#ScalarDetector polarization
polarization = Channel('X07MA-ID:MODE', type = 'd')
#ScalarDetector polangle
polangle = Channel('X07MA-ID:ALPHA', type = 'd')
ringCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd')
#ScalarDetector SetEnergy
SetEnergy = Channel('X07MA-PHS-E:GO.A', type = 'd')
#ScalarDetector offset
offset = Channel('X07MA-ID:ENERGY-OFFS', type = 'd')
#Dimension 1
#RegionPositioner PGMenergy
for setpoint1 in frange(idenergy-halfwidth, idenergy+halfwidth, step, True):
#TODO: Uncomment me
#PGMenergy.put(setpoint1, timeout=30.) # TODO: Set appropriate timeout
#wait_device(energy_done, 1 )
#sleep( 0.5 ) # Settling time
readback1 = PGMenergyReadback.get()
#if abs(readback1 - setpoint1) > 0.5 : # TODO: Check accuracy
#raise Exception('Actor PGMenergy could not be set to the value ' + str(setpoint1))
#Detector I0
detector2 = I0.get()
#Detector polarization
detector3 = polarization.get()
#Detector polangle
detector4 = polangle.get()
#Detector ringCurrent
detector6 = ringCurrent.get()
#Detector SetEnergy
detector7 = SetEnergy.get()
#Detector offset
detector10 = offset.get()
scan.append ([setpoint1], [readback1], [detector2, detector3, detector4, detector6, detector7, detector10])
#Closing channels
PGMenergy.close()
PGMenergyReadback.close()
I0.close()
polarization.close()
polangle.close()
ringCurrent.close()
SetEnergy.close()
offset.close()
scan.end()
return scan.getResult()
except:
print("Aborting...")
raise
+5 -5
View File
@@ -92,16 +92,16 @@ while(True):
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
tey_norm = detector1/detector2
trans_norm = detector3/detector2
_tey_norm = detector1/detector2
_trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = tey_norm
first = _tey_norm
else:
dif = tey_norm-first
dif = _tey_norm-first
dif_series.appendData(field_readback,dif)
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm])
#if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
if abs(field_readback - END_FIELD) < 0.007:
print "Field has reached target, breaking execution."
+5 -5
View File
@@ -103,16 +103,16 @@ while(True):
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
tey_norm = detector1/detector2
trans_norm = detector3/detector2
_tey_norm = detector1/detector2
_trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = tey_norm
first = _tey_norm
else:
dif = tey_norm-first
dif = _tey_norm-first
dif_series.appendData(field_readback,dif)
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm])
#if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
if abs(field_readback - END_FIELD) < 0.007:
print "Field has reached target, breaking execution."
+6 -6
View File
@@ -126,25 +126,25 @@ while(True):
#Variable Mappings
#TODO: Move, if needed, this import to the file header: import math
tey_norm = detector1/detector2
_tey_norm = detector1/detector2
#Manipulation trans_norm
#Variable Mappings
#TODO: Move, if needed, this import to the file header: import math
trans_norm = detector3/detector2
_trans_norm = detector3/detector2
if dif_series is not None:
if setpoint2 == ENERGIES[0]:
first = tey_norm
first = _tey_norm
else:
dif = tey_norm-first
dif = _tey_norm-first
dif_series.appendData(field_readback,dif)
#print [field_readback, setpoint2]
#print [field_readback, readback2]
#print [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm]
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
#print [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm]
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, _tey_norm, _trans_norm])
#print "Field = " + str(fieldReadback.get())
+24
View File
@@ -0,0 +1,24 @@
set_exec_pars(layout="table")
tag_prefix=get_context().setup.expandPath("{date}_{hour}{min}")
index=0
def calc():
global index
index += 1
ret= tscan(field_x, 10, 0.1, tag=tag_prefix+"_raw_{index}")
#ret= tscan(sin, 10, 0.1)
v = max(ret.getReadable(0))
return float(v)
class PseudoDev(Readable):
def read(self):
return calc()
d= PseudoDev()
ret= tscan(d, 5, 1.0, tag=tag_prefix+"_output")
#ret= lscan(inp, (d), 0, 40, 5, 0.2)
+7
View File
@@ -0,0 +1,7 @@
for i in range(1000):
for channel in ["X07MA-ES1-AI:SIGNAL0", "X07MA-ES1-AI:SIGNAL1", "X07MA-ID:MODE", "X07MA-ID:ALPHA", \
"X07MA-PC-TC:STS:T1", "ARIDI-PCT:CURRENT", \
"X07MA-PHS-E:GO.A", "X07MA-ES1-AI:SIGNAL2" ]:
print channel
print caget(channel)

Some files were not shown because too many files have changed in this diff Show More