This commit is contained in:
BIN
config/AbsortionSpectrum/Mn_L3_L2coarse.abs
Normal file
BIN
config/AbsortionSpectrum/Mn_L3_L2coarse.abs
Normal file
Binary file not shown.
BIN
config/AbsortionSpectrum/Mn_L3_coarse.abs
Normal file
BIN
config/AbsortionSpectrum/Mn_L3_coarse.abs
Normal file
Binary file not shown.
BIN
config/AbsortionSpectrum/Ni_L23_jgpark_fine.abs
Normal file
BIN
config/AbsortionSpectrum/Ni_L23_jgpark_fine.abs
Normal file
Binary file not shown.
BIN
config/AbsortionSpectrum/Ni_L23_jgpark_fine_mod.abs
Normal file
BIN
config/AbsortionSpectrum/Ni_L23_jgpark_fine_mod.abs
Normal file
Binary file not shown.
BIN
config/AbsortionSpectrum/O_K_edge.abs
Normal file
BIN
config/AbsortionSpectrum/O_K_edge.abs
Normal file
Binary file not shown.
BIN
config/AbsortionSpectrum/Ti_L23_edge.abs
Normal file
BIN
config/AbsortionSpectrum/Ti_L23_edge.abs
Normal file
Binary file not shown.
@@ -1,11 +1,11 @@
|
||||
#fe_slit_V_ctr:offset=ch.psi.pshell.epics.ChannelDouble||||
|
||||
#fe_slit_V_ctr=ch.psi.pshell.epics.Positioner|X11MA-FE-SV:ctr caget X11MA-FE-SV:t2.D|||true
|
||||
fe_slit_V_ctr=ch.psi.pshell.epics.Motor|X11MA-FE-SV:center|||true
|
||||
#fe_slit_H_ctr_offset=ch.psi.pshell.epics.ChannelDouble||||
|
||||
#fe_slit_H_ctr=ch.psi.pshell.epics.Positioner|X11MA-FE-SH:ctr X11MA-FE-SH:t2.D|||true
|
||||
fe_slit_H_ctr=ch.psi.pshell.epics.Motor|X11MA-FE-SH:center|||true
|
||||
fe_slit_V_size_offs=ch.psi.pshell.epics.ChannelDouble|X11MA-FE-DSVER.A|||true
|
||||
fe_slit_V_size=ch.psi.pshell.epics.Positioner|X11MA-FE-SV:size X11MA-FE-SV:t2.C|||true
|
||||
fe_slit_V_size=ch.psi.pshell.epics.Motor|X11MA-FE-SV:size|||true
|
||||
fe_slit_H_size_offs=ch.psi.pshell.epics.ChannelDouble|X11MA-FE-DSHOR.A|||true
|
||||
fe_slit_H_size=ch.psi.pshell.epics.Positioner|X11MA-FE-SH:size X11MA-FE-SH:t2.C|||true
|
||||
fe_slit_H_size=ch.psi.pshell.epics.Motor|X11MA-FE-SH:size|||true
|
||||
exit_slit_offset=ch.psi.pshell.epics.ChannelDouble|X11MA-OP2-SL:EOff|||true
|
||||
exit_slit=ch.psi.pshell.epics.Motor|X11MA-OP2-SL:TRY|||true
|
||||
machine_cur=ch.psi.pshell.epics.ChannelDouble|ARIDI-PCT:CURRENT|Read||true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Tue Sep 04 18:00:08 CEST 2018
|
||||
#Mon Aug 16 09:37:19 CEST 2021
|
||||
ch.psi.jcae.ContextFactory.addressList=
|
||||
ch.psi.jcae.ContextFactory.maxArrayBytes=10000000
|
||||
ch.psi.jcae.ChannelFactory.retries=1
|
||||
@@ -10,5 +10,5 @@ ch.psi.jcae.impl.DefaultChannelService.waitRetryPeriod=10000
|
||||
ch.psi.jcae.ContextFactory.serverPort=
|
||||
ch.psi.jcae.ContextFactory.maxSendArrayBytes=
|
||||
ch.psi.jcae.ContextFactory.autoAddressList=true
|
||||
ch.psi.jcae.ContextFactory.useShellVariables=false
|
||||
ch.psi.jcae.ContextFactory.useShellVariables=true
|
||||
ch.psi.jcae.ContextFactory.addLocalBroadcastInterfaces=false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#Wed Jun 30 15:27:33 CEST 2021
|
||||
#Thu Jul 01 12:57:32 CEST 2021
|
||||
environment=prod
|
||||
testParameters=-testenv -user slssim\:4DMGBarXmr
|
||||
sourceFolder=/sls/X11MA/Data1/e18900
|
||||
sourceFolder=/sls/X11MA/Data1/e19172
|
||||
prodParameters=\ -user slssim\:4DMGBarXmr
|
||||
devParameters=-devenv -user slssim\:slssim
|
||||
ownerGroup=
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Mon Jun 07 19:28:06 CEST 2021
|
||||
#Thu Sep 02 13:21:00 CEST 2021
|
||||
keywords=List;[]
|
||||
ownerEmail=String;caretta@berkeley.edu
|
||||
ownerEmail=String;jinghui.luo@psi.ch
|
||||
contactEmail=String;armin.kleibert@psi.ch
|
||||
owner=String;Lucas Caretta
|
||||
owner=String;Jinghui Luo
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#Wed Jun 30 09:46:41 CEST 2021
|
||||
SessionCounter=29
|
||||
#Fri Sep 03 09:21:14 CEST 2021
|
||||
SessionCounter=38
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#Wed Jun 30 16:03:46 CEST 2021
|
||||
#Thu Sep 09 14:50:51 CEST 2021
|
||||
HARMONIC_ID_1=1
|
||||
RSYNC_USER=
|
||||
OUTLIERS_THRESHOLD=1000000000
|
||||
NORM_FILE=/sls/X11MA/data/X11MA/Data1/2021/Yona250121/s250121
|
||||
AUTO_SWITCH_VALVE=false
|
||||
AUTO_SWITCH_VALVE=true
|
||||
DRY_RUN=false
|
||||
POL_ID_2=Lin_Hor
|
||||
OFFSET_ID_1=0.0
|
||||
ID=ID2
|
||||
OFFSET_ID_2=0.0
|
||||
proposal=proposal
|
||||
ENERGY=400.0
|
||||
ENERGY=706.3
|
||||
proposer=proposer
|
||||
POL_ID_1=Circ_Plus
|
||||
RSYNC_HOST=
|
||||
sample=sample
|
||||
RSYNC_PATH=
|
||||
pgroup=pgroup
|
||||
ALPHA_ID_2=30.0
|
||||
ALPHA_ID_2=60.0
|
||||
ALPHA_ID_1=0.0
|
||||
RSYNC_DEL=true
|
||||
AVERAGING_DETECTOR=true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Wed Jun 30 14:55:49 CEST 2021
|
||||
LastRunDate=210630
|
||||
FileSequentialNumber=8602
|
||||
DaySequentialNumber=44
|
||||
#Mon Sep 13 13:08:47 CEST 2021
|
||||
LastRunDate=210913
|
||||
FileSequentialNumber=9757
|
||||
DaySequentialNumber=34
|
||||
|
||||
18
devices/fe_slit_H_ctr.properties
Normal file
18
devices/fe_slit_H_ctr.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
#Thu Sep 09 15:24:03 CEST 2021
|
||||
precision=5
|
||||
scale=1.0
|
||||
estbilizationDelay=0
|
||||
resolution=0.01
|
||||
minValue=-100.0
|
||||
defaultSpeed=0.5
|
||||
sign_bit=0
|
||||
monitorByPosition=false
|
||||
minSpeed=0.05
|
||||
offset=0.0
|
||||
maxValue=100.0
|
||||
rotation=false
|
||||
maxSpeed=NaN
|
||||
homingType=None
|
||||
startRetries=1
|
||||
unit=mm
|
||||
hasEnable=false
|
||||
@@ -1,10 +1,18 @@
|
||||
#Wed Jun 30 14:15:27 CEST 2021
|
||||
#Tue Jul 06 10:50:06 CEST 2021
|
||||
precision=3
|
||||
scale=1.0
|
||||
estbilizationDelay=0
|
||||
resolution=0.005
|
||||
minValue=-200.0
|
||||
defaultSpeed=1.0
|
||||
sign_bit=0
|
||||
monitorByPosition=false
|
||||
minSpeed=0.1
|
||||
offset=0.0
|
||||
maxValue=200.0
|
||||
rotation=false
|
||||
precision=3
|
||||
scale=1.0
|
||||
resolution=0.005
|
||||
minValue=-200.0
|
||||
maxSpeed=NaN
|
||||
homingType=null
|
||||
startRetries=1
|
||||
unit=mm
|
||||
sign_bit=0
|
||||
hasEnable=false
|
||||
|
||||
18
devices/fe_slit_V_ctr.properties
Normal file
18
devices/fe_slit_V_ctr.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
#Thu Sep 09 15:24:18 CEST 2021
|
||||
precision=5
|
||||
scale=1.0
|
||||
estbilizationDelay=0
|
||||
resolution=0.01
|
||||
minValue=-100.0
|
||||
defaultSpeed=0.5
|
||||
sign_bit=0
|
||||
monitorByPosition=false
|
||||
minSpeed=0.05
|
||||
offset=0.0
|
||||
maxValue=100.0
|
||||
rotation=false
|
||||
maxSpeed=NaN
|
||||
homingType=None
|
||||
startRetries=1
|
||||
unit=mm
|
||||
hasEnable=false
|
||||
@@ -1,10 +1,18 @@
|
||||
#Wed Jun 30 10:57:08 CEST 2021
|
||||
#Tue Jul 06 10:51:28 CEST 2021
|
||||
precision=3
|
||||
scale=1.0
|
||||
estbilizationDelay=0
|
||||
resolution=0.005
|
||||
minValue=-200.0
|
||||
defaultSpeed=1.0
|
||||
sign_bit=0
|
||||
monitorByPosition=false
|
||||
minSpeed=0.01
|
||||
offset=0.0
|
||||
maxValue=200.0
|
||||
rotation=false
|
||||
precision=3
|
||||
scale=1.0
|
||||
resolution=0.005
|
||||
minValue=-200.0
|
||||
maxSpeed=NaN
|
||||
homingType=null
|
||||
startRetries=1
|
||||
unit=mm
|
||||
sign_bit=0
|
||||
hasEnable=false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Wed Jun 30 12:51:54 CEST 2021
|
||||
#Mon Sep 13 13:04:13 CEST 2021
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalOffsetX=NaN
|
||||
colormapLogarithmic=false
|
||||
@@ -6,12 +6,12 @@ scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
colormapMax=500.0
|
||||
colormapMax=7000.0
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Grayscale
|
||||
invert=false
|
||||
colormapMin=0.0
|
||||
colormapMin=2000.0
|
||||
rotationCrop=false
|
||||
rotation=0.0
|
||||
rescaleFactor=1.0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#wold be nice to print relative changes of the parameters
|
||||
RANGE_OBJ = 1.0
|
||||
STEP_OBJ = 0.1
|
||||
RANGE_STIG = 10.0
|
||||
@@ -7,7 +8,7 @@ AVERAGE = 1
|
||||
width, height = eiger.getImageSize()
|
||||
#ROI = Rectangle(width/3, height/3, width/3, height/3,)
|
||||
#ROI = Rectangle(0, 0, width, height,)
|
||||
ROI = Rectangle(233,30,128,128)
|
||||
ROI = Rectangle(200,100,256,256)#(x0,y0,delta_x(2**n), delta_y(2**n))
|
||||
|
||||
initial_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
|
||||
print "Initial state:" , initial_state
|
||||
|
||||
17
script/Users/filianina/E_scan_XMCD.py
Normal file
17
script/Users/filianina/E_scan_XMCD.py
Normal file
@@ -0,0 +1,17 @@
|
||||
#Constants
|
||||
AVERAGE = 1
|
||||
EXPOSURE = 1.0
|
||||
MEASUREMENTS = 50
|
||||
#Energies=[635, 635.5]
|
||||
Energies=[637, 637.2, 637.4, 637.6, 637.8, 638, 638.2, 638.4, 638.6, 638.8, 639]
|
||||
#Energies=[637, 637.2, 637.4, 637.6, 637.8, 638, 638.2, 638.4, 638.6, 638.8, 639, 639.2, 639.4, 639.6, 639.8, 640, 640.5, 641]
|
||||
#TakeImage at 710 eV at the given polarization
|
||||
change_energy(636)
|
||||
|
||||
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
|
||||
set_beamline_setup(id ="ID1_ID2", en=636, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
|
||||
time.sleep(2.0)
|
||||
for item in Energies:
|
||||
change_energy(item)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
49
script/Users/filianina/lupa_scan.py
Normal file
49
script/Users/filianina/lupa_scan.py
Normal file
@@ -0,0 +1,49 @@
|
||||
#Constants
|
||||
AVERAGE = 1
|
||||
EXPOSURE = 2.0
|
||||
MEASUREMENTS = 50
|
||||
|
||||
#TakeImage at 710 eV at the given polarization
|
||||
change_energy(639)
|
||||
#take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
#TwoImages Two Pol with Lin_hor/lin_ver and ID1 + ID2, tune-detune, at 638.8 eV
|
||||
set_beamline_setup(id ="ID1_ID2", en=638.6, pol1="Lin_Hor", alp1=0.0, har1=1, off1=0.0, pol2="Lin_Ver", alp2=90.0, har2=1, off2=0.0)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
change_energy(637.6)
|
||||
time.sleep(2.0)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
|
||||
set_beamline_setup(id ="ID1_ID2", en=638.2, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
#TwoEnergies with lin hor polarization ID2 only (normal)
|
||||
#set_beamline_setup(id ="ID2", en=710, pol1="Lin_Hor")
|
||||
#two_energies(705, 710, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
#time.sleep(2.0)
|
||||
|
||||
#abs_spec(ranges=[[500.0, 1000.0, 100.0],], switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE) #Use manulally defined ranges and rois defined in GUI
|
||||
#abs_spec(ranges="C_edge", roi="test", switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE)
|
||||
|
||||
|
||||
|
||||
#manip_x.write(0.1)
|
||||
|
||||
|
||||
#Direct functions to change energy, pol, offset:
|
||||
#change_energy(700)
|
||||
#change_pol(1, "Circ_Plus" ) #Pol on ID1: "Circ_Plus", "Circ_Minus" , "Lin_Hor", "Lin_Ver"
|
||||
#change_pol(1, "Lin" , alpha = "0" ) #Lin pol on ID 1
|
||||
#change_offset(1, 0.0) #offset on ID1
|
||||
|
||||
#Auto-switching:
|
||||
#switch_pol()
|
||||
|
||||
#Restoring beamline state defined in last set_beamline_setut:
|
||||
#restore_beamline_setup()
|
||||
29
script/Users/filianina/stack_scan.py
Normal file
29
script/Users/filianina/stack_scan.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#Constants
|
||||
AVERAGE = 1
|
||||
EXPOSURE = 1.0
|
||||
MEASUREMENTS = 50
|
||||
positions=[-510, -525, -540, -555, -570, -585]
|
||||
for position in positions:
|
||||
manip_x.write(position)
|
||||
time.sleep(60)
|
||||
#auto_intensity()
|
||||
#time_sleep(2)
|
||||
#TakeImage at 710 eV at the given polarization
|
||||
change_energy(638.8)
|
||||
#take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
#TwoImages Two Pol with Lin_hor/lin_ver and ID1 + ID2, tune-detune, at 638.8 eV
|
||||
set_beamline_setup(id ="ID1_ID2", en=638.8, pol1="Lin_Hor", alp1=0.0, har1=1, off1=0.0, pol2="Lin_Ver", alp2=90.0, har2=1, off2=0.0)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
change_energy(638.0)
|
||||
time.sleep(2.0)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
|
||||
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
|
||||
set_beamline_setup(id ="ID1_ID2", en=638.2, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
|
||||
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
|
||||
time.sleep(2.0)
|
||||
@@ -86,7 +86,9 @@ diag_devices = {
|
||||
"id2 gap": id2_gap, \
|
||||
"id2 shift": id2_shift, \
|
||||
"ring current": machine_cur, \
|
||||
"PEEM high voltage": microscope.high_voltage,
|
||||
"PEEM high voltage": microscope.high_voltage, \
|
||||
"Tilt vertical": tilt_vertical, \
|
||||
"Tilt horizontal": tilt_horizontal, \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SETTLING_TIME =0.5
|
||||
MAX_CONTRAST = 10e14
|
||||
|
||||
MAX_SHIFT = 100
|
||||
|
||||
import java.awt.Rectangle as Rectangle
|
||||
|
||||
@@ -21,7 +21,35 @@ if get_device("roi_contrast") is None:
|
||||
add_device(RoiContrast(), False)
|
||||
|
||||
|
||||
def scan_focus(positioner, pos_range, pos_step, roi = None, average = 1, update_position = True):
|
||||
def get_focus_scan_pos():
|
||||
return objective.read(),obj_stig_a.read(),obj_stig_b.read()
|
||||
|
||||
def apply_focus_scan_pos(pos):
|
||||
objective.write(pos[0])
|
||||
obj_stig_a.write(pos[1])
|
||||
obj_stig_b.write(pos[2])
|
||||
|
||||
|
||||
fucus_scan_roi=None
|
||||
def show_focus_scan_roi():
|
||||
global fucus_scan_roi
|
||||
pn=show_panel(image)
|
||||
ov=Overlays.Rect(Pen(Color.BLUE), Point(fucus_scan_roi.x,fucus_scan_roi.y),Dimension(fucus_scan_roi.width,fucus_scan_roi.height))
|
||||
pn.clearOverlays()
|
||||
#ov.setMovable(True)
|
||||
pn.addOverlay(ov)
|
||||
|
||||
def set_focus_scan_roi(roi):
|
||||
global fucus_scan_roi
|
||||
fucus_scan_roi = roi
|
||||
show_focus_scan_roi()
|
||||
|
||||
def get_focus_scan_roi():
|
||||
return fucus_scan_roi
|
||||
|
||||
|
||||
"""
|
||||
def scan_focus(positioner, pos_range, pos_step, roi = None, average = 1, update_position = True, update_roi = True)):
|
||||
def after_read(rec):
|
||||
if rec[positioner] > MAX_CONTRAST:
|
||||
print "Invalid contrast value"
|
||||
@@ -61,3 +89,96 @@ def scan_focus(positioner, pos_range, pos_step, roi = None, average = 1, update_
|
||||
print "Invalid fit for ", positioner.name, mn, range_scan
|
||||
time.sleep(1.0) # Wait restoring positions
|
||||
return r
|
||||
"""
|
||||
def update_roi_pos(cur_data, former_data):
|
||||
roi=get_focus_scan_roi()
|
||||
calc_roi = Roi(roi.x,roi.y,roi.width, roi.height)
|
||||
try:
|
||||
xoff, yoff, error, diffphase = calculate_shift(former_data,cur_data, calc_roi)
|
||||
print "Calculated shift: ", xoff, yoff, error, diffphase
|
||||
if (0<abs(xoff) < MAX_SHIFT) and (0<abs(yoff) < MAX_SHIFT):
|
||||
x,y=int(roi.x - xoff), int(roi.y - yoff)
|
||||
print "Updating ROI location to ", x, y
|
||||
x,y=max(x,0), max(y,0)
|
||||
x,y=min(x,cur_data.width-roi.width), min(y,cur_data.height-roi.height)
|
||||
ROI.setLocation(x,y)
|
||||
show_focus_scan_roi()
|
||||
else:
|
||||
print "Error - sshift too big: xoff, yoff"
|
||||
except:
|
||||
print "Error calculating shift: " + str(sys.exc_info()[1])
|
||||
|
||||
|
||||
former_data=None
|
||||
def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = True):
|
||||
global former_data
|
||||
roi=get_focus_scan_roi()
|
||||
former_data = image.data
|
||||
initial_state = get_focus_scan_pos()
|
||||
initial_roi_location = roi.location if roi is not None else None
|
||||
|
||||
def before_read(pos,scan):
|
||||
global former_data
|
||||
cur_data = image.data
|
||||
try:
|
||||
print "----- Pos: ", pos
|
||||
update_roi_pos(cur_data, former_data)
|
||||
finally:
|
||||
former_data = cur_data
|
||||
|
||||
print "New ROI pos: " , roi_contrast.roi.location
|
||||
|
||||
|
||||
def after_read(rec, scam):
|
||||
global former_data
|
||||
if rec[positioner] > MAX_CONTRAST:
|
||||
print "Invalid contrast value"
|
||||
time.sleep(eiger.exposure)
|
||||
rec.invalidate()
|
||||
|
||||
|
||||
def before_pass(scan, num_pass):
|
||||
pass
|
||||
#print "Waiting to reach scan init pos"
|
||||
#time.sleep(1.0)
|
||||
|
||||
|
||||
if roi is None:
|
||||
sensor = image_contrast
|
||||
else:
|
||||
sensor = roi_contrast
|
||||
roi_contrast.set_roi(roi)
|
||||
|
||||
if average > 1:
|
||||
sensor = create_averager(sensor, average, interval = eiger.exposure, name = image_contrast.name, monitored = False)
|
||||
|
||||
r = lscan( positioner, [sensor,], -pos_range, pos_range, pos_step, \
|
||||
latency=eiger.exposure+SETTLING_TIME, relative=True, initial_move=False, restore_position=False, \
|
||||
before_read=before_read, after_read=after_read, before_pass=before_pass)
|
||||
|
||||
ydata, xdata = r[sensor], r[positioner]
|
||||
if average > 1:
|
||||
ydata = [v.doubleValue() for v in ydata]
|
||||
(norm, mn, std ) = fit (ydata, xdata, limit_to_range=True)
|
||||
|
||||
range_scan = (min(r[positioner]), max(r[positioner]))
|
||||
if (mn is not None) and (range_scan[0] <= mn <= range_scan[1]):
|
||||
print "Valid fit for ", positioner.name, mn
|
||||
if update_position:
|
||||
#time.sleep(1.0) # Wait restoring positions
|
||||
#print "Updating position: ", positioner.name, mn
|
||||
#show_message("Setting mx pos", blocking = True)
|
||||
former_data = image.data
|
||||
positioner.write(mn)
|
||||
time.sleep(eiger.exposure+SETTLING_TIME)
|
||||
#show_message("Updating ROI", blocking = True)
|
||||
update_roi_pos(image.data, former_data)
|
||||
else:
|
||||
apply_focus_scan_pos(initial_state)
|
||||
if initial_roi_location: roi.location=initial_roi_location
|
||||
else:
|
||||
print "Invalid fit for ", positioner.name, mn, range_scan
|
||||
apply_focus_scan_pos(initial_state)
|
||||
if initial_roi_location: roi.location=initial_roi_location
|
||||
time.sleep(1.0) # Wait restoring positions
|
||||
return r
|
||||
|
||||
7
script/test/2DFE_OTF.py
Normal file
7
script/test/2DFE_OTF.py
Normal file
@@ -0,0 +1,7 @@
|
||||
for x in frange(-0.5, -0.3, 0.1):
|
||||
fe_slit_V_ctr.move(x)
|
||||
time.sleep(1)
|
||||
# Execute the scan
|
||||
result=cscan(fe_slit_H_ctr, Keithley_1_raw, -0.5, 1.0, float(0.5))
|
||||
|
||||
#SlitCalib(Slit=fe_slit_H_ctr, Slit_offset=fe_slit_H_ctr, detector = Keithley_1_raw, start=ctrH - wdthH/2, end=ctrH + wdth/2, step_size=0.1, ctrH - wdth/2)
|
||||
21
script/test/FESlitCalib.py
Normal file
21
script/test/FESlitCalib.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#seting parameters
|
||||
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
|
||||
fe_slit_H_size.move(1.0)
|
||||
fe_slit_V_size.move(1.0)
|
||||
|
||||
#scan SizeH
|
||||
SlitCalib(Slit=fe_slit_H_size, Slit_offset=fe_slit_H_size_offs, detector = keithley_1a, start=1.0, end=-0.5, step_size=0.03, final_pos=1.0)
|
||||
time.sleep(1)
|
||||
#scan SizeV
|
||||
SlitCalib(Slit=fe_slit_V_size, Slit_offset=fe_slit_V_size_offs, detector = keithley_1a, start=1.0, end=-0.5, step_size=0.03, final_pos=1.0)
|
||||
|
||||
ctrH=fe_slit_H_ctr.getPosition()
|
||||
wdthH=2.6
|
||||
ctrV=fe_slit_V_ctr.getPosition()
|
||||
wdthV=1.3
|
||||
#scan CenterH
|
||||
SlitCalib(Slit=fe_slit_H_ctr, Slit_offset=fe_slit_H_ctr, detector = Keithley_1_raw, start=ctrH - wdthH/2, end=ctrH + wdth/2, step_size=0.1, ctrH - wdth/2)
|
||||
|
||||
#resetting parameters
|
||||
caput ('X11MA-FE-DSAPER', 0) # 0--> closed
|
||||
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO
|
||||
15
script/test/FE_ctrSlitCalib.py
Normal file
15
script/test/FE_ctrSlitCalib.py
Normal file
@@ -0,0 +1,15 @@
|
||||
#Hill Climbing Search
|
||||
fe_slit_V_ctr.move(0.0);
|
||||
fe_slit_H_ctr.move(0.0);
|
||||
r = hsearch([fe_slit_V_ctr, fe_slit_H_ctr], Keithley_1_raw,[-0.5,-0.5], [1.0,1.0], [0.1, 0.1], [0.02, 0.02], 1, relative = False, maximum=True, latency = 1.0, title = "Hill Climbing")
|
||||
print "--------------- Hill Climbing Search -----------------"
|
||||
print r
|
||||
print r.print()
|
||||
print len(r.getRecords())
|
||||
|
||||
#strategy = "Normal" # or "Boundary" or "FullNeighborhood"
|
||||
#r = bsearch([fe_slit_V_ctr, fe_slit_H_ctr], Keithley_1_raw, [-0.5,-0.5], [1.0,1.0], [0.1, 0.1], maximum=True, strategy = strategy, latency = 0.01, title = "Binary Search")
|
||||
#print "--------------- Binary Search -----------------"
|
||||
#print r
|
||||
#print r.print()
|
||||
#print len(r.getRecords())
|
||||
@@ -6,21 +6,18 @@ from mathutils import fit_polynomial
|
||||
from mathutils import PolynomialFunction
|
||||
|
||||
# Input parameters
|
||||
Slit = exit_slit
|
||||
Slit = exit_slit
|
||||
Slit_offset = exit_slit_offset
|
||||
|
||||
detector = keithley_1a
|
||||
start = 30.0
|
||||
end = -20.0
|
||||
step_size = 1.0
|
||||
settling_time= 1.0 #Slits need 1s to accept next command
|
||||
final_pos = 20.0
|
||||
|
||||
#setting parameters
|
||||
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
|
||||
Slit.move(start)
|
||||
#Slit.
|
||||
|
||||
if(Slit==exit_slit):
|
||||
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
|
||||
Slit.move(start)
|
||||
speed = Slit.getSpeed()
|
||||
min_speed=Slit.getMinSpeed()
|
||||
Slit.setSpeed(min_speed)
|
||||
@@ -28,9 +25,9 @@ if(Slit==exit_slit):
|
||||
time.sleep(1)
|
||||
|
||||
# Execute the scan
|
||||
result=cscan(Slit, keithley_1a, start, end, float(step_size))
|
||||
result=cscan(Slit, detector, start, end, float(step_size))
|
||||
|
||||
readable_ = result[keithley_1a]
|
||||
readable_ = result[detector]
|
||||
positions_ = result[Slit]
|
||||
print positions_
|
||||
readable=[]
|
||||
@@ -76,8 +73,9 @@ offset=Slit_offset.read()
|
||||
Slit_offset.write(offset+k)
|
||||
|
||||
#resetting parameters
|
||||
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO
|
||||
if(Slit == exit_slit):
|
||||
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO
|
||||
Slit.setSpeed(speed)
|
||||
|
||||
Slit.write(final_pos)
|
||||
|
||||
32
script/test/test_autofocus2.py
Normal file
32
script/test/test_autofocus2.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#wold be nice to print relative changes of the parameters
|
||||
RANGE_OBJ = 1.0
|
||||
STEP_OBJ = 0.1
|
||||
RANGE_STIG = 10.0
|
||||
STEP_STIG = 1.0
|
||||
UPDATE_POSITION = True
|
||||
AVERAGE = 1
|
||||
width, height = eiger.getImageSize()
|
||||
#ROI = Rectangle(width/3, height/3, width/3, height/3,)
|
||||
#ROI = Rectangle(0, 0, width, height,)
|
||||
ROI = Rectangle(200,100,256,256) #(x0,y0,delta_x(2**n), delta_y(2**n))
|
||||
ROI = Rectangle(130,74,256,256)
|
||||
ROI = Rectangle(180,170,256,256)
|
||||
|
||||
|
||||
initial_state = get_focus_scan_pos()
|
||||
print "Initial state:" , initial_state
|
||||
|
||||
set_focus_scan_roi(ROI)
|
||||
|
||||
|
||||
|
||||
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ,average = AVERAGE, update_position = UPDATE_POSITION)
|
||||
#r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
|
||||
#r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG,average = AVERAGE, update_position = UPDATE_POSITION)
|
||||
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, average = AVERAGE, update_position = UPDATE_POSITION)
|
||||
#r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
|
||||
#r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
|
||||
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, average = AVERAGE, update_position = UPDATE_POSITION)#
|
||||
|
||||
final_state = get_focus_scan_pos()
|
||||
print "Final state:" , final_state
|
||||
Reference in New Issue
Block a user