Skip to content

Instantly share code, notes, and snippets.

View stefanv's full-sized avatar

Stefan van der Walt stefanv

View GitHub Profile
@stefanv
stefanv / foo.pynb
Created August 17, 2011 05:42
Test IPython notebook upload
Test this file
@stefanv
stefanv / observe_thread.py
Created October 19, 2011 01:12
Observer thread
import threading
import time
class Worker(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.val = 0
self.val2 = 20
def run(self):
@stefanv
stefanv / github_fixed_font.user.js
Created October 25, 2011 01:38
Userscript for fixing monospace fonts on GitHub to browser default
// ==UserScript==
// @name GitHub Fixed Font
// @namespace http://jonasgalvez.com.br/
// @description Fixed-font code listings for GitHub
// @include http://github.com/*
// @include http://*.github.com/*
// @include https://*.github.com/*
// @include https://*.github.com/*
// ==/UserScript==
@stefanv
stefanv / minimize_doc.py
Created November 9, 2011 20:42
Illustration of possible extra documentation for generic SciPy optimization interface.
def minimize_doc(method=None):
"""Additional arguments for SciPy minimisers.
* BFGS
- Arg 1 descr
- Arg 2 descr
* Newton
- Newton arg 1
- Newton arg 2
@stefanv
stefanv / sparks.py
Created November 17, 2011 00:25
Command line sparks in Python
#!/usr/bin/python
# coding=utf-8
# Python version of Zach Holman's "spark"
# https://github.com/holman/spark
# by Stefan van der Walt <stefan@sun.ac.za>
"""
USAGE:
@stefanv
stefanv / khintchine.py
Created January 24, 2012 03:30
Illustration of Wiener-Khintchine
import numpy as np
import matplotlib.pyplot as plt
# Signal frequencies, in Hz
f = np.array([10, 20, 40, 80])
# Sampling duration
T = 1.0
# Sampling frequency (in Hz)
@stefanv
stefanv / random_walk.py
Created January 24, 2012 22:05
Random walk example
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim(-10, 10)
ax.set_aspect(1)
x = [0]
@stefanv
stefanv / chase_escape.py
Created January 26, 2012 11:33
Group chase and escape
# Stefan van der Walt, 2012
# License: BSD
# Implementation of the simulation described in
#
# Atsushi Kamimura and Toru Ohira, "Group Chase and Escape",
# New Journal of Physics, 12 (2010).
#
# http://arxiv.org/abs/0912.4327v2
@stefanv
stefanv / test.tmpl
Created March 6, 2012 20:50
Transmogrify
Dear all,
Here's a list of attendees, in alphabetical order:
{{py:
attendees = [
"Van der Walt, Stefan",
"Laurie, Dirk",]
}}
@stefanv
stefanv / mtf.py
Created March 16, 2012 19:17
Simulate MTF of various filters
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
N = 100
std = 3.75
box = 5