Alexander commited on
Commit
0736539
Β·
1 Parent(s): 871d06d

change banner text and adjust v and t default settings

Browse files
Files changed (1) hide show
  1. src/app.py +27 -16
src/app.py CHANGED
@@ -11,13 +11,25 @@ import utils
11
 
12
  # Function to create input select widgets
13
  def create_param_selectors(model_name: str, model_num: int = 1):
14
-
15
  d_config = model_config[model_name]
16
  params = d_config["params"]
17
  param_bounds_low = d_config["param_bounds"][0]
18
  param_bounds_high = d_config["param_bounds"][1]
19
  param_defaults = d_config["default_params"]
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  d_param_slider = {}
22
  for i, (name, low, high, default) in enumerate(
23
  zip(
@@ -56,23 +68,23 @@ def create_styling_selectors(model_num: int = 1):
56
  Returns:
57
  dict: Dictionary containing all styling parameters with their user-selected values
58
  """
59
-
60
  # Color options for different plot elements
61
  color_options = ["blue", "red", "green", "orange", "purple", "black", "gray", "brown"]
62
-
63
  # Legend location options (matplotlib standard locations)
64
  legend_locations = ["upper right", "upper left", "lower left", "lower right",
65
  "center", "upper center", "lower center", "center left", "center right"]
66
-
67
  # Marker type options for trajectories
68
  marker_options = { "Diamond": "D", "Square": "s", "Line": 0, "Circle": "o", "Star": "*", "Triangle": "^",
69
  "Plus": "+", "X": "x"}
70
-
71
  styling_config = {}
72
-
73
  # Create an expander for styling options to keep the interface clean
74
  with st.expander(f"🎨 Styling", expanded=False):
75
-
76
  # Color Settings Section
77
  st.markdown("**Colors**")
78
  styling_config["data_color"] = st.selectbox(
@@ -81,14 +93,14 @@ def create_styling_selectors(model_num: int = 1):
81
  index=color_options.index("blue" if model_num == 1 else "red"),
82
  key=f"data_color_{model_num}_{st.session_state['styling_version']}"
83
  )
84
-
85
  styling_config["posterior_uncertainty_color"] = st.selectbox(
86
  "Model Color",
87
  color_options,
88
  index=color_options.index("black"),
89
  key=f"model_color_{model_num}_{st.session_state['styling_version']}"
90
  )
91
-
92
  # Line Width Settings Section
93
  st.markdown("**Lines**")
94
  styling_config["linewidth_histogram"] = st.slider(
@@ -99,7 +111,7 @@ def create_styling_selectors(model_num: int = 1):
99
  step=0.1,
100
  key=f"hist_lw_{model_num}_{st.session_state['styling_version']}"
101
  )
102
-
103
  styling_config["linewidth_model"] = st.slider(
104
  "Model Line Width",
105
  min_value=0.1,
@@ -108,7 +120,7 @@ def create_styling_selectors(model_num: int = 1):
108
  step=0.1,
109
  key=f"model_lw_{model_num}_{st.session_state['styling_version']}"
110
  )
111
-
112
  # Histogram Settings Section
113
  st.markdown("**Histograms**")
114
  styling_config["bin_size"] = st.slider(
@@ -119,7 +131,7 @@ def create_styling_selectors(model_num: int = 1):
119
  step=0.01,
120
  key=f"bin_size_{model_num}_{st.session_state['styling_version']}"
121
  )
122
-
123
  styling_config["alpha"] = st.slider(
124
  "alpha",
125
  min_value=0.0,
@@ -128,7 +140,7 @@ def create_styling_selectors(model_num: int = 1):
128
  step=0.05,
129
  key=f"alpha_{model_num}_{st.session_state['styling_version']}"
130
  )
131
-
132
  # Model Components Section - Toggle which parts of the model to show
133
  st.markdown("**Model Components**")
134
  styling_config["add_data_model_keep_boundary"] = st.checkbox(
@@ -141,7 +153,7 @@ def create_styling_selectors(model_num: int = 1):
141
  value=True,
142
  key=f"show_slope_{model_num}_{st.session_state['styling_version']}"
143
  )
144
-
145
  styling_config["add_data_model_keep_ndt"] = st.checkbox(
146
  "Show Non-Decision Time",
147
  value=True,
@@ -419,8 +431,7 @@ st.markdown("""
419
  <div style='background-color: #f0f2f6; padding: 15px; border-radius: 10px; margin: 20px 0; border-left: 5px solid #1f77b4;'>
420
  <p style='margin: 0; font-size: 16px;'>
421
  <strong>πŸ“Š Fit to your own data</strong><br>
422
- This dashboard provides interactive visualization of Sequential Sampling Models.
423
- To fit these models to your own data, checkout the <a href='https://github.com/lnccbrown/HSSM' target='_blank' style='color: #1f77b4; text-decoration: none;'><strong>HSSM</strong></a> toolbox.
424
  </p>
425
  </div>
426
  """, unsafe_allow_html=True)
 
11
 
12
  # Function to create input select widgets
13
  def create_param_selectors(model_name: str, model_num: int = 1):
14
+
15
  d_config = model_config[model_name]
16
  params = d_config["params"]
17
  param_bounds_low = d_config["param_bounds"][0]
18
  param_bounds_high = d_config["param_bounds"][1]
19
  param_defaults = d_config["default_params"]
20
 
21
+ # fix some specific parameters to
22
+ # custom defaults for better / more interesting
23
+ # default visuals
24
+
25
+ if "v" in params:
26
+ v_index = params.index("v")
27
+ param_defaults[v_index] = 0.5
28
+
29
+ if "t" in params:
30
+ t_index = params.index("t")
31
+ param_defaults[t_index] = 0.2
32
+
33
  d_param_slider = {}
34
  for i, (name, low, high, default) in enumerate(
35
  zip(
 
68
  Returns:
69
  dict: Dictionary containing all styling parameters with their user-selected values
70
  """
71
+
72
  # Color options for different plot elements
73
  color_options = ["blue", "red", "green", "orange", "purple", "black", "gray", "brown"]
74
+
75
  # Legend location options (matplotlib standard locations)
76
  legend_locations = ["upper right", "upper left", "lower left", "lower right",
77
  "center", "upper center", "lower center", "center left", "center right"]
78
+
79
  # Marker type options for trajectories
80
  marker_options = { "Diamond": "D", "Square": "s", "Line": 0, "Circle": "o", "Star": "*", "Triangle": "^",
81
  "Plus": "+", "X": "x"}
82
+
83
  styling_config = {}
84
+
85
  # Create an expander for styling options to keep the interface clean
86
  with st.expander(f"🎨 Styling", expanded=False):
87
+
88
  # Color Settings Section
89
  st.markdown("**Colors**")
90
  styling_config["data_color"] = st.selectbox(
 
93
  index=color_options.index("blue" if model_num == 1 else "red"),
94
  key=f"data_color_{model_num}_{st.session_state['styling_version']}"
95
  )
96
+
97
  styling_config["posterior_uncertainty_color"] = st.selectbox(
98
  "Model Color",
99
  color_options,
100
  index=color_options.index("black"),
101
  key=f"model_color_{model_num}_{st.session_state['styling_version']}"
102
  )
103
+
104
  # Line Width Settings Section
105
  st.markdown("**Lines**")
106
  styling_config["linewidth_histogram"] = st.slider(
 
111
  step=0.1,
112
  key=f"hist_lw_{model_num}_{st.session_state['styling_version']}"
113
  )
114
+
115
  styling_config["linewidth_model"] = st.slider(
116
  "Model Line Width",
117
  min_value=0.1,
 
120
  step=0.1,
121
  key=f"model_lw_{model_num}_{st.session_state['styling_version']}"
122
  )
123
+
124
  # Histogram Settings Section
125
  st.markdown("**Histograms**")
126
  styling_config["bin_size"] = st.slider(
 
131
  step=0.01,
132
  key=f"bin_size_{model_num}_{st.session_state['styling_version']}"
133
  )
134
+
135
  styling_config["alpha"] = st.slider(
136
  "alpha",
137
  min_value=0.0,
 
140
  step=0.05,
141
  key=f"alpha_{model_num}_{st.session_state['styling_version']}"
142
  )
143
+
144
  # Model Components Section - Toggle which parts of the model to show
145
  st.markdown("**Model Components**")
146
  styling_config["add_data_model_keep_boundary"] = st.checkbox(
 
153
  value=True,
154
  key=f"show_slope_{model_num}_{st.session_state['styling_version']}"
155
  )
156
+
157
  styling_config["add_data_model_keep_ndt"] = st.checkbox(
158
  "Show Non-Decision Time",
159
  value=True,
 
431
  <div style='background-color: #f0f2f6; padding: 15px; border-radius: 10px; margin: 20px 0; border-left: 5px solid #1f77b4;'>
432
  <p style='margin: 0; font-size: 16px;'>
433
  <strong>πŸ“Š Fit to your own data</strong><br>
434
+ This dashboard provides interactive visualization of several Sequential Sampling Models available for fitting to data in the <a href='https://github.com/lnccbrown/HSSM' target='_blank' style='color: #1f77b4; text-decoration: none;'><strong>HSSM</strong></a> toolbox.
 
435
  </p>
436
  </div>
437
  """, unsafe_allow_html=True)