Skip to content

Instantly share code, notes, and snippets.

View andrewgiessel's full-sized avatar
🧬
hackhackhack

andrew giessel andrewgiessel

🧬
hackhackhack
View GitHub Profile
@andrewgiessel
andrewgiessel / correlation\ example\ with\ a\ 2d\ gaussian.ipynb
Created November 5, 2012 22:17
2d correlation example with a gaussian ipython notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewgiessel
andrewgiessel / lfp_notebok.ipynb
Created December 4, 2012 23:10
LFP filtering and spectrogram IPython Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewgiessel
andrewgiessel / NLTK_and_python_syntax.ipynb
Created December 11, 2012 15:49
python nltk and some simple python syntax
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
PREFIX=$HOME
VERSION=1.2.3
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
./configure --prefix=$PREFIX
make
make install
@andrewgiessel
andrewgiessel / gist:4514186
Last active October 17, 2020 01:42
butterworth bandpass filter in python
from scipy.signal import butter, lfilter
def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
y = lfilter(b, a, data)
return y
@andrewgiessel
andrewgiessel / gist:4589258
Created January 21, 2013 20:52
histogram normalization with numpy
import numpy as np
def histeq(im,nbr_bins=256):
#get image histogram
imhist,bins = np.histogram(im.flatten(),nbr_bins,normed=True)
cdf = imhist.cumsum() #cumulative distribution function
cdf = 255 * cdf / cdf[-1] #normalize
#use linear interpolation of cdf to find new pixel values
im2 = np.interp(im.flatten(),bins[:-1],cdf)
@andrewgiessel
andrewgiessel / gist:4635563
Last active June 30, 2023 20:31
simple numpy based 2d gaussian function
import numpy as np
def makeGaussian(size, fwhm = 3, center=None):
""" Make a square gaussian kernel.
size is the length of a side of the square
fwhm is full-width-half-maximum, which
can be thought of as an effective radius.
"""
@andrewgiessel
andrewgiessel / gist:4708558
Last active December 12, 2015 03:38
simple csv to svg
import matplotlib.pyplot as plt
import numpy as np
data = np.fromfile('/path/to/file.csv', sep=',')
fig = plt.figure()
plt.plot(data)
fig.savefig('/path/to/file.svg', format='svg')
@andrewgiessel
andrewgiessel / gist:5066789
Created March 1, 2013 18:43
basketball-reference parser
{
"metadata": {
"name": "basketball-reference parser"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{