Skip to content

Instantly share code, notes, and snippets.

@wackywendell
Created July 29, 2014 14:31
Show Gist options
  • Save wackywendell/75f1b8d83d26664fd3f6 to your computer and use it in GitHub Desktop.
Save wackywendell/75f1b8d83d26664fd3f6 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:d2c53345c12b26146e69f399ffbd1c6eadec273bb56825c0838fe563abeffd8f"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import sys, numpy, matplotlib\n",
"print('Python', sys.version)\n",
"print('numpy', numpy.__version__)\n",
"print('matplotlib', matplotlib.__version__)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Python 3.4.1 (default, May 19 2014, 17:23:49) \n",
"[GCC 4.9.0 20140507 (prerelease)]\n",
"numpy 1.8.1\n",
"matplotlib 1.3.1\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from numpy import array\n",
"from matplotlib.colors import SymLogNorm"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"data = array([-1, -0.2, 0, 0.01, 0.2, 4])"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"norm1 = SymLogNorm(0.1, vmin=-1, vmax=40)\n",
"norm2 = SymLogNorm(0.1, vmax=40)\n",
"\n",
"print(norm1(data))\n",
"print(norm2(data))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[-inf -inf nan inf inf inf]\n",
"[ 0. 0.14046408 0.33902607 0.35283281 0.53758806 0.79904133]\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"/usr/lib/python3.4/site-packages/matplotlib/colors.py:1077: RuntimeWarning: divide by zero encountered in true_divide\n",
" resdat /= (self._upper - self._lower)\n",
"/usr/lib/python3.4/site-packages/matplotlib/colors.py:1077: RuntimeWarning: invalid value encountered in true_divide\n",
" resdat /= (self._upper - self._lower)\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(norm1.vmin, norm1.vmax, norm1._lower, norm1._upper)\n",
"print(norm2.vmin, norm2.vmax, norm2._lower, norm2._upper)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"-1 40 0 0\n",
"-1.0 40 -0.388456179986 0.757344125398\n"
]
}
],
"prompt_number": 5
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment