This commit is contained in:
gac-x11ma
2024-03-19 16:16:03 +01:00
parent 1d75bc4535
commit 8aefd82ba7
72 changed files with 5064 additions and 75 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,65 +1,66 @@
#Tue May 16 14:12:40 CEST 2023
#Tue Mar 19 14:13:19 CET 2024
xscanMoveTimeout=600
imageSourcesFile={config}/imaging.properties
autoSaveScanData=true
simulation=false
commandExecutionEvents=true
logDaysToLive=7
xscanCrlogicChannel=null
dataScanSaveOutput=false
xscanCrlogicSimulated=false
userAuthenticator=
logLevelConsole=Off
filePermissionsConfig=Public
scanStreamerPort=-1
dataScanSaveScript=false
dataScanSaveSetpoints=false
notifiedTasks=EigerAbsSpec|Eiger2Img
parallelInitialization=true
fdaSerialization=true
dataTransferPath=~/Data1
scanStreamingPort=-1
saveConsoleSessionFiles=false
xscanAppendSuffix=true
saveConsoleSessionFiles=false
devicePoolFile={config}/devices.properties
versionTrackingManual=true
dataTransferMode=Off
hostName=null
userManagement=true
disableEmbeddedAttributes=false
instanceName=SIM
dataServerPort=-1
serverPort=8080
hideServerMessages=false
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}/{date}_{seq}%04d_{name}
serverEnabled=false
depthDimension=0
dataScanReleaseRecords=false
dataScanPreserveTypes=false
logLevel=Fine
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
filePermissionsLogs=Public
dataLayout=table
disableDataFileLogs=false
sessionHandling=On
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=false
notificationLevel=Completion
filePermissionsScripts=Public
terminalPort=3579
xscanCrlogicPrefix=null
tasksFile={config}/tasks.properties
dataTransferUser=
filePermissionsData=Default
xscanContinuousUpdate=false
xscanCrlogicAbortable=true
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/x11ma.git
dataScanLazyTableCreation=false
xscanMoveTimeout=600
imageSourcesFile={config}/imaging.properties
commandExecutionEvents=true
logDaysToLive=7
xscanCrlogicSimulated=false
logLevelConsole=Off
filePermissionsConfig=Public
scanStreamerPort=-1
dataScanSaveSetpoints=false
versionTrackingManual=true
dataTransferMode=Off
userManagement=true
instanceName=SIM
dataServerPort=-1
hideServerMessages=false
dataScanReleaseRecords=false
dataScanPreserveTypes=false
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
filePermissionsLogs=Public
filePermissionsScripts=Public
xscanCrlogicPrefix=null
tasksFile={config}/tasks.properties
filePermissionsData=Default
xscanCrlogicAbortable=true
createSessionFiles=false
dataProvider=txt
dataProvider=tiff
xscanCrlogicIoc=null
dataScanLazyTableCreation=false
saveCommandStatistics=false
pythonHome=

View File

@@ -1,11 +1,22 @@
et7026=ch.psi.pshell.modbus.ModbusTCP|129.129.121.95:502|||
ai1-raw=ch.psi.pshell.modbus.AnalogInput|et7026 1||5000|
ai1_temperature=ch.psi.pshell.epics.ReadonlyProcessVariable|X11MA-PC-ET7000:SW-K|Read||true
#ai1-raw=ch.psi.pshell.modbus.AnalogInput|et7026 1||5000|
et7026=ch.psi.pshell.modbus.ModbusTCP|129.129.121.94:502|||
ai0=ch.psi.pshell.modbus.ReadonlyProcessVariable|et7026 0||5000|
ai1=ch.psi.pshell.modbus.ReadonlyProcessVariable|et7026 1||5000|
ao0=ch.psi.pshell.modbus.ProcessVariable|et7026 0||5000|
ao1=ch.psi.pshell.modbus.ProcessVariable|et7026 1||5000|
ais=ch.psi.pshell.modbus.AnalogInputArray|et7026 0 6||5000|false
et7244=ch.psi.pshell.modbus.ModbusTCP|129.129.121.96:502|||
et7244=ch.psi.pshell.modbus.ModbusTCP|129.129.121.110:502|||
di1=ch.psi.pshell.modbus.DigitalInput|et7244 0||5000|
di2=ch.psi.pshell.modbus.DigitalInput|et7244 1||5000|
do1=ch.psi.pshell.modbus.DigitalOutput|et7244 0|||
do1=ch.psi.pshell.modbus.DigitalOutput|et7244 0||5000|
do2=ch.psi.pshell.modbus.DigitalOutput|et7244 1||5000|
do3=ch.psi.pshell.modbus.DigitalOutput|et7244 2||5000|
do4=ch.psi.pshell.modbus.DigitalOutput|et7244 3||5000|
do5=ch.psi.pshell.modbus.DigitalOutput|et7244 4||5000|
do6=ch.psi.pshell.modbus.DigitalOutput|et7244 5||5000|
do7=ch.psi.pshell.modbus.DigitalOutput|et7244 6||5000|
do8=ch.psi.pshell.modbus.DigitalOutput|et7244 7||5000|
Grating_ch=ch.psi.pshell.epics.ChannelString|X11MA-PGM-GRCH:GRATING|||true
DiffOrd=ch.psi.pshell.epics.ChannelString|X11MA-PGM:difforder0|||true
voltage=ch.psi.pshell.epics.ChannelDouble|X11MA-KEI13:SETVOLTAGE|||true
@@ -101,6 +112,9 @@ girder_x=ch.psi.pshell.epics.Positioner|X11MA-HG:X_SET X11MA-HG:X1|||true
girder_y=ch.psi.pshell.epics.Positioner|X11MA-HG:Y_SET X11MA-HG:Y1|||true
temp_readout=ch.psi.pshell.epics.ReadonlyProcessVariable|X11MA-PC-SW:Pt100-K|||true
cam2=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-CAM2|||true
peemcam=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-PEEMCAM|||true
raw=ch.psi.pshell.imaging.CameraSource|eiger|||true
image2=ch.psi.pshell.imaging.CameraSource|cam2|||true
img_peemcam=ch.psi.pshell.imaging.CameraSource|peemcam|||true
axis=ch.psi.pshell.imaging.MjpegSource|http://axis-x11ma.psi.ch/axis-cgi/mjpg/video.cgi?id=176 true||-200|false
axis2=ch.psi.pshell.imaging.MjpegSource|http://129.129.121.54/axis-cgi/mjpg/video.cgi?id=0 true||-200|

6
config/jcae.properties Executable file → Normal file
View File

@@ -1,10 +1,10 @@
#Mon Aug 16 09:37:19 CEST 2021
#Tue Jan 23 10:11:47 CET 2024
ch.psi.jcae.ContextFactory.addressList=
ch.psi.jcae.ContextFactory.maxArrayBytes=10000000
ch.psi.jcae.ChannelFactory.retries=1
ch.psi.jcae.ChannelFactory.timeout=1500
ch.psi.jcae.ChannelFactory.timeout=300
ch.psi.jcae.impl.DefaultChannelService.retries=2
ch.psi.jcae.impl.DefaultChannelService.timeout=500
ch.psi.jcae.impl.DefaultChannelService.timeout=300
ch.psi.jcae.impl.DefaultChannelService.waitTimeout=300000
ch.psi.jcae.impl.DefaultChannelService.waitRetryPeriod=10000
ch.psi.jcae.ContextFactory.serverPort=

View File

@@ -39,14 +39,14 @@
"style" : 0,
"size" : 14
},
"tabSize" : 10,
"tabSize" : 4,
"contentWidth" : 0,
"editorBackground" : null,
"editorForeground" : null,
"simpleEditor" : false,
"hideEditorLineNumbers" : false,
"hideEditorContextMenu" : false,
"consoleLocation" : "Status",
"consoleLocation" : "Plot",
"dataPanelLocation" : "Status",
"openDataFilesInDocTab" : false,
"noVariableEvaluationPropagation" : false,

View File

@@ -1,4 +1,4 @@
#Sat Jun 24 09:37:51 CEST 2023
#Fri Sep 15 16:26:06 CEST 2023
keywords=List;[]
ownerEmail=String;gavin.macauley@psi.ch
contactEmail=String;armin.kleibert@psi.ch

View File

@@ -1,2 +1,2 @@
#Wed Jun 14 21:20:33 CEST 2023
#Wed Sep 13 14:03:47 CEST 2023
SessionCounter=89

View File

@@ -1,26 +1,27 @@
#Tue Jul 18 10:46:52 CEST 2023
#Tue Mar 19 16:14:06 CET 2024
RSYNC_USER=
CFF=2.25
OUTLIERS_THRESHOLD=1000000000
AUTO_SWITCH_VALVE=false
NORM_FILE=/sls/X11MA/data/e20816/Data1/2023_06/20230615/654
DRY_RUN=true
POL_ID_2=Lin_Hor
OFFSET_ID_2=-2.0
POL_ID_2=Circ_Minus
ID=PGM_ID2
OFFSET_ID_2=-2.0
proposal=proposal
ENERGY=800
ENERGY=565
proposer=proposer
GRATING=G3_600
image_shift_angle=1.0963912950426833
POS_H_DIR=POS
RSYNC_HOST=
sample=sample
RSYNC_PATH=
AUTO_SWITCH_BEAMLINE=false
pgroup=pgroup
POS_V_DIR=POS
AUTO_SWITCH_SHUTTER=true
ALPHA_ID_2=0.0
TILT_H_DIR=POS
RSYNC_DEL=true
DIFF_ORD=1
image_shift_scale=3.296579966879864
AVERAGING_DETECTOR=true
FdaBrowser=false

View File

@@ -1,4 +1,4 @@
#Mon Jul 17 23:25:27 CEST 2023
LastRunDate=230717
FileSequentialNumber=22119
DaySequentialNumber=2
#Tue Mar 19 16:14:24 CET 2024
LastRunDate=240319
FileSequentialNumber=52
DaySequentialNumber=52

11
devices/7.properties Normal file
View File

@@ -0,0 +1,11 @@
#Wed Jul 26 00:07:52 CEST 2023
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
description=null
resolution=NaN

11
devices/76.properties Normal file
View File

@@ -0,0 +1,11 @@
#Wed Jul 26 12:21:07 CEST 2023
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
description=null
resolution=NaN

11
devices/8.properties Normal file
View File

@@ -0,0 +1,11 @@
#Wed Jul 26 00:08:03 CEST 2023
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
description=null
resolution=NaN

7
devices/ai0.properties Normal file
View File

@@ -0,0 +1,7 @@
#Fri Sep 22 16:07:20 CEST 2023
offset=0.0
precision=3
scale=1.0
description=Voltage
unit=V
sign_bit=0

View File

