Skip to content

Instantly share code, notes, and snippets.

@mtambos
mtambos / ring_buffer
Created October 10, 2014 11:41
RingBuffer
import numpy as np
class RingBuffer(np.ndarray):
'A multidimensional ring buffer.'
def __new__(cls, input_array):
obj = np.asarray(input_array).view(cls)
return obj
@cameronneylon
cameronneylon / percolation.py
Created July 18, 2013 21:39
Code for percolation network simulation used in my talk at #BOSC July 19 2013 in Berlin. Based on code from http://dragly.org/2013/03/25/working-with-percolation-clusters-in-python/. The license for the source code is not entirely clear so this code is made available under a CC BY-SA license as per the blog it was derived from. For reasons not e…
from pylab import *
from scipy.ndimage import measurements
import numpy as np
import matplotlib.pyplot as plt
import time
import sys
import signal
def signal_handler(signal, frame):
sys.exit(0)