added error percentage
Browse files- src/__pycache__/calculator.cpython-311.pyc +0 -0
- src/__pycache__/company.cpython-311.pyc +0 -0
- src/__pycache__/expert.cpython-311.pyc +0 -0
- src/__pycache__/impacts.cpython-311.pyc +0 -0
- src/__pycache__/utils.cpython-311.pyc +0 -0
- src/calculator.py +24 -21
- src/company.py +3 -2
- src/expert.py +4 -2
- src/impacts.py +64 -2
- src/utils.py +23 -0
src/__pycache__/calculator.cpython-311.pyc
CHANGED
|
Binary files a/src/__pycache__/calculator.cpython-311.pyc and b/src/__pycache__/calculator.cpython-311.pyc differ
|
|
|
src/__pycache__/company.cpython-311.pyc
CHANGED
|
Binary files a/src/__pycache__/company.cpython-311.pyc and b/src/__pycache__/company.cpython-311.pyc differ
|
|
|
src/__pycache__/expert.cpython-311.pyc
CHANGED
|
Binary files a/src/__pycache__/expert.cpython-311.pyc and b/src/__pycache__/expert.cpython-311.pyc differ
|
|
|
src/__pycache__/impacts.cpython-311.pyc
CHANGED
|
Binary files a/src/__pycache__/impacts.cpython-311.pyc and b/src/__pycache__/impacts.cpython-311.pyc differ
|
|
|
src/__pycache__/utils.cpython-311.pyc
CHANGED
|
Binary files a/src/__pycache__/utils.cpython-311.pyc and b/src/__pycache__/utils.cpython-311.pyc differ
|
|
|
src/calculator.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
|
| 3 |
from ecologits.tracers.utils import llm_impacts
|
| 4 |
from src.impacts import get_impacts, display_impacts, display_equivalent
|
| 5 |
-
from src.utils import format_impacts
|
| 6 |
from src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH
|
| 7 |
from src.models import load_models
|
| 8 |
|
|
@@ -45,28 +45,31 @@ def calculator_mode():
|
|
| 45 |
if df_filtered['warning_arch'].values[0] and df_filtered['warning_multi_modal'].values[0]:
|
| 46 |
st.warning(WARNING_BOTH)
|
| 47 |
|
| 48 |
-
try:
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
impacts, _, _ = format_impacts(impacts)
|
| 58 |
-
|
| 59 |
-
with st.container(border=True):
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
display_equivalent(impacts, provider, location="🌎 World")
|
| 70 |
-
|
| 71 |
-
except Exception as e:
|
| 72 |
-
st.error('Could not find the model in the repository. Please try another model.')
|
|
|
|
| 2 |
|
| 3 |
from ecologits.tracers.utils import llm_impacts
|
| 4 |
from src.impacts import get_impacts, display_impacts, display_equivalent
|
| 5 |
+
from src.utils import format_impacts, range_percent_impact_one_sided
|
| 6 |
from src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH
|
| 7 |
from src.models import load_models
|
| 8 |
|
|
|
|
| 45 |
if df_filtered['warning_arch'].values[0] and df_filtered['warning_multi_modal'].values[0]:
|
| 46 |
st.warning(WARNING_BOTH)
|
| 47 |
|
| 48 |
+
#try:
|
| 49 |
|
| 50 |
+
impacts = llm_impacts(
|
| 51 |
+
provider=provider_raw,
|
| 52 |
+
model_name=model_raw,
|
| 53 |
+
output_token_count=[x[1] for x in PROMPTS if x[0] == output_tokens][0],
|
| 54 |
+
request_latency=100000
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
range_percent_impact_one_sided_calculated = range_percent_impact_one_sided(impacts)
|
| 59 |
+
impacts, _, _ = format_impacts(impacts)
|
| 60 |
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
with st.container(border=True):
|
| 63 |
+
|
| 64 |
+
st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)
|
| 65 |
+
st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)
|
| 66 |
+
display_impacts(impacts, provider, range_percent_impact_one_sided_calculated, location="🌎 World" )
|
| 67 |
+
|
| 68 |
+
with st.container(border=True):
|
| 69 |
|
| 70 |
+
st.markdown('<h3 align = "center">That\'s equivalent to ...</h3>', unsafe_allow_html=True)
|
| 71 |
+
st.markdown('<p align = "center">Making this request to the LLM is equivalent to the following actions :</p>', unsafe_allow_html=True)
|
| 72 |
+
display_equivalent(impacts, provider, location="🌎 World")
|
| 73 |
|
| 74 |
+
# except Exception as e:
|
| 75 |
+
# st.error('Could not find the model in the repository. Please try another model.')
|
|
|
|
|
|
|
|
|
|
|
|
src/company.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
|
| 3 |
from ecologits.tracers.utils import llm_impacts
|
| 4 |
from src.impacts import get_impacts, display_impacts_company, display_equivalent_company
|
| 5 |
-
from src.utils import format_impacts
|
| 6 |
from src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH
|
| 7 |
from src.models import load_models
|
| 8 |
|
|
@@ -98,6 +98,7 @@ def company_mode():
|
|
| 98 |
request_latency=100000
|
| 99 |
)
|
| 100 |
|
|
|
|
| 101 |
impacts, _, _ = format_impacts(impacts)
|
| 102 |
|
| 103 |
|
|
@@ -106,7 +107,7 @@ def company_mode():
|
|
| 106 |
|
| 107 |
st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)
|
| 108 |
st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)
|
| 109 |
-
display_impacts_company(impacts, provider, company_multiplier, location="🌎 World")
|
| 110 |
|
| 111 |
with st.container(border=True):
|
| 112 |
#TODO : corriger ça
|
|
|
|
| 2 |
|
| 3 |
from ecologits.tracers.utils import llm_impacts
|
| 4 |
from src.impacts import get_impacts, display_impacts_company, display_equivalent_company
|
| 5 |
+
from src.utils import format_impacts, range_percent_impact_one_sided
|
| 6 |
from src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH
|
| 7 |
from src.models import load_models
|
| 8 |
|
|
|
|
| 98 |
request_latency=100000
|
| 99 |
)
|
| 100 |
|
| 101 |
+
range_percent_impact_one_sided_calculated = range_percent_impact_one_sided(impacts)
|
| 102 |
impacts, _, _ = format_impacts(impacts)
|
| 103 |
|
| 104 |
|
|
|
|
| 107 |
|
| 108 |
st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)
|
| 109 |
st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)
|
| 110 |
+
display_impacts_company(impacts, provider, company_multiplier, range_percent_impact_one_sided_calculated, location="🌎 World")
|
| 111 |
|
| 112 |
with st.container(border=True):
|
| 113 |
#TODO : corriger ça
|
src/expert.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from ecologits.impacts.llm import compute_llm_impacts
|
| 3 |
|
| 4 |
-
from src.utils import format_impacts, average_range_impacts
|
| 5 |
from src.impacts import display_impacts
|
| 6 |
from src.electricity_mix import COUNTRY_CODES, find_electricity_mix, dataframe_electricity_mix
|
| 7 |
from src.models import load_models
|
|
@@ -127,13 +127,15 @@ def expert_mode():
|
|
| 127 |
provider = provider_selected
|
| 128 |
)
|
| 129 |
|
|
|
|
|
|
|
| 130 |
impacts, usage, embodied = format_impacts(impacts)
|
| 131 |
|
| 132 |
with st.container(border = True):
|
| 133 |
|
| 134 |
st.markdown('<h3 align="center">Environmental Impacts</h2>', unsafe_allow_html = True)
|
| 135 |
|
| 136 |
-
display_impacts(impacts, provider_exp, location)
|
| 137 |
|
| 138 |
with st.expander('⚖️ Usage vs Embodied'):
|
| 139 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from ecologits.impacts.llm import compute_llm_impacts
|
| 3 |
|
| 4 |
+
from src.utils import format_impacts, average_range_impacts, range_percent_impact_one_sided
|
| 5 |
from src.impacts import display_impacts
|
| 6 |
from src.electricity_mix import COUNTRY_CODES, find_electricity_mix, dataframe_electricity_mix
|
| 7 |
from src.models import load_models
|
|
|
|
| 127 |
provider = provider_selected
|
| 128 |
)
|
| 129 |
|
| 130 |
+
|
| 131 |
+
range_percent_impact_one_sided_calculated = range_percent_impact_one_sided(impacts)
|
| 132 |
impacts, usage, embodied = format_impacts(impacts)
|
| 133 |
|
| 134 |
with st.container(border = True):
|
| 135 |
|
| 136 |
st.markdown('<h3 align="center">Environmental Impacts</h2>', unsafe_allow_html = True)
|
| 137 |
|
| 138 |
+
display_impacts(impacts, provider_exp, range_percent_impact_one_sided_calculated, location)
|
| 139 |
|
| 140 |
with st.expander('⚖️ Usage vs Embodied'):
|
| 141 |
|
src/impacts.py
CHANGED
|
@@ -35,7 +35,7 @@ def get_impacts(model, active_params, total_params, mix_ghg, mix_adpe, mix_pe):
|
|
| 35 |
############################################################################################################
|
| 36 |
|
| 37 |
|
| 38 |
-
def display_impacts(impacts, provider, location):
|
| 39 |
|
| 40 |
st.divider()
|
| 41 |
|
|
@@ -54,6 +54,13 @@ def display_impacts(impacts, provider, location):
|
|
| 54 |
<div style="text-align: center;"><i>Evaluates the electricity consumption<i>
|
| 55 |
</div>
|
| 56 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
with col_ghg:
|
| 59 |
st.markdown("""
|
|
@@ -67,6 +74,12 @@ def display_impacts(impacts, provider, location):
|
|
| 67 |
<div style="text-align: center;"><i>Evaluates the effect on climate change<i>
|
| 68 |
</div>
|
| 69 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
with col_adpe:
|
| 72 |
st.markdown("""
|
|
@@ -96,6 +109,12 @@ def display_impacts(impacts, provider, location):
|
|
| 96 |
<div style="text-align: center;"><i>Evaluates the use of metals and minerals<i>
|
| 97 |
</div>
|
| 98 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
with col_pe:
|
| 101 |
st.markdown("""
|
|
@@ -110,6 +129,12 @@ def display_impacts(impacts, provider, location):
|
|
| 110 |
<div style="text-align: center;"><i>Evaluates the use of energy resources<i>
|
| 111 |
</div>
|
| 112 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
with col_water:
|
| 115 |
st.markdown("""
|
|
@@ -123,10 +148,16 @@ def display_impacts(impacts, provider, location):
|
|
| 123 |
<div style="text-align: center;"><i>Evaluates the use of water<i>
|
| 124 |
</div>
|
| 125 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
|
| 128 |
#################################################################################################
|
| 129 |
-
def display_impacts_company(impacts, provider, company_multiplier, location):
|
| 130 |
|
| 131 |
st.divider()
|
| 132 |
|
|
@@ -162,6 +193,12 @@ def display_impacts_company(impacts, provider, company_multiplier, location):
|
|
| 162 |
<div style="text-align: center;"><i>Evaluates the electricity consumption<i>
|
| 163 |
</div>
|
| 164 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
with col_ghg:
|
| 167 |
st.markdown("""
|
|
@@ -183,6 +220,13 @@ def display_impacts_company(impacts, provider, company_multiplier, location):
|
|
| 183 |
<div style="text-align: center;"><i>Evaluates the effect on climate change<i>
|
| 184 |
</div>
|
| 185 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
with col_adpe:
|
| 188 |
st.markdown("""
|
|
@@ -212,6 +256,12 @@ def display_impacts_company(impacts, provider, company_multiplier, location):
|
|
| 212 |
<div style="text-align: center;"><i>Evaluates the use of metals and minerals<i>
|
| 213 |
</div>
|
| 214 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
with col_pe:
|
| 217 |
st.markdown("""
|
|
@@ -240,6 +290,12 @@ def display_impacts_company(impacts, provider, company_multiplier, location):
|
|
| 240 |
<div style="text-align: center;"><i>Evaluates the use of energy resources<i>
|
| 241 |
</div>
|
| 242 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
with col_water:
|
| 245 |
st.markdown("""
|
|
@@ -270,6 +326,12 @@ def display_impacts_company(impacts, provider, company_multiplier, location):
|
|
| 270 |
<div style="text-align: center;"><i>Evaluates the use of water<i>
|
| 271 |
</div>
|
| 272 |
""", unsafe_allow_html = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|
| 274 |
|
| 275 |
|
|
|
|
| 35 |
############################################################################################################
|
| 36 |
|
| 37 |
|
| 38 |
+
def display_impacts(impacts, provider, range_percent_impact_one_sided_calculated, location):
|
| 39 |
|
| 40 |
st.divider()
|
| 41 |
|
|
|
|
| 54 |
<div style="text-align: center;"><i>Evaluates the electricity consumption<i>
|
| 55 |
</div>
|
| 56 |
""", unsafe_allow_html = True)
|
| 57 |
+
st.markdown(f"""
|
| 58 |
+
<div style="text-align: center;">
|
| 59 |
+
<div style="font-size: 10px;">Error range</div>
|
| 60 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["energy"]} %</div>
|
| 61 |
+
</div>
|
| 62 |
+
""", unsafe_allow_html = True)
|
| 63 |
+
|
| 64 |
|
| 65 |
with col_ghg:
|
| 66 |
st.markdown("""
|
|
|
|
| 74 |
<div style="text-align: center;"><i>Evaluates the effect on climate change<i>
|
| 75 |
</div>
|
| 76 |
""", unsafe_allow_html = True)
|
| 77 |
+
st.markdown(f"""
|
| 78 |
+
<div style="text-align: center;">
|
| 79 |
+
<div style="font-size: 10px;">Error range</div>
|
| 80 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["gwp"]} %</div>
|
| 81 |
+
</div>
|
| 82 |
+
""", unsafe_allow_html = True)
|
| 83 |
|
| 84 |
with col_adpe:
|
| 85 |
st.markdown("""
|
|
|
|
| 109 |
<div style="text-align: center;"><i>Evaluates the use of metals and minerals<i>
|
| 110 |
</div>
|
| 111 |
""", unsafe_allow_html = True)
|
| 112 |
+
st.markdown(f"""
|
| 113 |
+
<div style="text-align: center;">
|
| 114 |
+
<div style="font-size: 10px;">Error range</div>
|
| 115 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["adpe"]} %</div>
|
| 116 |
+
</div>
|
| 117 |
+
""", unsafe_allow_html = True)
|
| 118 |
|
| 119 |
with col_pe:
|
| 120 |
st.markdown("""
|
|
|
|
| 129 |
<div style="text-align: center;"><i>Evaluates the use of energy resources<i>
|
| 130 |
</div>
|
| 131 |
""", unsafe_allow_html = True)
|
| 132 |
+
st.markdown(f"""
|
| 133 |
+
<div style="text-align: center;">
|
| 134 |
+
<div style="font-size: 10px;">Error range</div>
|
| 135 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["pe"]} %</div>
|
| 136 |
+
</div>
|
| 137 |
+
""", unsafe_allow_html = True)
|
| 138 |
|
| 139 |
with col_water:
|
| 140 |
st.markdown("""
|
|
|
|
| 148 |
<div style="text-align: center;"><i>Evaluates the use of water<i>
|
| 149 |
</div>
|
| 150 |
""", unsafe_allow_html = True)
|
| 151 |
+
st.markdown(f"""
|
| 152 |
+
<div style="text-align: center;">
|
| 153 |
+
<div style="font-size: 10px;">Error range</div>
|
| 154 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["water"]} %</div>
|
| 155 |
+
</div>
|
| 156 |
+
""", unsafe_allow_html = True)
|
| 157 |
|
| 158 |
|
| 159 |
#################################################################################################
|
| 160 |
+
def display_impacts_company(impacts, provider, company_multiplier, range_percent_impact_one_sided_calculated, location):
|
| 161 |
|
| 162 |
st.divider()
|
| 163 |
|
|
|
|
| 193 |
<div style="text-align: center;"><i>Evaluates the electricity consumption<i>
|
| 194 |
</div>
|
| 195 |
""", unsafe_allow_html = True)
|
| 196 |
+
st.markdown(f"""
|
| 197 |
+
<div style="text-align: center;">
|
| 198 |
+
<div style="font-size: 10px;">Error range</div>
|
| 199 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["energy"]} %</div>
|
| 200 |
+
</div>
|
| 201 |
+
""", unsafe_allow_html = True)
|
| 202 |
|
| 203 |
with col_ghg:
|
| 204 |
st.markdown("""
|
|
|
|
| 220 |
<div style="text-align: center;"><i>Evaluates the effect on climate change<i>
|
| 221 |
</div>
|
| 222 |
""", unsafe_allow_html = True)
|
| 223 |
+
st.markdown(f"""
|
| 224 |
+
<div style="text-align: center;">
|
| 225 |
+
<div style="font-size: 10px;">Error range</div>
|
| 226 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["gwp"]} %</div>
|
| 227 |
+
</div>
|
| 228 |
+
""", unsafe_allow_html = True)
|
| 229 |
+
|
| 230 |
|
| 231 |
with col_adpe:
|
| 232 |
st.markdown("""
|
|
|
|
| 256 |
<div style="text-align: center;"><i>Evaluates the use of metals and minerals<i>
|
| 257 |
</div>
|
| 258 |
""", unsafe_allow_html = True)
|
| 259 |
+
st.markdown(f"""
|
| 260 |
+
<div style="text-align: center;">
|
| 261 |
+
<div style="font-size: 10px;">Error range</div>
|
| 262 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["adpe"]} %</div>
|
| 263 |
+
</div>
|
| 264 |
+
""", unsafe_allow_html = True)
|
| 265 |
|
| 266 |
with col_pe:
|
| 267 |
st.markdown("""
|
|
|
|
| 290 |
<div style="text-align: center;"><i>Evaluates the use of energy resources<i>
|
| 291 |
</div>
|
| 292 |
""", unsafe_allow_html = True)
|
| 293 |
+
st.markdown(f"""
|
| 294 |
+
<div style="text-align: center;">
|
| 295 |
+
<div style="font-size: 10px;">Error range</div>
|
| 296 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["pe"]} %</div>
|
| 297 |
+
</div>
|
| 298 |
+
""", unsafe_allow_html = True)
|
| 299 |
|
| 300 |
with col_water:
|
| 301 |
st.markdown("""
|
|
|
|
| 326 |
<div style="text-align: center;"><i>Evaluates the use of water<i>
|
| 327 |
</div>
|
| 328 |
""", unsafe_allow_html = True)
|
| 329 |
+
st.markdown(f"""
|
| 330 |
+
<div style="text-align: center;">
|
| 331 |
+
<div style="font-size: 10px;">Error range</div>
|
| 332 |
+
<div style="font-size: 10px;">±{range_percent_impact_one_sided_calculated["water"]} %</div>
|
| 333 |
+
</div>
|
| 334 |
+
""", unsafe_allow_html = True)
|
| 335 |
|
| 336 |
|
| 337 |
|
src/utils.py
CHANGED
|
@@ -180,6 +180,29 @@ def format_water(water: Water) -> Quantity:
|
|
| 180 |
val = val.to("mL")
|
| 181 |
return val
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
def format_impacts(impacts: Impacts) -> QImpacts:
|
| 184 |
|
| 185 |
try:
|
|
|
|
| 180 |
val = val.to("mL")
|
| 181 |
return val
|
| 182 |
|
| 183 |
+
def range_percent_impact_one_sided(impacts: Impacts) -> float:
|
| 184 |
+
impacts_energy_mean = (impacts.energy.value.max + impacts.energy.value.min)/2
|
| 185 |
+
range_percent_energy_one_sided = (impacts.energy.value.max - impacts.energy.value.min) / (2* impacts_energy_mean) * 100
|
| 186 |
+
impacts_gwp_mean = (impacts.gwp.value.max + impacts.gwp.value.min)/2
|
| 187 |
+
range_percent_gwp_one_sided = (impacts.gwp.value.max - impacts.gwp.value.min) / (2* impacts_gwp_mean) * 100
|
| 188 |
+
impacts_adpe_mean = (impacts.adpe.value.max + impacts.adpe.value.min)/2
|
| 189 |
+
range_percent_adpe_one_sided = (impacts.adpe.value.max - impacts.adpe.value.min) / (2* impacts_adpe_mean) * 100
|
| 190 |
+
impacts_pe_mean = (impacts.pe.value.max + impacts.pe.value.min)/2
|
| 191 |
+
range_percent_pe_one_sided = (impacts.pe.value.max - impacts.pe.value.min) / (2* impacts_pe_mean) * 100
|
| 192 |
+
impacts_water_mean = (impacts.water.value.max + impacts.water.value.min)/2
|
| 193 |
+
range_percent_water_one_sided = (impacts.water.value.max - impacts.water.value.min) / (2* impacts_water_mean) * 100
|
| 194 |
+
|
| 195 |
+
results = {
|
| 196 |
+
"energy" : range_percent_energy_one_sided,
|
| 197 |
+
"gwp": range_percent_gwp_one_sided,
|
| 198 |
+
"adpe": range_percent_adpe_one_sided,
|
| 199 |
+
"pe": range_percent_pe_one_sided,
|
| 200 |
+
"water" : range_percent_water_one_sided
|
| 201 |
+
}
|
| 202 |
+
return results
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
|
| 206 |
def format_impacts(impacts: Impacts) -> QImpacts:
|
| 207 |
|
| 208 |
try:
|