@@ -0,0 +1,7 @@
#Tue Jul 18 11:22:37 CEST 2023
unit=K
offset=0.0
precision=3
sign_bit=0
scale=1.0
description=Switch-box value for Pt100-K

View File

@@ -0,0 +1,7 @@
#Tue Jul 18 11:42:29 CEST 2023
unit=K
offset=0.0
precision=3
sign_bit=0
scale=1.0
description=Switch-box value for Pt100-K

10
devices/ao0.properties Normal file
View File

@@ -0,0 +1,10 @@
#Fri Sep 22 16:15:50 CEST 2023
offset=0.0
maxValue=10.0
precision=3
scale=2.44140625E-4
description=Voltage
resolution=0.01
minValue=-10.0
unit=V
sign_bit=0

10
devices/ao1.properties Normal file
View File

@@ -0,0 +1,10 @@
#Sun Sep 24 22:18:39 CEST 2023
offset=0.0
maxValue=10.0
precision=4
scale=3.05175E-4
description=Voltage
resolution=1.0E-4
minValue=-10.0
unit=V
sign_bit=0

20
devices/axis2.properties Normal file
View File

@@ -0,0 +1,20 @@
#Tue Nov 28 15:12:52 CET 2023
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,11 @@
#Wed Jul 19 17:46:13 CEST 2023
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -0,0 +1,11 @@
#Wed Jul 19 17:46:13 CEST 2023
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -0,0 +1,20 @@
#Tue Mar 19 15:27:02 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Fri Sep 15 11:39:31 CEST 2023
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -1,4 +1,4 @@
#Sun Jun 11 15:10:26 CEST 2023
#Sun Sep 24 17:05:12 CEST 2023
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
@@ -6,7 +6,7 @@ scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=800.0
colormapMax=2.0
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale

View File

@@ -0,0 +1,25 @@
#Tue Mar 05 10:58:08 CET 2024
colormapLogarithmic=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotationCrop=false
roiHeight=-1
colormapAutomatic=true
roiY=0
roiX=0
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
scale=1.0
grayscale=false
colormapMax=NaN
rotation=0.0
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
flipHorizontally=false
transpose=false

View File

@@ -0,0 +1,20 @@
#Tue Mar 19 15:27:14 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Fri Mar 01 15:58:17 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,11 @@
#Tue Jul 18 12:00:56 CEST 2023
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
rotation=false
precision=-1
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -0,0 +1,11 @@
#Wed Jul 26 21:08:49 CEST 2023
offset=0.0
maxValue=0.0
rotation=false
precision=0
scale=1.0
description=null
resolution=5.0
minValue=-20000.0
unit=um
sign_bit=0

View File

@@ -0,0 +1,20 @@
#Tue Feb 27 11:10:18 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Fri Mar 01 16:04:56 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Tue Feb 27 11:24:15 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Mon Mar 04 10:03:57 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Mon Mar 04 10:04:05 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Sun Mar 03 23:31:13 CET 2024
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,8 @@
bv.write(5.0)
time.sleep(2.0)
start_voltage.write(6.8)
time.sleep(2.0)
objective.write(1458.6)
time.sleep(2.0)
bv.write(0.0)

View File

@@ -0,0 +1,221 @@
import random
from timeit import default_timer as timer
#move_y_sim(1050.0)
k = 0
start = timer()
move_y_sim(0.0)
move_x_sim(0.0)
take_peemcam_image(0)
move_y_sim(0.0)
move_x_sim(1000.0)
take_peemcam_image(1)
move_y_sim(0.0)
move_x_sim(2000.0)
take_peemcam_image(2)
move_y_sim(0.0)
move_x_sim(3000.0)
take_peemcam_image(3)
move_y_sim(-1000.0)
move_x_sim(3000.0)
take_peemcam_image(4)
move_y_sim(-2000.0)
move_x_sim(3000.0)
take_peemcam_image(5)
move_y_sim(-3000.0)
move_x_sim(3000.0)
take_peemcam_image(6)
move_y_sim(-3000.0)
move_x_sim(2000.0)
take_peemcam_image(7)
move_y_sim(-2000.0)
move_x_sim(2000.0)
take_peemcam_image(8)
move_y_sim(-1000.0)
move_x_sim(2000.0)
take_peemcam_image(9)
move_y_sim(-1000.0)
move_x_sim(1000.0)
take_peemcam_image(10)
move_y_sim(-2000.0)
move_x_sim(1000.0)
take_peemcam_image(11)
move_y_sim(-3000.0)
move_x_sim(1000.0)
take_peemcam_image(12)
move_y_sim(-3000.0)
move_x_sim(0.0)
take_peemcam_image(13)
move_y_sim(-2000.0)
move_x_sim(0.0)
take_peemcam_image(14)
move_y_sim(-1000.0)
move_x_sim(0.0)
take_peemcam_image(15)
move_y_sim(-1000.0)
move_x_sim(-1000.0)
take_peemcam_image(16)
move_y_sim(-2000.0)
move_x_sim(-1000.0)
take_peemcam_image(17)
move_y_sim(-3000.0)
move_x_sim(-1000.0)
take_peemcam_image(18)
move_y_sim(-3000.0)
move_x_sim(-2000.0)
take_peemcam_image(19)
move_y_sim(-3000.0)
move_x_sim(-3000.0)
take_peemcam_image(20)
move_y_sim(-2000.0)
move_x_sim(-3000.0)
take_peemcam_image(21)
move_y_sim(-2000.0)
move_x_sim(-2000.0)
take_peemcam_image(22)
move_y_sim(-1000.0)
move_x_sim(-2000.0)
take_peemcam_image(23)
move_y_sim(-1000.0)
move_x_sim(-3000.0)
take_peemcam_image(24)
move_y_sim(0.0)
move_x_sim(-3000.0)
take_peemcam_image(25)
move_y_sim(1000.0)
move_x_sim(-3000.0)
take_peemcam_image(26)
move_y_sim(2000.0)
move_x_sim(-3000.0)
take_peemcam_image(27)
move_y_sim(3000.0)
move_x_sim(-3000.0)
take_peemcam_image(28)
move_y_sim(3000.0)
move_x_sim(-2000.0)
take_peemcam_image(29)
move_y_sim(2000.0)
move_x_sim(-2000.0)
take_peemcam_image(30)
move_y_sim(1000.0)
move_x_sim(-2000.0)
take_peemcam_image(31)
move_y_sim(0.0)
move_x_sim(-2000.0)
take_peemcam_image(32)
move_y_sim(0.0)
move_x_sim(-1000.0)
take_peemcam_image(33)
move_y_sim(1000.0)
move_x_sim(-1000.0)
take_peemcam_image(34)
move_y_sim(2000.0)
move_x_sim(-1000.0)
take_peemcam_image(35)
move_y_sim(3000.0)
move_x_sim(-1000.0)
take_peemcam_image(36)
move_y_sim(3000.0)
move_x_sim(0.0)
take_peemcam_image(37)
move_y_sim(3000.0)
move_x_sim(1000.0)
take_peemcam_image(38)
move_y_sim(3000.0)
move_x_sim(2000.0)
take_peemcam_image(39)
move_y_sim(3000.0)
move_x_sim(3000.0)
take_peemcam_image(40)
move_y_sim(2000.0)
move_x_sim(3000.0)
take_peemcam_image(41)
move_y_sim(1000.0)
move_x_sim(3000.0)
take_peemcam_image(42)
move_y_sim(1000.0)
move_x_sim(2000.0)
take_peemcam_image(43)
move_y_sim(2000.0)
move_x_sim(2000.0)
take_peemcam_image(44)
move_y_sim(2000.0)
move_x_sim(1000.0)
take_peemcam_image(45)
move_y_sim(2000.0)
move_x_sim(0.0)
take_peemcam_image(46)
move_y_sim(1000.0)
move_x_sim(0.0)
take_peemcam_image(47)
move_y_sim(1000.0)
move_x_sim(1000.0)
take_peemcam_image(48)
#
#for i in range(0, 7):
# #print("Ver. step Nr. %d" % (i))
# y = i * 1000.0 - 3000.0
# print("Move y to %f" % (y))
# move_y_sim(y)
# for j in range(0, 7):
# k = k + 1
# print("Step Nr. %d (49)." % (k))
# x = j * 1000.0 - 3000.0
# move_x_sim(x)
# print("Move x to %f" % (x))
# take_peemcam_image(k)
end = timer()
print "Time needed =", round(end - start), "sec"

View File

@@ -0,0 +1,5 @@
def move_with_backlash(motor, pos, backlash):
cur_pos = motor.read()
if cur_pos is None or pos<(cur_pos+backlash):
motor.move(pos-backlash)
motor.move(pos)

View File

