fix retdep

This commit is contained in:
Valentin Boettcher 2019-05-15 11:47:51 +02:00
parent 246a226c49
commit 36b6f608f7
3 changed files with 7 additions and 8 deletions

View file

@ -17,7 +17,7 @@ from SecondaryValue import SecondaryValue
# the argument can be either a string or a sympy expression
x = SecondaryValue("a*b/sqrt(c)")
# Calculate a result value by substituting the keyword arguments
# Calculate a result value by substi3tuting the keyword arguments
# where a keyword agument may consist of (value, error_1, error_2, ...)
# and (...) stands for any iterable.
result = x(a=(1, 20), b=(2, 30), c=2)

View file

@ -68,6 +68,7 @@ class SecondaryValue:
# we always calculate the depndencies
tmp = sec_val(retdeps=True, **kwargs)
kwargs[name] = tmp[0]
calc_deps[name] = tmp
@ -220,7 +221,8 @@ class SecondaryValue:
dictionary with the calculated dependencies as a
second value
"""
# process the keyword arguments
# process the keyword arguments
values, errors, dep_values = self._process_args(*args, **kwargs)
# calulate the central value
@ -229,7 +231,7 @@ class SecondaryValue:
vector_values)
if not errors:
return central_value
return (central_value, dep_values) if retdeps else central_value
# calculate errors
result = self._calculate_errors(errors, vector_values, scalar_values)
@ -238,10 +240,7 @@ class SecondaryValue:
result.insert(0, central_value)
result = tuple(result)
if retdeps:
return result, dep_values
return result
return (result, dep_values) if retdeps else result
def _get_derivatives(self, *args):
"""Calculates the derivatives of the expression for a given

View file

@ -6,7 +6,7 @@ def readme():
return f.read()
setup(name='SecondaryValue',
version='0.1.4',
version='0.1.6',
description='A helper to calculate the gaussian error propagation.',
long_description=readme(),
long_description_content_type='text/markdown',