Skip to content

Instantly share code, notes, and snippets.

View gajomi's full-sized avatar

Gabriel Joel Mitchell gajomi

View GitHub Profile
@gajomi
gajomi / csstademo.m
Last active August 29, 2015 14:00
Quick demo of compressed sensing Spike triggered average analysis
%Download and uncompress:
%http://users.ece.gatech.edu/~justin/l1magic/downloads/l1magic-1.11.zip
addpath l1magic/
%W with smooth connected points
L = 32;
z = linspace(-.25,1.25,L);
[Z1,Z2] = meshgrid(z,z);
rho = .015;
@gajomi
gajomi / cssta_lowmem.m
Created May 2, 2014 11:40
Compressed sensing STA low memory version
%Download and uncompress:
%http://users.ece.gatech.edu/~justin/l1magic/downloads/l1magic-1.11.zip
addpath l1magic/
%W with smooth connected points
L = 32;
z = linspace(-.25,1.25,L);
[Z1,Z2] = meshgrid(z,z);
rho = .015;
@gajomi
gajomi / eigclusters
Created May 28, 2014 16:27
Structured matrix eigenvalue clusters
%params
N = 512;
k = 128;
p = .5;
%form block clustered matrix
A = rand(N,N)>p;%or randn(N,N) also
B = diag([50*ones(1,k) 1*ones(1,N-k)]);
C = A+B;
%compute spectrum
@gajomi
gajomi / demo.ipynb
Created September 21, 2014 18:07
Spiek response demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gajomi
gajomi / gist:d4c2b26fc14f4671d6be
Created January 28, 2015 16:40
DSSG Energy Exploration 1
This file has been truncated, but you can view the full file.
{
"metadata": {
"language": "Julia",
"name": "",
"signature": "sha256:8d7e42b7a30a22ad0c12a19f77345d3e7789701850f74dbce0e3573ca1a227e4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
@gajomi
gajomi / fmincon_example
Created March 1, 2012 00:23
An example of fmincon returning Hessian for linear model
clear g
T = 10;
m_exact = 1;
b_exact = 2;
x_exact = [m_exact; b_exact]
t = [0:T-1]/(T-1);
A = [t' ones(size(t'))];
@gajomi
gajomi / gist:2216541
Created March 27, 2012 14:48
Demo of various features of MM kinetics and turbidity
from scipy.integrate import odeint
import numpy as np
import pylab as pylab
def mm_rate(z,k):
"The Michealis-Menten reaction rate a concentration z and rate parameter k"
s,e,c,j = z
k_bind,k_unbind,k_cat = k
return np.array([-k_bind*s*e+k_unbind*c,
@gajomi
gajomi / gist:2637517
Created May 8, 2012 17:16
Method for counting disjoint pairwise motifs in N^2
N = 5;
C = triu(ones(N,N));
A = C(1:N,N:-1:1);
A(N,N) = 1;
D = A*ones(N,N)*A - A^3;
H = (A==0).*D/2;
U = sum(H(:))
@gajomi
gajomi / nodf_script
Created May 22, 2012 19:19
Possibly a faster way to compute NODF?
M = 3; N = 4;
p = .2;
B = double(rand(M,N)>p);
C1 = B*B';
D1 = repmat(diag(C1),1,M);
eta1 = C1.*(D1~=D1')./(min(D1,D1'));
C2 = B'*B;
@gajomi
gajomi / gist:8498230
Created January 18, 2014 23:28
Loading external notebooks
import io
from IPython.nbformat import current
#function for loading external nb
def execute_notebook(nbfile):
with io.open(nbfile) as f:
nb = current.read(f, 'json')
ip = get_ipython()