question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Float index in coregistration gui

See original GitHub issue

@christianbrodbeck I have a problem with the source alignment example - I get the following error when trying to open the GUI:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-8dc6699564c7> in <module>()
----> 1 mne.gui.coregistration(subject='sample', subjects_dir=subjects_dir)

c:\proj\src\mne-python\mne\gui\__init__.py in coregistration(tabbed, split, scene_width, inst, subject, subjects_dir, guess_mri_subject, scene_height, head_opacity, head_high_res, trans, scrollable, verbose)

c:\proj\src\mne-python\mne\utils.py in verbose(function, *args, **kwargs)
    726         with use_log_level(verbose_level):
    727             return function(*args, **kwargs)
--> 728     return function(*args, **kwargs)
    729 
    730 

c:\proj\src\mne-python\mne\gui\__init__.py in coregistration(tabbed, split, scene_width, inst, subject, subjects_dir, guess_mri_subject, scene_height, head_opacity, head_high_res, trans, scrollable, verbose)
    127     frame = CoregFrame(inst, subject, subjects_dir, guess_mri_subject,
    128                        head_opacity, head_high_res, trans, config)
--> 129     return _initialize_gui(frame, view)
    130 
    131 

c:\proj\src\mne-python\mne\gui\__init__.py in _initialize_gui(frame, view)
     16         return frame.edit_traits(view=view), frame
     17     else:
---> 18         frame.configure_traits(view=view)
     19         return frame
     20 

C:\Anaconda3\envs\pyqt4\lib\site-packages\traits\has_traits.py in configure_traits(self, filename, view, kind, edit, context, handler, id, scrollable, **args)
   2154                 context = self
   2155             rc = toolkit().view_application( context, self.trait_view( view ),
-> 2156                                            kind, handler, id, scrollable, args )
   2157             if rc and (filename is not None):
   2158                 fd = None

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\toolkit.py in view_application(self, context, view, kind, handler, id, scrollable, args)
    211         from . import view_application
    212         return view_application.view_application( context, view, kind, handler,
--> 213                                                   id, scrollable, args )
    214 
    215     #---------------------------------------------------------------------------

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\view_application.py in view_application(context, view, kind, handler, id, scrollable, args)
     88                   id         = id,
     89                   scrollable = scrollable,
---> 90                   args       = args )
     91 
     92     # If the UI has not been closed yet, we need to keep a reference to

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\view.py in ui(self, context, parent, kind, view_elements, handler, id, scrollable, args)
    431             kind = self.kind
    432 
--> 433         ui.ui( parent, kind )
    434 
    435         return ui

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\ui.py in ui(self, parent, kind)
    220                                    dispatch = 'ui' )
    221         self.rebuild = getattr( toolkit(), 'ui_' + kind )
