A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
import numpy as np | |
from math import pi, log | |
import pylab | |
from scipy import fft, ifft | |
from scipy.optimize import curve_fit | |
i = 10000 | |
x = np.linspace(0, 3.5 * pi, i) | |
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 * | |
np.random.randn(i)) |
def randomvariate(pdf,n=1000,xmin=0,xmax=1): | |
""" | |
Rejection method for random number generation | |
=============================================== | |
Uses the rejection method for generating random numbers derived from an arbitrary | |
probability distribution. For reference, see Bevington's book, page 84. Based on | |
rejection*.py. | |
Usage: | |
>>> randomvariate(P,N,xmin,xmax) |
#!/bin/sh | |
# Post-commit hook for revision-awsm-ness | |
function gettempfilename() | |
{ | |
tempfilename=$1-$RANDOM$RANDOM.tex | |
if [ -e $tempfilename ] | |
then | |
tempfilename=$(gettempfilename) |
#!/usr/bin/env python | |
"""strip outputs from an IPython Notebook | |
Opens a notebook, strips its output, and writes the outputless version to the original file. | |
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS. | |
This does mostly the same thing as the `Clear All Output` command in the notebook UI. | |
LICENSE: Public Domain |
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
bumpversion patch
{ | |
"metadata": { | |
"name": "numpy_tricks" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |