Commit dcfbd350 authored by Yoann Sallaz Damaz's avatar Yoann Sallaz Damaz

New Grob HWObj and correction Spec2bliss

parent c1f5f027
Pipeline #19594 failed with stages
......@@ -56,18 +56,18 @@ for idx,ip in enumerate(icepapIP):
steps_per_unit = float(motorInfo[3])
sign = int(motorInfo[4])
accelTime = int(motorInfo[8])
speed = int(motorInfo[6])
speed = int(motorInfo[5])
backlash = int(motorInfo[7])
mne = motorInfo[11]
print(" -")
print(" name: %s"%mne)
print(" address: %d"%(icepapCrate*10+icepapCard))
print(" sign: %d"%(sign))
print(" steps_per_unit: %f"%steps_per_unit)
print(" velocity: %f"%(speed/(float(steps_per_unit))))
print(" acceleration: %f"%((speed/(float(steps_per_unit))/(float(accelTime)/1000.))))
print(" backlash: %f"%(backlash/(float(steps_per_unit))))
print(" low_limit: -inf")
print(" high_limit: inf")
print(" offset: 0")
print(" - name: %s"%mne)
print(" address: %d"%(icepapCrate*10+icepapCard))
print(" sign: %d"%(sign))
print(" steps_per_unit: %f"%steps_per_unit)
print(" velocity: %f"%(speed/(float(steps_per_unit))))
print(" acceleration: %f"%((speed/(float(steps_per_unit))/(float(accelTime)/1000.))))
print(" backlash: %f"%(backlash/(float(steps_per_unit))))
print(" low_limit: -inf")
print(" high_limit: inf")
print(" offset: 0")
print("")
from bliss.config import static as static_config
from bliss.comm.modbus import ModbusTcp
from bliss.config.channels import Cache, Channel
#<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
#<TOPICSLIST>
......@@ -297,7 +299,7 @@ class grob_FIP(object):
def get_sample_mounted(self):
self.read_all_memory()
return self.sample_angle_mounted
return self.NumSampleMounted
def get_sample_omega(self):
self.read_all_memory()
......@@ -326,7 +328,22 @@ class grob_FIP(object):
def get_current_puck_type(self):
self.read_all_memory()
return self.CurrentPuckType
def transfer_state(self):
#TODO
return 0
def callback_transfer_state(self, fct):
self.transfer_state_chan = Channel("transfer_state", callback=fct)
def callback_io_bits(self, fct):
self.io_bits_chan = Channel("io_bits", default_value="0 0", callback=fct)
def callback_mounted_sample(self, fct):
self.mounted_sample_chan = Channel("mounted_sample", default_value=0, callback=fct)
def callback_samples_map(self, fct):
self.samples_map_chan = Channel("samples_map", default_value=dict(zip(range(30), ["unknown"] * 30)), callback=fct)
\ No newline at end of file
......@@ -4,104 +4,26 @@ from bliss.shell.cli.pt_widgets import BlissDialog
from bliss import global_map
import numpy as np
import datetime
import random as rnd
from .geofip import geofip, tab_nrj
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)]
def geofip_fill_beam_save():
import math
cc = get_config()
cc.reload()
optical_conf = cc.get("optical_setup")
for nrj in tab_nrj:
dict_pos_mot = {"omega2":rnd.random()*5000, "gamma2":rnd.random()*5000}
resu_geofip = geofip(nrj[3], VERBOSE=0)
dict_pos_mot = {
"alpha1": round((resu_geofip.get("angle_m1")*180./math.pi), 4),
"beta": round((resu_geofip.get("mono_angle")*180./math.pi), 4),
"utx": round(resu_geofip.get("dx"), 4),
"utz": round(resu_geofip.get("dz"), 4),
"moveh": round(resu_geofip.get("z_c1"), 4),
"alpha2": round((resu_geofip.get("angle_m2")*180./math.pi), 4)
}
if(optical_conf.get(str(nrj[2])) is None):
new_conf = { "geofip": dict_pos_mot }
else:
......@@ -162,6 +84,7 @@ def beam_get_setup(nrj):
optical_conf = cc.get("optical_setup")
list_nrj_setup = list(optical_conf.keys())
list_nrj_setup.remove("name")
list_nrj_setup.remove("selected")
list_nrj_setup = np.array([float(i) for i in list_nrj_setup])
list_nrj_setup.sort()
......@@ -181,6 +104,9 @@ def beam_get_setup(nrj):
print(nrj, "is between", list_nrj_setup[idxmin], "and", list_nrj_setup[idxmax])
def beam_select_setup():
cc = get_config()
......@@ -196,11 +122,14 @@ def beam_select_setup():
tab_nrj_choice = [(str(i), "%6s %6s"%(str(i),"-".join(tab_nrj[np.argwhere(tab_nrj_kev==i)[0][0]][0:2]))) for i in list_nrj_setup]
selected_conf = optical_conf.get("selected")
for idx in range(len(tab_nrj_choice)):
current_selected_conf = selected_conf.get(tab_nrj_choice[idx][0])
if current_selected_conf is None:
if selected_conf is None:
tab_nrj_choice[idx]= (tab_nrj_choice[idx][0], tab_nrj_choice[idx][1]+" (interpolate)")
else:
tab_nrj_choice[idx]= (tab_nrj_choice[idx][0], tab_nrj_choice[idx][1]+" ("+current_selected_conf+")")
current_selected_conf = selected_conf.get(tab_nrj_choice[idx][0])
if current_selected_conf is None:
tab_nrj_choice[idx]= (tab_nrj_choice[idx][0], tab_nrj_choice[idx][1]+" (interpolate)")
else:
tab_nrj_choice[idx]= (tab_nrj_choice[idx][0], tab_nrj_choice[idx][1]+" ("+current_selected_conf+")")
dlg3 = UserChoice(label="Choose an available energy :", values=tab_nrj_choice)
wanted_nrj = BlissDialog( [ [ dlg3 ] ], title='Beam configuration editor', ok_text="Next").show()
......
from bliss.common.standard import _MAX_COLS, _ERR, _tabulate, _print_errors_with_traceback
from bliss.common.utils import ErrorWithTraceback
from bliss import global_map, global_log
from bliss.common import session
def wa(**kwargs):
"""
......
Markdown is supported
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