--> 222         self.rebuild( self, parent )
    223 
    224     #---------------------------------------------------------------------------

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\toolkit.py in ui_live(self, ui, parent)
    153         """
    154         from . import ui_live
--> 155         ui_live.ui_live( ui, parent )
    156 
    157     def ui_modal ( self, ui, parent ):

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_live.py in ui_live(ui, parent)
     37     """Creates a live, non-modal PyQt user interface for a specified UI object.
     38     """
---> 39     _ui_dialog(ui, parent, BaseDialog.NONMODAL)
     40 
     41 def ui_livemodal(ui, parent):

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_live.py in _ui_dialog(ui, parent, style)
     57         ui.owner = _LiveWindow()
     58 
---> 59     BaseDialog.display_ui(ui, parent, style)
     60 
     61 

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_base.py in display_ui(ui, parent, style)
    480         """Display the UI."""
    481 
--> 482         ui.owner.init(ui, parent, style)
    483         ui.control = ui.owner.control
    484         ui.control._parent = parent

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_live.py in init(self, ui, parent, style)
    175             bbox = None
    176 
--> 177         self.add_contents(panel(ui), bbox)
    178 
    179     def close(self, rc=True):

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in panel(ui)
    253         panel = None
    254     if nr_groups == 1:
--> 255         panel = _GroupPanel(content[0], ui).control
    256     elif nr_groups > 1:
    257         panel = QtGui.QTabWidget()

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in __init__(self, group, ui, suppress_label)
    543             self._setup_editor(group, editor)
    544 
--> 545             self._add_splitter_items(content, splitter)
    546 
    547         elif group.layout in ('tabbed', 'fold'):

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in _add_splitter_items(self, content, splitter)
    621             # Get a panel for the Item or Group.
    622             if isinstance(item, Group):
--> 623                 panel = _GroupPanel(item, self.ui, suppress_label=True).control
    624             else:
    625                 panel = self._add_items([item])

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in __init__(self, group, ui, suppress_label)
    588 
    589             if isinstance(content[0], Group):
--> 590                 layout = self._add_groups(content, inner)
    591             else:
    592                 layout = self._add_items(content, inner)

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in _add_groups(self, content, outer)
    667         # Process each group.
    668         for subgroup in content:
--> 669             panel = _GroupPanel(subgroup, self.ui).control
    670 
    671             if isinstance(panel, QtGui.QWidget):

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in __init__(self, group, ui, suppress_label)
    588 
    589             if isinstance(content[0], Group):
--> 590                 layout = self._add_groups(content, inner)
    591             else:
    592                 layout = self._add_items(content, inner)

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in _add_groups(self, content, outer)
    667         # Process each group.
    668         for subgroup in content:
--> 669             panel = _GroupPanel(subgroup, self.ui).control
    670 
    671             if isinstance(panel, QtGui.QWidget):

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in __init__(self, group, ui, suppress_label)
    590                 layout = self._add_groups(content, inner)
    591             else:
--> 592                 layout = self._add_items(content, inner)
    593             layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
    594 

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\ui_panel.py in _add_items(self, content, outer)
    858             # that it is not None (otherwise the main TraitsUI code can change
    859             # the "kind" of the created UI object).
--> 860             editor.prepare(inner)
    861             control = editor.control
    862 

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\editor.py in prepare(self, parent)
    154             self.context_object.on_trait_change( self._update_editor, name,
    155                                                  dispatch = 'ui' )
--> 156         self.init( parent )
    157         self._sync_values()
    158         self.update_editor()

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\enum_editor.py in init(self, parent)
    367                                self.update_object)
    368 
--> 369         self.rebuild_editor()
    370 
    371     #---------------------------------------------------------------------------

C:\Anaconda3\envs\pyqt4\lib\site-packages\traitsui\qt4\enum_editor.py in rebuild_editor(self)
    431             for j in range( cols ):
    432                 if n > 0:
--> 433                     name = names[index]
    434                     rb = self.create_button(name)
    435                     rb.value = mapping[name]

TypeError: list indices must be integers or slices, not float

Seems that index is a float, but I don’t know how it gets to that point.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
christianbrodbeckcommented, Nov 17, 2017

Hm yeah then we should update the conda-forge recipe once a new version is released…

On Nov 17, 2017, at 9:43 AM, Eric Larson notifications@github.com wrote:

Ahh right, I think you need to be on Python3 for the error to show up, and it does with 5.1.0, so we do need to use some unreleased dev version

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

0reactions
larsonercommented, Nov 17, 2017

Ahh right, I think you need to be on Python3 for the error to show up, and it does with 5.1.0, so we do need to use some unreleased dev version

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.gui.coregistration — MNE 1.2.2 documentation
Coregister an MRI with a subject's head shape. The GUI can be launched through the command line interface: $ mne coreg.
Read more >
ENH: New interface for Coregistration · Issue #8833 - GitHub
This patch moves past the error allowing CLI coregistration, but I don't know how it interacts with the work you're doing in the...
Read more >
Neuroimaging Data Processing - Spatial normalization
Concept of CoregistrationEdit. Generally, coregistration refers to the spatial alignment of a series of images, either from intra-subject or inter-subject ...
Read more >
Support BrainVoyager - Support BrainVoyager
Manual adjustment of rotation, translation and scale parameters · BrainVoyager User's Guide · What's New · General Information · Overview · Getting Started....
Read more >
User's Guide to COSI-CORR Co-registration of Optically ...
This value must be a floating point between 0.0 - 1.0. The closer this parameter is to zero, the more the linear regression...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found