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 numpy as np | |
import scipy.signal as signal | |
import matplotlib.pyplot as plt | |
import math | |
import datetime | |
from matplotlib.font_manager import FontProperties | |
def convolveoriginal(x, y): | |
''' | |
The original algorithm from http://www.physics.rutgers.edu/~masud/computing/WPark_recipes_in_python.html. |
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
#include <Python.h> | |
//Normally #include "arrayobject.h" should be sufficient. I need to fix my includes. | |
#include "/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h" | |
/* | |
* Convolution method. | |
*/ | |
static PyObject* convolve(PyObject* self, PyObject* args) | |
{ | |
PyArrayObject *vec1, *vec2, *conv; //The python object proxies |
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 timeit | |
setup = ''' | |
from random import Random | |
from itertools import izip | |
import numpy as np | |
length = 1000 | |
random = Random() | |
A_new = np.array([random.random() for _ in xrange(length)]) | |
A_old = np.array([random.random() for _ in xrange(length)]) |
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
// ==UserScript== | |
// @name Run MathJax in Github or Bitbucket | |
// @namespace http://www.mathjax.org/ | |
// @description Runs MathJax on any page in github.com or bitbucket.org | |
// @include http://github.com/* | |
// @include https://github.com/* | |
// @include http://bitbucket.org/* | |
// @include https://bitbucket.org/* | |
// ==/UserScript== |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
if (window.MathJax === undefined) { | |
//Add the MathJax script | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = "//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"; | |
var config = 'MathJax.Hub.Config({' + 'extensions: ["tex2jax.js"],' + 'tex2jax: { inlineMath: [["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]], displayMath: [["$","$"],["\\\\[","\\\\]"]], processEscapes: true },' + 'jax: ["input/TeX","output/HTML-CSS"]' + '});'; | |
if (window.opera) { | |
script.innerHTML = config | |
} else { | |
script.text = config |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.core.magic import Magics, magics_class, line_magic | |
import inspect, re | |
# The class MUST call this class decorator at creation time | |
@magics_class | |
class TahMagics(Magics): | |
@line_magic | |
def docstring(self, line): | |
""" | |
Generate a numpy-style docstring. |
We can't make this file beautiful and searchable because it's too large.
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
"departure city","long. departure (decimal)","lat. departure (decimal)","departure country","arrival city","long. departure (decimal)","lat. departure (decimal)","arrival country","number of routes","distance" | |
"Sao Paulo",-46.116,-23.054,"Brazil","Rio De Janeiro",-42.74,-22.682,"Brazil",18,348 | |
"Rio De Janeiro",-42.74,-22.682,"Brazil","Sao Paulo",-46.116,-23.054,"Brazil",18,348 | |
"Beijing",116.974,40.133,"China","Shanghai",122.342,31.238,"China",18,1100 | |
"Johannesburg",28.41,-25.566,"South Africa","Cape Town",19.002,-33.942,"South Africa",16,1299 | |
"Honolulu",-157.871,21.531,"United States","Tokyo",140.643,36.274,"Japan",16,6103 | |
"Tokyo",140.643,36.274,"Japan","Honolulu",-157.871,21.531,"United States",16,6103 | |
"Tokyo",140.643,36.274,"Japan","Seoul",126.75,37.781,"South Korea",15,1243 | |
"Seoul",126.75,37.781,"South Korea","Tokyo",140.643,36.274,"Japan",15,1243 | |
"Tokyo",140.643,36.274,"Japan","Los Angeles",-118.014,34.57,"United States",15,8691 |
OlderNewer