Skip to content
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