@@ -0,0 +1,463 @@
import random
from timeit import default_timer as timer
#Y_UP = 40.0
Y_UP = 400.0 # Backlash for UP direction
Y_UP_OFFSET = - 0.0 # Offset for UP direction (to compensate some overshooting)
#Y_DW = 70.0
Y_DW = 200.0 # Backlash for DW direction
Y_DW_OFFSET = 0.0 # Offset for DW direction (to compensate some overshooting)
Y_LIMIT = 4000.0 # User limit for y-axis
X_RG = 7.0 # Backlash for RG (right) direction
X_RG_OFFSET = -0.0 # Offset for UP direction (to compensate some overshooting)
X_LF = 7.0 # Backlash for LF (left) direction
X_LF_OFFSET = 0.0 # Offset for UP direction (to compensate some overshooting)
X_LIMIT = 4000.0 # User limit for x-axis
TOL = 0.5 # Movement is discared, if step is smaller than TOL
LARGE_STEP = 1000.0 # Large step
# Set DEBUG_STATUS = 1 to enable additional print commands
# DEBUG = True
#
# def debug_print(message):
# if DEBUG:
# print(message)
#
# Based on Manipulator_scans_simulation.py
def manip_x_move_sim(position):
# This function simulates the manip_x.write(position) command, but including the handling of failure.
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
status = "Done!" # status = "Done!" or status = "Exception!"
# This is the simulated MOTOR funtion
# x = random.randint(0,1)
# if x == 0:
## print "Position reached!"
# index = 1
# status = "Exception!"
# This is the real MOTOR funtion
# Do we need sys.exc_info()[2]
try:
manip_x.write(position)
print "Position reached!"
except:
index = 1
status = "Exception:" #, sys.exc_info()[2]
return index, status
def manip_y_move_sim(position):
# This function simulates the manip_y.write(position) command, but including the handling of failure.
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
status = "Done!" # status = "Done!" or status = "Exception!"
# This is the simulated MOTOR funtion
# x = random.randint(0,1)
# if x == 0:
## print "Position reached!"
# index = 1
# status = "Exception!"
# This is the real MOTOR funtion
# Do we need sys.exc_info()[2]
try:
manip_y.write(position)
print "Position reached!"
except:
index = 1
status = "Exception:" #, sys.exc_info()[2]
return index, status
def move_x_sim(x):
# This function simulates the motion command for the sample including the handling of failure.
# Increasing x (towards positive) means motion to the left in the PEEMCAM
#
# To be done:
#
# (1) Where to log the errors?
# (2) How to perform small motions below 1 mum. This could be a separate function!
# (3) Check OFFSETS. Are they really needed?
# (4) TOL needed?
# (5) For large movements: It seems that Pshell has a timeout of 300 seconds. The longest motions take 600 seconds.
# (6) Alexandre: The intermediate step could directly come, if the motion is opposite to the previous step. How to save the history / last step?
# (7) Alexandre: Strange problem: When y = 4000.0 (Renishaw) manip_y.read() yields -4000.3. The same for the x-axis. One needs to reload Pshell to solve this.
# (7a) Elmitec: Also the update rate of the manip_y.read() is low.
# (8) Elmitec: Parallel operation of motors possible?
# (9) Elmitec: Stop motion per software?
# How to introduce a memory for the manipulator motion, via settings variable (see also Shell Settings):
# The settings variable is sort of permanent and survives even a restart of Pshell.
# 1. set_setting("POS_H_DIR", "POS") (default, also for Vertical)
# 2. get_setting("POS_H_DIR")
# 3. if get_setting("POS_H_DIR") == "POS": print 1
start = timer()
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed
failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
x_act = manip_x.read()
print "x_start =", x_act, "mum"
x_move = 0.0
tolerance = 0.5
# x_act = 0.0
# Consider OFFSETS
# Offsets might depend on distance
if (x - x_act) > 0: # Corresponds to a motion to RG (right) as seen in PEEMCAM
x_move = x + X_RG_OFFSET
tolerance = TOL
if abs(x_move - x_act) < TOL:
x_move = x
if (x - x_act) < 0: # Corresponds to a motion to LF (left) as seen in PEEMCAM
x_move = x + X_LF_OFFSET
tolerance = TOL
if abs(x_move - x_act) < TOL:
x_move = x
# Consider LIMITS
if x_move > X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x_move = X_LIMIT
if x_move < -X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x_move = -X_LIMIT
# Start motion
while(True):
if abs(x_move - x_act) > tolerance:
print "First attempt:"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "First attempt successful!"
break
if index == 1:
if abs(x_move - x_act) > LARGE_STEP:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
print "First attempt failed."
print "Second attempt:"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Second attempt successful!"
break
if index == 1:
print "Second attempt failed."
if (x_move - x_act) > 0:
if (x_move - x_act) < X_LF:
x_temp = x_act - X_LF
print "Try intermediate step to x_temp_LF =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Intermediate step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Positioning not possible!"
failure = 1
break
if index == 1:
print "Intermediate step failed."
if (x - x_act) < 0:
if (x_act - x) < X_RG:
x_temp = x_act + X_RG
print "Try intermediate step to x_temp_RG =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Intermediate step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Positioning not possible!"
failure = 1
break
if index == 1:
print "Intermediate step failed."
print "Try large step."
if abs(x_move + 1000.0) <= X_LIMIT:
print "Move to x =", x_move + LARGE_STEP, "mum (nom. x=", x + LARGE_STEP, "mum)."
index, status = manip_x_move_sim(x_move + LARGE_STEP)
if index == 1:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
if index == 0:
print "Large step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Final attempt failed!"
print "Positioning not possible!"
failure = 1
break
else:
print "Move to x =", x_move - LARGE_STEP, "mum (nom. x=", x - LARGE_STEP, "mum)."
index, status = manip_x_move_sim(x_move - LARGE_STEP)
if index == 1:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
if index == 0:
print "Large step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Final attempt failed!"
print "Positioning not possible!"
failure = 1
break
break
x_act = manip_x.read()
print "x_end =", x_act, "mum"
print "Failure status =",failure,"."
end = timer()
print "Time needed =", round(end - start), "sec"
def move_y_sim(y):
# This function simulates the motion command for the sample including the handling of failure.
# Inreasing y (towards positive) moves UP.
#
# To be done:
#
# (0) Check LF and RG with respect to PEEMCAM
# (1) Where to log the errors? - All outputs in a file in a folder manipulator_log! File_name = Date_Time_Failure_State
# (2) How to perform small motions below 1 mum. This could be a separate function!
# (3) Check OFFSETS. Are they really needed?
# (4) TOL needed?
start = timer()
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed
failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
y_move = 0.0
tolerance = 0.5
y_act = manip_y.read()
print "y_start =", y_act, "mum"
# x_act = 0.0
# Consider OFFSETS
# Offsets might depend on distance
if (y - y_act) > 0: # Corresponds to a motion to RG (right) as seen in PEEMCAM
y_move = y + Y_UP_OFFSET
tolerance = TOL
if abs(y_move - y_act) < TOL:
y_move = y
if (y - y_act) < 0: # Corresponds to a motion to LF (left) as seen in PEEMCAM
y_move = y + Y_DW_OFFSET
tolerance = TOL
if abs(y_move - y_act) < TOL:
y_move = y
# Consider LIMITS
if y_move > Y_LIMIT:
print "Chosen y exceeds user limit."
print "Move to limit."
y_move = Y_LIMIT
if y_move < -Y_LIMIT:
print "Chosen y exceeds user limit."
print "Move to limit."
y_move = -Y_LIMIT
# Start motion
while(True):
if abs(y_move - y_act) > tolerance:
print "First attempt:"
print "Move to y =", y_move, "mum (nom. y=", y, "mum)."
index, status = manip_y_move_sim(y_move)
if index == 0:
print "First attempt successful!"
break
if index == 1:
if abs(y_move - y_act) > LARGE_STEP:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
print "First attempt failed."
print "Second attempt:"
print "Move to y =", y_move, "mum (nom. y=", y, "mum)."
index, status = manip_y_move_sim(y_move)
if index == 0:
print "Second attempt successful!"
break
if index == 1:
print "Second attempt failed."
if (y_move - y_act) > 0:
if (y_move - y_act) < Y_DW:
y_temp = y_act - Y_DW
print "Try intermediate step to y_temp_DW =", y_temp, "mum."
print "Move to y =", y_temp, "mum."
index, status = manip_y_move_sim(y_temp)
if index == 0:
print "Intermediate step successful!"
print "Move to y =", y_move, "mum (nom. y=", y, "mum)."
index, status = manip_y_move_sim(y_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Positioning not possible!"
failure = 1
break
if index == 1:
print "Intermediate step failed."
if (y - y_act) < 0:
if (y_act - y) < Y_UP:
y_temp = y_act + Y_UP
print "Try intermediate step to y_temp_UP =", y_temp, "mum."
print "Move to y =", y_temp, "mum."
index, status = manip_y_move_sim(y_temp)
if index == 0:
print "Intermediate step successful!"
print "Move to y =", y_move, "mum (nom. y=", y, "mum)."
index, status = manip_y_move_sim(y_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Positioning not possible!"
failure = 1
break
if index == 1:
print "Intermediate step failed."
print "Try large step."
if abs(y_move + 1000.0) <= Y_LIMIT:
print "Move to y =", y_move + LARGE_STEP, "mum (nom. y=", y + LARGE_STEP, "mum)."
index, status = manip_y_move_sim(y_move + LARGE_STEP)
if index == 1:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
if index == 0:
print "Large step successful!"
print "Move to y =", y_move, "mum (nom. y=", y, "mum)."
index, status = manip_y_move_sim(y_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Final attempt failed!"
print "Positioning not possible!"
failure = 1
break
else:
print "Move to y =", y_move - LARGE_STEP, "mum (nom. y=", y - LARGE_STEP, "mum)."
index, status = manip_y_move_sim(y_move - LARGE_STEP)
if index == 1:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
if index == 0:
print "Large step successful!"
print "Move to y =", y_move, "mum (nom. y=", y, "mum)."
index, status = manip_y_move_sim(y_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Final attempt failed!"
print "Positioning not possible!"
failure = 1
break
break
y_act = manip_y.read()
print "y_end =", y_act, "mum"
print "Failure status =",failure,"."
end = timer()
print "Time needed =", round(end - start), "sec"

View File

@@ -0,0 +1,2 @@
set_setting("POS_H_DIR", "POS")

View File

@@ -0,0 +1,20 @@
from datetime import datetime
def take_peemcam_image(img_nr):
#filename = get_exec_pars().path + "/test.tiff"
filepath = expand_path("{data}/{year}_{month}/{date}/")
filename = filepath + "/pos_{:04d}.tif".format(img_nr)
# Den vollständigen Pfad zur Datei erstellen
# voller_pfad = os.path.join(pfad, dateiname)
# filename = filepath, img_nr, + "tilt.tiff"
trigger_peemcam()
time_str = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
matadata = {"time": time_str}
save_as_tiff(img_peemcam.data, filename, show = True, metadata=matadata)

View File

@@ -0,0 +1,136 @@
import time
# Output:
# (After a 5 second delay, the program continues...)
take_peemcam_image(0)
time.sleep(5)
tilt_horizontal.write(-1000.0)
time.sleep(600)
take_peemcam_image(1)
# time.sleep(5) # Makes Python wait for 5 seconds
tilt_horizontal.write(-2000.0)
time.sleep(600)
take_peemcam_image(2)
tilt_horizontal.write(-3000.0)
time.sleep(600)
take_peemcam_image(3)
tilt_horizontal.write(-4000.0)
time.sleep(600)
take_peemcam_image(4)
tilt_horizontal.write(-5000.0)
time.sleep(600)
take_peemcam_image(5)
tilt_horizontal.write(-6000.0)
time.sleep(600)
take_peemcam_image(6)
tilt_horizontal.write(-7000.0)
time.sleep(600)
take_peemcam_image(7)
tilt_horizontal.write(-8000.0)
time.sleep(600)
take_peemcam_image(8)
tilt_horizontal.write(-7000.0)
time.sleep(600)
take_peemcam_image(9)
tilt_horizontal.write(-6000.0)
time.sleep(600)
take_peemcam_image(10)
tilt_horizontal.write(-5000.0)
time.sleep(600)
take_peemcam_image(11)
tilt_horizontal.write(-4000.0)
time.sleep(600)
take_peemcam_image(12)
tilt_horizontal.write(-3000.0)
time.sleep(600)
take_peemcam_image(13)
tilt_horizontal.write(-2000.0)
time.sleep(600)
take_peemcam_image(14)
tilt_horizontal.write(-1000.0)
time.sleep(600)
take_peemcam_image(15)
tilt_horizontal.write(0.0)
time.sleep(600)
take_peemcam_image(16)
tilt_horizontal.write(1000.0)
time.sleep(600)
take_peemcam_image(17)
tilt_horizontal.write(2000.0)
time.sleep(600)
take_peemcam_image(18)
tilt_horizontal.write(3000.0)
time.sleep(600)
take_peemcam_image(19)
tilt_horizontal.write(4000.0)
time.sleep(600)
take_peemcam_image(20)
tilt_horizontal.write(5000.0)
time.sleep(600)
take_peemcam_image(21)
tilt_horizontal.write(6000.0)
time.sleep(600)
take_peemcam_image(22)
tilt_horizontal.write(7000.0)
time.sleep(600)
take_peemcam_image(23)
tilt_horizontal.write(8000.0)
time.sleep(600)
take_peemcam_image(24)
tilt_horizontal.write(7000.0)
time.sleep(600)
take_peemcam_image(25)
tilt_horizontal.write(6000.0)
time.sleep(600)
take_peemcam_image(26)
tilt_horizontal.write(5000.0)
time.sleep(600)
take_peemcam_image(27)
tilt_horizontal.write(4000.0)
time.sleep(600)
take_peemcam_image(28)
tilt_horizontal.write(3000.0)
time.sleep(600)
take_peemcam_image(29)
tilt_horizontal.write(2000.0)
time.sleep(600)
take_peemcam_image(30)
tilt_horizontal.write(1000.0)
time.sleep(600)
take_peemcam_image(31)
tilt_horizontal.write(0.0)
time.sleep(600)
take_peemcam_image(32)

View File

@@ -0,0 +1,136 @@
import time
# Output:
# (After a 5 second delay, the program continues...)
take_peemcam_image(0)
time.sleep(5)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(1)
# time.sleep(5) # Makes Python wait for 5 seconds
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(2)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(3)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(4)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(5)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(6)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(7)
tilt_horizontal.write(-8000.0)
time.sleep(60)
take_peemcam_image(8)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(9)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(10)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(11)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(12)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(13)
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(14)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(15)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(16)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(17)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(18)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(19)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(20)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(21)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(22)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(23)
tilt_horizontal.write(8000.0)
time.sleep(60)
take_peemcam_image(24)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(25)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(26)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(27)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(28)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(29)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(30)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(31)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(32)

View File

@@ -0,0 +1,152 @@
import time
# Output:
# (After a 5 second delay, the program continues...)
take_peemcam_image(0)
time.sleep(5)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(1)
# time.sleep(5) # Makes Python wait for 5 seconds
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(2)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(3)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(4)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(5)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(6)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(7)
tilt_horizontal.write(-8000.0)
time.sleep(60)
take_peemcam_image(8)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(9)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(10)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(11)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(12)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(13)
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(14)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(15)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(16)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(17)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(18)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(19)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(20)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(21)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(22)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(23)
tilt_horizontal.write(8000.0)
time.sleep(60)
take_peemcam_image(24)
tilt_horizontal.write(9000.0)
time.sleep(60)
take_peemcam_image(25)
tilt_horizontal.write(10000.0)
time.sleep(60)
take_peemcam_image(26)
tilt_horizontal.write(9000.0)
time.sleep(60)
take_peemcam_image(27)
tilt_horizontal.write(8000.0)
time.sleep(60)
take_peemcam_image(28)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(29)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(30)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(31)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(32)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(33)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(34)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(35)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(36)

View File

@@ -0,0 +1,144 @@
import time
# Output:
# (After a 5 second delay, the program continues...)
take_peemcam_image(0)
time.sleep(5)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(1)
# time.sleep(5) # Makes Python wait for 5 seconds
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(2)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(3)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(4)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(5)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(6)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(7)
tilt_horizontal.write(-8000.0)
time.sleep(60)
take_peemcam_image(8)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(9)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(10)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(11)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(12)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(13)
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(14)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(15)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(16)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(17)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(18)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(19)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(20)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(21)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(22)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(23)
tilt_horizontal.write(8000.0)
time.sleep(60)
take_peemcam_image(24)
tilt_horizontal.write(9000.0)
time.sleep(60)
take_peemcam_image(25)
tilt_horizontal.write(8000.0)
time.sleep(60)
take_peemcam_image(26)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(27)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(28)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(29)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(30)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(31)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(32)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(33)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(34)

View File

@@ -0,0 +1,136 @@
import time
# Output:
# (After a 5 second delay, the program continues...)
take_peemcam_image(0)
time.sleep(5)
tilt_vertical.write(-1000.0)
time.sleep(60)
take_peemcam_image(1)
# time.sleep(5) # Makes Python wait for 5 seconds
tilt_vertical.write(-2000.0)
time.sleep(60)
take_peemcam_image(2)
tilt_vertical.write(-3000.0)
time.sleep(60)
take_peemcam_image(3)
tilt_vertical.write(-4000.0)
time.sleep(60)
take_peemcam_image(4)
tilt_vertical.write(-5000.0)
time.sleep(60)
take_peemcam_image(5)
tilt_vertical.write(-6000.0)
time.sleep(60)
take_peemcam_image(6)
tilt_vertical.write(-7000.0)
time.sleep(60)
take_peemcam_image(7)
tilt_vertical.write(-8000.0)
time.sleep(60)
take_peemcam_image(8)
tilt_vertical.write(-7000.0)
time.sleep(60)
take_peemcam_image(9)
tilt_vertical.write(-6000.0)
time.sleep(60)
take_peemcam_image(10)
tilt_vertical.write(-5000.0)
time.sleep(60)
take_peemcam_image(11)
tilt_vertical.write(-4000.0)
time.sleep(60)
take_peemcam_image(12)
tilt_vertical.write(-3000.0)
time.sleep(60)
take_peemcam_image(13)
tilt_vertical.write(-2000.0)
time.sleep(60)
take_peemcam_image(14)
tilt_vertical.write(-1000.0)
time.sleep(60)
take_peemcam_image(15)
tilt_vertical.write(0.0)
time.sleep(60)
take_peemcam_image(16)
tilt_vertical.write(1000.0)
time.sleep(60)
take_peemcam_image(17)
tilt_vertical.write(2000.0)
time.sleep(60)
take_peemcam_image(18)
tilt_vertical.write(3000.0)
time.sleep(60)
take_peemcam_image(19)
tilt_vertical.write(4000.0)
time.sleep(60)
take_peemcam_image(20)
tilt_vertical.write(5000.0)
time.sleep(60)
take_peemcam_image(21)
tilt_vertical.write(6000.0)
time.sleep(60)
take_peemcam_image(22)
tilt_vertical.write(7000.0)
time.sleep(60)
take_peemcam_image(23)
tilt_vertical.write(8000.0)
time.sleep(60)
take_peemcam_image(24)
tilt_vertical.write(7000.0)
time.sleep(60)
take_peemcam_image(25)
tilt_vertical.write(6000.0)
time.sleep(60)
take_peemcam_image(26)
tilt_vertical.write(5000.0)
time.sleep(60)
take_peemcam_image(27)
tilt_vertical.write(4000.0)
time.sleep(60)
take_peemcam_image(28)
tilt_vertical.write(3000.0)
time.sleep(60)
take_peemcam_image(29)
tilt_vertical.write(2000.0)
time.sleep(60)
take_peemcam_image(30)
tilt_vertical.write(1000.0)
time.sleep(60)
take_peemcam_image(31)
tilt_vertical.write(0.0)
time.sleep(60)
take_peemcam_image(32)

View File

@@ -0,0 +1,6 @@
def trigger_peemcam(wait=True):
peemcam.waitReady(5000)
peemcam.start()
if wait:
img_peemcam.waitNext(20000 + int(peemcam.exposure * 1000))
#peemcam.waitNewImage(20000 + int(peemcam.exposure * 1000))

View File

@@ -0,0 +1,151 @@
from timeit import default_timer as timer
##manip_x.write(-0.0)
##manip_x.write(-7.0)
##manip_x.write(0.0)
##manip_y.write(-30.0)
##manip_y.write(0.0)
Y_UP = 40.0
Y_UP_OFFSET = - 0.5
Y_DW = 40.0
Y_DW_OFFSET = 0.0
Y_LIMIT = 4000.0
X_RG = 7.0
X_RG_OFFSET = 0.0
X_LF = 7.0
X_LF_OFFSET = 0.0
X_LIMIT = 4000.0
TOL = 0.5
def move_y(y):
# Still to be done
# - Check whether y is within physical limits
# - Check how to handle remaining errors
start = timer()
index = 0
retries = 3
while(True):
try:
y_act = manip_y.read()
print "y_start =", y_act, "mum"
if abs(y - y_act) > TOL:
if (y - y_act) > TOL:
if (y - y_act) < Y_UP:
y_temp = y_act - Y_UP
print "y_temp_UP =", y_temp, "mum"
print "y =", y
manip_y.write(y_temp)
manip_y.write(y + Y_UP_OFFSET)
else:
print "go directly UP to y =", y, "mum"
manip_y.write(y + Y_UP_OFFSET)
if (y_act - y) > TOL:
if (y_act - y) < Y_DW:
y_temp = y_act + Y_DW
print "y_temp_DW =", y_temp, "mum"
print "y =", y
manip_y.write(y_temp)
manip_y.write(y + Y_DW_OFFSET)
else:
print "go directly DW to y =", y, "mum"
manip_y.write(y + Y_DW_OFFSET)
break;
except:
index = index + 1
if index >= retries:
raise
print "Exception: ", sys.exc_info()[2]
print "Retry:", index
y_act = manip_y.read()
print "y_end =", y_act, "mum"
end = timer()
print "Time needed =", round(end - start), "sec"
def move_x(x):
# Still to be done
# - Check whether y is within physical limits
# - Check how to handle remaining errors
start = timer()
index = 0
retries = 3
# Check, whether the chosen x exceeds limits:
if x > X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x = 4000.0
if x < -X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x = -4000.0
while(True):
try:
x_act = manip_x.read()
print "x_start =", x_act, "mum"
index = 1
# If two retries were not successful, make a large move first, before trying again:
if index == 2:
print "Move large step, after two failed attempts"
# Send email to beamline scientists
if abs(x + 1000.0) <= X_LIMIT:
manip_x.write(x + 1000.0)
x_act = manip_x.read()
print "x_start_new =", x_act, "mum"
else:
manip_x.write(x - 1000.0)
x_act = manip_x.read()
print "x_start_new =", x_act, "mum"
if abs(x - x_act) > TOL:
if (x - x_act) > TOL:
if (x - x_act) < X_LF:
x_temp = x_act - X_LF
print "x_temp_LF =", x_temp, "mum"
print "x =", x
manip_x.write(x_temp)
manip_x.write(x + X_LF_OFFSET)
else:
print "go directly LF to x =", x, "mum"
manip_x.write(x + X_LF_OFFSET)
if (x_act - x) > TOL:
if (x_act - x) < X_RG:
x_temp = x_act + X_RG
print "x_temp_RG =", x_temp, "mum"
print "x =", x
manip_x.write(x_temp)
manip_x.write(x + X_RG_OFFSET)
else:
print "go directly RG to x =", x, "mum"
manip_x.write(x + X_RG_OFFSET)
break;
except:
index = index + 1
if index >= retries:
raise
print "Exception: ", sys.exc_info()[2]
print "Retry:", index
x_act = manip_x.read()
print "x_end =", x_act, "mum"
end = timer()
print "Time needed =", round(end - start), "sec"
##manip_x.write(-7.0)
##manip_x.write(0.0)
##manip_y.write(-30.0)
##manip_y.write(0.0)

View File

@@ -0,0 +1,228 @@
import random
from timeit import default_timer as timer
Y_UP = 40.0 # Backlash for UP direction
Y_UP_OFFSET = - 0.5 # Offset for UP direction (to compensate some overshooting)
Y_DW = 40.0 # Backlash for DW direction
Y_DW_OFFSET = 0.0 # Offset for DW direction (to compensate some overshooting)
Y_LIMIT = 4000.0 # User limit for y-axis
X_RG = 7.0 # Backlash for RG (right) direction
X_RG_OFFSET = -0.6 # Offset for UP direction (to compensate some overshooting)
X_LF = 7.0 # Backlash for LF (left) direction
X_LF_OFFSET = 0.6 # Offset for UP direction (to compensate some overshooting)
X_LIMIT = 4000.0 # User limit for x-axis
TOL = 0.5 # Movement is discared, if step is smaller than TOL
LARGE_STEP = 1000.0 # Large step
# Set DEBUG_STATUS = 1 to enable additional print commands
# DEBUG = True
#
# def debug_print(message):
# if DEBUG:
# print(message)
#
def manip_x_move_sim(position):
# This function simulates the manip_x.write(position) command, but including the handling of failure.
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
status = "Done!" # status = "Done!" or status = "Exception!"
# This is the simulated MOTOR funtion
x = random.randint(0,1)
if x == 0:
# print "Position reached!"
index = 1
status = "Exception!"
# This is the real MOTOR funtion
# Do we need sys.exc_info()[2]
# try:
# manip_x.write(position)
# print "Position reached!"
#
# except:
# index = 1
# status = "Exception:" #, sys.exc_info()[2]
return index, status
# This is how to call the function:
#
# index, status = manip_x_move_sim(position)
#
# print status
# print index
#
def move_x_sim(x):
# This function simulates the motion command for the sample including the handling of failure.
# To be done:
# Where to log the errors?
#
start = timer()
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed
failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
x_act = 0.0
# Consider OFFSETS
# Offsets might depend on distance
if (x - x_act) > 0: # Corresponds to a motion to RG (right) as seen in PEEMCAM
x_move = x + X_RG_OFFSET
tolerance = TOL
if abs(x_move - x_act) < TOL:
x_move = x
if (x - x_act) < 0: # Corresponds to a motion to LF (left) as seen in PEEMCAM
x_move = x + X_LF_OFFSET
tolerance = TOL
if abs(x_move - x_act) < TOL:
x_move = x
# Consider LIMITS
if x_move > X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x_move = X_LIMIT
if x_move < -X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x_move = -X_LIMIT
# Start motion
while(True):
if abs(x_move - x_act) > tolerance:
print "First attempt:"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "First attempt successful!"
break
if index == 1:
if abs(x_move - x_act) > LARGE_STEP:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
print "First attempt failed."
print "Second attemp:"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Second attempt successful!"
break
if index == 1:
print "Second attempt failed."
if (x_move - x_act) > 0:
if (x_move - x_act) < X_LF:
x_temp = x_act - X_LF
print "Try intermediate step to x_temp_LF =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Intermediate step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Positioning not possible!"
failure = 1
break
if index == 1:
print "Intermediate step failed."
if (x - x_act) < 0:
if (x_act - x) < X_RG:
x_temp = x_act + X_RG
print "Try intermediate step to x_temp_RG =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Intermediate step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Positioning not possible!"
failure = 1
break
if index == 1:
print "Intermediate step failed."
print "Try large step."
if abs(x_move + 1000.0) <= X_LIMIT:
print "Move to x =", x_move + LARGE_STEP, "mum (nom. x=", x + LARGE_STEP, "mum)."
index, status = manip_x_move_sim(x_move + LARGE_STEP)
if index == 1:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
if index == 0:
print "Large step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Final attempt failed!"
print "Positioning not possible!"
failure = 1
break
else:
print "Move to x =", x_move - LARGE_STEP, "mum (nom. x=", x - LARGE_STEP, "mum)."
index, status = manip_x_move_sim(x_move - LARGE_STEP)
if index == 1:
print "Large step failed."
print "Positioning not possible!"
failure = 1
break
if index == 0:
print "Large step successful!"
print "Move to x =", x_move, "mum (nom. x=", x, "mum)."
index, status = manip_x_move_sim(x_move)
if index == 0:
print "Positioning successful!"
break
if index == 1:
print "Final attempt failed!"
print "Positioning not possible!"
failure = 1
break
break
# x_act = manip_x.read()
# print "x_end =", x_act, "mum"
print "Failure status =",failure,"."
end = timer()
print "Time needed =", round(end - start), "sec"

View File

@@ -0,0 +1,324 @@
import random
from timeit import default_timer as timer
Y_UP = 40.0
Y_UP_OFFSET = - 0.5
Y_DW = 40.0
Y_DW_OFFSET = 0.0
Y_LIMIT = 4000.0
X_RG = 7.0
X_RG_OFFSET = -0.6
X_LF = 7.0
X_LF_OFFSET = 0.6
X_LIMIT = 4000.0
TOL = 0.5
# Set DEBUG_STATUS = 1 to enable additional print commands
#DEBUG = True
#
#def debug_print(message):
# if DEBUG:
# print(message)
#
def manip_x_move_sim(position):
# This function simulates the manip_x.write(position) command, but including the handling of failure.
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
status = "Done!" # status = "Done!" or status = "Exception!"
# This is the simulated MOTOR funtion
x = random.randint(0,1)
if x == 0:
# print "Position reached!"
index = 1
status = "Exception!"
# This is the real MOTOR funtion
# Do we need sys.exc_info()[2]
# try:
# manip_x.write(position)
# print "Position reached!"
#
# except:
# index = 1
# status = "Exception:" #, sys.exc_info()[2]
return index, status
# This is how to call the function:
#
# index, status = manip_x_move_sim(position)
#
# print status
# print index
#
def move_x_sim(x):
# This function simulates the motion command for the sample including the handling of failure.
# To be done:
# Where to log the errors?
#
start = timer()
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed
failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
if x > X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x = 4000.0
if x < -X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x = -4000.0
while(True):
x_act = 0.0
if abs(x - x_act) > TOL:
# if (x - x_act) > TOL:
print "Erster Versuch:"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x)
# print status
# print index
if index == 0:
print "Erfolg im ersten Versuch!"
break
if index == 1:
print "Erster Versuch fehlgeschlagen."
print "Zweiter Versuch:"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x)
# print status
# print index
if index == 0:
print "Erfolg im zweiten Versuch!"
break
if index == 1:
print "Zweiter Versuch fehlgeschlagen."
if (x - x_act) < X_LF:
x_temp = x_act - X_LF
print "Versuche Zwischenschritt zu x_temp_LF =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
# print status
# print index
if index == 0:
print "Zwischenschritt erfolgreich!"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Positionierung erfolgreich!"
break
if index == 1:
print "Positionierung nicht moeglich!"
failure = 1
break
if index == 1:
print "Zwischenschritt fehlgeschlagen."
print "Versuche einen grossen Schritt."
if abs(x + 1000.0) <= X_LIMIT:
print "Move to x =", x + 1000.0
index, status = manip_x_move_sim(x + 1000.0)
# print status
# print index
if index == 1:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung fehlgeschlagen!"
failure = 1
break
if index == 0:
print "Grosser Schritt erfolgreich!"
print "Move to x =", x
index, status = manip_x_move_sim(x)
# print status
# print index
if index == 0:
print "Positionierung erfolgreich!"
break
# print status
# print index
if index == 1:
print "Letzter Versuch fehlgeschlagen!"
print "Positionierung fehlgeschlagen!"
failure = 1
break
# print status
# print index
else:
print "Move to x =", x - 1000.0
index, status = manip_x_move_sim(x - 1000.0)
# print status
# print index
if index == 1:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung fehlgeschlagen!"
failure = 1
break
if index == 0:
print "Grosser Schritt erfolgreich!"
print "Move to x =", x
index, status = manip_x_move_sim(x)
# print status
# print index
if index == 0:
print "Positionierung erfolgreich!"
break
# print status
# print index
if index == 1:
print "Letzter Versuch fehlgeschlagen!"
print "Positionierung fehlgeschlagen!"
failure = 1
break
# print status
# print index
# print status
# print index
if (x_act - x) < X_RG:
x_temp = x_act + X_RG
print "Versuche einen Zwischenschritt zu x_temp_RG =", x_temp, "mum."
print "x =", x
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
# print status
# print index
if index == 0:
print "Zwischenschritt erfolgreich!"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Positionierung erfolgreich!"
break
if index == 1:
print "Positionierung nicht moeglich!"
failure = 1
break
if index == 1:
print "Zwischenschritt fehlgeschlagen."
print "Versuche einen grossen Schritt."
if abs(x + 1000.0) <= X_LIMIT:
print "Move to x =", x + 1000.0
index, status = manip_x_move_sim(x + 1000.0)
# print status
# print index
if index == 1:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung fehlgeschlagen!"
failure = 1
break
if index == 0:
print "Grosser Schritt erfolgreich!"
print "Move to x =", x
index, status = manip_x_move_sim(x)
# print status
# print index
if index == 0:
print "Positionierung erfolgreich!"
break
# print status
# print index
if index == 1:
print "Letzter Versuch fehlgeschlagen!"
print "Positionierung fehlgeschlagen!"
failure = 1
break
# print status
# print index
else:
print "Move to x =", x - 1000.0
index, status = manip_x_move_sim(x - 1000.0)
# print status
# print index
if index == 1:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung fehlgeschlagen!"
failure = 1
break
if index == 0:
print "Grosser Schritt erfolgreich!"
print "Move to x =", x
index, status = manip_x_move_sim(x)
# print status
# print index
if index == 0:
print "Positionierung erfolgreich!"
break
# print status
# print index
if index == 1:
print "Letzter Versuch fehlgeschlagen!"
print "Positionierung fehlgeschlagen!"
failure = 1
break
# print status
# print index
# print status
# print index
# else:
break;
#
# # manip_x.write(x_temp)
# # manip_x.write(x + X_LF_OFFSET)
#
# else:
#
# print "go directly LF to x =", x, "mum"
# manip_x.write(x + X_LF_OFFSET)
#
# if (x_act - x) > TOL:
# if (x_act - x) < X_RG:
#
# x_temp = x_act + X_RG
# print "x_temp_RG =", x_temp, "mum"
# print "x =", x
## manip_x.write(x_temp)
## manip_x.write(x + X_RG_OFFSET)
#
# else:
#
## print "go directly RG to x =", x, "mum"
## manip_x.write(x + X_RG_OFFSET)
# break;
#
# except:
#
# index = index + 1
# if index >= retries:
# raise
#
# print "Exception: ", sys.exc_info()[2]
# print "Retry:", index
# x_act = manip_x.read()
# print "x_end =", x_act, "mum"
print "Failure status =", failure, "."
end = timer()
print "Time needed =", round(end - start), "sec"

View File

@@ -0,0 +1,210 @@
import random
from timeit import default_timer as timer
Y_UP = 40.0 # Backlash for UP direction
Y_UP_OFFSET = - 0.5 # Offset for UP direction (to compensate some overshooting)
Y_DW = 40.0 # Backlash for DW direction
Y_DW_OFFSET = 0.0 # Offset for DW direction (to compensate some overshooting)
Y_LIMIT = 4000.0 # User limit for y-axis
X_RG = 7.0 # Backlash for RG (right) direction
X_RG_OFFSET = -0.6 # Offset for UP direction (to compensate some overshooting)
X_LF = 7.0 # Backlash for LF (left) direction
X_LF_OFFSET = 0.6 # Offset for UP direction (to compensate some overshooting)
X_LIMIT = 4000.0 # User limit for x-axis
TOL = 0.5 # Movement is discared, if step is smaller than TOL
LARGE_STEP = 1000.0 # Large step
# Set DEBUG_STATUS = 1 to enable additional print commands
# DEBUG = True
#
# def debug_print(message):
# if DEBUG:
# print(message)
#
def manip_x_move_sim(position):
# This function simulates the manip_x.write(position) command, but including the handling of failure.
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
status = "Done!" # status = "Done!" or status = "Exception!"
# This is the simulated MOTOR funtion
x = random.randint(0,1)
if x == 0:
# print "Position reached!"
index = 1
status = "Exception!"
# This is the real MOTOR funtion
# Do we need sys.exc_info()[2]
# try:
# manip_x.write(position)
# print "Position reached!"
#
# except:
# index = 1
# status = "Exception:" #, sys.exc_info()[2]
return index, status
# This is how to call the function:
#
# index, status = manip_x_move_sim(position)
#
# print status
# print index
#
def move_x_sim(x):
# This function simulates the motion command for the sample including the handling of failure.
# To be done:
# Where to log the errors?
#
start = timer()
index = 0 # 0 = Motor erfolgreich, 1 = Motor failed
failure = 0 # 0 = Positionierung erfolgreich, 1 = Positionierung fehlgeschlagen
if x > X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x = X_LIMIT
if x < -X_LIMIT:
print "Chosen x exceeds user limit."
print "Move to limit."
x = -X_LIMIT
while(True):
x_act = 0.0
if abs(x - x_act) > TOL:
print "Erster Versuch:"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x)
if index == 0:
print "Erfolg im ersten Versuch!"
break
if index == 1:
if abs(x - x_act) > LARGE_STEP:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung nicht moeglich!"
failure = 1
break
print "Erster Versuch fehlgeschlagen."
print "Zweiter Versuch:"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x)
if index == 0:
print "Erfolg im zweiten Versuch!"
break
if index == 1:
print "Zweiter Versuch fehlgeschlagen."
if (x - x_act) > 0:
if (x - x_act) < X_LF:
x_temp = x_act - X_LF
print "Versuche Zwischenschritt zu x_temp_LF =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Zwischenschritt erfolgreich!"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Positionierung erfolgreich!"
break
if index == 1:
print "Positionierung nicht moeglich!"
failure = 1
break
if index == 1:
print "Zwischenschritt fehlgeschlagen."
if (x - x_act) < 0:
if (x_act - x) < X_RG:
x_temp = x_act + X_RG
print "Versuche einen Zwischenschritt zu x_temp_RG =", x_temp, "mum."
print "Move to x =", x_temp, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Zwischenschritt erfolgreich!"
print "Move to x =", x, "mum."
index, status = manip_x_move_sim(x_temp)
if index == 0:
print "Positionierung erfolgreich!"
break
if index == 1:
print "Positionierung nicht moeglich!"
failure = 1
break
if index == 1:
print "Zwischenschritt fehlgeschlagen."
print "Versuche einen grossen Schritt."
if abs(x + 1000.0) <= X_LIMIT:
print "Move to x =", x + LARGE_STEP
index, status = manip_x_move_sim(x + LARGE_STEP)
if index == 1:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung fehlgeschlagen!"
failure = 1
break
if index == 0:
print "Grosser Schritt erfolgreich!"
print "Move to x =", x
index, status = manip_x_move_sim(x)
if index == 0:
print "Positionierung erfolgreich!"
break
if index == 1:
print "Letzter Versuch fehlgeschlagen!"
print "Positionierung fehlgeschlagen!"
failure = 1
break
else:
print "Move to x =", x - LARGE_STEP
index, status = manip_x_move_sim(x - LARGE_STEP)
if index == 1:
print "Grosser Schritt fehlgeschlagen."
print "Positionierung fehlgeschlagen!"
failure = 1
break
if index == 0:
print "Grosser Schritt erfolgreich!"
print "Move to x =", x
index, status = manip_x_move_sim(x)
if index == 0:
print "Positionierung erfolgreich!"
break
if index == 1:
print "Letzter Versuch fehlgeschlagen!"
print "Positionierung fehlgeschlagen!"
failure = 1
break
break
# x_act = manip_x.read()
# print "x_end =", x_act, "mum"
print "Failure status =",failure,"."
end = timer()
print "Time needed =", round(end - start), "sec"

