GithubHelp home page GithubHelp logo

errorprop's Introduction

About

Python code for doing error propagation pretty quick.

Features

  • Automatic error propagation
  • Compute weighted averages

Quick start

The following is an example which calculates the gravitational acceleration $g$ from pendulum period $T$ and length $l$ measurements using the following relationship:

$$ g = \frac{4\pi^2 l}{T^2} $$

Error propagation for $g$ is done automatically.

>>> from errorprop import *
>>> measurements = np.array([2.77,2.81,2.93,2.95,2.49,2.81,2.95,2.76])
>>> T = MeasuredQuantity(measurements, err_sys=0.3)
>>> print(T)
2.809 ± 0.3 ± 0.1
>>> l = Quantity(1.84, err_sys=0.7E-2, err_stat=0)
>>> print(l)
1.84 ± 0.007
>>> g = 4*np.pi**2*l/T**2
>>> print(g)
9.208 ± 2.002 ± 0.656

See tutorial.ipynb for a thorough walkthrough. You can download this repository to play around with the jupyter notebook on your computer.

How to use

  1. Download the errorprop.py file and put it into the same directory as your jupyter notebook.
  2. Add the following import to your notebook:
from errorprop import *
  1. Start doing error propagation... ;-)

Feel free to open an issue on this repository if something's not working properly.

errorprop's People

Watchers

Mike Nöthiger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.