move config loading to top -- may break doctest
@@ -39,12 +39,30 @@ from pymedphys._mosaiq import helpers as msq_helpers
from pymedphys._utilities import patient as utl_patient
from pymedphys.labs.managelogfiles import index as pmp_index
+
"""
# MU Density comparison tool
Tool to compare the MU Density between planned and delivery.
"""
+
+def download_and_extract_demo_data(cwd):
+ pymedphys.zip_data_paths("mu-density-gui-e2e-data.zip", extract_directory=cwd)
+
+
+@st.cache
+def load_config():
+ try:
+ result = pmp_config.get_config()
+ except FileNotFoundError:
+ cwd = pathlib.Path.cwd()
+ download_and_extract_demo_data(cwd)
+ result = pmp_config.get_config(cwd.joinpath("pymedphys-gui-demo"))
+
+ return result
+
+
CONFIG = load_config()
AVAILABLE_DATA_METHODS = CONFIG["data_methods"]["available"]
@@ -106,22 +124,6 @@ GRID = pymedphys.mudensity.grid(
COORDS = (GRID["jaw"], GRID["mlc"])
-def download_and_extract_demo_data(cwd):
- pymedphys.zip_data_paths("mu-density-gui-e2e-data.zip", extract_directory=cwd)
-
-
-@st.cache
-def load_config():
- try:
- result = pmp_config.get_config()
- except FileNotFoundError:
- cwd = pathlib.Path.cwd()
- download_and_extract_demo_data(cwd)
- result = pmp_config.get_config(cwd.joinpath("pymedphys-gui-demo"))
-
- return result
-
-
class InputRequired(ValueError):
pass
