Commit f42265aa authored by Yoann Sallaz Damaz's avatar Yoann Sallaz Damaz
Browse files

Change nrj and distance in geofip

parent 08317a01
......@@ -15,95 +15,151 @@ import sys
##########################################################################
# ENERGY TABLE FOR EACH COMPONENT
##########################################################################
# lambda = 12397.64/eV
# eV = 12397.64/lambda
# http://www.bmsc.washington.edu/scatter/data/V.html
tab_nrj=[
("U", "L3", 8.955, 0.72227),
("Y", "K", 9.022, 0.72766),
("Bi", "L1", 9.387, 0.75710),
("Sr", "K", 9.544, 0.76973),
("Pb", "L1", 9.695, 0.78196),
("Bi", "L2", 9.779, 0.78870),
("Tl", "L1", 10.019, 0.80810),
("Pb", "L2", 10.110, 0.81538),
("Rb", "K", 10.111, 0.81554),
("Hg", "L1", 10.356, 0.83530),
("Tl", "L2", 10.457, 0.84340),
("Au", "L1", 10.709, 0.86376),
("Kr", "K", 10.731, 0.86552),
("Hg", "L2", 10.814, 0.87220),
("Pt", "L1", 11.073, 0.89310),
("Au", "L2", 11.191, 0.90259),
("Br", "K", 11.412, 0.92040),
("Bi", "L3", 11.449, 0.92340),
("Ir", "L1", 11.451, 0.92360),
("Pt", "L2", 11.582, 0.93414),
("Pb", "L3", 11.788, 0.95073),
("Os", "L1", 11.851, 0.95580),
("Ir", "L2", 11.991, 0.96710),
("Tl", "L3", 12.142, 0.97930),
("Se", "K", 12.147, 0.97974),
("Re", "L1", 12.267, 0.98940),
("Os", "L2", 12.416, 1.00140),
("Hg", "L3", 12.511, 1.00910),
("W", "L1", 12.704, 1.02467),
("Re", "L2", 12.859, 1.03710),
("Au", "L3", 12.894, 1.04000),
("As", "K", 12.956, 1.04500),
("Ta", "L1", 13.159, 1.06130),
("Pt", "L3", 13.295, 1.07230),
("W", "L2", 13.322, 1.07450),
("Hf", "L1", 13.635, 1.09970),
("Ir", "L3", 13.710, 1.10580),
("Ta", "L2", 13.808, 1.11370),
("Ge", "K", 13.844, 1.11658),
("Lu", "L1", 14.137, 1.14020),
("Os", "L3", 14.144, 1.14080),
("Hf", "L2", 14.318, 1.15480),
("Re", "L3", 14.597, 1.17730),
("Yb", "L1", 14.653, 1.18180),
("Ga", "K", 14.826, 1.19580),
("Lu", "L2", 14.860, 1.19850),
("W", "L3", 15.070, 1.21550),
("Tm", "L1", 15.188, 1.22500),
("Yb", "L2", 15.409, 1.24280),
("Ta", "L3", 15.564, 1.25530),
("Er", "L1", 15.754, 1.27060),
("Zn", "K", 15.912, 1.28340),
("Tm", "L2", 15.984, 1.28920),
("Hf", "L3", 16.083, 1.29720),
("Ho", "L1", 16.354, 1.31900),
("Er", "L2", 16.597, 1.33860),
("Lu", "L3", 16.620, 1.34050),
("Dy", "L1", 16.976, 1.36920),
("Cu", "K", 17.117, 1.38059),
("Yb", "L3", 17.187, 1.38620),
("Ho", "L2", 17.240, 1.39050),
("Tb", "L1", 17.634, 1.42230),
("Tm", "L3", 17.772, 1.43340),
("Dy", "L2", 17.910, 1.44450),
("Gd", "L1", 18.330, 1.47840),
("Er", "L3", 18.393, 1.48350),
("Ni", "K", 18.450, 1.48807),
("Tb", "L2", 18.626, 1.50230),
("Ho", "L3", 19.054, 1.53680),
("Eu", "L1", 19.070, 1.53810),
("Cu", "Em", 19.094, 1.54000),
("Gd", "L2", 19.381, 1.56320),
("Dy", "L3", 19.733, 1.59160),
("Sm", "L1", 19.840, 1.60020),
("Co", "K", 19.939, 1.60815),
("Eu", "L2", 20.174, 1.62710),
("Tb", "L3", 20.454, 1.64970),
("Pm", "L1", 20.673, 1.66740),
("Sm", "L2", 21.019, 1.69530),
("Gd", "L3", 21.223, 1.71170),
("Nd", "L1", 21.561, 1.73900),
("Fe", "K", 21.616, 1.74346),
("Pm", "L2", 21.916, 1.76760),
("Eu", "L3", 22.021, 1.77610),
("Nd", "L2", 22.863, 1.84400),
("Sm", "L3", 22.884, 1.84570),
("Mn", "K", 23.513, 1.89643),
("Yo", "ann", 25.000, 0.496)]
("Ag", "K", 0.4859, 25.5140),
("Pd", "K", 0.5091, 24.3503),
("Rh", "K", 0.5339, 23.2199),
("Ru", "K", 0.5605, 22.1172),
("U", "L1", 0.5701, 21.7474),
("Tc", "K", 0.5891, 21.0440),
("U", "L2", 0.5918, 20.9476),
("Th", "L1", 0.6056, 20.4721),
("Mo", "K", 0.6199, 19.9995),
("Ac", "L1", 0.6249, 19.8400),
("Nb", "K", 0.6530, 18.9856),
("Th", "L2", 0.6295, 19.6932),
("Ra", "L1", 0.6445, 19.2367),
("Ac", "L2", 0.6497, 19.0832),
("Fr", "L1", 0.6651, 18.6390),
("Ra", "L2", 0.6707, 18.4843),
("Rn", "L1", 0.6869, 18.0490),
("Zr", "K", 0.6888, 17.9976),
("Fr", "L2", 0.6924, 17.9065),
("At", "L1", 0.7087, 17.4930),
("Rn", "L2", 0.7151, 17.3371),
("U", "L3", 0.7222, 17.1663),
("Y", "K", 0.7276, 17.0384),
("Po", "L1", 0.7319, 16.9393),
("At", "L2", 0.7386, 16.7847),
("Bi", "L1", 0.7565, 16.3875),
("Th", "L3", 0.7606, 16.3003),
("Po", "L2", 0.7632, 16.2443),
("Sr", "K", 0.7698, 16.1046),
("Pb", "L1", 0.7817, 15.8608),
("Ac", "L3", 0.7812, 15.8710),
("Bi", "L2", 0.7891, 15.7111),
("Ra", "L3", 0.8027, 15.4444),
("Tl", "L1", 0.8078, 15.3467),
("Pb", "L2", 0.8156, 15.2000),
("Rb", "K", 0.8157, 15.1997),
("Fr", "L3", 0.8248, 15.0312),
("Hg", "L1", 0.8355, 14.8393),
("Tl", "L2", 0.8435, 14.6979),
("Rn", "L3", 0.8480, 14.6194),
("Au", "L1", 0.8638, 14.3528),
("Kr", "K", 0.8654, 14.3256),
("At", "L3", 0.8722, 14.2135),
("Hg", "L2", 0.8725, 14.2087),
("Pt", "L1", 0.8932, 13.8799),
("Po", "L3", 0.8975, 13.8138),
("Au", "L2", 0.9027, 13.7336),
("Br", "K", 0.9201, 13.4737),
("Bi", "L3", 0.9239, 13.4186),
("Ir", "L1", 0.9239, 13.4185),
("Pt", "L2", 0.9341, 13.2726),
("Pb", "L3", 0.9511, 13.0352),
("Os", "L1", 0.9560, 12.9680),
("Ir", "L2", 0.9667, 12.8241),
("Tl", "L3", 0.9795, 12.6575),
("Se", "K", 0.9794, 12.6578),
("Re", "L1", 0.9905, 12.5167),
("Os", "L2", 1.0010, 12.3850),
("Hg", "L3", 1.0093, 12.2839),
("W ", "L1", 1.0246, 12.0998),
("Re", "L2", 1.0367, 11.9587),
("Au", "L3", 1.0402, 11.9187),
("As", "K", 1.0447, 11.8667),
("Ta", "L1", 1.0613, 11.6815),
("Pt", "L3", 1.0721, 11.5637),
("W", "L2", 1.0739, 11.5440),
("Hf", "L1", 1.1000, 11.2707),
("Ir", "L3", 1.1054, 11.2152),
("Ta", "L2", 1.1133, 11.1361),
("Ge", "K", 1.1166, 11.1031),
("Lu", "L1", 1.1405, 10.8704),
("Os", "L3", 1.1404, 10.8709),
("Hf", "L2", 1.1544, 10.7394),
("Re", "L3", 1.1768, 10.5353),
("Yb", "L1", 1.1823, 10.4864),
("Ga", "K", 1.1959, 10.3671),
("Lu", "L2", 1.1980, 10.3486),
("W", "L3", 1.2146, 10.2068),
("Tm", "L1", 1.2256, 10.1157),
("Yb", "L2", 1.2425, 9.9782),
("Ta", "L3", 1.2547, 9.8811),
("Er", "L1", 1.2714, 9.7513),
("Zn", "K", 1.2836, 9.6586),
("Tm", "L2", 1.2892, 9.6169),
("Hf", "L3", 1.2967, 9.5607),
("Ho", "L1", 1.3197, 9.3942),
("Er", "L2", 1.3382, 9.2643),
("Lu", "L3", 1.3411, 9.2441),
("Dy", "L1", 1.3705, 9.0458),
("Cu", "K", 1.3808, 8.9789),
("Yb", "L3", 1.3862, 8.9436),
("Ho", "L2", 1.3902, 8.9178),
("Tb", "L1", 1.4237, 8.7080),
("Tm", "L3", 1.4336, 8.6480),
("Dy", "L2", 1.4448, 8.5806),
("Gd", "L1", 1.4802, 8.3756),
("Er", "L3", 1.4833, 8.3579),
("Ni", "K", 1.4878, 8.3328),
("Tb", "L2", 1.5025, 8.2516),
("Ho", "L3", 1.5361, 8.0711),
("Eu", "L1", 1.5397, 8.0520),
("Gd", "L2", 1.5633, 7.9303),
("Dy", "L3", 1.5915, 7.7901),
("Sm", "L1", 1.6024, 7.7368),
("Co", "K", 1.6082, 7.7089),
("Eu", "L2", 1.6276, 7.6171),
("Tb", "L3", 1.6499, 7.5140),
("Pm", "L1", 1.6691, 7.4279),
("Sm", "L2", 1.6956, 7.3118),
("Gd", "L3", 1.7117, 7.2428),
("Nd", "L1", 1.7398, 7.1260),
("Fe", "K", 1.7432, 7.1120),
("Pm", "L2", 1.7679, 7.0128),
("Eu", "L3", 1.7770, 6.9769),
("Pr", "L1", 1.8139, 6.8348),
("Nd", "L2", 1.8445, 6.7215),
("Sm", "L3", 1.8459, 6.7162),
("Ce", "L1", 1.8931, 6.5488),
("Mn", "K", 1.8960, 6.5390),
("Pm", "L3", 1.9193, 6.4593),
("Pr", "L2", 1.9250, 6.4404),
("La", "L1", 1.9785, 6.2663),
("Nd", "L3", 1.9971, 6.2079),
("Ce", "L2", 2.0112, 6.1642),
("Cr", "K", 2.0700, 5.9892),
("Ba", "L1", 2.0701, 5.9888),
("Pr", "L3", 2.0786, 5.9643),
("La", "L2", 2.1046, 5.8906),
("Ce", "L3", 2.1661, 5.7234),
("Cs", "L1", 2.1696, 5.7143),
("Ba", "L2", 2.2046, 5.6236),
("La", "L3", 2.2612, 5.4827),
("V", "K", 2.2685, 5.4651),
("Xe", "L1", 2.2736, 5.4528),
("Cs", "L2", 2.3133, 5.3594),
("Ba", "L3", 2.3628, 5.2470),
("I", "L1", 2.3896, 5.1881),
("Xe", "L2", 2.4291, 5.1037),
("Cs", "L3", 2.4736, 5.0119),
("Ti", "K", 2.4963, 4.9664),
("Te", "L1", 2.5101, 4.9392)]
##########################################################################
......@@ -137,17 +193,17 @@ def geofip(LAMBDA=0.97974,VERBOSE=2):
#FIP2 PARAMETERS
#--------------------------------------------------------------------
X_SOURCE = 0.00 #everything shifted -2800.00
X_MASK = 23455.00 #masque dans le front end
X_CACHE = 28965.25 #cache a l entree de M1
X_M1 = 29615.25
X_BE = 30515.25
X_FILW = 31329.25
X_C1 = 32344.05
X_M2 = 35072.85
X_FLUO1 = 33705.85
X_FLUO2 = 36257.85
X_FLUO3 = 54970.69
X_SP = 57149.69
X_MASK = 23437.00 #masque dans le front end
X_CACHE = 28882 #cache a l entree de M1
X_M1 = 29601
X_BE = 30577
X_FILW = 31419
X_C1 = 32336
X_M2 = 35066.5
X_FLUO1 = 33550
X_FLUO2 = 36418
X_FLUO3 = 55088
X_SP = 57157
#-------------------
......
......@@ -7,14 +7,92 @@ from bliss.common.standard import mv, mvr
import numpy as np
import datetime
from .geofip import geofip, tab_nrj
from bliss.physics import trajectory
from bliss.common import axis
from bliss.common.motor_group import TrajectoryGroup
import time
def change_energy(value):
mv(energy,value)
def trajectoire_mono()
def trajectoire_mono(nrj_target):
#get all yml optical position
cc = get_config()
cc.reload()
optical_conf = cc.get("optical_setup")
list_selected_str = list(optical_conf["selected"].keys())
date_selected =list(optical_conf["selected"].values())
list_selected_float = [float(i) for i in list_selected_str]
if nrj_target in list_selected_float:
idx = list_selected_float.index(nrj_target)
final_pos_dict=dict(optical_conf.get(list_selected_str[idx]).get(date_selected[idx]))
else:
print("nrj not found")
return
#get usefull object motor
motor_name_list=["beta", "utx", "utz", "moveh"]
motor_list = []
for axis in global_map.get_axes_iter():
if axis.name in motor_name_list:
motor_list.append(axis)
#comput the time need for the slowest motor to reach target
time_slowest = 0
for motor in motor_list:
motor.apply_config(reload=True)
distance = abs(motor.position-final_pos_dict.get(motor.name))
moving_time = 2*motor.acctime+distance/motor.velocity
if moving_time > time_slowest:
time_slowest=moving_time
#move motor to reach their target all at the same time (good speed)
motor_need_moving_list = []
for motor in motor_list:
distance = abs(motor.position-final_pos_dict.get(motor.name))
velocity = max(distance/time_slowest, motor.velocity*0.01)
motor.velocity=velocity
motor.move(final_pos_dict.get(motor.name), wait=False)
motor_need_moving_list.append(motor)
#verif si un axe bouge pas et qui n'est pas à la position final stop de tout
ok = True
end_time = time.time()+time_slowest
while ok:
try:
print_str = "\033[94m Target reached in %ds"%(end_time-time.time())
ok = False
for motor in motor_need_moving_list:
if motor.is_moving:
ok = True
print_str=print_str+" "+\
motor.name+"="+\
"%.2f"%motor.position+"/"+\
"%.2f"%final_pos_dict.get(motor.name)
if motor.is_moving == False:
distance = abs(motor.position-final_pos_dict.get(motor.name))
if distance>0.1:
ok = False
print(" !!! Emergency stop - some motor can not move !!!")
for motor in motor_need_moving_list:
motor.stop()
print(print_str, end="\r")
except:
print(" !!! Emergency stop - error or keyboard interupt !!!")
mono_stop()
for motor in motor_list:
motor.apply_config(reload=True)
def mono_stop():
utx.stop()
utz.stop()
beta.stop()
gamma2.stop()
omega2.stop()
khi2.stop()
moveh.stop()
def geofip_fill_beam_save():
import math
......@@ -115,7 +193,7 @@ def beam_get_setup(nrj):
print(nrj, "is between", list_nrj_setup[idxmin], "and", list_nrj_setup[idxmax])
list_nrj_setup[idxmin]
def beam_select_setup():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment