Skip to content

Commit

Permalink
Move all sliders into sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceyron committed May 8, 2024
1 parent d2c727e commit 703a29c
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions understanding_normalized_and_difficulty_nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
jax.config.update("jax_platform_name", "cpu")

with st.sidebar:
st.title("Exponax Dynamics Brewer")
dimension_type = st.select_slider(
"Number of Spatial Dimensions (ST=Spatio-Temporal plot)",
options=["1d ST", "1d", "2d", "2d ST", "3d"],
Expand All @@ -32,6 +33,10 @@
num_modes_init = st.slider("Number of modes in the initial condition", 1, 40, 5)
num_substeps = st.slider("Number of substeps", 1, 100, 1)

v_range = st.slider("Value range", 0.1, 10.0, 1.0)

st.divider()

overall_scale = st.slider("Overall scale", 0.1, 10.0, 1.0)

preset_mode = st.selectbox(
Expand Down Expand Up @@ -229,24 +234,14 @@
)
b_2 = float(f"{b_2_sign}{b_2_mantissa}e{b_2_exponent}")

# elif preset_mode == "Burgers (single-channel hack)":
# use_difficulty = True

# a_0 = 0.0
# a_1 = 0.0
# a_2 = 1.5
# a_3 = 0.0
# a_4 = 0.0
# b_0 = 0.0
# b_1 = -2.0
# b_2 = 0.0

linear_tuple = (a_0, a_1, a_2, a_3, a_4)
nonlinear_tuple = (b_0, b_1, b_2)

linear_tuple = (a_0, a_1, a_2, a_3, a_4)
nonlinear_tuple = (b_0, b_1, b_2)
linear_tuple = tuple([overall_scale * x for x in linear_tuple])
nonlinear_tuple = tuple([overall_scale * x for x in nonlinear_tuple])

linear_tuple = tuple([overall_scale * x for x in linear_tuple])
nonlinear_tuple = tuple([overall_scale * x for x in nonlinear_tuple])
st.write(f"Linear: {linear_tuple}")
st.write(f"Nonlinear: {nonlinear_tuple}")

if dimension_type in ["1d ST", "1d"]:
num_spatial_dims = 1
Expand Down Expand Up @@ -293,12 +288,6 @@
trj = ex.rollout(stepper, num_steps, include_init=True)(u_0)


v_range = st.slider("Value range", 0.1, 10.0, 1.0)


st.write(f"Linear: {linear_tuple} Nonlinear: {nonlinear_tuple}")


TEMPLATE_IFRAME = """
<div>
<iframe id="{canvas_id}" src="https://keksboter.github.io/v4dv/?inline" width="{canvas_width}" height="{canvas_height}" frameBorder="0" sandbox="allow-same-origin allow-scripts"></iframe>
Expand Down

0 comments on commit 703a29c

Please sign in to comment.