86 lines
2.7 KiB
Python
86 lines
2.7 KiB
Python
open_valve()
|
|
#####################
|
|
## INPUT PARAMETERS##
|
|
POS_START = 150.0 #Minn = 150.0
|
|
POS_END = 170 #Max = 170.0
|
|
POS_STEP = 1.0
|
|
|
|
SETTLING_TIME = 0.25
|
|
accumulation_time = 1.0
|
|
|
|
#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 = [708.685] # 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
|
|
|
|
|
|
|
|
#####################
|
|
|
|
#open_valve()
|
|
#sensors = [tey_norm,signal_tey, signal_i0, signal_trans, trans_norm, sample_vert, energy_readback]
|
|
acc = Accumulator([tey_norm,signal_tey, signal_i0, signal_trans, trans_norm,], accumulation_time)
|
|
detectors = acc.getSensors() + [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, accumulation_time = 1, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
|
|
ret= rscan(sample_hor,detectors, [(POS_START, POS_END, POS_STEP)], latency = SETTLING_TIME, accumulation_time=1, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
|
|
|
|
close_valve()
|