Skip to content

Commit

Permalink
Merge pull request #43 from ericdill/skxray_refac
Browse files Browse the repository at this point in the history
MNT : Skxray refac
  • Loading branch information
tacaswell committed Nov 13, 2014
2 parents 4391ea9 + f1a68d3 commit e2285a0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 477 deletions.
2 changes: 1 addition & 1 deletion bubblegum/backend/mpl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AbstractMPLDataView(object):
"""
Class docstring
"""
_default_cmap = 'jet'
_default_cmap = 'gray'
_default_norm = cm.colors.Normalize(vmin=0, vmax=1)

def __init__(self, fig, cmap=None, norm=None, *args, **kwargs):
Expand Down
34 changes: 23 additions & 11 deletions bubblegum/backend/mpl/cross_section_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from six.moves import zip
from matplotlib.widgets import Cursor
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import NullLocator
from matplotlib.ticker import NullLocator, LinearLocator
import numpy as np

from . import AbstractMPLDataView
Expand Down Expand Up @@ -138,9 +138,9 @@ def _percentile_limit(im):


_INTERPOLATION = ['none', 'nearest', 'bilinear', 'bicubic', 'spline16',
'spline36', 'hanning', 'hamming', 'hermite', 'kaiser',
'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
'sinc', 'lanczos']
'spline36', 'hanning', 'hamming', 'hermite', 'kaiser',
'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
'sinc', 'lanczos']


class CrossSection2DView(AbstractDataView2D, AbstractMPLDataView):
Expand Down Expand Up @@ -177,14 +177,12 @@ def __init__(self, fig, data_list, key_list, cmap=None, norm=None,
"""
if 'limit_args' in kwargs:
raise Exception("changed API, don't use limit_args anymore, use closures")

# call up the inheritance chain
super(CrossSection2DView, self).__init__(fig=fig, data_list=data_list,
key_list=key_list, norm=norm,
cmap=cmap)
self._xsection = CrossSection(fig,
self._data_dict[self._key_list[0]],
cmap=cmap, norm=norm,
cmap=self._cmap, norm=self._norm,
limit_func=limit_func,
interpolation=interpolation)

Expand Down Expand Up @@ -248,7 +246,7 @@ def inner(self, *args, **kwargs):
return ret

inner.__name__ = func.__name__
inner.__doct__ = func.__doc__
inner.__doc__ = func.__doc__

return inner

Expand Down Expand Up @@ -287,7 +285,13 @@ class CrossSection(object):
Properties
----------
interpolation
interpolation : str
The stringly-typed pixel interpolation. See _INTERPOLATION attribute
of this cross_section_2d module
cmap : str
The colormap to use for rendering the image
"""
def __init__(self, fig, cmap=None, norm=None,
Expand Down Expand Up @@ -356,10 +360,10 @@ def __init__(self, fig, cmap=None, norm=None,
# (set up the horizontal and vertical cuts)
self._ax_h = divider.append_axes('top', .5, pad=0.1,
sharex=self._im_ax)
self._ax_h.yaxis.set_major_locator(NullLocator())
self._ax_h.yaxis.set_major_locator(LinearLocator(numticks=2))
self._ax_v = divider.append_axes('left', .5, pad=0.1,
sharey=self._im_ax)
self._ax_v.xaxis.set_major_locator(NullLocator())
self._ax_v.xaxis.set_major_locator(LinearLocator(numticks=2))
self._ax_cb = divider.append_axes('right', .2, pad=.5)
# add the color bar
self._cb = fig.colorbar(self._im, cax=self._ax_cb)
Expand Down Expand Up @@ -644,3 +648,11 @@ def _update_artists(self):

def _draw(self):
self._fig.canvas.draw()

@auto_redraw
def autoscale_horizontal(self, enable):
self._ax_h.autoscale(enable=enable)

@auto_redraw
def autoscale_vertical(self, enable):
self._ax_v.autoscale(enable=False)
161 changes: 0 additions & 161 deletions qt_apps/DEMO_Live.py

This file was deleted.

139 changes: 0 additions & 139 deletions qt_apps/DEMO_live.py

This file was deleted.

Loading

0 comments on commit e2285a0

Please sign in to comment.