Files
x07ma/script/HorizontalScan_infocus.py
gac-x07ma 7aff507f60 Mars 2022
2022-03-04 14:47:07 +01:00

77 lines
2.2 KiB
Python

open_valve()
#####################
## INPUT PARAMETERS##
POS_START = 157.5 #Minn = 150.0
POS_END = 165 #Max = 170.0
POS_STEP = 0.25
SETTLING_TIME = 0.1
#ENERGIES = [543] # O
#ENERGIES = [461] # Ti
#ENERGIES = [1611] # Tb
#ENERGIES = [1190] # Gd
#ENERGIES = [570.0]#, 577.0] # Cr
#ENERGIES = [461] #Ti
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [778.0,778.3] # Co
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [931.7, 925.0 ] # Cu
#ENERGIES = [928.4] #Cu
#ENERGIES = [928.4, 707.5] #Cu Fe, special
#ENERGIES = [572.0]
#ENERGIES = [706]#,708.3,704.0] # Fe
#ENERGIES = [851.3 ,845]
#ENERGIES = [851.2,848.0] # Ni
#ENERGIES = [280,292] #C
#ENERGIES = [776.7,774] # Co
#ENERGIES = [639.5,630.0] # Mn
ENERGIES = [459.7,456] #Ti
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [516.0, 503.0] # V
#ENERGIES = [510.0] # V
#ENERGIES = [1234.5, 1225 ] # Tb
#ENERGIES = [706.6, 704] # Fe metal
#ENERGIES = [706.6,706.6]
#ENERGIES = [1067, 1076.4 ] # Sm
#ENERGIES = [870, 880.3 ] # Ce
#####################
#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()