Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method error_contribution_from. #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions uncertainties/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,24 @@ def error_components(self):

return error_components

def error_contribution_from(self, filter_tag):
"""
Provides contribution from given error components.

Provides the error contribution from error components for
which filter_tag(tag) returns True.
"""

errors_that_contribute = []
for variable, derivative in self.error_components().iteritems():
if filter_tag(variable.tag):
errors_that_contribute.append(derivative**2)

# Since error components already does the heavy lifting of separating
# errors into a linear combination, we select only the ones we are
# interested in.
return sqrt(sum(errors_that_contribute))

@property
def std_dev(self):
"""
Expand Down