Added hook to git to remove all notebook output prior to committing.
This should make git ignore differences caused by merely running a notebook.
This commit is contained in:
parent
499f8d91f5
commit
9ae5aea761
398
Gaussians.ipynb
398
Gaussians.ipynb
File diff suppressed because one or more lines are too long
2220
Kalman Filters.ipynb
2220
Kalman Filters.ipynb
File diff suppressed because one or more lines are too long
@ -9,13 +9,14 @@ import math
|
||||
import matplotlib.pyplot as plt
|
||||
import noise
|
||||
import numba
|
||||
import numpy.random as random
|
||||
|
||||
class KalmanFilter1D(object):
|
||||
|
||||
def __init__ (self, x0, var):
|
||||
self.mean = x0
|
||||
self.variance = var
|
||||
@jit
|
||||
|
||||
def estimate(self, z, z_variance):
|
||||
self.mean = (self.variance*z + z_variance*self.mean) / (self.variance + z_variance)
|
||||
self.variance = 1. / (1./self.variance + 1./z_variance)
|
||||
@ -132,4 +133,4 @@ if __name__ == "__main__":
|
||||
|
||||
if 1:
|
||||
plt.figure()
|
||||
_test_sin()
|
||||
_test_sin()
|
||||
|
File diff suppressed because one or more lines are too long
350
Untitled0.ipynb
350
Untitled0.ipynb
File diff suppressed because one or more lines are too long
25
gaussian.py
25
gaussian.py
@ -38,8 +38,9 @@ def multivariate_gaussian(x, mu, cov):
|
||||
"""
|
||||
|
||||
# force all to numpy.array type
|
||||
x = _to_array(x)
|
||||
mu = _to_array(mu)
|
||||
x = np.asarray(x)
|
||||
mu = np.asarray(mu)
|
||||
|
||||
n = mu.size
|
||||
cov = _to_cov(cov, n)
|
||||
|
||||
@ -128,18 +129,6 @@ def plot_sigma_ellipses(ellipses,title=None,axis_equal=True,x_lim=None,y_lim=Non
|
||||
if title is not None:
|
||||
plt.title (title)
|
||||
|
||||
def _to_array(x):
|
||||
""" returns any of a scalar, matrix, or array as a 1D numpy array
|
||||
Example:
|
||||
_to_array(3) == array([3])
|
||||
"""
|
||||
try:
|
||||
x.shape
|
||||
if type(x) != np.ndarray:
|
||||
x = np.asarray(x)[0]
|
||||
return x
|
||||
except:
|
||||
return np.array(np.mat(x)).reshape(1)
|
||||
|
||||
def _to_cov(x,n):
|
||||
""" If x is a scalar, returns a covariance matrix generated from it
|
||||
@ -171,12 +160,12 @@ if __name__ == '__main__':
|
||||
assert rv.pdf(1.2) == x2
|
||||
assert abs(x2- x3) < 0.00000001
|
||||
|
||||
cov = np.array([\
|
||||
[1,1],\
|
||||
[1,1.1]])
|
||||
cov = np.array([[1,1],
|
||||
[1,1.1]])
|
||||
|
||||
sigma = [1,1]
|
||||
ev = sigma_ellipses(cov, x=2, y=2, sigma=sigma)
|
||||
plot_sigma_ellipses([e1, e2, e3, ev], axis_equal=True,x_lim=[0,4],y_lim=[0,15])
|
||||
plot_sigma_ellipses([ev], axis_equal=True,x_lim=[0,4],y_lim=[0,15])
|
||||
#isct = plt.Circle((2,2),1,color='b',fill=False)
|
||||
#plt.figure().gca().add_artist(isct)
|
||||
plt.show()
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user