Skip to content

Commit

Permalink
fixed some bugs, improved increments, put EU logo on each page
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenaH84 committed Jun 13, 2024
1 parent 4f3542a commit 313a924
Show file tree
Hide file tree
Showing 22 changed files with 3,933 additions and 389 deletions.
2 changes: 1 addition & 1 deletion streamlit/Introduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def run_app():
app_view.st_space(space_width=3)

#Set funding acknowledgement
set_acknowlegent_info(col)
set_acknowlegent_info()



Expand Down
6 changes: 6 additions & 0 deletions streamlit/app_scripts/app_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def get_path_to_light_style_css():
light_style_css_path = os.path.join(html_path, "light_style.css")
return light_style_css_path

@st.cache_data
def get_path_to_custom_style_css():
html_path = get_path_to_html_dir()
light_style_css_path = os.path.join(html_path, "light_style.css")
return light_style_css_path

@st.cache_data
def get_path_to_dark_style_css():
html_path = get_path_to_html_dir()
Expand Down
4 changes: 2 additions & 2 deletions streamlit/app_scripts/app_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def set_material_description():
def get_results_data(file_names):
return view.GetResultsData(file_names)

def set_acknowlegent_info(col):
return view.SetAcknowledgementInfo(col)
def set_acknowlegent_info():
return view.SetAcknowledgementInfo()


#####################################
Expand Down
26 changes: 19 additions & 7 deletions streamlit/app_scripts/app_parameter_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import os
import sys
import streamlit as st
import math

##############################
# Set page directory to base level to allow for module import from different folder
Expand Down Expand Up @@ -148,15 +149,26 @@ def set_increment(self):
"""

if self.type == float.__name__:
average_value = 0.5*(self.min_value + self.max_value)
five_percent_of_value = "%e" % (0.05 * average_value)
average_value = 0.5 * (self.min_value + self.max_value)
if average_value == 0:
self.increment = 1e-17
return

decimal, exponential = five_percent_of_value.split("e")
# Calculate the order of magnitude
order_of_magnitude = math.floor(math.log10(abs(average_value)))

self.increment = round(
float(ceil(float(decimal)) * 10 ** int(exponential)),
2
)
# Determine a base increment which is a power of 10
base_increment = 10 ** order_of_magnitude

# Adjust the increment to be more user-friendly
if average_value < 1:
self.increment = base_increment / 10
else:
self.increment = base_increment / 2

# Further refinement for very small values
if abs(self.increment) < 1e-10:
self.increment = 1e-10

else:
self.increment = 1
Expand Down
Loading

0 comments on commit 313a924

Please sign in to comment.