diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index db36b12..dde54ba 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,11 @@ +# +* Fix bug in compare_simplified introduced since the release of *functional_unit* + + # 1.1.2 Bugfix release : -* Fix major bug #58 with axis being in diffrent order when used with multiple methods +* Fix major bug #58 with axis being in different order when used with multiple methods * Fix bug #54 : unexpected behaviour with '*' wildcard and 'old_amount' parameter # 1.1 diff --git a/doc/source/notebooks/init.py b/doc/source/notebooks/init.py index c141dd3..5f97594 100644 --- a/doc/source/notebooks/init.py +++ b/doc/source/notebooks/init.py @@ -1,16 +1,17 @@ -import pandas as pd import time -import matplotlib.pyplot as plt -import numpy as np + import brightway2 as bw import bw2data import bw2io +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd import SALib -from tabulate import tabulate -from sympy import * -from scipy.stats import binned_statistic import seaborn as sns from IPython.display import HTML, display +from scipy.stats import binned_statistic +from sympy import * +from tabulate import tabulate # + # Custom utils defined for inter-acv @@ -21,7 +22,6 @@ # from lca_algebraic.stats import _generate_random_params, _compute_stochastics # - -from IPython.display import HTML, display # Larger space in notebook for large graphs display(HTML("")) diff --git a/lca_algebraic/stats.py b/lca_algebraic/stats.py index 6c88f1f..a82bad6 100644 --- a/lca_algebraic/stats.py +++ b/lca_algebraic/stats.py @@ -309,7 +309,10 @@ def _stochastics( return problem, params, Y -def _compute_stochastics(modelOrLambdas, methods, functional_unit=1, params=dict()): +def _compute_stochastics(modelOrLambdas, methods, functional_unit=1, params=None): + if params is None: + params = {} + if isinstance(modelOrLambdas, Activity): Y = compute_impacts(modelOrLambdas, methods, functional_unit=functional_unit, **params) else: @@ -1292,11 +1295,11 @@ def compare_simplified( params, _ = _generate_random_params(100000, sample_method=StochasticMethod.RAND) # Run Monte Carlo on full model - Y1 = _compute_stochastics([lambd], [method], params) + Y1 = _compute_stochastics([lambd], [method], params=params) d1 = Y1[Y1.columns[0]] # Run monte carlo of simplified model - Y2 = _compute_stochastics([simpl_lambd], [method], params) + Y2 = _compute_stochastics([simpl_lambd], [method], params=params) d2 = Y2[Y2.columns[0]] r_value = r_squared(Y1, Y2)