Skip to content

Instantly share code, notes, and snippets.


Fernando Perez fperez

View GitHub Profile
"""Callable object, to test various parts of ipython's info system.
Run this file and then do f(, g( or c( or c.method( in the qt gui to see the
various tooltips.
class Call(object):
"""This is the class docstring."""
def __init__(self, x, y=1):
fperez /
Created Feb 13, 2011
Permutations with repetitions
import numpy as np
def bin_perm_rep(ndim,a=0,b=1):
"""bin_perm_rep(ndim) -> ndim permutations with repetitions of (a,b).
Returns an array with all the possible permutations with repetitions of
(0,1) in ndim dimensions. The array is shaped as (2**ndim,ndim), and is
ordered with the last index changing fastest. For examble, for ndim=3:
View Auto transliterating form elements
// Another change
// Testing gists on the web
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google AJAX Language API - Basic Transliteration</title>
<script type="text/javascript" src="//"></script>
<script type="text/javascript">
fperez /
Created Feb 20, 2011
Conversion from Launchpad bugs to GitHub ones
#!/usr/bin/env python
"""Launchpad to github bug migration script.
There's a ton of code from Hydrazine copied here:
WARNING: this code was written for the Github issues v2 API, and has *not* been ported to v3. If anyone finds it useful and ports it, please drop me a pull request.
fperez /
Created Mar 9, 2011
Matplotlib contours with overlap control
"""Contours with overlap control.
This script generates widely spaced black contours, with a gray patch in a
subregion where more finely-spaced colored contours are visible. The gray
patch covers the black contours.
import numpy as np
import matplotlib.mlab as mlab
from matplotlib.patches import Rectangle
#!/usr/bin/env python
# -*- encoding: utf-8
#from IPython.external
import sys
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
paa = parser.add_argument
View gist:912014
ERROR: test pushing and pulling functions
Traceback (most recent call last):
File "/home/fperez/usr/lib/python2.6/site-packages/IPython/parallel/tests/", line 92, in test_push_pull_function
self.assertEqual(r(1.0), testf(1.0))
TypeError: 'AsyncResult' object is not callable
FAIL: test_queue_status (IPython.parallel.tests.test_client.TestClient)
fperez /
Created May 31, 2011
Convert nose parametric tests to normal ones
#!/usr/bin/env python
"""Simple script to remove nose-style parametric tests and turn them into
normal ones.
Usage: ...
By default it overwrites the files in-place, you can change that below in the
__main__ section.
fperez /
Created Nov 15, 2011
A simple file with an error for testing interactive debugging
#!/usr/bin/env python
file with deliberate errors to check IPython.
from numpy import *
import time,sys
import sys
fperez / mpl_test.log
Created Dec 7, 2011
Log of matplotlib test run
View mpl_test.log
longs[junk]> nosetests matplotlib
/home/fperez/usr/opt/lib/python2.7/site-packages/matplotlib/ UserWarning: This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
if warn: warnings.warn(_use_error_msg)
/home/fperez/usr/opt/lib/python2.7/site-packages/matplotlib/ UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))