nipy / PySurfer

Cortical neuroimaging visualization in Python
https://pysurfer.github.io/
BSD 3-Clause "New" or "Revised" License
240 stars 97 forks source link

BUG/WIP: positive only overlays + multiple hemis #93

Closed dengemann closed 10 years ago

dengemann commented 10 years ago

this is a start, the changes produce a failing test with the same error I encountered in a real-world application.

mluessi commented 10 years ago

What is the error?

dengemann commented 10 years ago

@mluessi ah, right ;-)

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-2-5f4987fe74b0> in <module>()
----> 1 test_viz.test_image()

/Users/dengemann/anaconda/lib/python2.7/site-packages/numpy/testing/decorators.pyc in skipper_func(*args, **kwargs)
    144                 raise nose.SkipTest(get_msg(f,msg))
    145             else:
--> 146                 return f(*args, **kwargs)
    147
    148         def skipper_gen(*args, **kwargs):

/Users/dengemann/github/PySurfer/surfer/tests/test_viz.py in test_image()
     50     brain = Brain(subject_id, 'both', surf=surf, config_opts=small_brain)
     51     brain.add_overlay(overlay_fname, hemi='lh', min=5, max=20, sign="pos")
---> 52     brain.save_imageset(tmp_name, ['med', 'lat'], 'jpg')
     53
     54     brain = Brain(*std_args, config_opts=small_brain)

/Users/dengemann/github/PySurfer/surfer/viz.pyc in save_imageset(self, prefix, views, filetype, colorbar, row, col)
   1845                     self.show_colorbar(row, col)
   1846                 else:
-> 1847                     self.hide_colorbar(row, col)
   1848                 self.show_view(view, row=row, col=col)
   1849                 if prefix is not None:

/Users/dengemann/github/PySurfer/surfer/viz.pyc in hide_colorbar(self, row, col)
   1656             Column index of which brain to use
   1657         """
-> 1658         self._colorbar_visibility(False, row, col)
   1659
   1660     def close(self):

/Users/dengemann/github/PySurfer/surfer/viz.pyc in _colorbar_visibility(self, visible, row, col)
   1630
   1631     def _colorbar_visibility(self, visible, row, col):
-> 1632         for cb in self._get_colorbars(row, col):
   1633             if cb is not None:
   1634                 cb.visible = visible

/Users/dengemann/github/PySurfer/surfer/viz.pyc in _get_colorbars(self, row, col)
   1624                 for bar in ["pos_bar", "neg_bar"]:
   1625                     try:
-> 1626                         colorbars.append(getattr(obj[ind], bar))
   1627                     except AttributeError:
   1628                         pass

IndexError: list index out of range
dengemann commented 10 years ago

Basically the colorbar indexing is screwed.

dengemann commented 10 years ago

pushed a fix, can someone pull and try?

larsoner commented 10 years ago

For some reason my machine locks up when running tests now :(

I'm trying a different tactic, getting Travis to run the tests. :) Hopefully it will be quick...

dengemann commented 10 years ago

@Eric89GXL does your machine also lock on master? If not that would not be a good sign.

larsoner commented 10 years ago

Yeah, it's been doing it for a while (but not during regular use), I haven't gotten around to tracking down the issue.

larsoner commented 10 years ago

@dengemann if you can push an empty commit, Travis will run a test (so I don't have to) and I can merge.

dengemann commented 10 years ago

@Eric89GXL rebased instead.

larsoner commented 10 years ago

The code passed, but the style did not :)

dengemann commented 10 years ago

@Eric89GXL I see, new advances in automated nitpicking ;-)

larsoner commented 10 years ago

@dengemann is this ready to merge from your end? (Sorry for the very slow response. I see that Travis is happy.)

dengemann commented 10 years ago

I forgot about the details ... go ahead if you are happy :-)

larsoner commented 10 years ago

LGTM. @mwaskom okay for you?

mwaskom commented 10 years ago

:+1: