diff --git a/Readme.md b/Readme.md index e47cce8..c212abf 100644 --- a/Readme.md +++ b/Readme.md @@ -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) diff --git a/SecondaryValue/SecondaryValue.py b/SecondaryValue/SecondaryValue.py index 4ce1e80..5568818 100644 --- a/SecondaryValue/SecondaryValue.py +++ b/SecondaryValue/SecondaryValue.py @@ -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 diff --git a/setup.py b/setup.py index 4f09de5..db29c0a 100644 --- a/setup.py +++ b/setup.py @@ -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',