View File

@@ -0,0 +1,211 @@
import random
def some_function():
# Diese Funktion simuliert ein Device, das zufaellig eine Fehlfunktion zeigt.
print "Try to move to x."
x = random.randint(0,1)
#print x
if x > 0:
print "Success!"
else:
# Hier wird eine Ausnahme ausgelöst
raise ValueError ("Error!")
def some_function_large():
# Diese Funktion simuliert ein Device, das zufaellig eine Fehlfunktion zeigt.
print "Try to move to x + 1000."
x = random.randint(0,1)
#print x
if x > 0:
print "Success!"
else:
# Hier wird eine Ausnahme ausgelöst
raise ValueError ("Error!")
def try_this_out():
# This function simulates the error handling when changing the manipulator position as follows:
# (1) Try two times, to reach the position x using the X,Y_UP,DW and the corresponding OFFSETS. (PRIMARY APPROACH)
# (2) If (1) fails, we are trying to move a large step x p or m 1000 and to go from there to x. (SECONDARY APPROACH)
index = 0
retries = 3
# PRIMARY APPROACH to x.
try:
while(True):
try:
some_function()
print "Position reached! Primary approach successful."
break;
except ValueError as e:
print e
index = index + 1
if index >= retries - 1:
raise ValueError ("Too many failed attempts!")# Damit brechen wir aus der while-Schleife aus.
# print "Exception: ", sys.exc_info()[2]
# print "Retry:", index
# SECONDARY APPROACH to x.
except:
print "Attempt", index,"failed. Try to make a large step."
# In this situation, we try a large step. REMEMBER, that we need to check the limits.
try:
some_function_large()
print "Large step succesful!"
try:
some_function()
print "Final position reached! Second approach successful."
except ValueError as e:
print e
print "Final position NOT reached!"
print "Please position the sample manually using knobs at the motors."
print "Inform local contact."
print "Thank you!"
except ValueError as e:
print e
print "Large step failed!"
print "Final position NOT reached!"
print "Please position the sample manually using knobs at the motors."
print "Inform local contact."
print "Thank you!"
print "Done!"
def one_step_sim_error(position, retries):
# This function simulates the error handling when changing the manipulator position using move_motor_sim_error(position): as follows:
# 1) Move to position 1 with retries1 attempts. In case of failure break out.
index = 0
try:
while(True):
try:
move_motor_sim_error(position)
print "Position reached!"
break;
except ValueError as e:
print e
index = index + 1
if index >= retries:
raise ValueError ("Too many failed attempts position!")# Damit brechen wir aus der while-Schleife aus.
# print "Exception: ", sys.exc_info()[2]
# print "Retry:", index
except ValueError as e:
print e
print "Attempt", index,"failed."
print "Done!"
def two_step_sim_error(position1, retries1, position2, retries2):
# This function simulates the error handling when changing the manipulator position using move_motor_sim_error(position): as follows:
# 1) Move to position 1 with retries1 attempts. In case of failure break out.
# 2) If position1 is reached, move to position 2 with retries2 attempts. In case of failure break out.
index = 0
try:
while(True):
try:
move_motor_sim_error(position1)
print "Position 1 reached!"
index = 0
while(True):
try:
move_motor_sim_error(position2)
print "Position 2 reached!"
break;
except ValueError as e:
print e
index = index + 1
if index >= retries2:
raise ValueError ("Too many failed attempts position 2!")# Damit brechen wir aus der while-Schleife aus.
break;
except ValueError as e:
print e
index = index + 1
if index >= retries1:
raise ValueError ("Too many failed attempts position 1!")# Damit brechen wir aus der while-Schleife aus.
# print "Exception: ", sys.exc_info()[2]
# print "Retry:", index
except ValueError as e:
print e
print "Attempt", index,"failed."
print "Done!"
def move_motor_sim_error(position):
# Diese Funktion simuliert ein Device, das zufaellig eine Fehlfunktion zeigt.
print "Try to move to x =",position,"mum."
x = random.randint(0,1)
#print x
# if x > 0:
# print "Success!"
# else:
if x == 0:
# Hier wird eine Ausnahme ausgelöst
raise ValueError ("Error!")
# Das hier ist vielleicht sinnvoller fuer das Debuggen
# raise ValueError (sys.exc_info()[2])
# print "Exception: ", sys.exc_info()[2]
# print "Retry:", index
def one_step_sim_error_return(position):
# This function simulates the error handling when changing the manipulator position using move_motor_sim_error(position): as follows:
# 1) Move to position 1 with retries1 attempts. In case of failure break out.
index = 0
status = "Done!"
try:
move_motor_sim_error(position)
print "Position reached!"
except ValueError as e:
index = 1
status = e
# raise ValueError ("Too many failed attempts position!")# Damit brechen wir aus der while-Schleife aus.
# print "Exception: ", sys.exc_info()[2]
# print "Retry:", index
# print status
return index, status
def move_to_sim(position):
index, status = one_step_sim_error_return(position)
print status
print index

