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 numpy import linspace, cos, pi, absolute | |
from numpy.fft import fft, fftfreq, fftshift | |
import matplotlib.pyplot as plt | |
# Sampling rate | |
fs = 64 # Hz | |
# Time is from 0 to 1 seconds, but leave off the endpoint, so | |
# that 1.0 seconds is the first sample of the *next* chunk | |
length = 1 # second |
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
license: gpl-3.0 |
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
Jquick7490MLA:force jquick$ mkvirtualenv force | |
Traceback (most recent call last): | |
File "/usr/local/bin/virtualenv", line 8, in <module> | |
load_entry_point('virtualenv==1.5.1', 'console_scripts', 'virtualenv')() | |
File "/Library/Python/2.6/site-packages/virtualenv.py", line 558, in main | |
prompt=options.prompt) | |
File "/Library/Python/2.6/site-packages/virtualenv.py", line 647, in create_environment | |
site_packages=site_packages, clear=clear)) | |
File "/Library/Python/2.6/site-packages/virtualenv.py", line 771, in install_python | |
copy_required_modules(home_dir) |
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 python | |
# Average runs looks like this: | |
# $ ./serialization.py | |
# Starting json... | |
# done: 5.75292301178 | |
# Starting simplejson... | |
# done: 6.66689586639 | |
# Starting cjson... | |
# done: 2.09307098389 |
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
# To check if this is up-to-date with the tax rates go to | |
# http://www.expatax.nl/tax-rates-2016.php and see if there's anything | |
# newer there. | |
# | |
# I make no guarantees that any of this is correct. I calculated this | |
# at the time and have been updating it when new tax rates come along | |
# because people keep finding this useful. | |
# | |
# There's also an interactive JS version of this created by | |
# @stevermeister at |
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 coroutine(func): | |
""" | |
A decorator that turns a function with normal input into a coroutine. | |
This decorator takes care of priming the coroutine, doing the looping and | |
handling the closing. | |
The first argument of any decorated function is what was received when | |
data was sent to the coroutine via the ``.send`` method. All the other | |
``*args`` and ``**kwargs`` are what was passed to the decorated function | |
when instantiating the coroutine. |
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 python | |
from numpy import asmatrix, asarray, ones, zeros, mean, sum, arange, prod, dot, loadtxt | |
from numpy.random import random, randint | |
import pickle | |
MISSING_VALUE = -1 # a constant I will use to denote missing integer values | |
def impute_hidden_node(E, I, theta, sample_hidden): |
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 python | |
from pandas import DataFrame, Series | |
import numpy as np | |
import math | |
import random | |
import copy | |
NaN_Flag = -1 # pandas uses np.nan, but that coerces ints to floats :( |
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 python | |
# Trivial GARCH implementation in python | |
# | |
# From Peter Tessin's http://www.petertessin.com/TimeSeries.pdf | |
# |
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 gspread | |
from pandas import * | |
import logging | |
class GDocError(Exception): | |
def __init__(self, value): | |
self.parameter = value | |
def __str__(self): |
OlderNewer