hibtc / madgui

GUI for accelerator simulations using MAD-X
https://hibtc.github.io/madgui
Other
3 stars 2 forks source link

Overlay elements broken #7

Closed coldfix closed 7 years ago

coldfix commented 7 years ago

Originally reported by @DavidSagan:

When there is a controller element (group, overlay, girder) in the lattice then madqt will fail reading in the lattice since these elements do not have defined a length. The error message I get is:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Traceback (most recent call last):
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/core/menu.py", line 32, in <lambda>
    self.callback = lambda: callback()
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/core/mainwindow.py", line 192, in fileOpen
    self.loadFile(filename)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/core/mainwindow.py", line 314, in loadFile
    self.setWorkspace(Workspace(filename, self.config))
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/tao.py", line 68, in __init__
    super(Workspace, self).__init__(filename, app_config)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 72, in __init__
    self.load(filename)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 79, in load
    self.load_dispatch(name, ext)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/tao.py", line 77, in load_dispatch
    self.load_lattice_file(name)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/tao.py", line 94, in load_lattice_file
    self.init('-lat', filename, '-noinit', **kw)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/tao.py", line 107, in init
    self.segment = Segment(self, self.data.get('sequence'))
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/tao.py", line 151, in __init__
    self.elements = ElementList(el_names, self.get_element_data)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 323, in __init__
    self.update()
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 327, in update
    beg, end = self[0], self[-1]
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 353, in __getitem__
    return self._get_by_index(index)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 414, in _get_by_index
    el = self._cached[index] = self._get_data(index)
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/common.py", line 187, in get_element_data
    return self.utool.dict_add_unit(self.get_element_data_raw(index, which))
  File "/home/dcs16/dcs16/usr_local/lib/python3.5/site-packages/MadQt-0.0.0-py3.5.egg/madqt/engine/tao.py", line 162, in get_element_data_raw
    data['at'] = data['s'] - data['l']
KeyError: 'l'

An example lattice is:

parameter[particle] = #12C+6
parameter[geometry] = open

beginning[e_tot]    = 400e+9

beginning[beta_a]   = 44
beginning[beta_b]   = 4
beginning[alpha_a]  = -7
beginning[alpha_b]  = -1

bb: sbend, l = 2, angle = 1
oo: overlay = {bb}, g_err

seq: line = (bb)

use, seq