This is companion code to this guide.
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script> | |
<script type="text/javascript" src="./sankey.js"></script> | |
<title>Sankey Diagram</title> | |
<style> |
#!/bin/bash | |
# https://gist.github.com/robwierzbowski/5430952/ | |
# Create and push to a new github repo from the command line. | |
# Grabs sensible defaults from the containing folder and `.gitconfig`. | |
# Refinements welcome. | |
# Gather constant vars | |
CURRENTDIR=${PWD##*/} | |
GITHUBUSER=$(git config github.user) |
# wavio.py | |
# Author: Warren Weckesser | |
# License: BSD 3-Clause (http://opensource.org/licenses/BSD-3-Clause) | |
import wave | |
import numpy as np | |
def _wav2array(nchannels, sampwidth, data): | |
"""data must be the string containing the bytes from the wav file.""" |
A dendrogram is a common way to represent hierarchical data. For Python users, Scipy has a hierarchical clustering module that performs hierarchical clustering and outputs the results as dendrogram plots via matplotlib. When it's time to make a prettier, more customized, or web-version of the dendogram, however, it can be tricky to use Scipy's dendrogram to create a suitable visualization. My preferred method of visualizing data -- especially on the web -- is D3. This example includes a script to convert a Scipy dendrogram into JSON format used by D3's cluster
method.
In the example, I cluster six genes by their expression values from two experiments. You can easily replace that data with your own, larger data set, to harness the power of both Scipy and D3 for analyzing hierarchical data. The D3 code I used to generate this example is straigh
/* Kinda like Python's defaultdict, but for JS*/ | |
function defDict(type) { | |
var dict = {}; | |
return { | |
get: function (key) { | |
if (!dict[key]) { | |
dict[key] = type.constructor(); | |
} | |
return dict[key]; |
consumer_key = 'your-consumer-key' | |
consumer_secret = 'your-consumer-secret' | |
access_token = 'your-access-token' | |
access_secret = 'your-access-secret' |
from collections import defaultdict | |
import boto3 | |
""" | |
A tool for retrieving basic information from the running EC2 instances. | |
""" | |
# Connect to EC2 | |
ec2 = boto3.resource('ec2') |