GithubHelp home page GithubHelp logo

joostscheffer / uncertainty-propagator Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 91 KB

An ipynb widget for propagating and evaluating the uncertainty when evaluating a function.

License: MIT License

Python 100.00%

uncertainty-propagator's Introduction

⚠️ This widget is still work in progress ⚠️

Error propagation widget

An ipynb widget for propagating and evaluating the uncertainty when evaluating a function. Propagator screenshot

Usages

First import the Propagator class from the propagator module.

from uncertainty_propagator import Propagator
import numpy as np

Basic usage

prop = Propagator("I_0 * cos(theta + theta_0) + I_background")

Then use either the widget or the set_variables method to set the variables and their uncertainties. Use the following methods to evaluate the function and the uncertainty at one or multiple points.

y = prop.evaluate_function()
y_err = prop.evaluate_error_function()

Usage with predefined variables

  1.  from uncertainties import ufloat as uf
    
     x, a, b = sp.symbols("x a b")
     func = a * x + b
    
     prop = Propagator(func, {b: uf(20, 0), x: uf(10, 1)})
  2.  prop = Propagator("I_0 * cos(theta + theta_0) + I_background")
    
     theta = np.linspace(0, 2 * np.pi, 100)
     theta_err = 0.01 * theta
    
     prop.set_variables({
         "I_0": (1.0, 0.1),
         "theta": (theta, theta_err),
         "theta_0": 0.0,
         "I_background": 0.0
     })

uncertainty-propagator's People

Contributors

nynra avatar joostscheffer avatar

Stargazers

 avatar  avatar

Watchers

 avatar

uncertainty-propagator's Issues

Separate UI from backend

The app is very promising but for now only seems only usable in jupyter notebooks. Would it be possible to separate the backend into it's own package (or sub package)? This way it wil also be easier to add for example a QT or command line interfaces.

If I have some spare time I would like to spend some time on these functions (If you want some help)

Using dependant errors

Would it be possible to add dependant variables in the propagator. This can be done by for example using an optional correlation matrix on input (doesn't have to be a full matrix only the dependant variables in the set)

Better documentation

The code is not that hard to understand when you take the time to read the doc-strings but some example scripts would really help new users to get going. Also, you already have these nice doc-strings, why not use Spinx to generate some nice documentation?

Testing testing testing

While I trust your math skills development would be a lot less prone to errors if you use some test suites to test basic functionality.

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.