Files
x07ma/script/HorizontalScan_out_of_focus.py
gac-x07ma 9e969bd356
2023-12-06 11:15:37 +01:00

89 lines
2.5 KiB
Python

open_valve()
#####################
## INPUT PARAMETERS##
POS_START =106 #Minn = 98.0
POS_END = 114 #Max = 118.0
POS_STEP = 0.2
SETTLING_TIME = 0.25
#ENERGIES = [842.6] # Ni
#ENERGIES = [570] # Gd
#ENERGIES = [570.0] # Cr
#ENERGIES = [543] # O
#ENERGIES = [461] # Ti
#ENERGIES = [459.7,456] #Ti
#ENERGIES = [1611] # Tb
#ENERGIES = [1338, 1346] # Ho
#ENERGIES = [1190] # Gd
#ENERGIES = [570.0, 575.0] # Cr
#ENERGIES = [461] #Ti
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [776.0,778.0] # Co
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [930.0, 928.0 ] # Cu
#ENERGIES = [928.0] #Cu
#ENERGIES = [928.4, 707.5] #Cu Fe, special
#ENERGIES = [572.0]
#ENERGIES = [704.0, 707.7, 709.6 ] # Fe
#ENERGIES = [704.0] # Fe
#ENERGIES = [851.3 ,845]
#ENERGIES = [851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [776.7,774] # Co
#ENERGIES = [639.1,636.6] # Mn
ENERGIES = [640,636.6] # Mn+2
#ENERGIES = [642,635] # Mn
#ENERGIES = [459.7,456] #Ti
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [1289.5, 1280] # Dy edge, pre-edge
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [515.5, 510] # V
#ENERGIES = [539, 500] # O
#ENERGIES = [1234.5, 1225 ] # Tb
#ENERGIES = [706.6, 704] # Fe metal
#ENERGIES = [706.6,706.6]
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [987, 997.8 ] # Nd
#ENERGIES = [1185.9, 1180] # Gd
#ENERGIES = [1395, 1401] # Er
#ENERGIES = [1838, 1833] # Si
#####################
#open_valve()
sensors = [tey_norm,signal_tey, signal_i0, signal_trans, trans_norm, sample_vert, energy_readback]
#TODO: #Why must set range to "auto"?
'''
def before_pass(pass_num, scan):
print "Setting energy = " , ENERGIES[pass_num-1]
set_energy(ENERGIES[pass_num-1])
lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
'''
#Setting a different color for each pass: must manage plots manually
#del name
print tey_norm.name
plots = plot([None]*len(sensors), name = [d.name for d in sensors])
for p in plots:
p.clear()
p.legendVisible = True
def after_readout(record, scan):
for i in range(len(plots)):
plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.readables[i])
def before_pass(pass_num):
en = ENERGIES[pass_num-1]
set_energy(en)
open_valve()
for p in plots: p.addSeries(LinePlotSeries(str(en)))
ret= lscan(sample_hor,sensors, POS_START, POS_END, POS_STEP, latency = SETTLING_TIME, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
close_valve()