Skip to content

Instantly share code, notes, and snippets.

View ellisonbg's full-sized avatar

Brian E. Granger ellisonbg

View GitHub Profile
@ellisonbg
ellisonbg / QGridWidget.ipynb
Created October 31, 2015 19:06
QGridWidget.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ellisonbg
ellisonbg / OutputArea.append_svg
Created June 8, 2012 17:45
Prototype of resizable SVG images
OutputArea.prototype.append_svg = function (svg, element) {
var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_svg");
toinsert.append(svg);
element.append(toinsert);
// The <svg> tag cannot be made resizable so we wrap it in a resizable <div>.
// The problem with this is that we need to 1) set the initial size of the
// <div> based on the size of the <svg> and 2) we need to tie the size of the
// <div> and the <svg>.
var img = $('<div/>');
img.html(svg);
@ellisonbg
ellisonbg / cython_magic.ipynb
Created May 24, 2012 06:50
Cython Magic using pyximport
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ellisonbg
ellisonbg / cython_inline_magic.ipynb
Created May 24, 2012 05:54
Cython inline IPython magic
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ellisonbg
ellisonbg / d3.ipynb
Created February 16, 2012 01:32
How to use d3 with the IPython notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import networkx as nx
import matplotlib as mat
# Builds a graphene sheet with the given number of rows and columns.
# The sheet has a defected column running through the optionally passed
# arg. Otherwise it defaults to the center.
def build_defected_graph(rows, columns, defect = 0):
g = nx.Graph()
if( columns <= 2 ):
@ellisonbg
ellisonbg / Configuring the IPython.parallel
Created August 20, 2011 18:11
Running IPython.parallel on Microsoft Azure
============================
Configuring IPython.parallel
============================
This guide describes the steps needed to run IPython engines on Microsoft Azure to perform a parallel
computation in the Microsoft cloud. We assume (see above guide) that Python, IPython and PyZMQ have
been installed on a set of Azure compute nodes.
1. Install Python, IPython and PyZMQ on a system having open access to the internet. We used an
Ubuntu 11.04 system for this purpose. This system will run the IPython controller and the IPython
"""Solve the 1D diffusion equation using CN and finite differences."""
from time import sleep
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
# The total number of nodes
nodx = 3
nody = 3
@ellisonbg
ellisonbg / diffusion2d.py
Created May 10, 2011 15:16
2D Diffusion Equation with CN
"""Solve the 1D diffusion equation using CN and finite differences."""
from time import sleep
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
# The total number of nodes
numx = 5
numy = 5
@ellisonbg
ellisonbg / gist:959768
Created May 6, 2011 20:58 — forked from thider/gist:956525
cranck nicholson stuck on BCs
from numpy import *
from matplotlib.pyplot import *
from time import sleep
import numpy as np
import networkx as nx
dim = [3,2]