Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
96131 views
1
# -*- coding: utf-8 -*-
2
"""Copyright 2015 Roger R Labbe Jr.
3
4
FilterPy library.
5
http://github.com/rlabbe/filterpy
6
7
Documentation at:
8
https://filterpy.readthedocs.org
9
10
Supporting book at:
11
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
12
13
This is licensed under an MIT license. See the readme.MD file
14
for more information.
15
"""
16
17
from filterpy.common import norm_cdf
18
19
20
def test_norm_cdf():
21
# test using the 68-95-99.7 rule
22
23
mu = 5
24
std = 3
25
var = std*std
26
27
std_1 = (norm_cdf((mu-std, mu+std), mu, var))
28
assert abs(std_1 - .6827) < .0001
29
30
std_1 = (norm_cdf((mu+std, mu-std), mu, std=std))
31
assert abs(std_1 - .6827) < .0001
32
33
std_1half = (norm_cdf((mu+std, mu), mu, var))
34
assert abs(std_1half - .6827/2) < .0001
35
36
std_2 = (norm_cdf((mu-2*std, mu+2*std), mu, var))
37
assert abs(std_2 - .9545) < .0001
38
39
std_3 = (norm_cdf((mu-3*std, mu+3*std), mu, var))
40
assert abs(std_3 - .9973) < .0001
41
42