Skip to content

Instantly share code, notes, and snippets.

@ptomato
ptomato / Makefile.am
Created October 27, 2012 12:43
Test case for strange libpeas behavior
plugindir = $(libdir)/plugins
dist_plugin_DATA = confplugin.plugin
plugin_LTLIBRARIES = libconfplugin.la
libconfplugin_la_SOURCES = confplugin.c
libconfplugin_la_LIBADD = $(PLUGIN_LIBS)
libconfplugin_la_LDFLAGS = -module -avoid-version -shared
AM_CFLAGS = $(PLUGIN_CFLAGS)
dist_noinst_SCRIPTS = testconfplugin.py
@ptomato
ptomato / luminance.py
Created June 25, 2012 15:02
Luminance color scale
import numpy as N
import matplotlib.colors
def rotate(x, y, angle):
r, theta = N.sqrt(x ** 2 + y ** 2), N.arctan2(y, x)
theta += angle
return r * (N.cos(theta), N.sin(theta))
@ptomato
ptomato / zernike.py
Created May 25, 2012 18:19
Zernike aberrations
import numpy as N
import numpy.fft
from matplotlib import pyplot as P
npoints = 51 # odd number
side = N.linspace(-1, 1, npoints)
x, y = N.meshgrid(side, side)
r, theta = N.hypot(x, y), N.arctan2(y, x)
# Create a gaussian
@ptomato
ptomato / gist:2761283
Created May 21, 2012 08:55
Surface plasmon launch at a metal slit in Meep
(define-param slit? true) ; set to false to turn off the slit
(define a 1e-6) ;length unit used in simulation = 1 micron
(set! resolution 50) ;pixels per micron
(define size-x 7) ;microns
(define size-y 3) ;microns
(define wl 0.83) ;microns
(define pi 3.14159265358979)
(define c0 299792458) ; m/s
(define timesteps 150)