refactor: remove motion listings from compass view, keep voting discipline
Remove the '🔍 Wat bepaalt deze assen?' expander that showed individual motion titles (➕/➖) with axis labels and variance explanation. Only the Stemdiscipline analyse (Rice index) section remains. Also removes the now-unused _render_axis_motions() helper function.
This commit is contained in:
-41
@@ -469,19 +469,6 @@ def _swap_axes(
|
||||
return projections.swap_axes(positions_by_window, axis_def)
|
||||
|
||||
|
||||
def _render_axis_motions(label: str, conf_pct: str, top: dict) -> None:
|
||||
st.markdown(f"**{label}**{conf_pct}")
|
||||
for sign, icon in (("+", "➕"), ("-", "➖")):
|
||||
titles = top.get(sign, [])
|
||||
if titles:
|
||||
st.markdown(
|
||||
" "
|
||||
+ icon
|
||||
+ " "
|
||||
+ " · ".join(f"{t} ({d})" for t, d in titles[:3])
|
||||
)
|
||||
|
||||
|
||||
@st.cache_data(show_spinner="2D posities berekenen (kan even duren)…")
|
||||
def load_positions(
|
||||
db_path: str, window_size: str = "annual"
|
||||
@@ -1576,34 +1563,6 @@ def build_compass_tab(db_path: str, window_size: str) -> None:
|
||||
):
|
||||
st.caption(_y_interp)
|
||||
|
||||
# Motion expander — show which motions define each axis for this window
|
||||
x_top = axis_def.get("x_top_motions", {}).get(window_idx, {})
|
||||
y_top = axis_def.get("y_top_motions", {}).get(window_idx, {})
|
||||
x_conf = axis_def.get("x_label_confidence", {}).get(window_idx)
|
||||
y_conf = axis_def.get("y_label_confidence", {}).get(window_idx)
|
||||
evr = axis_def.get("explained_variance_ratio", [None, None])
|
||||
evr0 = evr[0] if evr else None
|
||||
|
||||
_has_motion_data = bool(
|
||||
x_top.get("+") or x_top.get("-") or y_top.get("+") or y_top.get("-")
|
||||
)
|
||||
if _has_motion_data:
|
||||
with st.expander("🔍 Wat bepaalt deze assen?"):
|
||||
x_conf_pct = (
|
||||
f" (vertrouwen: {x_conf:.0%})" if x_conf is not None else ""
|
||||
)
|
||||
y_conf_pct = (
|
||||
f" (vertrouwen: {y_conf:.0%})" if y_conf is not None else ""
|
||||
)
|
||||
|
||||
_render_axis_motions(f"Horizontale as: {_x_label}", x_conf_pct, x_top)
|
||||
_render_axis_motions(f"Verticale as: {_y_label}", y_conf_pct, y_top)
|
||||
|
||||
if evr0 is not None:
|
||||
st.caption(
|
||||
f"De sterkste component verklaart {evr0:.1%} van de variantie in stemgedrag."
|
||||
)
|
||||
|
||||
# Voting discipline analysis
|
||||
st.markdown("---")
|
||||
st.markdown(
|
||||
|
||||
Reference in New Issue
Block a user