View File

@@ -0,0 +1,29 @@
def test_one_step_sim_error_return(position):
# This function simulates the error handling when changing the manipulator position using move_motor_sim_error(position): as follows:
# 1) Move to position 1 with retries1 attempts. In case of failure break out.
index = 0
status = "Done!"
try:
manip_x.write(position)
print "Position reached!"
except:
index = 1
status = "Exception:" #, sys.exc_info()[2]
return index, status
def test_move_to_sim(position):
index, status = test_one_step_sim_error_return(position)
print status
print index
def test_error_handling(position):
test_move_to_sim(position)
x_act = manip_x.read()
print "x =", x_act, "mum"

View File

@@ -0,0 +1,29 @@
# import os
# Der Pfad, in dem die Dateien gespeichert werden sollen
pfad = "/pfad/zum/verzeichnis/"
# Anfangsnummer für die Dateinamen
start_nummer = 1
# Anzahl der Dateien, die Sie speichern möchten
anzahl_dateien = 5
for i in range(anzahl_dateien):
# Erstellen des Dateinamens mit führenden Nullen für die Nummer
dateiname = "tilt_{:04d}.tif".format(start_nummer)
# Den vollständigen Pfad zur Datei erstellen
# voller_pfad = os.path.join(pfad, dateiname)
voller_pfad = pfad + dateiname
# Hier speichern Sie Ihre Datei oder führen andere Operationen durch
# Zum Beispiel:
# with open(voller_pfad, 'w') as file:
# file.write("Hier ist der Inhalt der Datei")
# Die Nummer für den nächsten Dateinamen erhöhen
start_nummer += 1
print("Datei gespeichert unter:", voller_pfad)

