Skip to content

Instantly share code, notes, and snippets.

View matthew-brett's full-sized avatar

Matthew Brett matthew-brett

View GitHub Profile
#!/usr/bin/env python
""" Find defs, cpdefs in pyx files, print calls in tests """
from __future__ import division, print_function
DESCRIP = "Find def and cpdef functions / methods, look for calls in tests"
EPILOG = \
"""Search for all ".pyx" files at given file root.
Find all functions and method definitions in the pyx files by looking for
"def " or "cpdef " followed by an identifier and open parentheses.
""" Test we can correctly import example PARREC files
"""
from __future__ import print_function, absolute_import
from glob import glob
from os.path import join as pjoin, basename, splitext, exists, dirname
import numpy as np
from nibabel import load as top_load, Nifti1Image
@matthew-brett
matthew-brett / hyp1f1_port.py
Last active August 29, 2015 14:10
Partial port of mpmath hyp1f1 function
""" mpmath hyp1f1 algorithm crudely ported """
import math
import cmath
import operator
import numpy as np
import scipy.special as sps
eps = np.finfo(float).eps
""" Make html pages redirecting to another URL base
USAGE: rewrite_pages.py <path-to-html> <base-url-to-redirect-to>
"""
import os
from os.path import join as pjoin, relpath
import sys
import numpy as np
import scipy.linalg as spl
blas_routines = [
'dot',
'nrm2',
'asum',
# 'idamax',
'swap',
from pprint import pprint
import scipy.linalg as spl
def get_routine(routine_name, type='blas'):
routines = getattr(spl, '_f' + type, None)
if routines is None:
routines = getattr(spl, type, None)
return getattr(routines, routine_name, 'missing')
#!/bin/bash
set -e
PYTHON_VERSIONS="2.6 2.7 3.3 3.4 3.5"
CYTHON_VERSIONS="0.17 0.17.1 0.17.2 0.17.3 0.17.4 0.18 \
0.19 0.19.1 0.19.2 0.20 0.20.1 0.20.2 \
0.21 0.21.1 0.21.2 0.22 0.22.1 \
0.23 0.23.1 0.23.2 0.23.3 0.23.4"
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
#!/bin/bash
set -e
PYTHON_VERSIONS="2.6 2.7 3.3 3.4 3.5"
NUMPY_VERSIONS="1.6.1 1.6.2 1.7.1 1.7.2 1.8.0 1.9.3 1.10.4"
MANYLINUX_URL=https://nipy.bic.berkeley.edu/manylinux
CYTHON_VERSION=0.21.2
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
function lex_ver {
#!/bin/bash
set -e
MANYLINUX_URL=https://nipy.bic.berkeley.edu/manylinux
HDF5_VERSION_2=1.8.16
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Get hdf5 libraries
# curl -LO $MANYLINUX_URL/hdf5-${HDF5_VERSION_1}.tgz