Skip to content

Instantly share code, notes, and snippets.

View matthew-brett's full-sized avatar

Matthew Brett matthew-brett

View GitHub Profile
# Script to investigate exp errors
from __future__ import print_function, division
import numpy as np
import sympy.mpmath as mp
mp.mp.dps = 100
EPS = np.finfo(np.float64).eps
#!/usr/bin/env python
""" Detect Windows non-SSE2 machines in Firefox crash reports
Uses algorithm described in:
https://groups.google.com/d/msg/mozilla.dev.platform/GWb7C76nRqk/haR0oZkfkWgJ
and replicates results in:
https://groups.google.com/d/msg/mozilla.dev.platform/GWb7C76nRqk/w_T3nzDlVVkJ
#!/usr/bin/env python
""" Detect Windows versions in crash reports
Runs on *pub-crashdata.csv.gz files from:
https://crash-analysis.mozilla.com/crash_analysis
"""
from __future__ import division, print_function
import sys
@matthew-brett
matthew-brett / rename_wheels.py
Created May 20, 2014 04:19
Script to rename wheel files built with MacPython, to express compatibility with 10.9 system python and homebrew.
#!/usr/bin/env python
""" Rename MacPython wheels for system python and homebrew """
from __future__ import print_function
import os
from os.path import expanduser, splitext
import sys
from wheel.install import WheelFile
POP_PLAT_TAG = 'macosx_10_6_intel'
# An install file for ATLAS SSE2-only 32-bit build
#
# Must be unix line endings
# In vim - set ff=unix
# Turn off CPU throttling
# Control panel, Hardware and sound, Power options, Select a power plan, Show
# additional plans, High perfornamce
win_home="/cygdrive/c/Users/mb312"
downloads="${win_home}/Downloads"
code_home="/cygdrive/c/code"
#!/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',