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
# Install Macports | |
# We'll install a relatively high-level package first, with a lot of dependencies, | |
# so that we pick up everything along the way | |
# Chaco is an enthought plotting package that'll | |
sudo port install py26-chaco | |
sudo port select python python26 | |
sudo port install py26-ipython |
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 subprocess | |
import tempfile | |
import numpy as np | |
import os | |
def npArrayFromClipboard(): | |
"""Reads the current clipboard and tries to make an numpy array out of it""" | |
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) | |
output = p.communicate() |
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
def downsample2d(inputArray, kernelSize): | |
"""This function downsamples a 2d numpy array by convolving with a flat | |
kernel and then sub-sampling the resulting array. | |
A kernel size of 2 means convolution with a 2x2 array [[1, 1], [1, 1]] and | |
a resulting downsampling of 2-fold. | |
:param: inputArray: 2d numpy array | |
:param: kernelSize: integer | |
""" |
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 requests, os, glob, json | |
you = 'giessel' | |
data = 'tweets' | |
try: os.mkdir(data) | |
except Exception: pass | |
def run(max_id = False): | |
already = glob.glob("%s/*.json" % data) |
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 IPython.display import HTML | |
import subprocess | |
import tempfile | |
from PIL import Image | |
def playNPArray(array, frameRate = 6): | |
# ffmpeg is fussy- images must be in the right format to encode right | |
uint8_array = np.uint8(array.astype('float').copy() / float(array.max()) * 2**8-1) | |
fileName = 'temp' |
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
{ | |
"metadata": { | |
"name": "manual inline mode" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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 PySide import QtCore, QtGui | |
import sys | |
matplotlib.rcParams['backend.qt4']='PySide' | |
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas | |
from matplotlib.figure import Figure | |
class MatplotlibWidget(FigureCanvas): | |
def __init__(self, parent=None): |
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
#!/usr/bin/env ruby | |
## disconnect | |
# ./disconnect.rb -u yourusername [-o /your/path] [-p yourhttpproxyserver] | |
# | |
# This is a command-line utility for the bulk-downloading of run data from | |
# the connect.garmin.com web application, which has lackluster export | |
# capabilities. | |
# |
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
{ | |
"metadata": { | |
"name": "astro_ml_tutorial" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
def bayesian_blocks(t): | |
"""Bayesian Blocks Implementation | |
By Jake Vanderplas. License: BSD | |
Based on algorithm outlined in http://adsabs.harvard.edu/abs/2012arXiv1207.5578S | |
Parameters | |
---------- | |
t : ndarray, length N | |
data to be histogrammed |
OlderNewer