Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernando Perez fperez

View GitHub Profile
View calltips.py
"""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
fperez / bin_perm_rep.py
Created Feb 13, 2011
Permutations with repetitions
View bin_perm_rep.py
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:
Examples:
View Auto transliterating form elements
// Another change
// Testing gists on the web
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google AJAX Language API - Basic Transliteration</title>
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
@fperez
fperez / lp2gh-issues.py
Created Feb 20, 2011
Conversion from Launchpad bugs to GitHub ones
View lp2gh-issues.py
#!/usr/bin/env python
"""Launchpad to github bug migration script.
There's a ton of code from Hydrazine copied here:
https://launchpad.net/hydrazine
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.
Usage
-----
@fperez
fperez / contour_overlap.py
Created Mar 9, 2011
Matplotlib contours with overlap control
View contour_overlap.py
"""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
View unicode.py
#!/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/test_view.py", 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
fperez / param2normal.py
Created May 31, 2011
Convert nose parametric tests to normal ones
View param2normal.py
#!/usr/bin/env python
"""Simple script to remove nose-style parametric tests and turn them into
normal ones.
Usage:
param2normal.py file1.py file2.py ...
By default it overwrites the files in-place, you can change that below in the
__main__ section.
@fperez
fperez / error.py
Created Nov 15, 2011
A simple file with an error for testing interactive debugging
View error.py
#!/usr/bin/env python
"""
file with deliberate errors to check IPython.
"""
from numpy import *
import time,sys
import sys
@fperez
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/__init__.py:923: 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/font_manager.py:1210: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))
You can’t perform that action at this time.