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

84 lines
2.4 KiB
Python

open_valve()
#####################
## INPUT PARAMETERS##
POS_START = 158 #Minn = 150.0
POS_END = 162 #Max = 170.0
POS_STEP = 0.1
SETTLING_TIME = 0.25
ENERGIES = [575]
#ENERGIES = [842.6] # Ni
#ENERGIES = [570] # Gd
#ENERGIES = [570.0] # Cr
#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 = [722.46]#,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 = [640.5,637] # 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
#####################
#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()