This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distutils.core import setup, Extension | |
import numpy | |
import os | |
os.environ['CC'] = 'g++'; | |
setup(name='matt_simple_test', version='1.0', ext_modules =[Extension('_simple', | |
['simple.cc', 'simple.i'], include_dirs = [numpy.get_include(),'.'])]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# standard compile options for the c++ executable | |
FLAGS = -fPIC | |
# the python interface through swig | |
PYTHONI = -I/usr/include/python2.6/ | |
PYTHONL = -Xlinker -export-dynamic | |
# default super-target | |
all: | |
g++ -fPIC -c kitty.cc -o kitty.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
import numpy as np | |
#============================================================================= | |
# Progress bar | |
#============================================================================= | |
class ProgressBar(object): | |
def __init__(self, num, label='Progress', value=0, screen=79, | |
time_remaining=True, bar=True, bar_symbol='=', bar_caps='[]', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pylab as pl | |
import numpy as np | |
from matplotlib.colors import Normalize | |
from matplotlib.collections import LineCollection | |
def plot_colored_curve(x, y, t=None, linewidth=2, drawpoints=False, cmap=pl.cm.copper): | |
""" | |
Plot a curve that is colored based on index or 'time' value at each point | |
in that curve. [x,y,t] are the values y(x, t) which will be plotted. They |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import uuid | |
from celery import signals | |
from celery import Celery, Task | |
from celery.utils.log import get_task_logger | |
app = Celery('simple_celery') | |
logger = get_task_logger(__name__) | |
class Worker(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pylab as pl | |
class Encirculator(object): | |
def __init__(self, image, cmap='bone', size=14, max_number_circles=100): | |
""" | |
A class which builds a matplotlib interface to facilitate the drawing | |
of circles on an image (typically to measure the sizes and positions of | |
objects). To create the circles, you label the edges with points via | |
mouse clicks, and a fitted circle is drawn over the image to guide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as pl | |
from matplotlib import cm | |
from matplotlib.colors import Normalize | |
from matplotlib.widgets import Slider | |
def rescale(xs, ys, params, values): | |
""" | |
An example scaling_func that can be provided to interactive_collapse. This | |
scales the zombie data by the variables alphac, sigma, tau for curves at |