View File

@@ -0,0 +1,11 @@
from datetime import datetime
#filename = get_exec_pars().path + "/test.tiff"
filename = expand_path("{data}/{year}_{month}/{date}/test_{dseq}.tiff")
trigger_peemcam()
time_str = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
matadata = {"time": time_str}
save_as_tiff(img_peemcam.data, filename, show = True, metadata=matadata)

View File

@@ -0,0 +1,136 @@
import time
# Output:
# (After a 5 second delay, the program continues...)
take_peemcam_image(0)
time.sleep(5)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(1)
# time.sleep(5) # Makes Python wait for 5 seconds
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(2)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(3)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(4)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(5)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(6)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(7)
tilt_horizontal.write(-8000.0)
time.sleep(60)
take_peemcam_image(8)
tilt_horizontal.write(-7000.0)
time.sleep(60)
take_peemcam_image(9)
tilt_horizontal.write(-6000.0)
time.sleep(60)
take_peemcam_image(10)
tilt_horizontal.write(-5000.0)
time.sleep(60)
take_peemcam_image(11)
tilt_horizontal.write(-4000.0)
time.sleep(60)
take_peemcam_image(12)
tilt_horizontal.write(-3000.0)
time.sleep(60)
take_peemcam_image(13)
tilt_horizontal.write(-2000.0)
time.sleep(60)
take_peemcam_image(14)
tilt_horizontal.write(-1000.0)
time.sleep(60)
take_peemcam_image(15)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(16)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(17)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(18)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(19)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(20)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(21)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(22)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(23)
tilt_horizontal.write(8000.0)
time.sleep(60)
take_peemcam_image(24)
tilt_horizontal.write(7000.0)
time.sleep(60)
take_peemcam_image(25)
tilt_horizontal.write(6000.0)
time.sleep(60)
take_peemcam_image(26)
tilt_horizontal.write(5000.0)
time.sleep(60)
take_peemcam_image(27)
tilt_horizontal.write(4000.0)
time.sleep(60)
take_peemcam_image(28)
tilt_horizontal.write(3000.0)
time.sleep(60)
take_peemcam_image(29)
tilt_horizontal.write(2000.0)
time.sleep(60)
take_peemcam_image(30)
tilt_horizontal.write(1000.0)
time.sleep(60)
take_peemcam_image(31)
tilt_horizontal.write(0.0)
time.sleep(60)
take_peemcam_image(32)

