Summer 2021

This commit is contained in:
gac-x07ma
2021-09-01 10:22:59 +02:00
parent 99bca0bd79
commit ca26181ed4
94 changed files with 2062 additions and 315 deletions
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+39 -24
View File
@@ -1,41 +1,56 @@
#Tue Aug 11 09:21:15 CEST 2020
hostName=null
userManagement=false
imageSourcesFile={config}/imaging.properties
instanceName=
#Tue Aug 31 09:45:29 CEST 2021
autoSaveScanData=true
simulation=false
dataServerPort=-1
hideServerMessages=false
dataScanSaveOutput=false
userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\://d.psi.ch | d.psi.ch | users.psi
dataScanSaveScript=false
notifiedTasks=null
parallelInitialization=false
dataTransferPath=
scanStreamingPort=-1
saveConsoleSessionFiles=false
devicePoolFile={config}/devices.properties
hostName=null
disableEmbeddedAttributes=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=fda
disableDataFileLogs=false
sessionHandling=Files
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=true
notificationLevel=Error
userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\://d.psi.ch | d.psi.ch | users.psi
logLevelConsole=Off
notificationLevel=Off
terminalPort=3579
tasksFile={config}/tasks.properties
dataTransferUser=
versionTrackingLogin={context}/svcusr-hlapp_robot
scriptType=py
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07ma.git
imageSourcesFile={config}/imaging.properties
commandExecutionEvents=false
logDaysToLive=50
logLevelConsole=Off
filePermissionsConfig=Public
scanStreamerPort=-1
dataScanSaveSetpoints=false
parallelInitialization=false
scanStreamingPort=-1
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
devicePoolFile={config}/devices.properties
scriptType=py
versionTrackingManual=true
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07ma.git
dataTransferMode=Off
userManagement=false
instanceName=X07MA
dataServerPort=-1
hideServerMessages=false
dataScanReleaseRecords=false
dataScanPreserveTypes=false
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
filePermissionsLogs=Default
filePermissionsScripts=Public
tasksFile={config}/tasks.properties
filePermissionsData=Default
createSessionFiles=false
dataProvider=fda
saveCommandStatistics=false
Regular → Executable
View File
Regular → Executable
+21 -9
View File
@@ -1,7 +1,9 @@
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|||
TControl=ch.psi.pshell.epics.ChannelInteger|X07MA-ES1-TEMP:CONTROL|||false
Hall_probe=ch.psi.pshell.epics.ChannelDouble|X07MA-XTR-MAGFIELDX:UH|Read||false
gold_mesh=ch.psi.pshell.epics.Motor|X07MA-OP-IO1:TR1|||false
gold_mesh2=ch.psi.pshell.epics.Motor|X07MA-OP-IO2:TR1|||false
current=ch.psi.pshell.epics.ChannelDouble|ARIDI-PCT:CURRENT|Read||true
energy_id=ch.psi.pshell.epics.ChannelDouble|X07MA-ID:ENERGY|||true
count=ch.psi.pshell.epics.ChannelInteger|COUNT|Read||true
data=ch.psi.pshell.epics.ChannelDoubleArray|DATA 6|Read||
edata=ch.psi.pshell.epics.ChannelDoubleArray|EDATA 6|Read||
@@ -21,16 +23,17 @@ pol_done=ch.psi.pshell.epics.ChannelString|X07MA-ID:DONE|Read||true
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:RAMP-MAX X07MA-ES1-IPS:RAMP-MAX|||true
sample_hor=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRZ1|||true
#sample_hor_mot=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRZ1|||true
sample_hor=ch.psi.pshell.epics.Positioner|X07MA-ES1-MAG:TRZS.VAL X07MA-ES1-MAG:TRZS.RBV|||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=ch.psi.pshell.epics.ChannelDouble|X07MA-PHS-E:GO.A|||true
energy_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:CERBK|Read||true
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
@@ -41,9 +44,18 @@ 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
#signal_diode_electro=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI10:READOUT|Read||true
CADC1=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL0|Read||true
CADC2=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL1|Read||true
CADC3=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL2|Read||true
CADC4=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL3|Read||true
CADC5=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL4|Read||true
adc6=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL5|Read||true
adc7=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL6|Read||true
FieldX=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-MAG:X:RBV|Read||true
FieldZ=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-MAG:Z:RBV|Read||true
Temperature=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:STS:T1|Read||true
Ecrbk=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:CERBK|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|||
Regular → Executable
+14 -10
View File
@@ -1,16 +1,20 @@
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
Al=1545.0;1610.0;3.0;0.0;-7.0;-1.5;0.0;0.0
C=250.0;350.0;2.0;0.0;0.0;0.0;0.0;0.0
Ce=870.0;910.0;2.0;0.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
Cr=565.0;595.0;3.0;5.0;-0.5;1.0;5.6;0.6
Co=760.0;820.0;3.0;0.0;0.0;2.0;0.0;0.0
Cr=565.0;595.0;3.0;0.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
Er=1380.0;1470.0;3.0;0.0;-9.0;-4.0;3.0;3.0
Eu=1110.0;1170.0;3.0;0.0;0.0;0.0;0.0;0.0
Fe=690.0;755.0;2.0;0.0;0.0;2.0;2.0;2.0
Ge=1207.0;1280.0;2.0;0.0;0.0;0.0;0.0;0.0
La=825.0;865.0;3.0;5.0;0.0;0.0;0.0;0.0
Mn=630.0;685.0;2.0;0.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
Sm=1070.0;1125.0;3.0;0.0;0.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
Ta=1700.0;1820.0;3.0;0.0;-11.0;-5.5;4.0;4.0
Tb=1215.0;1300.0;3.0;0.0;-7.5;-3.5;0.0;0.0
Ti=450.0;485.0;2.0;0.0;0.0;2.0;2.0;2.0
V=500.0;535.0;2.0;0.0;0.0;0.0;0.0;0.0
Regular → Executable
View File
+18
View File
@@ -1,7 +1,25 @@
F=695.0
Gd=1189.0
Ba=790.0
C=280.0
Ce=890.0
Co=780.0
Cr=580.0
Cu=940.0
Dy=1310.0
Er=1400.0
Eu=1150.0
Fe=705.0
Ge=1230.0
Ho=1360.0
La=840.0
Mn=641.0
N=410.0
Ni=852.0
O=543.0
Sm=1110.0
V=520.0
W_M45=1850.0
Tb=1250.0
Ti=460.0
Zn=1020.0
+82 -24
View File
@@ -1,25 +1,83 @@
#Fri Jul 10 10:28:13 CEST 2020
V-C-=1.0 06.07.20 08\:57
V-LV=2.5 06.07.20 09\:09
Er-C+=-4.5 04.07.20 17\:02
Er-C-=-1.5 04.07.20 17\:06
Er-LV=7.0 04.07.20 17\:12
Dy-C+=-4.5 05.07.20 22\:04
Dy-C-=-1.5 05.07.20 22\:05
Dy-LV=6.0 05.07.20 12\:53
Dy-LH=6.0 05.07.20 12\:51
Cr-C+=0.0 06.07.20 16\:36
Fe-LH=2.5 10.07.20 10\:28
Ce-LV=4.5 09.07.20 19\:03
Cr-C-=1.5 06.07.20 16\:42
Sm-LH=4.5 09.07.20 17\:20
Fe-C-=2.0 05.07.20 22\:58
Fe-LV=3.5 10.07.20 10\:25
V-LH=2.5 06.07.20 09\:07
V-C+=0.0 06.07.20 08\:56
Ce-LH=5.0 09.07.20 18\:39
#Tue Aug 31 22:33:17 CEST 2021
Ni-C+=1.0 31.08.21 22\:27
W_M45-C-=1.0 26.04.21 15\:51
Cu-C-=4.0 18.08.21 09\:09
Cu-C+=3.0 18.08.21 09\:07
Zn-LV=-8.0 19.04.21 10\:05
V-C-=0.5 19.08.21 20\:31
Ni-C-=2.0 31.08.21 22\:30
Ho-C+=-5.0 08.03.21 00\:56
Co-LV=3.5 20.08.21 11\:56
Al-LV=-10.0 19.04.21 09\:56
Er-LV=6.0 24.04.21 13\:44
Gd-C-=-1.0 12.06.21 18\:19
Gd-C+=-4.5 12.06.21 18\:22
Ti-LV=2.0 16.08.21 14\:38
Dy-C+=-4.5 05.03.21 15\:58
Dy-C-=-1.0 27.01.21 02\:56
Ho-C-=0.0 08.03.21 00\:57
Eu-LH=5.0 06.11.20 15\:11
O-LH=2.5 23.06.21 10\:43
Cr-LH=2.3 23.09.20 13\:31
W_M45-C+=-1.0 26.04.21 15\:49
Cr-C+=0.0 11.06.21 13\:17
O-C+=-0.5 19.04.21 09\:41
Fe-LH=2.5 31.08.21 17\:44
Eu-LV=6.5 22.10.20 15\:02
Tb-C-=-1.5 21.06.21 09\:51
W-C-=1.0 22.04.21 09\:51
Tb-C+=-5.0 28.08.21 20\:19
Ce-C-=3.5 20.08.21 14\:20
Cr-C-=1.5 11.06.21 13\:18
O-C-=1.5 19.04.21 09\:43
Ce-C+=2.5 20.08.21 14\:23
Ge-LV=6.0 09.09.20 14\:22
Fe-LV=3.0 31.08.21 17\:45
Zn-LH=4.5 01.06.21 21\:25
V-C+=-1.0 19.08.21 09\:43
Sm-C+=-5.0 20.08.21 14\:29
Mn-C-=2.0 15.08.21 20\:37
Mn-C+=-0.5 19.08.21 20\:32
Ge-LH=6.0 09.09.20 14\:19
Sm-C-=-1.5 08.09.20 21\:19
Co-LH=3.5 20.08.21 11\:57
Cu-LV=6.0 23.06.21 13\:14
Zn-C-=10.0 19.04.21 10\:02
V-LV=3.0 28.06.21 10\:08
Ni-LV=3.0 31.08.21 22\:33
Zn-C+=7.5 19.04.21 09\:59
Er-C+=-4.0 18.10.20 10\:34
Co-C-=2.5 20.08.21 12\:03
Er-C-=3.0 17.10.20 10\:50
Co-C+=1.0 20.08.21 11\:59
Ho-LH=7.0 11.03.21 02\:17
C-LV=2.5 06.05.21 03\:41
N-LV=2.0 23.06.21 13\:11
Ti-C+=-0.5 05.05.21 11\:55
Ti-C-=0.5 05.05.21 12\:01
Ni-LH=3.0 31.08.21 22\:32
W-C+=-0.5 22.04.21 09\:53
Dy-LV=6.0 30.01.21 18\:02
Ho-LV=7.0 11.03.21 02\:19
C-LH=2.0 06.05.21 03\:39
Ge-C+=-5.0 09.09.20 14\:23
Dy-LH=6.5 05.03.21 23\:04
Ti-LH=2.0 16.08.21 14\:34
Eu-C-=-0.5 21.04.21 17\:18
Mn-LH=2.5 19.08.21 20\:35
Eu-C+=-5.0 21.04.21 17\:20
Ce-LV=4.0 20.08.21 14\:27
Sm-LH=4.0 20.08.21 10\:55
O-LV=2.5 23.06.21 10\:42
Ge-C-=0.0 09.09.20 14\:24
Fe-C-=1.5 31.08.21 20\:44
Cu-LH=6.5 23.06.21 13\:15
V-LH=3.0 28.06.21 10\:06
Ce-LH=4.5 20.08.21 14\:25
Mn-LV=2.5 15.08.21 20\:31
Er_C+=-4.3 30.06.20 21\:58
Er-LH=6.5 04.07.20 17\:10
Sm-C-=-2.0 09.07.20 17\:19
Sm-LV=5.0 09.07.20 19\:11
Fe-C+=1.0 04.07.20 10\:01
Al-LH=10.0 19.04.21 09\:55
Er-LH=6.0 24.04.21 13\:43
Sm-LV=4.0 20.08.21 10\:57
Fe-C+=-0.5 31.08.21 20\:45
N-LH=2.0 23.06.21 13\:08
Regular → Executable
+2 -2
View File
@@ -1,4 +1,4 @@
#Tue Aug 21 18:28:14 CEST 2018
#Fri Aug 13 15:30:22 CEST 2021
ch.psi.jcae.ContextFactory.maxArrayBytes=10000000
ch.psi.jcae.ChannelFactory.timeout=2000
ch.psi.jcae.ChannelFactory.retries=1
@@ -13,6 +13,6 @@ ch.psi.jcae.impl.DefaultChannelService.retries=4
ch.psi.jcae.ContextFactory.addressList=
ch.psi.jcae.ContextFactory.serverPort=
ch.psi.jcae.ContextFactory.autoAddressList=true
ch.psi.jcae.ContextFactory.useShellVariables=false
ch.psi.jcae.ContextFactory.useShellVariables=true
ch.psi.jcae.ContextFactory.addLocalBroadcastInterfaces=false
ch.psi.jcae.ContextFactory.maxSendArrayBytes=
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
+11
View File
@@ -0,0 +1,11 @@
#Tue Aug 31 11:31:23 CEST 2021
environment=prod
testParameters=-testenv -user slssim\:slssim
sourceFolder=/sls/X07MA/Data1/x07maop
prodParameters=\ -user slssim\:slssim
devParameters=-devenv -user slssim\:slssim
ownerGroup=P1000
type=raw
parameters=-ingest -allowexistingsource -noninteractive -autoarchive
creationLocation=/PSI/SLS/XTREME
principalInvestigator=
+6
View File
@@ -0,0 +1,6 @@
#Tue Aug 31 11:08:32 CEST 2021
Sample=String
keywords=List;[]
owner=String;Cinthia Piamonteze
ownerEmail=String;cinthia.piamonteze@psi.ch
contactEmail=String;cinthia.piamonteze@psi.ch
+2
View File
@@ -0,0 +1,2 @@
#Tue Aug 31 11:40:30 CEST 2021
SessionCounter=3
+2 -2
View File
@@ -1,2 +1,2 @@
#Tue Aug 11 09:21:16 CEST 2020
FdaBrowser=true
#Tue Aug 31 15:35:20 CEST 2021
FdaBrowser=false
Regular → Executable
+14 -11
View File
@@ -1,22 +1,25 @@
#Fri Sep 20 16:53:43 CEST 2019
#Tue Apr 06 11:52:39 CEST 2021
scriptPath={home}/script
sessionsPath={home}/sessions
configFileImageSources={config}/imaging.properties
pluginsPath={home}/plugins
sessionsPath={outp}/sessions
configFileDevices={config}/devices.properties
libraryPath={script}; {script}/Lib
configFilePlugins={config}/plugins.properties
contextPath={home}/context
extensionsPath={home}/extensions
configFileUpdateStrategy={config}/update.properties
configPath={home}/config
configFileSessions={config}/sessions.properties
userSessionsPath={sessions}/user
dataPath=/sls/X07MA/data/x07maop/Data1
devicesPath={home}/devices
configFileVariables={config}/variables.properties
configFileSettings={config}/settings.properties
logPath={home}/log
logPath={outp}/log
wwwPath={home}/www
configFile={config}/config.properties
configFileTasks={config}/tasks.properties
configFileImageSources={config}/imaging.properties
pluginsPath={home}/plugins
consoleSessionsPath={sessions}/console
libraryPath={script}; {script}/Lib
configFilePlugins={config}/plugins.properties
contextPath={outp}/context
devicesPath={home}/devices
configFileSettings={config}/settings.properties
imagesPath={outp}/images
scriptType=py
configFileTasks={config}/tasks.properties
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
+5 -2
View File
@@ -1,2 +1,5 @@
#Mon Aug 10 00:23:04 CEST 2020
FileSequentialNumber=5831
#Wed Sep 01 10:20:33 CEST 2021
LastRunDate=210901
SessionCounter=0
FileSequentialNumber=13754
DaySequentialNumber=14
+10
View File
@@ -0,0 +1,10 @@
#Tue Mar 02 15:06:37 CET 2021
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
resolution=NaN
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
View File
Regular → Executable
View File
Regular → Executable
View File
+4 -12
View File
@@ -1,18 +1,10 @@
#Fri Sep 20 16:53:49 CEST 2019
#Thu Jul 15 14:09:19 CEST 2021
offset=0.0
maxValue=170.0
precision=6
rotation=false
precision=6
scale=1.0
estbilizationDelay=0
maxSpeed=NaN
resolution=6.23E-4
homingType=None
startRetries=1
minValue=98.0
resolution=0.001
minValue=93.0
unit=mm
defaultSpeed=0.5
hasEnable=true
sign_bit=0
monitorByPosition=false
minSpeed=0.02
+18
View File
@@ -0,0 +1,18 @@
#Fri Sep 25 13:46:30 CEST 2020
precision=6
scale=1.0
estbilizationDelay=0
resolution=6.23E-4
minValue=93.0
defaultSpeed=0.5
sign_bit=0
monitorByPosition=false
minSpeed=0.02
offset=0.0
maxValue=170.0
rotation=false
maxSpeed=NaN
homingType=None
startRetries=1
unit=mm
hasEnable=true
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+1 -1
View File
@@ -234,7 +234,7 @@ public class EnergyScan extends Panel {
args.put("FOLDER", folder);
buttonAbort.setEnabled(true);
runAsync("EnergyScan", args).handle((ok, ex) -> {
runAsync("EnergyScan_v2", args).handle((ok, ex) -> {
try{
buttonAbort.setEnabled(false);
if (ex != null) {
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Binary file not shown.
+9 -6
View File
@@ -93,11 +93,11 @@ def getNewestFile():
except:
return None
newest = getNewestFile()
#print "newest = ",newest
print "former newest = ",newest
#Pre-actions
if NO_BEAM_CHECK == False:
print "Wait beam"
wait_beam()
@@ -108,6 +108,7 @@ if MODE is not None:
if ALPHA is not None:
pol_angle.write(ALPHA)
time.sleep(0.5) # TIME SLEEP IS NECESSARY. OTHERWISE NEXT COMMAND WILL NOT WAIT FOR POLARIZATION SETTING. ADDED BY CP ON 07.02.2020
pol_done.update()
wait_device(pol_done, "DONE") # Oct. 2019 added wait to try avoid taper error
print "Polarization setting done"
@@ -166,7 +167,7 @@ time.sleep(DELAY)
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
print "\nStart otf" # for debug
try:
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
@@ -205,17 +206,18 @@ try:
#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 "new file: ", name
# print "newest file:"
# print name
#print "newest variable"
#print newest
# print "newest variable"
# print newName
#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):
if (name is None) or (not os.path.isfile(name)):
raise Exception("Data file not found: " + name)
convert_file(name, newName)
@@ -225,6 +227,7 @@ try:
#print("Success")
#"PlotDomain", "Ecrbk"
except:
print sys.exc_info()
print("Aborting...")
while caget('START') == 'START':
caput('START', '0')
+134
View File
@@ -0,0 +1,134 @@
'''
#Parameters
E1 = 630
E2 = 685
TIME = 1 #min
DELAY = 0.0 #s
MODE = 'LINEAR' #'CIRC +'
OFFSET = None
FOLDER = '2021_03/20210330'
FILE = 'Test'
ALPHA=0 #None
'''
set_exec_pars (reset=True)
print "\nStart energy scan..."
#print E1,E2,TIME,DELAY,str(MODE) ,str(OFFSET) ,str(FOLDER) ,str(FILE) ,str(ALPHA)
if MODE == "LINEAR":
print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE),str(ALPHA),"deg"
else:
print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE)
folder = os.path.expanduser("~/Data1/") + FOLDER + "/";
set_exec_pars(name= FILE)
#Pre-actions
if NO_BEAM_CHECK == False:
print "Wait beam"
wait_beam()
if MODE is not None:
print "Set polarization"
pol_mode.write(MODE)
if MODE == 'LINEAR':
if ALPHA is not None:
pol_angle.write(ALPHA)
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")
energy.write(float(E1)) # no need to add wait command. This commands sets and waits.
print "Energy setting done"
caput('X07MA-PGM:CERBK.N',10) # set energy readback averaging to 10 pts
caput('E1', E1)
caput('E2', E2)
caput('TIME', TIME)
#caput('FOLDER', FOLDER)
caput('FOLDER', "OTF/" + FOLDER)
caput('FILE', FILE)
time.sleep(0.1)
#open_valve()
#open_valve(0.0) #TODO: WHY WRITING AGAIN???
time.sleep(DELAY)
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
scan_completed = False
try:
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
caput('START', '1')
write_logs()
waiting = True
class Time(Readable):
def __init__(self):
self.start = time.time()
def read(self):
return time.time()-self.start
class NORMtey(Readable):
def read(self):
return float(CADC1.take())/float(CADC2.take())
class NORMdiode(Readable):
def read(self):
return float(CADC3.take())/float(CADC2.take())
pol = pol_angle if (pol_mode.readback.read() == "LINEAR") else pol_mode #Fixed, should be an attribute, not a column
sensors = [Ecrbk, CADC1, CADC2, CADC3,CADC4,CADC5,current,Time(),FieldX,FieldZ,pol, Temperature, NORMtey(), NORMdiode()]
def monitoring_task():
global scan_completed
time.sleep(1.0)
try:
plot_titles = ["TEY raw", "I0", "diode_raw", "TEY_norm", "diode_norm"]
for index, title in enumerate(plot_titles, start=0): get_plots()[index].title = title
except:
pass
wait_channel('START', 'STOP', type = 's')
scan_completed = True
get_exec_pars().currentScan.abort()
ret = fork(monitoring_task)
current.alias="MCurr"
pol.alias="Pol"
print "Scanning...",
try:
mscan(Ecrbk, sensors, -1, None, range="auto", domain_axis="Ecrbk", enabled_plots = ["NORMtey", "NORMdiode", CADC1,CADC3, CADC2], )
finally:
ret[0].cancel(True)
current.alias=None
pol.alias=None
#time.sleep(2.0)
print "Finished Energy scan."
if after_sample(): #Repeat if id error
break
except:
if not scan_completed:
print sys.exc_info()
print("Aborting...")
while caget('START') == 'START':
caput('START', '0')
time.sleep(0.1)
#if get_exec_pars().source != CommandSource.plugin:
# show_message(str(ex))
raise
+24 -14
View File
@@ -1,23 +1,33 @@
#####################
## INPUT PARAMETERS##
POS_START = 157 #Minn = 150.0
POS_END = 163 #Max = 170.0
POS_STEP = 0.05
POS_START = 156.0 #Minn = 150.0
POS_END = 162 #Max = 170.0
POS_STEP = 0.25
SETTLING_TIME = 0.1
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [774. 0] # Co
#ENERGIES = [577.0, 573.0] # Cr
#ENERGIES = [573.0, 577.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 = [931.7]# 925.0 ] # Cu
#ENERGIES = [928.4] #Cu
#ENERGIES = [928.4, 707.5] #Cu Fe, special
#ENERGIES = [572.0]
#ENERGIES = [706]#,708.3,704.0] # Fe
#ENERGIES = [851.3 ,845]#[851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [776.9,774] # Co
#ENERGIES = [642.0,630.0] # Mn
ENERGIES = [1067, 1076 ] # Sm
ENERGIES = [639.5,630.0] # Mn
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [516.0, 503.0] # V
#ENERGIES = [510.0] # V
#ENERGIES = [1234.5, 1225 ] # Tb
#ENERGIES = [706.6, 704] # Fe metal
#ENERGIES = [706.6,706.6]
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
@@ -46,14 +56,14 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
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")
ret= lscan(sample_hor,sensors, POS_START, POS_END, POS_STEP, latency = SETTLING_TIME, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()
+57 -29
View File
@@ -1,28 +1,47 @@
#####################
## INPUT PARAMATERS##
#open_valve()
POS_START = 106 #Min = 98.0
POS_END = 110 #Max = 118.0
POS_STEP = 0.5
#X07MA-ES1-SHUTTER:TRZ1.VAL
#POS_START = 107 #Min = 98.0
#POS_START = 106
#POS_END = 116
#POS_END = POS_START + 6 #Max = 118.0
#caput("X07MA-ES1-SHUTTER:TRZ1.VAL", POS_START - 108.0 + 40.5)
POS_START = 108.5 #Min = 98.0
POS_END = 110.5 #Max = 118.0
POS_STEP = 0.01
SETTLING_TIME = 0.0
#caput("X07MA-ES1-SHUTTER:TRZ1.VAL", POS_START - 108.0 + 40.5)
#36: 106.25
#37: 106.75
#ENERGIES = [929.31]
#"""
#POS_START =108 #Min = 98.0
#POS_END = 115
#POS_START =105 #Min = 98.0
#POS_END = 111
#Max = 118.0
#POS_STEP = 0.1
#"""
#ENERGIES = [458.4,454] #Ti
#ENERGIES = [285.3, 280.0]# C
#ENERGIES = [1030,1015] #Zn
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [1030] #Zn
#ENERGIES = [1344.5, 1338] # Ho edge, pre-edge
#ENERGIES = [1289.5, 1280] # Dy edge, pre-edge
#ENERGIES = [459.5,455] #Ti
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [260.0]# C
#ENERGIES = [285.2,280]# C
#ENERGIES = [280.0]# C
#ENERGIES = [300.0, 280]# C
#ENERGIES = [395,390] #Mo
#ENERGIES = [780.0,777.0]
#ENERGIES = [397.6, 395.0] # N
#ENERGIES = [397.8, 395.0] # N
#ENERGIES = [410] # N
#ENERGIES = [385.0]# C
#ENERGIES = [570.0,576.3] #Cr
#ENERGIES = [1850, 1820]# Si
@@ -30,19 +49,20 @@ POS_STEP = 0.5
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [399.1,392] # TCNQ
#ENERGIES = [700] #Ti
#ENERGIES = [642.0,630.0] # Mn
#ENERGIES = [638.8,633.0] # Mn
#ENERGIES = [463,457]
#ENERGIES = [637.8,638.9,640.1,636.0] # Mn
#ENERGIES = [700.0,708.5] # Fe
#ENERGIES = [928.4, 925] #Cu
#ENERGIES = [931.7, 925] #Cu
#ENERGIES = [929.3] #Cu
#ENERGIES = [638.8,636.6] # Mn
#ENERGIES = [707., 704.] # Fe
#ENERGIES = [708.3]
ENERGIES = [928.4] #CuO
#ENERGIES = [927, 929] #Cu
#ENERGIES = [929.5, 925] #Cu
#ENERGIES = [927, 929] #Cu
#ENERGIES = [928.5, 931] #CuGly special
#ENERGIES = [402, 397] # Ta
#ENERGIES = [777.3,774] # Co
#ENERGIES = [777., 774.0] # Co
#ENERGIES = [783.15,774] # Ba
#ENERGIES = [778] # Co
#ENERGIES = [848.5, 845] # La
#ENERGIES = [848.5, 842] # La
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1234.5, 1225 ] # Tb
#ENERGIES = [976, 970] # Nd
@@ -58,26 +78,34 @@ POS_STEP = 0.5
#ENERGIES = [1563.0,1555.0] # Al
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [931.7, 925.0] # Cu metal
#ENERGIES = [928.4 ] # Cu1
ENERGIES = [708.3, 700.0] # Fe
#ENERGIES = [920.0 ] # Cu1
#ENERGIES = [708.6, 704] # Fe
#ENERGIES = [706.6, 704] # Fe metal
#ENERGIES = [706.6]
#ENERGIES = [352, 340.0] # Ca
#ENERGIES = [1125.4, 1120] # Eu
#ENERGIES = [696.7, 680.0] # F
#ENERGIES = [692.0] # F
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1289, 1280] # Dy edge
#ENERGIES = [1289.5, 1282.0] # Dy
#ENERGIES = [660.0, 665.0] # In
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [1125.6]# Eu
#ENERGIES = [850.9, 849 ] # Ni
#ENERGIES = [516, 503] # V
#ENERGIES = [850.9, 842] # Ni
#ENERGIES = [517.5, 510] # V
#ENERGIES = [1455,1420] # Se
#ENERGIES = [1181.0,1173.0]
#ENERGIES = [285.1, 280.0]# C
#ENERGIES = [285.3, 280.0]# C
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [368, 367 ] # Ag
#ENERGIES = [1650.0]
#####################
#set_har(1.0)
open_valve()
sensors = [tey_norm,signal_tey, signal_i0, signal_trans, trans_norm, sample_vert, energy_readback]
#sensors = [signal_field_analog_z,signal_tey, signal_i0, signal_trans, trans_norm, sample_vert, energy_readback]
#TODO: #Why must set range to "auto"?
'''
@@ -98,7 +126,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
@@ -106,7 +134,7 @@ def before_pass(pass_num):
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")
ret= lscan(sample_hor,sensors, POS_START, POS_END, POS_STEP, latency = SETTLING_TIME, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
#if name is None:
# name=get_scan_filename()
+45 -4
View File
@@ -12,6 +12,7 @@ OFFSET = -1.0
iPS = False # false for old power supply, True for new (Oxford Instr) supply
#ramp_lohi = "HIGH" # only needed for modulation of ramping speed around 0 T. if not needed then comment out.
#close_shutter_at_zero = False # True to close shutter during B field scan when it is close to 0 T
#signal_field_analog_x
@@ -35,7 +36,7 @@ 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')
#caputq('X07MA-PC:CSCALER.INPB', '1')
# open shutter
caput('X07MA-FE-PH1:CLOSE4BL',1)
@@ -73,7 +74,7 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
caput("X07MA-PC-MAG:X:DMD",float(START_FIELD))
if field_done is None:
#ramp_rate.write(2.0)
ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
time.sleep(1.0)
caput("X07MA-ES1-IPS:ACTION", 1)
@@ -84,8 +85,35 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
time.sleep(0.1)
print "Done waiting"
else:
# OLD AND PRONE TO HANG
#time.sleep(3.0)
#wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# NEW, copied from hystscan_esr, april 2021
time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field.readback.read() - START_FIELD
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
time.sleep(5.0)
difference = field.readback.read() - START_FIELD
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference
#wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
#open_valve(2.0)
@@ -108,6 +136,7 @@ wait_device(pol_done, "DONE")
if RAMP_RATE is not None:
print ("ramp rate:",RAMP_RATE)
ramp_rate.write(RAMP_RATE)
ramp_rate.waitInPosition(RAMP_RATE,10000)
@@ -142,7 +171,19 @@ while(True):
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
#Detector field readback
field_readback = field.readback.read() #fieldReadback.get()
'''
############## this part is needed for field modulation at around 0 T (reduce ramp rate) (Jan)
if ramp_lohi is not None:
print("ramp_lohi is not NONE")
if abs(field_readback) < 0.25 and ramp_lohi == "HIGH":
ramp_rate.write(0.5) # for B fields less than abs() < 0.25 T the ramp rate is lowered to 0.2 T/min
ramp_lohi = "LOW"
if abs(field_readback) >= 0.25 and ramp_lohi == "LOW":
ramp_rate.write(RAMP_RATE)
ramp_lohi = "HIGH"
###############################################################################################
'''
detector1 = signal_tey.read() #TEY.get()
detector2 = signal_i0.read() #I0.get()
detector3 = signal_trans.read() #trans.get()
+34 -3
View File
@@ -7,7 +7,14 @@ ENERGY_CHANGE_SLEEP = 0.5
MODE = 'CIRC +'
OFFSET = -1.0
'''
"""
FIELD = field_x
RANGES =[(B1, B2, rr1),(B2,-B2,rr2),(-B2,-B1,rr1)]
ENERGIES = [E1,E2]
ENERGY_CHANGE_SLEEP = 0.5
MODE =None
OFFSET=None
"""
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
@@ -23,7 +30,7 @@ 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')
#caputq('X07MA-PC:CSCALER.INPB', '1')
if len(ENERGIES) ==2:
dif_series = plot([],"Dif", title="Dif")[0].getSeries(0)
@@ -59,8 +66,32 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
time.sleep(0.1)
print "Done waiting"
else:
# OLD AND PRONE TO HANG
#time.sleep(3.0)
#wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# NEW, copied from hystscan_esr, april 2021
time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field.readback.read() - START_FIELD
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
time.sleep(5.0)
difference = field.readback.read() - START_FIELD
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference
+3 -2
View File
@@ -21,7 +21,7 @@ if MODE is not None:
if OFFSET is not None:
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
pol_done.waitValue("DONE", -1)
wait_device(pol_done,"DONE", -1)
setpoints = []
for r in RANGES:
@@ -54,7 +54,8 @@ for setpoint1 in setpoints:
sleep(15.0)
"""
field_x.write(setpoint1)
field_x.readback.waitValueInRange(setpoint1,FIELD_PRECISION,300000)
#field_x.readback.waitValueInRange(setpoint1,FIELD_PRECISION,300000)
wait_device_in_range(field_x.readback, setpoint1, FIELD_PRECISION, 300.0)
readback1 = field.getPosition()
#print readback1
+93 -37
View File
@@ -35,7 +35,7 @@ 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')
#caputq('X07MA-PC:CSCALER.INPB', '1')
# open shutter
caput('X07MA-FE-PH1:CLOSE4BL',1)
@@ -54,12 +54,15 @@ if len(ENERGIES) ==2:
else:
dif_series = None
set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'ADC3','ADC4','ADC7','ADC6'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'ADC3':1, 'ADC4':1, 'ADC7':1, 'ADC6':1})
set_preference(Preference.DOMAIN_AXIS, 'Time')
field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
field_var,'ESR_extrachannel', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'ADC3', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
field_var,'ADC4','ADC7','ADC6', 'tey_norm','trans_norm','Time'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
# field_var,'ESR_extrachannel', 'tey_norm','trans_norm', 'fieldX' ,'fieldZ'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan.start()
write_logs()
@@ -67,7 +70,9 @@ write_logs()
print "Waiting for start field"
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
time.sleep(1.0)
ramp_rate.write(2.0)
time.sleep(1.0)
field.write(START_FIELD)
if iPS == True:
caput("X07MA-PC-MAG:X:DMD",float(START_FIELD))
@@ -85,7 +90,24 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
print "Done waiting"
else:
time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field.readback.read() - START_FIELD
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
time.sleep(5.0)
difference = field.readback.read() - START_FIELD
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference
#open_valve(2.0)
@@ -102,6 +124,21 @@ wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
# new mid 2021: monitor the UW reflected power
act_stamp = time.strftime('%Y%m%d_%H%M%S') + '_'
savename = get_exec_pars().name
if len(savename)> 38:
savename = savename[:38]
caput("UW:MON_FILE",act_stamp + savename)
mins_per_scan = abs((END_FIELD - START_FIELD)/RAMP_RATE)
caput("UW:MON_DURATION", mins_per_scan)
# make an additional check if there is still a running monitoring. This can easily happen if a previous scan was aborted...
if caget("UW:MON_STATUS") == 1:
caput("UW:MON_STOP", 1)
caput("UW:MON_START", 1)
#if WAIT_STABLE_TEMPERATURE == True:
# wait_temp()
@@ -117,9 +154,12 @@ 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
# buffer these values to increase speed
pol_mode_buffer = float(pol_mode.getPositions().index(pol_mode.readback.read()))
pol_angle_buffer = pol_angle.read() #polAngle.get()
while(True):
#Dimension 2START_FIELD = -0.2
#ArrayPositioner Energy
@@ -128,8 +168,8 @@ while(True):
#Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
else:
sleep( 0.25 ) # TODO: Check
# else:
# sleep( 0.25 ) # TODO: Check
#TODO: change to Controlled variable?
readback2 = energy_readback.read() #EnergyReadback.get()
@@ -139,33 +179,43 @@ while(True):
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
#while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
#Detector field readback
field_readback = field.readback.read() #fieldReadback.get()
#field_readback = field.readback.read() #fieldReadback.get()
field_readback = field.readback.read()
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()
# ESR HACK
detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
_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, detector9, _tey_norm, _trans_norm])
detector1 = signal_tey.read() #TEY.get()
detector2 = signal_i0.read() #I0.get()
detector3 = signal_trans.read() #trans.get()
detector4 = pol_mode_buffer #float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle_buffer #pol_angle.read() #polAngle.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_z.read() if FIELD =="Hz" else signal_field_analog_x.read() # fieldAnalogX.get()
# ESR HACK
detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
detector10 = adc7.read() # New in 2021: Also use ADC7 here as additional detector
detector11 = adc6.read() # Newer in 2021: Also use ADC6 here as additional detector
#if FIELD =="Hz":
# Hz_rb = field_z.readback.read()
#else:
# Hz_rb = 0.0
#Hx_rb = field_x.readback.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)
# 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, detector9, detector10, detector11, _tey_norm, _trans_norm,time.time()])
#if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
#if abs(field_readback - END_FIELDafter) < 0.007: REMOVED by Jan
@@ -184,6 +234,10 @@ scan.end()
log_scan_filename()
# switch off monitor, if it is still running (it should!)
if caget("UW:MON_STATUS") == 1:
caput("UW:MON_STOP", 1)
if RAMP_RATE is not None:
if FIELD == "Hz":
print "Reset ramp rate-z"
@@ -191,6 +245,8 @@ if RAMP_RATE is not None:
ramp_rate.waitInPosition(0.35,10000)
else:
print "Reset ramp rate-x"
ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
#ramp_rate.write(2.0)
#ramp_rate.waitInPosition(2.0,10000)
ramp_rate.write(0.35)
ramp_rate.waitInPosition(0.35,10000)
+4 -4
View File
@@ -1,12 +1,12 @@
#####################
## INPUT PARAMETERS##
POS_START = 150
POS_END = 175
POS_START = 150 #150
POS_END = 175 #175
POS_STEP = 0.5
#ENERGIES = [704.0,708.7] # Fe
ENERGIES = [630] #
ENERGIES = [530] #
#####################
@@ -36,7 +36,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
+1 -1
View File
@@ -36,7 +36,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
+1 -1
View File
@@ -66,7 +66,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
+1 -1
View File
@@ -66,7 +66,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
+1 -1
View File
@@ -66,7 +66,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
+18 -15
View File
@@ -6,28 +6,31 @@ import os,time,subprocess
# 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()
if sp =='':
Tcontrol_on = False
else:
sp = float(sp)
if sp != 1:
Tcontrol_on = False
else:
Tcontrol_on = True
# print "Tctrl on =",Tcontrol_on
try:
#prog = os.popen("caget -noname -num -nostat X07MA-ES1-TEMP:CONTROL")
sp = float( TControl.read() )
except: # if channel doesn't exist because orange window with script is not running
#Tcontrol_on = False
sp = 0
finally:
# sp=prog.read()
if sp != 1:
Tcontrol_on = False
else:
Tcontrol_on = True
return Tcontrol_on
#def check_Tcontrol_on():
# return (caget('X07MA-ES1-TEMP:CONTROL','i') == 1)
Tctrl = check_Tcontrol_on()
#print ("Tctrl value:", Tctrl)
if Tctrl == False :
print 'T auto control not running.'
sp = caget("X07MA-PC-TC:DMD:LOOP1:SETPOINT")
sp = temperature.read() # caget("X07MA-PC-TC:DMD:LOOP1:SETPOINT")
print 'T auto control not running. Setpoint = ' + str(sp) + ' K'
# path contains the path of the refill log file
path1=time.strftime("%Y_%m", time.localtime())
@@ -35,7 +38,7 @@ if Tctrl == False :
path="/sls/X07MA/data/x07maop/Data1/"+path1+"/"+path2 +"/"+"refill.log"
if (sp<2.0):
t = caget("X07MA-PC-TC:STS:T1",'d')
t = temperature.readback.read() # caget("X07MA-PC-TC:STS:T1",'d')
print "t= ",t
hl = caget("X07MA-PC-HE:LEVELB",'d')
print "hl= ",hl
+98 -35
View File
@@ -3,6 +3,8 @@
FIELD = "Hx"
START_FIELD = -0.1
ACQPOINTS = 100
ACQTIME_SECS = 60
ACQLIM = 'POINTS'
ENERGIES = (707.90, 703.90)
ENERGY_CHANGE_SLEEP = 2.0
MODE = 'CIRC +'
@@ -10,6 +12,8 @@ OFFSET = -1.0
"""
entry_time = time.time()
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
@@ -34,7 +38,7 @@ 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')
#caputq('X07MA-PC:CSCALER.INPB', '1')
# open shutter
caput('X07MA-FE-PH1:CLOSE4BL',1)
@@ -53,20 +57,28 @@ if len(ENERGIES) ==2:
else:
dif_series = None
set_preference(Preference.ENABLED_PLOTS, ['field', 'TEY', 'trans','ESR_extrachannel'])
#set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'ADC3','ADC4','ADC7','ADC6'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'ADC3':1, 'ADC4':1, 'ADC7':1, 'ADC6':1})
set_preference(Preference.DOMAIN_AXIS, 'Time')
field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
field_var,'ESR_extrachannel', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'ADC3', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
field_var,'ADC4','ADC7','ADC6', 'tey_norm','trans_norm','Time'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
# field_var,'ESR_extrachannel', 'tey_norm','trans_norm', 'fieldX' ,'fieldZ'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan.start()
write_logs()
print "Waiting for start field"
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
#if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
# enforce field setting here, i.e. it must be set
if abs(caget('X07MA-PC-MAG:X:DMD') - START_FIELD) > 0.00001:
time.sleep(1.0)
ramp_rate.write(2.0)
time.sleep(1.0)
field.write(START_FIELD)
if iPS == True:
caput("X07MA-PC-MAG:X:DMD",float(START_FIELD))
@@ -84,7 +96,25 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
print "Done waiting"
else:
time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
# wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field.readback.read() - START_FIELD
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
time.sleep(5.0)
difference = field.readback.read() - START_FIELD
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference
#open_valve(2.0)
@@ -117,6 +147,12 @@ wait_device(pol_done, "DONE")
#caput("X07MA-PC-MAG:X:DMD",float(END_FIELD))
# buffer these values to increase speed
pol_mode_buffer = float(pol_mode.getPositions().index(pol_mode.readback.read()))
pol_angle_buffer = pol_angle.read() #polAngle.get()
start_time = time.time()
index = 0
while(True):
@@ -138,33 +174,43 @@ while(True):
energy.write(setpoint2)
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
#while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
#Detector field readback
field_readback = field.readback.read() #fieldReadback.get()
#field_readback = field.readback.read() #fieldReadback.get()
field_readback = field.readback.read()
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()
# ESR HACK
detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
_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, detector9, _tey_norm, _trans_norm])
detector1 = signal_tey.read() #TEY.get()
detector2 = signal_i0.read() #I0.get()
detector3 = signal_trans.read() #trans.get()
detector4 = pol_mode_buffer #float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle_buffer #pol_angle.read() #polAngle.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_z.read() if FIELD =="Hz" else signal_field_analog_x.read() # fieldAnalogX.get()
# ESR HACK
detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
detector10 = adc7.read() # New in 2021: Also use ADC7 here as additional detector
detector11 = adc6.read() # Newer in 2021: Also use ADC6 here as additional detector
#if FIELD =="Hz":
# Hz_rb = field_z.readback.read()
#else:
# Hz_rb = 0.0
#Hx_rb = field_x.readback.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)
# 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, detector9, detector10, detector11, _tey_norm, _trans_norm,time.time()])
#if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
#if abs(field_readback - END_FIELDafter) < 0.007: REMOVED by Jan
@@ -178,14 +224,31 @@ while(True):
#print "Field has reached target, breaking execution."
#break
index = index+1
if index == ACQPOINTS:
break
# break conditions, either based on acquisition time or acquisition data points
if ACQLIM == 'POINTS':
if index == ACQPOINTS:
break
else:
execution_time = time.time() - entry_time
if execution_time > ACQTIME_SECS:
break
scan.end()
log_scan_filename()
end_time = time.time()
acq_time = end_time - start_time
if ACQLIM == 'POINTS':
print('{} points in {} secs. --> sampling rate of {} Sa/s'.format(ACQPOINTS, acq_time, ACQPOINTS/acq_time))
else:
print('{} points in {} secs. --> sampling rate of {} Sa/s'.format(index, acq_time, index/acq_time))
#if RAMP_RATE is not None:
# if FIELD == "Hz":
# print "Reset ramp rate-z"
+198
View File
@@ -0,0 +1,198 @@
#Parameters
"""
FIELD = "Hx"
START_FIELD = -0.1
ACQPOINTS = 100
ENERGIES = (707.90, 703.90)
ENERGY_CHANGE_SLEEP = 2.0
MODE = 'CIRC +'
OFFSET = -1.0
"""
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"
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)
#Pre-actions
#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
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)
print "OK"
#if RAMP_RATE is not None:
# ramp_rate.write(RAMP_RATE)
# ramp_rate.waitInPosition(RAMP_RATE,10000)
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, ['field', 'TEY', 'trans','ESR_extrachannel'])
#set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
field_var,'ESR_extrachannel', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan.start()
write_logs()
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)
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)
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)
#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
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
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()
# ESR HACK
detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
_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, detector9, _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..."
# while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
# time.sleep(0.1)
# print "Done waiting"
#print "Field has reached target, breaking execution."
#break
index = index+1
if index == ACQPOINTS:
break
scan.end()
log_scan_filename()
#if RAMP_RATE is not None:
# 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)
+49 -36
View File
@@ -1,82 +1,95 @@
#####################
## INPUT PARAMETERS##
POS_START =4
POS_END = 27
POS_STEP = 0.5
#POS_START = 1
#POS_END = 30 # 25.2
POS_START = 17
POS_END = 20.5
POS_STEP = 0.05 #0.25
#POS_START =4.5
#POS_END = 7
#POS_STEP = 0.1
#"""
#POS_START = 7
#POS_END = 15
#POS_STEP = 0.25
#"""
#ENERGIES = [458.4] #Ti
#ENERGIES = [458.4,454] #Ti
#ENERGIES = [1030, 1015]# Zn
#ENERGIES = [532, 523]#
#ENERGIES = [363.2, 356]# Nb
#ENERGIES = [782.50, 775.0]
#ENERGIES = [400.7, 396.0] # N
#ENERGIES = [395.0, 410] # N
#ENERGIES = [401.1,403] #Mo285
#ENERGIES = [577.0, 573.0] # Cr
#ENERGIES = [459.5,452] #Ti
#ENERGIES = [573.0] # Cr
#ENERGIES = [572.0]
#ENERGIES = [692.0] # F
#ENERGIES = [696.5, 680.0] # F
#ENERGIES = [696.7, 680.0] # F
#ENERGIES = [1110,1125.5] #STO
#ENERGIES = [397.7,392] # Pc
#ENERGIES = [708.3, 700.0] # Fe
#ENERGIES = [397.6,395] # N
#ENERGIES = [708.1, 704] # Fe
#ENERGIES = [783.15,771.0] # Ba
#ENERGIES = [700.0]
#ENERGIES = [530] #O
ENERGIES = [700.0,708.0] #Fe
#ENERGIES = [931.7, 925] #Cu
#ENERGIES = [707., 704.] # Fe
#ENERGIES = [706.6, 704] # Fe metal
#ENERGIES = [708.3]
#ENERGIES = [931.7]#, 925] #Cu
#ENERGIES = [928.4, 925] #CuO
#ENERGIES = [929.3] #Cu
#ENERGIES = [928.4] #Cu
#ENERGIES = [928.4, 707.5] #Cu, Fe special
#ENERGIES = [927, 929] #Cu
#ENERGIES = [928.5, 931] #CuGly special
#ENERGIES = [774.0] # Co
#ENERGIES = [776.9, 774.0] # Co
#ENERGIES = [777., 774.0] # Co
#ENERGIES = [851.3,842.0] # Ni
#ENERGIES = [848.5, 846] # La
ENERGIES = [639.5,630.0] # Mn
#ENERGIES = [848.5, 842.0] # La
#ENERGIES = [576.4, 560.0] #Cr
#ENERGIES = [570.0,576.3] #Cr
#ENERGIES = [573.0,576.3] #Cr
#ENERGIES = [485.0,490.0] # Ru
#ENERGIES = [642.5,633.0] # Mn
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1067, 1076 ] # Sm
#ENERGIES = [638.8,636.6] # Mn
#ENERGIES = [459.5,455] #Ti
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [1170, 1181 ] # Gd
#ENERGIES = [285] #C
#ENERGIES = [280]# C
#ENERGIES = [300.0,280]# C
#ENERGIES = [1370.0,1380.0] #Er??
#ENERGIES = [1400.6,1390.0] #Er
#ENERGIES = [1400.6,1395.0] #Er
#ENERGIES = [1390.0] #Er
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1457.8] # Dy
#ENERGIES = [1290.0, 1280.0] # Dy
#ENERGIES = [1344.2, 1346 ] # Ho
#ENERGIES = [1289.5, 1282.5] # Dy
#ENERGIES = [1344.2, 1338 ] # Ho
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [1566.0,1554.0] # Al
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [931.7, 925] # Cu metal
#ENERGIES = [402, 397] # Ta
#ENERGIES = [395,390] #Mo
#ENERGIES = [928.6]# Cu1
#ENERGIES = [928.6,925]# Cu1
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1233.7, 1225] # Tb
#ENERGIES = [1234.5, 1225] # Tb
#ENERGIES = [976, 970] # Nd
#ENERGIES = [1185] # Gd
#ENERGIES = [405.5, 390] # Sc
#ENERGIES = [1289.5, 1280] # Dy edge, pre-edge
#ENERGIES = [1289.5, 1282] # Dy edge, pre-edge
#ENERGIES = [1345, 1338] # Ho edge, pre-edge
#ENERGIES = [1290] # Dy
#ENERGIES = [1125.6]# Eu
#ENERGIES = [774,777.3] # Co
#ENERGIES = [516, 503] # V
#ENERGIES = [774,777.6] # Co
#ENERGIES = [517.5, 503] # V
#ENERGIES = [510] # V predge
#ENERGIES = [1455,1420] # Se
#ENERGIES = [285.1, 280.0]# C
#ENERGIES = [285.3, 280.0]# C
#ENERGIES = [368, 367] # Ag
#ENERGIES = [ 1650.0 ]
#ENERGIES = [1076.0]
#####################
open_valve()
#open_valve() # commented out Jan.21 for test
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
@@ -102,7 +115,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
@@ -114,6 +127,6 @@ ret70= lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency = 0.25,
#if name is None:
# name=get_scan_filename()
#print "Created data file: " + str(name)
# print "Created data file: " + str(name)
close_valve()
+6
View File
@@ -0,0 +1,6 @@
for ii in range(len(pos)):
if (ii == 3) or (ii == 5):
continue;
print(smps[ii]);
+1 -1
View File
@@ -1,4 +1,4 @@
ID_ENERGY = 770
ID_ENERGY = 852
+3
View File
@@ -0,0 +1,3 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Deployment specific global definitions - executed after startup.groovy
///////////////////////////////////////////////////////////////////////////////////////////////////
+4
View File
@@ -0,0 +1,4 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Deployment specific global definitions - executed after startup.js
///////////////////////////////////////////////////////////////////////////////////////////////////
+102 -22
View File
@@ -97,6 +97,7 @@ class TransNorm(ReadonlyRegisterBase):
add_device(TeyNorm("tey_norm"), True)
add_device(TransNorm("trans_norm"), True)
set_device_alias(temperature.readback, "temperature_readback")
###################################################################################################
@@ -139,6 +140,11 @@ def wait_device_in_range(dev, value, range, timeout=-1):
dev.waitValueInRange(value, range, timeout)
# print "Done waiting."
#TODO:
# - OTF outout folder should not be /sls/X07MA/data/x07maop/Data1/yyyy_mm/yyyymmdd/ but somewhere visible to e account.
# - One option is make /sls/X07MA/data/x07maop/Data1/OTF mode 755, and configure OTF to write /sls/X07MA/data/x07maop/Data1/OTF/yyyymmdd
# - Then e-account (and x07maop) read from there (get the newest file) and don't have to move the file there after processing.
def convert_file(input_file_name, output_file_name, pol = None):
#print "Converting data file: " + input_file_name + " to " + output_file_name
print "File converted to: ",output_file_name
@@ -266,16 +272,40 @@ def set_hx(field, timeout = -1):
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
print 'Setting Hx to ',field,' Tesla...'
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...'
#if iPS == True:
# caput("X07MA-PC-MAG:X:DMD",float(field))
time.sleep(3.0) # wait 3s
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field_x.readback.read() - field
print 'difference at beginning is ',difference,' Tesla...'
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
print 'difference inside while loop is ',difference,' Tesla...'
time.sleep(5.0)
difference = field_x.readback.read() - field
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference
print 'difference after resetting is ',difference,' Tesla...'
print 'Finished while loop'
if iPS == True:
field_x_ips_output.waitValue(0,timeout)
@@ -295,7 +325,11 @@ def set_hz(field, timeout = -1):
field_z.write(float(field))
print 'Setting Hz to',field,'Tesla...'
time.sleep(3.0) # wait 3s
field_z_done.waitValue(1,timeout)
try:
field_z_done.waitValue(1,timeout)
except:
print('Timeout exceeded for setting z field!')
print "Done setting magnetic field"
def set_pol_cplus(offset = None, timeout = -1):
@@ -308,7 +342,8 @@ def set_pol_cplus(offset = None, timeout = -1):
pol_offset.write(float(offset))
time.sleep(0.5)
pol_done.update()
pol_done.waitValue("DONE",timeout)
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs.Must use wait_device. CP June 21
print "Done setting x-ray polarization"
def set_pol_cminus(offset = None, timeout = -1):
@@ -321,7 +356,8 @@ def set_pol_cminus(offset = None, timeout = -1):
pol_offset.write(float(offset))
time.sleep(0.5)
pol_done.update()
pol_done.waitValue("DONE",timeout)
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs. Must use wait_device. CP June 21
print "Done setting x-ray polarization"
def set_pol_lin(angle, offset = None, timeout = -1):
@@ -335,7 +371,8 @@ def set_pol_lin(angle, offset = None, timeout = -1):
pol_offset.write(float(offset))
time.sleep(0.5)
pol_done.update()
pol_done.waitValue("DONE",timeout)
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs.Must use wait_device. CP June 21
print "Done setting x-ray polarization"
def set_temp(value, in_position_band = None):
@@ -348,31 +385,47 @@ def set_temp(value, in_position_band = None):
#TODO: Replace when this flag works for all temperatures
#cawait("X07MA-ES1-TEMP:STATUS", "Stable")
#return
temperature.readback.waitValueInRange(float(value), in_position_band, -1)
#temperature.readback.waitValueInRange(float(value), in_position_band, -1)
wait_device_in_range(temperature.readback, float(value), in_position_band, -1)
time.sleep(600.0) # wait 10min
print "Done setting temperature"
def open_valve(delay = 0.75):
def open_valve(delay = 0.75, timeout=500.0):
"""
"""
print "Open valve"
print "Opening valve"
start = time.time()
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)
if (timeout>0) and (time.time()-start > timeout):
raise Exception("Timeout opening the valve")
time.sleep(0.1)
#print "Retry open valve"
valve_try_open.write(1)
#print "Valve opened"
def close_valve(delay = 0.5): #TODO: Check default delay
def close_valve(delay = 0.5, timeout=10.0): #TODO: Check default delay
"""
"""
print "Close valve"
print "Closing valve"
valve_try_open.write(0)
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 2 :
if (timeout>0) and (time.time()>timeout):
raise Exception("Timeout opening the valve")
time.sleep(0.1)
# print "Retry close valve"
#print "Retry close valve"
valve_try_open.write(0)
#print "Valve closed"
def close_shutter(delay = 0.5): #TODO: Check default delay
"""
"""
print "Close photon shutter"
time.sleep(float(delay))
caput("X07MA-FE-PH1:CLOSE4BL",0)
def set_energy (value, delay=0.5):
print "Set energy"
@@ -507,7 +560,7 @@ def shutdown():
def has_beam():
"""
"""
return beam_status.readback.read() !="Machine Down"
return beam_status.readback.read() !="Machine Down"
def wait_beam():
"""
@@ -551,7 +604,25 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n
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":float(alpha) if alpha is not None else None})
if len(name)> 38:
name = name[:38]
print('WARNING: Sample name too long. Name has been truncated.')
#run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
run("EnergyScan_v2", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf2(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None):
"""
"""
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
if len(name)> 38:
name = name[:38]
print('WARNING: Sample name too long. Name has been truncated.')
run("EnergyScan_v2", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def hyst_cont(field, init_field, final_field, ramp_speed, energies):
"""
@@ -563,10 +634,15 @@ def hyst_cont_ESR(field, init_field, final_field, ramp_speed, energies):
"""
run("HystScan_ESR",{"FIELD":field, "START_FIELD":init_field, "END_FIELD":final_field, "ENERGIES":energies, "RAMP_RATE":ramp_speed, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def acq_cont_ESR(field, init_field, datapoints, energies):
def acq_cont_ESR_N(field, init_field, datapoints, energies):
"""
"""
run("TimeScan_ESR",{"FIELD":field, "START_FIELD":init_field, "ACQPOINTS":datapoints, "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
run("TimeScan_ESR",{"FIELD":field, "START_FIELD":init_field, "ACQPOINTS":datapoints, "ACQLIM":"POINTS", "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def acq_cont_ESR_t(field, init_field, acqtime, energies):
"""
"""
run("TimeScan_ESR",{"FIELD":field, "START_FIELD":init_field, "ACQTIME_SECS":acqtime, "ACQLIM":"TIME", "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def hyst_cont_mult(field, ranges, energies):
"""
@@ -600,7 +676,7 @@ def scan_e_mult(ranges, settling_time = 0, accumulation_time = None, name = None
if name is not None:
set_file(name = name)
wait_beam()
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
acc = Accumulator([energy_readback,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, before_read=before_sample, after_read=after_sample)
@@ -662,4 +738,8 @@ def write_logs():
log("Gain sample: " + str(caget(keithleys["k1"][2])))
log("Gain i0: " + str(caget(keithleys["k2"][2])))
log("Gain diode: " + str(caget(keithleys["k3"][2])))
log("XBPM1:V: " + str(caget ("X07MA-FE-XBPM1:posV")))
log("XBPM2:V: " + str(caget ("X07MA-FE-XBPM2:posV")))
log("XBPM1:H: " + str(caget ("X07MA-FE-XBPM1:posH")))
log("XBPM2:H: " + str(caget ("X07MA-FE-XBPM2:posH")))
+59
View File
@@ -0,0 +1,59 @@
#####################
## INPUT PARAMETERS##
POS_START = 159.2 #Minn = 150.0
POS_END = 162.5 #Max = 170.0
POS_STEP = 0.01
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [774. 0] # Co
#ENERGIES = [573.0, 577.0] # Cr
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [931.7]# 925.0 ] # Cu
#ENERGIES = [572.0]
ENERGIES = [706]#,708.3,704.0] # Fe
#ENERGIES = [851.3 ,845]#[851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [776.9,774] # Co
#ENERGIES = [642.0,630.0] # Mn
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [516.0, 503.0] # V
#ENERGIES = [510.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.readables[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()
+59
View File
@@ -0,0 +1,59 @@
#####################
## INPUT PARAMETERS##
POS_START = 159.2 #Minn = 150.0
POS_END = 162.5 #Max = 170.0
POS_STEP = 0.01
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [774. 0] # Co
#ENERGIES = [573.0, 577.0] # Cr
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [931.7]# 925.0 ] # Cu
#ENERGIES = [572.0]
ENERGIES = [706]#,708.3,704.0] # Fe
#ENERGIES = [851.3 ,845]#[851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [776.9,774] # Co
#ENERGIES = [642.0,630.0] # Mn
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [516.0, 503.0] # V
#ENERGIES = [510.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.readables[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()
+2 -2
View File
@@ -17,8 +17,8 @@ if (sp<2.0):
t=temperature.readback.read()
if t < 4:
break
print "Wait 7 min ..."
time.sleep(420)
print "Wait 10 min ..."
time.sleep(600)
print "Set needle valve to 0%"
needle.write(0.0)
print "Wait temperature stabilization"
+745
View File
@@ -0,0 +1,745 @@
###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
import ch.psi.fda.ProcessorFDA as ProcessorFDA
import ch.psi.pshell.data.LayoutFDA as LayoutFDA
import ntpath
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 = False
_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
#Reading Energy Scan configuration file
def getPars(element):
f = open(get_context().setup.getConfigPath() + '/energy_scan.properties')
try:
for line in f:
tokens = line.split("=")
if tokens[0] == str(element):
tokens = tokens[1].split(";")
for i in range(len(tokens)):
tokens[i] = float(tokens[i].strip())
return tokens
finally:
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
###################################################################################################
sim_energy = None
class SimulatedEnergy(Writable):
def write(self, value):
self.put(value)
def put(self, value, timeout = None):
global sim_energy
sim_energy = value
def close(self):
pass
class SimulatedEnergyReadback(Readable):
def read(self):
global sim_energy
return sim_energy;
def get(self):
return self.read()
def close(self):
pass
sim_energy = SimulatedEnergy()
sim_energy_readback = SimulatedEnergyReadback()
class TeyNorm(ReadonlyRegisterBase):
def read(self):
return signal_tey.take() / signal_i0.take();
class TransNorm(ReadonlyRegisterBase):
def read(self):
return signal_trans.take() / signal_i0.take();
add_device(TeyNorm("tey_norm"), True)
add_device(TransNorm("trans_norm"), True)
set_device_alias(temperature.readback, "temperature_readback")
###################################################################################################
# Utilities
###################################################################################################
def run_fda(file_name, arguments={}):
"""
Run FDA loop
"""
ProcessorFDA().execute(file_name,arguments)
run ("Accumulator")
def get_next_fid(folder, prefix):
try:
import glob
files = glob.glob(folder + prefix + '*_*.txt')
last = max(files)
index = int (last[last.rfind('_')+1 : last.rfind('.')]) + 1
return index
except:
return 0
def wait_channel(name, value, timeout=None, type='s'):
print "Waiting " + str(name) + " = " + str(value),"... "
cawait(name, value, timeout = timeout, type=type)
# 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),"... "
dev.waitValue(value,timeout)
# 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),"... "
dev.waitValueInRange(value, range, timeout)
# print "Done waiting."
#TODO:
# - OTF outout folder should not be /sls/X07MA/data/x07maop/Data1/yyyy_mm/yyyymmdd/ but somewhere visible to e account.
# - One option is make /sls/X07MA/data/x07maop/Data1/OTF mode 755, and configure OTF to write /sls/X07MA/data/x07maop/Data1/OTF/yyyymmdd
# - Then e-account (and x07maop) read from there (get the newest file) and don't have to move the file there after processing.
def convert_file(input_file_name, output_file_name, pol = None):
#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()
if pol is None:
pol = pol_angle.read() if (MODE == "LINEAR") else pol_mode.readback.read()
with open(input_file_name) as inp:
lines = inp.readlines()
with open(output_file_name, "wb") as out:
#Original header:
#out.write("Ecrbk" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
#Compatible header:
(db, st) = ("java.lang.Double", "java.lang.String")
out.write("#Ecrbk" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + st + sep + db + sep + db + sep + db + line_sep)
s = sep
for line in lines[1:]:
line = line.strip()
if line=="": break
try:
(Ecrbk, CADC1, CADC2, CADC3, CADC4, CADC5, MCurr, cffrbk, IDErbk, NORM, time, MAGX, MAGZ, EXPT) = line.split(" ")
normtey=repr( float(CADC1)/float(CADC2))
normdiode=repr(float(CADC3)/float(CADC2))
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + MCurr + s + time + s + MAGX + s + MAGZ + s + str(pol) + s + EXPT + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
def plot_file(file_name, title = None):
"""
"""
table = Table.load(file_name, "\t", '#')
plots = plot(table, title = title)
def elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "XTREME", encoding=1):
"""
Add entry to ELOG.
"""
if author is None:
author = "pshell" #get_context().user.name
typ = "pshell"
entry = ""
cmd = 'G_CS_ELOG_add -l "' + logbook + '" '
cmd = cmd + '-a "Author=' + author + '" '
cmd = cmd + '-a "Type=' + typ + '" '
cmd = cmd + '-a "Entry=' + entry + '" '
cmd = cmd + '-a "Title=' + title + '" '
cmd = cmd + '-a "Category=' + category + '" '
cmd = cmd + '-a "Domain=' + domain + '" '
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-n ' + str(encoding)
cmd = cmd + ' "' + message + '"'
#print cmd
#os.system (cmd)
#print os.popen(cmd).read()
import subprocess
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
if (err is not None) and err!="":
raise Exception(err)
print out
def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context().setup.getContextPath()):
"""
Returns list with file names of plots snapshots from a plotting context.
"""
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
ret = []
for p in get_plots(title):
file_name = os.path.abspath(temp_path + "/" + p.getTitle() + "." + file_type)
p.saveSnapshot(file_name , file_type)
ret.append(file_name)
return ret
###################################################################################################
#Default scan callbacks
###################################################################################################
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'],
"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):
"""
"""
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
print 'Setting Hx to ',field,' Tesla...'
timeout = int(timeout *1000) if timeout>0 else timeout
fieldx.write(float(field))
#if iPS == True:
# caput("X07MA-PC-MAG:X:DMD",float(field))
time.sleep(3.0) # wait 3s
### this waiting procedure was introduced because sometimes the field does not move and the whole script gets stuck then.
difference = field_x.readback.read() - field
print 'difference at beginning is ',difference,' Tesla...'
difference0 = difference # difference0 is the field offset before entering the stabilization loop
last_difference = difference # last_difference is updated during the stabilization loop
while abs(difference) > FIELD_PRECISION:
print 'difference inside while loop is ',difference,' Tesla...'
time.sleep(5.0)
difference = field_x.readback.read() - field
# resend a start ramp in case nothing is happening, ie when it is stuck in this waitfield
if abs(difference-difference0) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
# also resend a start ramp in case nothing is happening wrt to the last 5 seconds
elif abs(difference-last_difference) < FIELD_PRECISION:
caput('X07MA-PC-MAG:STARTRAMP.PROC',1)
print('Field setting stuck: re-starting ramp')
last_difference = difference
print 'difference after resetting is ',difference,' Tesla...'
print 'Finished while loop'
if iPS == True:
field_x_ips_output.waitValue(0,timeout)
while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
time.sleep(0.1)
else:
field_x_done.waitValue(1,timeout)
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
try:
field_z_done.waitValue(1,timeout)
except:
print('Timeout exceeded for setting z field!')
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))
time.sleep(0.5)
pol_done.update()
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs.Must use wait_device. CP June 21
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))
time.sleep(0.5)
pol_done.update()
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs. Must use wait_device. CP June 21
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))
time.sleep(0.5)
pol_done.update()
wait_device(pol_done, "DONE")
#pol_done.waitValue("DONE",timeout) # it hangs.Must use wait_device. CP June 21
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()
#TODO: Replace when this flag works for all temperatures
#cawait("X07MA-ES1-TEMP:STATUS", "Stable")
#return
#temperature.readback.waitValueInRange(float(value), in_position_band, -1)
wait_device_in_range(temperature.readback, float(value), in_position_band, -1)
time.sleep(600.0) # wait 10min
print "Done setting temperature"
def open_valve(delay = 0.75, timeout=500.0):
"""
"""
print "Opening valve"
start = time.time()
valve_try_open.write(1) #TODO: CAPUT
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 5 :
if (timeout>0) and (time.time()-start > timeout):
raise Exception("Timeout opening the valve")
time.sleep(0.1)
#print "Retry open valve"
valve_try_open.write(1)
#print "Valve opened"
def close_valve(delay = 0.5, timeout=10.0): #TODO: Check default delay
"""
"""
print "Closing valve"
valve_try_open.write(0)
time.sleep(float(delay))
while caget("X07MA-OP-VG13:POSITION", "i") != 2 :
if (timeout>0) and (time.time()>timeout):
raise Exception("Timeout opening the valve")
time.sleep(0.1)
#print "Retry close valve"
valve_try_open.write(0)
#print "Valve closed"
def close_shutter(delay = 0.5): #TODO: Check default delay
"""
"""
print "Close photon shutter"
time.sleep(float(delay))
caput("X07MA-FE-PH1:CLOSE4BL",0)
def set_energy (value, delay=0.5):
print "Set energy"
timeout_ms = 90000 # 1.5 minutes
tolerance = 0.3
energy.write(float(value))
try:
energy_done.waitValue(1, timeout_ms) # timeout is now 90 sec, was -1
except:
if abs(energy.read() - energy_readback.read()) > tolerance:
throw
time.sleep(float(delay))
print "Done setting energy"
def old_set_energy (value, delay=0.5):
"""
"""
print "Set energy"
energy.write(float(value))
energy_done.waitValue(1, -1) # timeout is now 60, was -1
time.sleep(float(delay))
print "Done setting energy"
def set_cff (value):
"""
"""
cff.write(float(value))
caput("X07MA-PGM:setE.PROC",1)
energy_done.waitValue(1, -1)
def set_slit(value):
"""
"""
exit_slit.write(float(value))
#1 or 3
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):
"""
"""
#keithley.write(fl'10^'+str(8)oat(value))
if not keithltey in keithleys.keys(): raise Exception("Invalid keithley: " + keithley)
caput(keithleys[keithley][0], float(value))
time.sharmonicleep(float(delay))
#value is int from 1 to 10
def set_range(keithley, value):
"""
"""
print "Set Keithley range"
if not keithley in keithleys.keys(): raise Exception("Invalid keithley: " + keithley)
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):
"""
"""
opening = int(opening*1000)
if opening==0:
aperture.write("closed")
elif opening==100:
aperture.write("0.1x0.1 mm")
elif opening==250:
aperture.write("0.25x0.25 mm")
elif opening==500:
aperture.write("0.5x0.5 mm")
elif opening==1000:
aperture.write("1x1 mm")
elif opening==1250:
aperture.write("1.25x1.25 mm")
elif opening==2000:
aperture.write("2x2 mm")
else:
raise Exception("Invalid aperture opening: " + str(opening))
def refill_1k():
"""
"""
#print "in refill_1k"
run("refill_1kpot")
def wait_temp():
"""
"""
#print "blabla"
# if (temperature.read() < 2.0):
# t=ct=temperature.readback.read()
#hl=caget("X07MA-PC-HE:LEVELB", 'd') # TODO: not used
# if (t > 3.7):
# print "Refilling 1K pot..."
# refill_1k()
print "Check temperature"
run("TEMP_wait_fill.py")
print "Temperature OK"
def rampdown():
"""
"""
field_x.write(0.0)
field_z.write(0.0)
def shutdown():
"""
"""
set_fe(0)
rampdown()
def has_beam():
"""
"""
return beam_status.readback.read() !="Machine Down"
def wait_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."
def wait_inj (value, delay=0.5):
"""
"""
wait_channel('X07MA-OP2-EVR:TOPUP-STAT', 'TOPUP-ON')
wait_channel('X07MA-OP2-EVR:TOPUP-STAT', 'TOPUP-OFF')
time.sleep(float(delay))
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
class pol_mod(Readable):
def read(self):
mode = pol_mode.read()
if mode == "LINEAR": return 0.0
if mode == "CIRC +": return 1.0
if mode == "CIRC -": return 2.0
return -1.0
polmod = pol_mod()
def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None):
"""
"""
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
if len(name)> 38:
name = name[:38]
print('WARNING: Sample name too long. Name has been truncated.')
#run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
run("EnergyScan_v2", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf2(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None):
"""
"""
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
if len(name)> 38:
name = name[:38]
print('WARNING: Sample name too long. Name has been truncated.')
run("EnergyScan_v2", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def hyst_cont(field, init_field, final_field, ramp_speed, energies):
"""
"""
run("HystScan",{"FIELD":field, "START_FIELD":init_field, "END_FIELD":final_field, "ENERGIES":energies, "RAMP_RATE":ramp_speed, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def hyst_cont_ESR(field, init_field, final_field, ramp_speed, energies):
"""
"""
run("HystScan_ESR",{"FIELD":field, "START_FIELD":init_field, "END_FIELD":final_field, "ENERGIES":energies, "RAMP_RATE":ramp_speed, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def acq_cont_ESR_N(field, init_field, datapoints, energies):
"""
"""
run("TimeScan_ESR",{"FIELD":field, "START_FIELD":init_field, "ACQPOINTS":datapoints, "ACQLIM":"POINTS", "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def acq_cont_ESR_t(field, init_field, acqtime, energies):
"""
"""
run("TimeScan_ESR",{"FIELD":field, "START_FIELD":init_field, "ACQTIME_SECS":acqtime, "ACQLIM":"TIME", "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def hyst_cont_mult(field, ranges, energies):
"""
"""
run("HystScanMult",{"FIELD":field, "RANGES":ranges, "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
def hyst_step(forward, field, init_field, final_field, step, energies, energy_change_sleep = 0.5, field_change_sleep = 22.0, mode = None, offset=None):
"""
"""
run("HystScanStep",{"FIELD":field, "RANGES":[(init_field, final_field, step),], "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":energy_change_sleep, "FIELD_CHANGE_SLEEP":field_change_sleep, "MODE":mode, "OFFSET":offset})
def hyst_step_mult(forward, ranges, ramp_speed, energies, energy_change_sleep = 0.5, field_change_sleep = 22.0, mode = None, offset=None):
"""
"""
run("HystScanStep",{"FIELD":field, "RANGES":ranges, "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":energy_change_sleep, "FIELD_CHANGE_SLEEP":field_change_sleep, "MODE":mode, "OFFSET":offset})
def scan_e(start, end, step, settling_time = 0, accumulation_time = None, name = None):
"""
"""
if name is not None:
set_file(name = name)
wait_beam()
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, before_read=before_sample, after_read=after_sample)
def scan_e_mult(ranges, settling_time = 0, accumulation_time = None, name = None):
"""
"""
if name is not None:
set_file(name = name)
wait_beam()
acc = Accumulator([energy_readback,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, before_read=before_sample, after_read=after_sample)
#not connected
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, before_read=before_sample, after_read=after_sample)
def set_hor(value):
"""
"""
print "Set sample horizontal positon"
sample_hor.move(float(value))
print "Done setting horizontal position"
def set_vert(value):
"""
"""
print "Set sample vertical position"
sample_vert.move(float(value))
print "Done setting vertical position"
def set_rot(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 get_scan_filename():
return str(get_exec_pars().output) + str(get_exec_pars().scanPath) + ".txt"
def log_scan_filename(name=None):
if name is None:
name=get_scan_filename()
msg = "Created data file: " + str(name)
print msg
log(msg)
def write_logs():
log("Exit slit: "+ str(exit_slit.read()), True)
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])))
log("Gain i0: " + str(caget(keithleys["k2"][2])))
log("Gain diode: " + str(caget(keithleys["k3"][2])))
log("XBPM1:V: " + str(caget ("X07MA-FE-XBPM1:posV")))
log("XBPM2:V: " + str(caget ("X07MA-FE-XBPM2:posV")))
log("XBPM1:H: " + str(caget ("X07MA-FE-XBPM1:posH")))
log("XBPM2:H: " + str(caget ("X07MA-FE-XBPM2:posH")))
+1 -1
View File
@@ -37,7 +37,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
#set_energy(en)
+50
View File
@@ -0,0 +1,50 @@
FOLDER = '2021_03/20210302'
FILE = 'Fe_plus'
PLOT_TITLES = ["TEY raw", "I0", "diode_raw", "TEY_norm", "diode_norm"]
folder = os.path.expanduser("~/Data1/") + FOLDER + "/";
set_exec_pars(name= FILE)
class Time(Readable):
def __init__(self):
self.start = time.time()
def read(self):
return time.time()-self.start
class NORMtey(Readable):
def read(self):
return float(CADC1.take())/float(CADC2.take())
class NORMdiode(Readable):
def read(self):
return float(CADC3.take())/float(CADC2.take())
#CADC1 = tey raw
#CADC2 = I0
#CADC3 = tfy raw
current.alias="MCurr"
sensors = [Ecrbk, CADC1, CADC2, CADC3,CADC4,CADC5,current,Time(),FieldX,FieldZ,Temperature, NORMtey(), NORMdiode()]
def monitoring_task():
time.sleep(1.0)
try:
for index, title in enumerate(PLOT_TITLES, start=0): get_plots()[index].title = title
except:
pass
time.sleep(2.0)
get_exec_pars().currentScan.abort()
ret = fork(monitoring_task)
try:
mscan(Ecrbk, sensors, -1, None, range="auto", enabled_plots = ["NORMtey", "NORMdiode", CADC1,CADC3, CADC2])
folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt";
finally:
ret[0].cancel(True)
current.alias=None
+3
View File
@@ -0,0 +1,3 @@
for i in range (1,20):
sample_hor.move(159.0 + 0.2*i)
time.sleep(1.0)
+5
View File
@@ -0,0 +1,5 @@
Estart=630
Eend=685
sample_name='eaccount_test'
otf2(start=Estart, end=Eend, time=3, mode = "LINEAR", alpha=0.0, offset = off_LH, name = sample_name)
+1 -1
View File
@@ -30,7 +30,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
+1 -1
View File
@@ -41,7 +41,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
@@ -42,7 +42,7 @@ for p in plots:
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])
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)