Skip to content

Instantly share code, notes, and snippets.

@rpmuller
rpmuller / make_contact_sheet.py
Created July 12, 2013 20:22
Create a simple contact sheet from a list of image filenames.
def make_contact_sheet(fnames,(ncols,nrows),(photow,photoh),
(marl,mart,marr,marb),
padding):
"""\
Make a contact sheet from a group of filenames:
fnames A list of names of the image files
ncols Number of columns in the contact sheet
nrows Number of rows in the contact sheet
def parseline(line,format):
"""\
Given a line (a string actually) and a short string telling
how to format it, return a list of python objects that result.
The format string maps words (as split by line.split()) into
python code:
x -> Nothing; skip this word
s -> Return this word as a string
i -> Return this word as an int
@rpmuller
rpmuller / ftree.py
Created July 12, 2013 20:36
Mandelbrot and frame's binary fractal trees
#!/usr/bin/env python
"""\
Mandelbrot and Frame's (Binary) Fractal Trees.
See http://www.math.union.edu/research/fractaltrees/
"""
import os
from math import sin,cos,pi
def ftree(iter,origin,t,r,theta,dtheta):
@rpmuller
rpmuller / Testing.md
Last active December 19, 2015 17:08
Testing Gist Pages

Playing around to see what one can do using Gist pages for writing.

@rpmuller
rpmuller / Tight Binding.ipynb
Created May 30, 2013 01:31
Tight Binding program to compute the band structure of simple semiconductors. Expands on the basic Harrison parameters. Parameters taken from Vogl, Hjalmarson and Dow, [A Semiempirical Tight-Binding Theory of the Electronic Structure of Semiconductors](http://www.sciencedirect.com/science/article/pii/0022369783900641), J. Phys. Chem. Sol. 44 (5)…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rpmuller
rpmuller / InteractiveShell.py
Created July 12, 2013 20:35
Create an interactive shell in a GUI
class FileCacher:
"Cache the stdout text so we can analyze it before returning it"
def __init__(self): self.reset()
def reset(self): self.out = []
def write(self,line): self.out.append(line)
def flush(self):
output = '\n'.join(self.out)
self.reset()
return output
@rpmuller
rpmuller / Polynomial.py
Last active August 24, 2018 11:30
Simple polynomial module.
#!/usr/bin/env python
"""\
Polynomial.py - A set of utilities to manipulate polynomials. This consists
of a set of simple functions to convert polynomials to a Python list, and
manipulate the resulting lists for multiplication, addition, and
power functions. There is also a class that wraps these functions
to make their use a little more natural.
This can also evaluate the polynomials at a value, and take integrals
and derivatives of the polynomials.
@rpmuller
rpmuller / svg-display.ipynb
Last active January 23, 2019 05:53
IPython's SVG display functionality, in conjunction with the ease of making SVG strings using ElementTrees, makes it really easy to have a nice drawing canvas inside of IPython.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rpmuller
rpmuller / CellularAutomata.py
Created July 12, 2013 20:23
Wolfram-style cellular automata using PIL
#!/usr/bin/env python
"""
CellularAutomata.py: Wolfram-style cellular automata in Python
Options:
-h # Use a screen of height # for the simulation
-w # Use a screen of width # for the simulation
-r Use a random initial row (rather than the standard single 1 in the middle)
-R # Use rule # for the simulation
@rpmuller
rpmuller / PyQuante Testing.ipynb
Last active July 8, 2021 00:53
Notes, timings, and additional tests for the development of pyquante2 by comparing to to PyQuante (1.6.??).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.