View File

@@ -21,3 +21,9 @@
# raise Exception("Invalid fit")
#objective.write(mn)
#roi_contrast.read()
#image_contrast.read()
lscan([slit_motion], [image.contrast], [-10500.0], [-6500.0], [100.0], latency=0.0, relative=False, passes=1, zigzag=False, title='slit', keep=False, name='test', layout='table', provider='txt')
#cscan([slit_motion], ['ca://X11MA-PC-ET7000:SW-K3'], [-9700.0], [-9500.0], [1.0], latency=2.0, time=1.0, relative=False, passes=1, zigzag=False, title='testslit', keep=False, name='Unknown')
#lscan([objective], ['ca://X11MA-ES1-PREP:PRESSURE'], [1475.0], [1485.0], [2.0], latency=10.0, relative=False, passes=1, zigzag=False, title='test', keep=False, name='testt', layout='default', provider='txt')

View File

@@ -0,0 +1,168 @@
AVERAGE = 1
EXPOSURE = 1.0
MEASUREMENTS = 1
#set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
#set_beamline_setup(id ="ID2", en=800, pol1="Circ_Plus", alp1=0.0, har1=1, off1=-2.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
#bv.write(5.0)
#time.sleep(2.0)
#start_voltage.write(6.8)
#time.sleep(2.0)
#objective.write(1458.6)
#time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Lin_Ver", alp2=90.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Plus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
set_beamline_setup(id ="PGM_ID2", en=565, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
time.sleep(2.0)
abs_spec(ranges="Cr_L23edge", roi="test", switch_pol=False, scans=2, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
#bv.write(0.0)
#BV 0, SV 2.8 eV, 1456.4
#BV 5, SV 6.8 eV, Obj. 1458.6, Angezeigt 10 V und 4.7 mA
#abs_spec(ranges="Ni_L23_fine_AFR", roi="test", switch_pol=False, scans=10, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
#set_beamline_setup(id ="PGM_ID2", en=850, pol2="Circ_Minus", alp2=0.0, har2=1, off2=-2.0)
#time.sleep(2.0)
#abs_spec(ranges="Ni_L23_fine_AFR", roi="test", switch_pol=False, scans=10, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
#set_beamline_setup(id ="PGM_ID2", en=710, pol2="Lin_Hor", alp2=0.0, har2=1, off2=-2.0)
#time.sleep(2.0)
#abs_spec(ranges="Fe_L3_fine", roi="test", switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
ao1.write(9.00)
time.sleep(1.0)
ao1.write(8.00)
time.sleep(1.0)
ao1.write(7.00)
time.sleep(1.0)
ao1.write(6.00)
time.sleep(1.0)
ao1.write(5.00)
time.sleep(1.0)
ao1.write(4.00)
time.sleep(1.0)
ao1.write(3.00)
time.sleep(1.0)
ao1.write(2.00)
time.sleep(1.0)
ao1.write(1.00)
time.sleep(1.0)
ao1.write(0.00)
time.sleep(1.0)
ao1.write(-1.00)
time.sleep(1.0)
ao1.write(-2.00)
time.sleep(1.0)
ao1.write(-3.00)
time.sleep(1.0)
ao1.write(-4.00)
time.sleep(1.0)
ao1.write(-5.00)
time.sleep(1.0)
ao1.write(-6.00)
time.sleep(1.0)
ao1.write(-7.00)
time.sleep(1.0)
ao1.write(-8.00)
time.sleep(1.0)
ao1.write(-9.00)
time.sleep(1.0)
ao1.write(-9.9)
time.sleep(1.0)
start_voltage.write(4.4)
time.sleep(2.0)

View File

@@ -0,0 +1,43 @@
ao1.write(-9.00)
time.sleep(1.0)
ao1.write(-8.00)
time.sleep(1.0)
ao1.write(-7.00)
time.sleep(1.0)
ao1.write(-6.00)
time.sleep(1.0)
ao1.write(-5.00)
time.sleep(1.0)
ao1.write(-4.00)
time.sleep(1.0)
ao1.write(-3.00)
time.sleep(1.0)
ao1.write(-2.00)
time.sleep(1.0)
ao1.write(-1.00)
time.sleep(1.0)
ao1.write(0.00)
time.sleep(1.0)
ao1.write(1.00)
time.sleep(1.0)
ao1.write(2.00)
time.sleep(1.0)
ao1.write(3.00)
time.sleep(1.0)
ao1.write(4.00)
time.sleep(1.0)
ao1.write(5.00)
time.sleep(1.0)
ao1.write(6.00)
time.sleep(1.0)
ao1.write(7.00)
time.sleep(1.0)
ao1.write(8.00)
time.sleep(1.0)
ao1.write(9.00)
time.sleep(1.0)
ao1.write(9.9)
time.sleep(1.0)
start_voltage.write(-1.6)
time.sleep(2.0)

View File

@@ -0,0 +1,29 @@
import smtplib
from email.mime.text import MIMEText
# E-Mail-Parameter
sender_email = 'deine_email@example.com'
empfaenger_email = 'empfaenger@example.com'
smtp_server = 'smtp.example.com'
smtp_port = 587
smtp_username = 'deine_username'
smtp_passwort = 'dein_passwort'
# E-Mail-Nachricht
nachricht = MIMEText('Hallo, dies ist eine Testnachricht.')
# E-Mail-Header setzen
nachricht['From'] = sender_email
nachricht['To'] = empfaenger_email
nachricht['Subject'] = 'Test-E-Mail'
# Verbindung zum SMTP-Server herstellen
server = smtplib.SMTP(smtp_server, smtp_port)
server.starttls()
server.login(smtp_username, smtp_passwort)
# E-Mail senden
server.sendmail(sender_email, empfaenger_email, nachricht.as_string())
# Verbindung trennen
server.quit()

View File

@@ -14,8 +14,8 @@ class LEEM2000(TcpDevice):
self.debug = False
self.retries = 1
self.timeout = 1000
self.move_timeout = 300000 #5min
self.homing_timeout = 300000 #5min
self.move_timeout = 600000 #5min
self.homing_timeout = 600000 #5min
def doInitialize(self):
super(LEEM2000, self).doInitialize()
@@ -143,6 +143,13 @@ class LEEM2000(TcpDevice):
ret.initialize()
return ret
def get_slit_motor(self, motor_id, encoder_index, name=None):
if name is None:
name=str(motor_id)
ret = LEEM2000SlitMotor(name, motor_id, encoder_index, self)
ret.initialize()
return ret
def get_tilt(self, motor_id_pos, motor_id_neg, name=None):
if name is None:
name=str(motor_id_pos) + "_" + str(motor_id_neg)
@@ -150,6 +157,12 @@ class LEEM2000(TcpDevice):
ret.initialize()
return ret
def get_motor(self, motor_id, name=None):
if name is None:
name=str(motor_id)
ret = LEEM2000Motor(name, motor_id, self)
ret.initialize()
return ret
def get_manip_readback(self, timeout = None, retries = None):
ret = microscope.send_receive("gmv", timeout, retries)
@@ -265,6 +278,45 @@ class LEEM2000ManipMotor(PositionerBase):
pos_mm= self.microscope.get_manip_readback()[self.encoder_index]
return pos_mm*1000.0
class LEEM2000SlitMotor(PositionerBase):
def __init__(self, name, motor_id, encoder_index, microscope):
PositionerBase.__init__(self, name, PositionerConfig())
self.motor_id = motor_id
self.encoder_index = encoder_index
self.microscope = microscope
self.pos = None
def doRead(self):
if self.pos is None:
self.pos = float(self.doReadReadback())
return self.pos
def doWrite(self, val):
self.microscope.move_motor(self.motor_id, val)
self.pos = None
def doReadReadback(self):
pos_step = self.microscope.get_value(str(self.encoder_index))
#pos_mm= self.microscope.get_manip_readback()[self.encoder_index]
return pos_step*0.700
class LEEM2000Motor(PositionerBase):
def __init__(self,name, motor_id, microscope):
PositionerBase.__init__(self,name, PositionerConfig())
self.motor_id = motor_id
self.microscope = microscope
self.pos = None
def doRead(self):
#self.microscope.get_value(str(self.motor_id))
return self.pos
def doWrite(self, val):
self.microscope.move_motor(self.motor_id, val)
self.pos = val
class LEEM2000Tilt(RegisterBase):
def __init__(self,name, motor_id_pos, motor_id_neg, microscope):
RegisterBase.__init__(self,name)
@@ -300,7 +352,13 @@ add_device (microscope.get_child("FIL","fil"), True)
add_device (microscope.get_child("STV","start_voltage"), True)
add_device (microscope.get_child("OBJDX","obj_align_x"), True)
add_device (microscope.get_child("OBJDY","obj_align_y"), True)
add_device (microscope.get_child("HMOTSLIT","slitttt"), True)
add_device (microscope.get_child("HMOTSLIT","slit_motion_pos"), True)
#add_device (microscope.get_child("76","slit_motion_pos"), True)
#add_device (microscope.get_child("HMOTCAX","ca_motion_pos"), True)
#add_device (microscope.get_child("HMOTCAY","ca_correction_pos"), True)
add_device (microscope.get_motor(1, "ca_correction"), True)
add_device (microscope.get_motor(2, "ca_motion"), True)
add_device (microscope.get_slit_motor(7, 76, "slit_motion"), True)
microscope.setPolling(5000)
@@ -317,7 +375,7 @@ class TiltMotor(RegisterBase):
return self.position
def doWrite(self, pos):
if abs(pos)>8000:
if abs(pos)>10000:
raise Exception("Exceeded device range")
offset = pos -self.position
self.tilt_motor.write(offset)
@@ -355,6 +413,7 @@ azimuth_rot.precision=1
azimuth_rot.polling=5000
bv.polling=1000
fil.polling=1000
slit_motion.polling=1000
#Create a listener to the sensor, verifying the readback values.
class ListenerAzimuth (DeviceListener):

View File

@@ -1,5 +1,7 @@
from collections import OrderedDict
PREFIX_MICROSCOPE = "Microscope "
diag_channels_names = { \
#"photon energy": "X11MA-PGM:rbkenergy", \
#"grating number": "X11MA-PGM:grating", \
@@ -46,11 +48,11 @@ diag_channels_names = { \
"PEEM leakage current": "X11MA-ES1-PEEM:IMON", \
"Pressure in PEEM": "X11MA-ES1-MAIN:PRESSURE", \
"Pressure in Column": "X11MA-ES1-COLU:PRESSURE", \
"SW Pt100 sample temperature": "X11MA-PC-SW:Pt100-K", \
"SW Pt100 resistance": "X11MA-PC-SW:Pt100-R", \
"SW E-field value voltage": "X11MA-PC-SW:E-Field-V", \
"SW E-field value current": "X11MA-PC-SW:E-Field-I", \
"SW Resistence value resistence": "X11MA-PC-SW:Resistance", \
#"SW Pt100 sample temperature": "X11MA-PC-SW:Pt100-K", \
#"SW Pt100 resistance": "X11MA-PC-SW:Pt100-R", \
#"SW E-field value voltage": "X11MA-PC-SW:E-Field-V", \
#"SW E-field value current": "X11MA-PC-SW:E-Field-I", \
#"SW Resistence value resistence": "X11MA-PC-SW:Resistance", \
"Cooling He flow meas": "X11MA-PC-BRONKHORST:PEEM-GET-MEASURE", \
"Cooling He flow set": "X11MA-PC-BRONKHORST:PEEM-SET-SETPOINT", \
"Cooling Needle Valve": "X11MA-ES1-AO4:V", \
@@ -103,7 +105,7 @@ diag_devices = {
"PEEM high voltage": microscope.high_voltage, \
"Tilt vertical": tilt_vertical, \
"Tilt horizontal": tilt_horizontal, \
"ai1 current": ai1, \
# "ai1 current": ai1, \
}
@@ -148,15 +150,15 @@ def get_diags():
if microscope.initialized and microscope.client.isConnected():
for k,v in get_microscope_diags().items():
ret["Microscope " + k] = str(v)
ret[PREFIX_MICROSCOPE + k] = str(v)
try:
ret["Microscope Manip. X"] = str(manip_x.readback.read())
ret[PREFIX_MICROSCOPE + "Manip. X"] = str(manip_x.readback.read())
except:
ret["Microscope Manip. X"] = "Error: " + str(sys.exc_info()[1])
ret[PREFIX_MICROSCOPE + "Manip. X"] = "Error: " + str(sys.exc_info()[1])
try:
ret["Microscope Manip. Y"] = str(manip_y.readback.read())
ret[PREFIX_MICROSCOPE + "Manip. Y"] = str(manip_y.readback.read())
except:
ret["Microscope Manip. Y"] = "Error: " + str(sys.exc_info()[1])
ret[PREFIX_MICROSCOPE + "Manip. Y"] = "Error: " + str(sys.exc_info()[1])
return OrderedDict(sorted(ret.items(), key=lambda i: i[0].lower()))

View File

@@ -156,7 +156,20 @@ def gude3(pwr):
caput("PEEM-GUDE:CH3SET",pwr)
def gude4(pwr):
caput("PEEM-GUDE:CH4SET",pwr)
###################################################################################################
#Triggering
###################################################################################################
def trigger_peemcam(wait=True):
peemcam.waitReady(5000)
peemcam.start()
if wait:
#img_peemcam.waitNext(20000 + int(peemcam.exposure * 1000))
peemcam.waitNewImage(20000 + int(peemcam.exposure * 1000))
peemcam.waitReady(5000)
###################################################################################################
#Default scan callbacks
###################################################################################################

45
script/test.py Normal file
View File

@@ -0,0 +1,45 @@
##Constants
AVERAGE = 10
EXPOSURE = 1.0
MEASUREMENTS = 20
change_pol(2, "Lin" , alpha = 0)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 10)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 20)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 30)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 40)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 50)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 60)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 70)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 80)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)
change_pol(2, "Lin" , alpha = 90)
two_energies(869.7, 870.9, measurements = MEASUREMENTS, exposure = EXPOSURE, average = AVERAGE)
time.sleep (2.0)

