Spaces:
Sleeping
Sleeping
siddhant-rajhans commited on
Commit ·
4f96c68
1
Parent(s): 8643122
Fix Cognitive Load fillcolor crash, pre-select Visual ROIs in Brain Viewer
Browse files- Fix hex-to-rgba conversion for confidence band fill colors (was producing
invalid color strings like 'rgba(00D2FF' instead of 'rgba(0,210,255,0.15)')
- Pre-select Visual region group in Brain Viewer so ROI highlighting is
visible on first load
Files changed (2)
91 unmodified lines929394959697989910091 unmodified linesci_hi = np.percentile(boot_arr, 97.5, axis=0)t_axis = timeline_df["time"].valuesfig.add_trace(go.Scatter(x=t_axis, y=ci_hi, mode="lines", line=dict(width=0), showlegend=False))fig.add_trace(go.Scatter(x=t_axis, y=ci_lo, mode="lines", line=dict(width=0),fill="tonexty", fillcolor=color.replace(")", ",0.15)").replace("rgb", "rgba").replace("#", "rgba(") if color.startswith("#") else color,showlegend=False))fig.add_trace(go.Scatter(x=timeline_df["time"], y=y, name=dim, line=dict(color=color, width=2)))91 unmodified lines929394959697989910010110210310410510610791 unmodified linesci_hi = np.percentile(boot_arr, 97.5, axis=0)t_axis = timeline_df["time"].values# Convert hex color to rgba for fillif color.startswith("#"):r, g, b = int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16)fill_color = f"rgba({r},{g},{b},0.15)"else:fill_color = colorfig.add_trace(go.Scatter(x=t_axis, y=ci_hi, mode="lines", line=dict(width=0), showlegend=False))fig.add_trace(go.Scatter(x=t_axis, y=ci_lo, mode="lines", line=dict(width=0),fill="tonexty", fillcolor=fill_color,showlegend=False))fig.add_trace(go.Scatter(x=timeline_df["time"], y=y, name=dim, line=dict(color=color, width=2)))
50 unmodified lines515253545556575859606150 unmodified linesformat_func=lambda x: {"#0E1117": "Dark", "#000000": "Black", "#1A1A2E": "Navy"}[x])st.subheader("ROI Highlighting")roi_groups_selected = st.multiselect("Region groups", list(ROI_GROUPS.keys()))available_rois = []for g in roi_groups_selected:available_rois.extend(ROI_GROUPS[g])selected_rois = st.multiselect("Specific ROIs", available_rois, default=available_rois[:5] if available_rois else [])show_labels = st.checkbox("Show ROI labels", value=True)# --- Load Mesh ---50 unmodified lines515253545556575859606150 unmodified linesformat_func=lambda x: {"#0E1117": "Dark", "#000000": "Black", "#1A1A2E": "Navy"}[x])st.subheader("ROI Highlighting")roi_groups_selected = st.multiselect("Region groups", list(ROI_GROUPS.keys()), default=["Visual"])available_rois = []for g in roi_groups_selected:available_rois.extend(ROI_GROUPS[g])selected_rois = st.multiselect("Specific ROIs", available_rois, default=available_rois[:4] if available_rois else [])show_labels = st.checkbox("Show ROI labels", value=True)# --- Load Mesh ---
pages/2_Cognitive_Load.py+8-1
pages/5_Brain_Viewer.py+2-2