Skip to content

Commit

Permalink
Updated gitignore, charting functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Niru Maheswaranathan committed Apr 10, 2016
1 parent 0639479 commit cb7a72f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 49 deletions.
49 changes: 7 additions & 42 deletions .gitignore
@@ -1,54 +1,19 @@
# Byte-compiled / optimized / DLL files
# compiled files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
# tests
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
docs/_build
build/
dist/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
# other
tags
19 changes: 12 additions & 7 deletions jetpack/chart.py
Expand Up @@ -11,8 +11,9 @@
import matplotlib.animation as animation
from functools import wraps, partial

__all__ = ['plotwrapper', 'image', 'hist', 'hist2d', 'errorplot', 'random_slice',
'setfontsize', 'noticks', 'nospines', 'breathe', 'play', 'imv']
__all__ = ['plotwrapper', 'image', 'hist', 'hist2d', 'errorplot',
'random_slice', 'setfontsize', 'noticks', 'nospines', 'breathe',
'play', 'imv']


def plotwrapper(fun):
Expand Down Expand Up @@ -73,7 +74,7 @@ def wrapper(*args, **kwargs):


@plotwrapper
def image(data, mode='div', center=True, cmap=None, aspect='equal', vmin=None, vmax=None, **kwargs):
def image(data, mode='div', center=True, cmap=None, aspect='equal', vmin=None, vmax=None, cbar=False, **kwargs):
"""
Visualize a matrix as an image
Expand Down Expand Up @@ -125,20 +126,24 @@ def image(data, mode='div', center=True, cmap=None, aspect='equal', vmin=None, v
vmax = img_max
if cmap is None:
cmap = 'viridis'
elif mode == 'cov':
vmin, vmax, cmap, cbar = 0, 1, 'viridis', True
elif mode == 'cov':
vmin, vmax, cmap, cbar = -1, 1, 'seismic', True
else:
raise ValueError("Unrecognized mode: '" + mode + "'")

# make the image
kwargs['ax'].imshow(img, cmap=cmap, interpolation=None,
vmin=vmin, vmax=vmax, aspect=aspect)

# colorbar
if cbar:
plt.colorbar()

# clear ticks
noticks(ax=kwargs['ax'])

# display
plt.show()
plt.draw()


def play(images, cmap='gray', interval=100, clim=None, **kwargs):
"""Plays an animation of the given stack of images"""
Expand Down

0 comments on commit cb7a72f

Please sign in to comment.