Skip to content

Commit 298ebc4

Browse files
Copilotdfeen87
andauthored
feat: publication-grade Figure 8 null-test comparison (cleaner visual)
Agent-Logs-Url: https://github.com/dfeen87/Cell-DNA-Dynamics/sessions/80746c40-9bd8-404d-a6bb-53c970a21f01 Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
1 parent 2ce4687 commit 298ebc4

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

-41.8 KB
Loading

src/viz/generate_figure_8.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@
4040
"stable": "#2E7D32", # deep green — stable control
4141
}
4242

43-
_LINEWIDTH = 1.6
43+
# Observed curve is drawn thick and fully opaque to stand out clearly.
44+
# Null curves are deliberately thinner and semi-transparent to reduce clutter.
45+
_LW_OBSERVED = 2.8 # prominent
46+
_LW_NULL = 1.1 # unobtrusive
47+
48+
_ALPHA_SHUFFLED = 0.45 # shuffled-time null – extra subdued (can have large swings)
49+
_ALPHA_NULL = 0.60 # other null curves
4450

4551

4652
def generate_figure_8(seed: int = 0) -> str:
@@ -77,14 +83,17 @@ def generate_figure_8(seed: int = 0) -> str:
7783
# ------------------------------------------------------------------
7884
fig, ax = plt.subplots(figsize=(12, 4))
7985

80-
ax.plot(t, observed, lw=_LINEWIDTH, color=_COLORS["observed"],
86+
# Null curves drawn first (behind), thin and semi-transparent to reduce clutter.
87+
ax.plot(t, shuffled, lw=_LW_NULL, color=_COLORS["shuffled"],
88+
label="Shuffled-time null", zorder=2, alpha=_ALPHA_SHUFFLED)
89+
ax.plot(t, surrogate, lw=_LW_NULL, color=_COLORS["surrogate"],
90+
label="Phase-randomized null", zorder=2, alpha=_ALPHA_NULL)
91+
ax.plot(t, control, lw=_LW_NULL, color=_COLORS["stable"],
92+
label="Stable control", zorder=2, alpha=_ALPHA_NULL)
93+
94+
# Observed curve drawn last (on top), thick and fully opaque for prominence.
95+
ax.plot(t, observed, lw=_LW_OBSERVED, color=_COLORS["observed"],
8196
label="Observed", zorder=4)
82-
ax.plot(t, shuffled, lw=_LINEWIDTH, color=_COLORS["shuffled"],
83-
label="Shuffled-time null", zorder=3, alpha=0.85)
84-
ax.plot(t, surrogate, lw=_LINEWIDTH, color=_COLORS["surrogate"],
85-
label="Phase-randomized null", zorder=3, alpha=0.85)
86-
ax.plot(t, control, lw=_LINEWIDTH, color=_COLORS["stable"],
87-
label="Stable control", zorder=2, alpha=0.85)
8897

8998
ax.set_xlabel("Time (s)", fontsize=12)
9099
ax.set_ylabel("ΔΦ(t)", fontsize=12)
@@ -93,6 +102,10 @@ def generate_figure_8(seed: int = 0) -> str:
93102
ax.tick_params(labelsize=10)
94103
ax.set_xlim(t[0], t[-1])
95104

105+
# Clip the y-axis to a range anchored on the observed signal so that
106+
# high-amplitude shuffled-time swings do not compress the rest of the plot.
107+
ax.set_ylim(bottom=0, top=np.max(observed) * 1.35)
108+
96109
plt.tight_layout()
97110

98111
# ------------------------------------------------------------------

0 commit comments

Comments
 (0)