Popular recipes tagged "error_propagation"http://code.activestate.com/recipes/tags/error_propagation/2010-04-06T20:40:05-07:00ActiveState Code RecipesEasy Exception, Error Handling and Debugging with Auto Logging (Python)
2010-04-06T20:40:05-07:00AJ. Mayorgahttp://code.activestate.com/recipes/users/4173476/http://code.activestate.com/recipes/577144-easy-exception-error-handling-and-debugging-with-a/
<p style="color: grey">
Python
recipe 577144
by <a href="/recipes/users/4173476/">AJ. Mayorga</a>
(<a href="/recipes/tags/debug/">debug</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/error_propagation/">error_propagation</a>, <a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/logging/">logging</a>).
Revision 5.
</p>
<p>Being new to Python and trying to chase where in my project exceptions were taking place always seems to take up a large amount of time. So I created this class that I now pretty use in all my projects to help me save time tracking exceptions and errors. its also has the ability to generate error logs or to output SQL query and data tuples for Database logging. Ive added sample code to give you an idea of how I normally use it. Hope this helps its saved me hours in tracking error/exception. Feed back would be great, mind you havent been Python all that long</p>
Calculations with error propagation, and semi-formal expressions (Python)
2010-01-15T06:08:56-08:00Eric-Olivier LE BIGOThttp://code.activestate.com/recipes/users/2672032/http://code.activestate.com/recipes/576721-calculations-with-error-propagation-and-semi-forma/
<p style="color: grey">
Python
recipe 576721
by <a href="/recipes/users/2672032/">Eric-Olivier LE BIGOT</a>
(<a href="/recipes/tags/calculus/">calculus</a>, <a href="/recipes/tags/error_propagation/">error_propagation</a>, <a href="/recipes/tags/expressions/">expressions</a>, <a href="/recipes/tags/formal_calculations/">formal_calculations</a>, <a href="/recipes/tags/lazy_evaluation/">lazy_evaluation</a>, <a href="/recipes/tags/uncertainties/">uncertainties</a>).
Revision 22.
</p>
<p><strong>Do not use this module</strong>, but use instead the more powerful <a href="http://pypi.python.org/pypi/uncertainties/">uncertainties.py module</a>.</p>
<p>Module for performing calculations with error propagation, such as (1 +- 0.1) * 2 = 2 +- 0.2. Mathematical operations (addition, etc.), operations defined in the math module (sin, atan,...) and logical operations (<, >, etc.) can be used.</p>
<p>Correlations between parts of an expression are correctly taken into account (for instance, the error on "x-x" is strictly zero).</p>
<p>Code written for floats should directly work with the numbers with uncertainty defined here, without much need for modifications.</p>
<p>The module also contains a class that represents non-evaluated mathematical expressions. This class is used for performing the differentiation required by the error propagation calculation, but can be used on its own, for manipulating "semi-formal" expressions whose variables can be accessed.</p>