Skip to content

Instantly share code, notes, and snippets.

@ev-br
ev-br / regroup_lapack_docs.py
Created January 21, 2015 18:50
regroup LAPACK wrapper functions in scipy.linalg.lapack docstring
import numpy as np
import scipy.linalg.lapack as sll
from collections import OrderedDict
lines = [line for line in sll.__doc__.split('\n')]
# split off the header
header, lines2 = [], []
for j, line in enumerate(lines):
if ':toctree: generated/' in line:
@ev-br
ev-br / vectorization.ipynb
Created January 22, 2015 22:11
vectorization 101
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true,
"slideshow": {
"slide_type": "slide"
}
},
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"slideshow": {
"slide_type": "skip"
}
@ev-br
ev-br / docstr_check.py
Created April 24, 2015 19:33
doctest docstring examples
"""
refguide_check.py [OPTIONS] [-- ARGS]
Check for a Scipy submodule whether the objects in its __all__ dict
correspond to the objects included in the reference guide.
Example of usage::
$ python refguide_check.py optimize
@ev-br
ev-br / gist:6753c191042727be16d6
Created May 13, 2015 18:26
sample m_eff runs
{
"metadata": {
"name": "",
"signature": "sha256:b08b733e2899ee6d89a19249b8782f46fd81b172f4320f7febbf4ab1e43b9e6f"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@ev-br
ev-br / gist:4385ac329753c40fffa9
Created May 13, 2015 18:39
P_inf(P_0) small gamma
{
"metadata": {
"name": "",
"signature": "sha256:64ebc188873e78125ef30a9c09fcfcf51451d6b12099e2320b5ca842eb517282"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
$ python tools/refguide_check.py --check_docs linalg
LinAlgError
**********************************************************************
File "/home/br/virtualenvs/scipy-dev/local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 59, in LinAlgError
Failed example:
LA.inv(np.zeros((2,2)))
Expected:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...linalg.py", line 350,
@ev-br
ev-br / gist:a11e5a25a98c2b0115ed
Last active August 29, 2015 14:22
a backwards-compatible Bunch
from __future__ import division, absolute_import, print_function
import pickle
import numpy as np
from numpy.testing import assert_equal, assert_, assert_raises
from scipy._lib.six import string_types
A, B = 3, 4
import numpy as np
from numpy.testing import run_module_suite, assert_, TestCase
class Base(object):
def test_one(self):
assert_(self.meth == 42)
def test_two(self):
assert_(2 == 3)