50
script/test/TestVscan.py Normal file
View File

@@ -0,0 +1,50 @@
#Pseudo motor for my motor functions, e.g. move_sim_x
#Detector = PEEMCAM
SHOW_COMPOSITE_IMG=True
TRANSPOSE=False
class MotorX(Writable):
def write(self, pos):
print "X=",pos
class MotorY(Writable):
def write(self, pos):
print "Y=",pos
motor_x=MotorX()
motor_y=MotorY()
vector = [ [1,1] , [1,2] , [1,3] , [1,4] ,
[2,1] , [2,2] , [2,3] , [2,4] ,
[3,1] , [3,2] , [3,3] , [3,4] ]
bins_x,bins_y = 4,3
composite =create_composite_image(peemcam.dataMatrix.take(), bins_x,bins_y)
if SHOW_COMPOSITE_IMG:
display_composite_image(composite, "Composite", reset=True, force_renderer=True, transpose=TRANSPOSE)
def before_read(pos, scan):
trigger_peemcam()
ProviderTIFF.setMetadata(get_diags())
def after_read(rec, scan):
x,y = rec.index%bins_x, rec.index/bins_x
append_composite_image(composite, rec[peemcam.dataMatrix], x, y)
if SHOW_COMPOSITE_IMG:
display_composite_image(composite, "Composite", force_renderer=True, transpose=TRANSPOSE)
r = vscan( (motor_x,motor_y), (peemcam.dataMatrix, CADC2), vector, latency=0.1,
before_read= before_read,
after_read=after_read,)
save_dataset("/composite", get_ip_array(composite))
#Plot all sampled images
#plot(r[peemcam.dataMatrix], title="Images")
#Plot a scalar
#plot(r[CADC2], title="Scalar")

View File

@@ -1,5 +1 @@
#otf2(start=778, end=785, time=1, delay=10, mode='LINEAR', alpha = 0.0, offset=-3.8, name='test_Co')
#otf2(start=772, end=805, time=2, delay=10, mode='LINEAR', alpha = 0.0, offset=-3.8, name='test')
#otf2(start=845, end=885, time=2, delay=10, mode='LINEAR', alpha = 0.0, offset=-3.8, name='test_Ni')
#otf2(start=520, end=570, time=2, delay=10, mode='LINEAR', alpha = 0.0, offset= 0, name='oXAS-VS01-OCP_O_test')
otf2(start=520, end=595, time=2, delay=10, mode='LINEAR', alpha = 0.0, offset= 0, name='oXAS-VS01-OCP_O_test')
otf2(start=525, end=560, time=1, delay=1, mode='LINEAR', alpha = 0.0, offset=-3.1, name='test')

View File

@@ -0,0 +1,12 @@
from datetime import datetime
#filename = get_exec_pars().path + "/test.tiff"
filename = expand_path("{data}/{year}_{month}/{date}/{date}/test_{dseq}.tiff")
trigger_peemcam()
time_str = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
matadata = {"time": time_str}
save_as_tiff(img_peemcam.data, FILENAME, show = True, metadata=matadata)