File size: 21,355 Bytes
4a3ac26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
#!/usr/bin/env python3
"""Generate simple, intuitive figures for the Brigalow v1 Plain-Language Guide (PLAIN_LANGUAGE_GUIDE.md).

Outputs in figures/explainer/:
  exp1_how_satellites_see.png             Visible light vs infrared: why cleared soil stands out from trees
  exp2_three_seasons.png                  Why 3 snapshots (Before, Mid, After) separate clearing from drought & fire
  exp3_local_contrast_and_committee.png   Two core ideas: comparing with neighbours + committee of 5 diverse models
  exp4_two_dials.png                      Wide Net (Standard) vs High Confidence: recall vs precision made tangible
  exp5_fair_test.png                      How we tested Brigalow fairly (no peeking at 2023-24 or held-out regions)
  exp6_strengths_and_limits.png           At-a-glance visual scorecard: where Brigalow shines vs where to double-check
"""
import os
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch, Circle, Rectangle, FancyArrowPatch

REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
OUT = os.path.join(REPO, "figures", "explainer")

PAL = dict(
    forest="#1E7B4C",
    light_green="#8CC99C",
    soil="#C97B4B",
    char="#3A3A3A",
    blue="#1C6EA4",
    sky="#66B2DF",
    amber="#E0941B",
    coral="#D65A31",
    cream="#FAF9F5",
    card="#FFFFFF",
    line="#DCDCD4",
    ink="#1F1F1D",
    muted="#5C5C56",
)


def setup():
    plt.rcParams.update({
        "font.family": "DejaVu Sans",
        "font.size": 9.0,
        "axes.spines.top": False,
        "axes.spines.right": False,
        "savefig.dpi": 200,
        "savefig.facecolor": PAL["cream"],
        "axes.facecolor": PAL["card"],
    })


def exp1_how_satellites_see():
    setup()
    fig, ax = plt.subplots(figsize=(9.6, 4.3))
    bands = ["Blue\n(visible)", "Green\n(visible)", "Red\n(visible)", "Red Edge\n(3 bands)", "Near-Infrared\n(NIR)", "Shortwave IR 1\n(SWIR1)", "Shortwave IR 2\n(SWIR2)"]
    x = np.arange(len(bands))
    # Typical Sentinel-2 reflectance profiles in Queensland woodland
    trees = [0.04, 0.06, 0.05, 0.14, 0.28, 0.17, 0.09]
    cleared = [0.09, 0.13, 0.18, 0.21, 0.24, 0.34, 0.27]
    burnt = [0.03, 0.04, 0.05, 0.06, 0.08, 0.10, 0.08]

    ax.axvspan(-0.4, 2.4, color="#EEF6FB", alpha=0.6, zorder=0)
    ax.axvspan(2.4, 6.4, color="#FFF6E8", alpha=0.6, zorder=0)
    ax.text(1.0, 0.39, "What human eyes see", ha="center", fontsize=8.5, fontweight="bold", color=PAL["blue"])
    ax.text(4.4, 0.39, "Invisible infrared light (Sentinel-2's superpower)", ha="center", fontsize=8.5, fontweight="bold", color=PAL["coral"])

    ax.plot(x, trees, "o-", color=PAL["forest"], lw=2.8, ms=7.5, label="Healthy woody trees (high NIR, low Red & SWIR)")
    ax.plot(x, cleared, "s-", color=PAL["soil"], lw=2.8, ms=7.5, label="Cleared bare soil / pasture (bright Red & SWIR)")
    ax.plot(x, burnt, "^--", color=PAL["char"], lw=2.2, ms=7.0, label="Fresh fire scar (very dark across NIR & SWIR)")

    ax.annotate("Leaves strongly\nreflect NIR", xy=(4, 0.28), xytext=(3.5, 0.335),
                arrowprops=dict(arrowstyle="->", color=PAL["forest"], lw=1.2), fontsize=8.0, color=PAL["forest"], fontweight="bold")
    ax.annotate("Exposed dry soil\nglows in SWIR", xy=(5, 0.34), xytext=(5.15, 0.355),
                arrowprops=dict(arrowstyle="->", color=PAL["soil"], lw=1.2), fontsize=8.0, color=PAL["soil"], fontweight="bold")
    ax.annotate("Ash & char stay\ndark in infrared", xy=(4, 0.08), xytext=(4.35, 0.025),
                arrowprops=dict(arrowstyle="->", color=PAL["char"], lw=1.2), fontsize=8.0, color=PAL["char"], fontweight="bold")

    ax.set_xticks(x); ax.set_xticklabels(bands, fontsize=8.2)
    ax.set_ylim(0, 0.42); ax.set_ylabel("Fraction of sunlight reflected")
    ax.grid(axis="y", alpha=0.3)
    ax.set_title("How Sentinel-2 sees a cleared paddock beyond human vision", loc="left", fontsize=11.0, fontweight="bold", pad=10)
    ax.legend(loc="upper left", bbox_to_anchor=(0.01, 0.90), fontsize=8.0, framealpha=0.95)
    fig.tight_layout()
    fig.savefig(os.path.join(OUT, "exp1_how_satellites_see.png"), bbox_inches="tight")
    plt.close(fig)


def exp2_three_seasons():
    setup()
    fig, ax = plt.subplots(figsize=(10.0, 4.6))
    ax.set_xlim(0, 1); ax.set_ylim(0, 1); ax.axis("off")

    ax.text(0.02, 0.96, "Why Brigalow checks THREE seasons instead of two", fontsize=12.0, fontweight="bold", color=PAL["ink"], va="top")
    ax.text(0.02, 0.895, "Looking only at 'Before' and 'After' can trick a model during droughts or crop harvests. Adding the middle wet/spring season reveals what really happened.",
            fontsize=8.3, color=PAL["muted"], va="top")

    col_x = [0.25, 0.465, 0.68]
    headers = ["1. Before (Dry season)\nJun – Aug (Year 1)", "2. Middle (Wet season)\nmid-Nov – mid-May", "3. After (Dry season)\nJul – Sep (Year 2)"]
    for cx, h in zip(col_x, headers):
        ax.text(cx + 0.085, 0.81, h, ha="center", va="top", fontsize=8.4, fontweight="bold", color=PAL["blue"])

    rows = [
        ("True Tree Clearing", "Trees removed ->\nstays bare or grassed",
         [(PAL["forest"], "Dense woody\ntrees"), (PAL["soil"], "Cleared soil /\nwindrows"), (PAL["soil"], "Still cleared\n(no canopy)")],
         PAL["forest"], "ALERT!"),
        ("Crop / Drought Cycle", "Temporary browning ->\nbounces back",
         [(PAL["forest"], "Green pasture\nor crop"), (PAL["amber"], "Dry / harvested\n(or flooded)"), (PAL["light_green"], "Regrows or\nrecovers")],
         PAL["amber"], "Ignore"),
        ("Bushfire Scar", "Charred black ->\ncanopy often resprouts",
         [(PAL["forest"], "Woody\nbushland"), (PAL["char"], "Dark burnt\nash & char"), (PAL["light_green"], "Patchy recovery /\nfire scar mapped")],
         PAL["char"], "Ignore"),
    ]
    ys = [0.56, 0.31, 0.06]
    for ry, (title, sub, boxes, col, verdict) in zip(ys, rows):
        ax.text(0.015, ry + 0.12, title, fontsize=9.4, fontweight="bold", color=col, va="center")
        ax.text(0.015, ry + 0.055, sub, fontsize=7.8, color=PAL["muted"], va="center")
        for bi, (cx, (fc, txt)) in enumerate(zip(col_x, boxes)):
            p = FancyBboxPatch((cx, ry + 0.02), 0.17, 0.15, boxstyle="round,pad=0.01,rounding_size=0.025",
                               facecolor=fc, edgecolor="white", linewidth=1.5, alpha=0.92)
            ax.add_patch(p)
            ax.text(cx + 0.085, ry + 0.095, txt, ha="center", va="center", fontsize=7.8,
                    color="white" if fc != PAL["light_green"] else PAL["ink"], fontweight="bold")
            if bi < 2:
                ax.add_patch(FancyArrowPatch((cx + 0.176, ry + 0.095), (col_x[bi + 1] - 0.008, ry + 0.095),
                                             arrowstyle="-|>,head_length=5,head_width=3", color="#777", lw=1.3))
        vc = PAL["coral"] if verdict == "ALERT!" else "#6E7F74"
        ax.add_patch(FancyArrowPatch((0.86, ry + 0.095), (0.895, ry + 0.095),
                                     arrowstyle="-|>,head_length=5,head_width=3", color="#777", lw=1.3))
        ax.text(0.945, ry + 0.095, verdict, ha="center", va="center", fontsize=8.6, fontweight="bold", color="white",
                bbox=dict(boxstyle="round,pad=0.36", facecolor=vc, edgecolor="none"))

    fig.tight_layout()
    fig.savefig(os.path.join(OUT, "exp2_three_seasons.png"), bbox_inches="tight")
    plt.close(fig)


def exp3_local_contrast_and_committee():
    setup()
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.6, 4.6), gridspec_kw={"width_ratios": [1.0, 1.08], "wspace": 0.16})

    ax1.set_xlim(0, 10); ax1.set_ylim(0, 10); ax1.axis("off")
    ax1.text(0.0, 9.7, "Idea 1: Compare with the neighbours", fontsize=10.5, fontweight="bold", color=PAL["ink"])
    ax1.text(0.0, 8.95, "In a dry year, EVERY tree turns slightly browner.\nBrigalow subtracts the surrounding 600 m average so\nregional drought fades out and cleared paddocks pop.",
             fontsize=7.9, color=PAL["muted"], va="top")

    rng = np.random.default_rng(4)
    grid_raw = rng.uniform(0.32, 0.45, (7, 7))
    grid_raw[2:5, 2:5] = rng.uniform(0.75, 0.92, (3, 3))
    for gx, title, arr in [
        (0.2, "Raw change\n(drought noise everywhere)", grid_raw),
        (5.4, "After subtracting neighbours\n(only real clearing stands out)", np.clip(grid_raw - 0.40, 0, 1) * 1.6),
    ]:
        ax1.text(gx + 1.96, 6.25, title, ha="center", va="bottom", fontsize=7.9, fontweight="bold", color=PAL["ink"])
        cell = 0.56
        for r in range(7):
            for c in range(7):
                val = float(np.clip(arr[r, c], 0, 1))
                col = plt.cm.YlOrBr(0.12 + 0.82 * val)
                ax1.add_patch(Rectangle((gx + c * cell, 2.0 + (6 - r) * cell), cell * 0.94, cell * 0.94,
                                        facecolor=col, edgecolor="white", lw=0.6))
        ax1.add_patch(Rectangle((gx + 2 * cell, 2.0 + 2 * cell), 3 * cell, 3 * cell,
                                facecolor="none", edgecolor=PAL["blue"], lw=2.0, ls="--"))
    ax1.add_patch(FancyArrowPatch((4.25, 4.0), (5.25, 4.0), arrowstyle="-|>,head_length=6,head_width=4", color=PAL["blue"], lw=2.0))
    ax1.text(4.8, 0.85, "Blue dashed box = actual cleared paddock\n(sharp edges, strong local contrast)", ha="center", fontsize=7.6, color=PAL["blue"], fontweight="bold")

    ax2.set_xlim(0, 10.6); ax2.set_ylim(0, 10); ax2.axis("off")
    ax2.text(0.0, 9.7, "Idea 2: Ask a committee of 5 experts", fontsize=10.5, fontweight="bold", color=PAL["ink"])
    ax2.text(0.0, 8.95, "Instead of trusting one AI brain, Brigalow averages\n5 models with 3 different designs, each trained on a\ndifferent geographic slice of Queensland.",
             fontsize=7.9, color=PAL["muted"], va="top")

    experts = [
        ("2x Texture & Edge Experts", "ConvNeXt-Small (CNNs)\nSharp paddock boundaries & tracks", PAL["blue"], 6.0),
        ("2x Hybrid Pattern Experts", "CAFormer-S36 (Conv + Attention)\nLocal edges + broader landscape context", PAL["forest"], 3.9),
        ("1x Satellite-Pretrained Expert", "Satlas Swin-Base (Sentinel-2 pretrained)\nGlobal knowledge of forests, farms & fire", PAL["coral"], 1.8),
    ]
    for title, desc, col, yy in experts:
        p = FancyBboxPatch((0.15, yy), 6.9, 1.58, boxstyle="round,pad=0.12,rounding_size=0.25",
                           facecolor="white", edgecolor=col, lw=1.8)
        ax2.add_patch(p)
        ax2.text(0.45, yy + 1.12, title, fontsize=8.3, fontweight="bold", color=col, va="center")
        ax2.text(0.45, yy + 0.48, desc, fontsize=7.1, color="#444", va="center")
        ax2.add_patch(FancyArrowPatch((7.22, yy + 0.79), (8.12, 4.65), arrowstyle="-|>,head_length=5,head_width=3", color=col, lw=1.4))

    pv = FancyBboxPatch((8.22, 3.2), 2.2, 2.9, boxstyle="round,pad=0.12,rounding_size=0.25",
                        facecolor="#EEF6FB", edgecolor=PAL["blue"], lw=2.0)
    ax2.add_patch(pv)
    ax2.text(9.32, 5.35, "Average\nVote", ha="center", va="center", fontsize=9.2, fontweight="bold", color=PAL["blue"])
    ax2.text(9.32, 4.10, "Calibrated\n0% – 100%\nclearing\nprobability", ha="center", va="center", fontsize=7.5, color="#333")
    ax2.text(5.3, 0.85, "Different model families make different mistakes β€”\naveraging their votes cancels errors out.", ha="center", fontsize=7.6, color=PAL["muted"])

    fig.savefig(os.path.join(OUT, "exp3_local_contrast_and_committee.png"), bbox_inches="tight")
    plt.close(fig)


def exp4_two_dials():
    setup()
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.2, 4.5), gridspec_kw={"wspace": 0.18})

    def draw_dial(ax, title, subtitle, caught, missed, confirmed_pct, extra_txt, col_main):
        ax.set_xlim(0, 10.6); ax.set_ylim(0, 10); ax.axis("off")
        ax.text(0.0, 9.6, title, fontsize=10.2, fontweight="bold", color=col_main)
        ax.text(0.0, 8.95, subtitle, fontsize=7.9, color=PAL["muted"], va="top")

        ax.text(2.3, 7.65, "100 real clearings (>=1 ha):", ha="center", fontsize=8.1, fontweight="bold", color=PAL["ink"])
        for i in range(100):
            r, c = divmod(i, 10)
            fc = col_main if i < caught else "#D8D8D2"
            ax.add_patch(Rectangle((0.2 + c * 0.42, 3.2 + (9 - r) * 0.42), 0.35, 0.35, facecolor=fc, edgecolor="none"))
        ax.text(2.3, 2.75, f"Finds {caught} of 100 patches\n({extra_txt})", ha="center", va="top", fontsize=7.9, fontweight="bold", color=col_main)

        ax.text(7.2, 7.65, "Of every 100 ha flagged:", ha="center", fontsize=8.1, fontweight="bold", color=PAL["ink"])
        bh = 4.15
        ok_h = bh * (confirmed_pct / 100.0)
        ax.add_patch(Rectangle((6.0, 3.2), 2.4, ok_h, facecolor=PAL["forest"], edgecolor="white", lw=1.0))
        ax.add_patch(Rectangle((6.0, 3.2 + ok_h), 2.4, bh - ok_h, facecolor="#E8C7B8", edgecolor="white", lw=1.0))
        ax.text(7.2, 3.2 + ok_h / 2, f"{confirmed_pct:.0f} ha\nconfirmed\nSLATS", ha="center", va="center", fontsize=8.2, fontweight="bold", color="white")
        if 100 - confirmed_pct > 15:
            ax.text(7.2, 3.2 + ok_h + (bh - ok_h) / 2, f"{100 - confirmed_pct:.0f} ha\noutside\nSLATS*", ha="center", va="center", fontsize=7.6, color="#552211")
        else:
            ax.text(8.6, 3.2 + bh - 0.15, f"Only {100 - confirmed_pct:.0f} ha\noutside\nSLATS*", ha="left", va="top", fontsize=7.5, color="#552211")
        ax.text(7.2, 2.75, f"~{confirmed_pct:.0f}% area precision\n(2-year rule)", ha="center", va="top", fontsize=7.9, fontweight="bold", color=PAL["forest"])

    draw_dial(ax1, "Dial 1: High Confidence (Main Map)",
              "Best for reporting, prioritisation & quick mapping.\nThreshold p >= 0.40 (alerts_YYYY.gpkg)",
              76, 24, 89, "85% of all cleared hectares", PAL["blue"])

    draw_dial(ax2, "Dial 2: Standard / Wide Net (Candidates)",
              "Best for screening so almost nothing slips through.\nThreshold p >= 0.048 (candidates_YYYY.gpkg)",
              94, 6, 56, "96% of all cleared hectares", PAL["coral"])

    fig.suptitle("Why Brigalow ships TWO alert layers: certainty vs completeness",
                 x=0.02, ha="left", y=1.01, fontsize=11.4, fontweight="bold")
    fig.text(0.02, -0.02,
             "* Area 'outside SLATS' includes real false alarms (drought, fire, bare soil) as well as genuine clearing that fell outside SLATS's mapping window or minimum threshold.\n"
             "Always inspect satellite before/after imagery before drawing conclusions about any individual site.",
             fontsize=7.4, color=PAL["muted"])
    fig.savefig(os.path.join(OUT, "exp4_two_dials.png"), bbox_inches="tight")
    plt.close(fig)


def exp5_fair_test():
    setup()
    fig, ax = plt.subplots(figsize=(10.0, 4.1))
    ax.set_xlim(0, 1); ax.set_ylim(0, 1); ax.axis("off")

    ax.text(0.01, 0.96, "How we made sure Brigalow's accuracy numbers are honest (Zero Peeking)",
            fontsize=11.4, fontweight="bold", color=PAL["ink"], va="top")
    ax.text(0.01, 0.89, "A common trap in AI is tuning settings on the same data you report scores on. Brigalow used two strict firewalls:",
            fontsize=8.4, color=PAL["muted"], va="top")

    # Firewall 1: Time split
    p1 = FancyBboxPatch((0.02, 0.44), 0.56, 0.36, boxstyle="round,pad=0.015,rounding_size=0.025",
                        facecolor="#EEF6FB", edgecolor=PAL["blue"], lw=1.6)
    ax.add_patch(p1)
    ax.text(0.04, 0.76, "Firewall 1: Time Split (Training & Calibration <= 2023)", fontsize=9.2, fontweight="bold", color=PAL["blue"], va="top")
    ax.text(0.04, 0.675, "β€’ Model trained only on 2018-19 through 2022-23 SLATS years\n"
                         "β€’ Probabilities & thresholds calibrated on 12.8M pixels across 2019–2023\n"
                         "  (including the harsh 2019–20 drought years)\n"
                         "β€’ Model & thresholds LOCKED on 28 Nov 2026 before running on 2023-24",
            fontsize=7.9, color="#222", va="top", linespacing=1.42)

    ax.add_patch(FancyArrowPatch((0.59, 0.62), (0.65, 0.62), arrowstyle="-|>,head_length=6,head_width=4", color=PAL["coral"], lw=2.0))
    ax.text(0.62, 0.69, "LOCKED\n(1 shot)", ha="center", va="bottom", fontsize=7.5, fontweight="bold", color=PAL["coral"])

    p2 = FancyBboxPatch((0.66, 0.44), 0.32, 0.36, boxstyle="round,pad=0.015,rounding_size=0.025",
                        facecolor="#FDF2EE", edgecolor=PAL["coral"], lw=1.8)
    ax.add_patch(p2)
    ax.text(0.68, 0.76, "Unseen Test Year: 2023-24", fontsize=9.2, fontweight="bold", color=PAL["coral"], va="top")
    ax.text(0.68, 0.675, "β€’ Run ONCE wall-to-wall across\n  all 250 Queensland tiles\nβ€’ 4.32 billion 20 m pixels\nβ€’ 27,543 SLATS clearings >=1 ha\nβ€’ Never re-tuned after scoring",
            fontsize=7.9, color="#222", va="top", linespacing=1.42)

    # Firewall 2: Space split
    p3 = FancyBboxPatch((0.02, 0.06), 0.96, 0.31, boxstyle="round,pad=0.015,rounding_size=0.025",
                        facecolor="#F1F9F5", edgecolor=PAL["forest"], lw=1.6)
    ax.add_patch(p3)
    ax.text(0.04, 0.33, "Firewall 2: Geographic Hold-Out (Two Whole Bioregions Never Seen in Training)", fontsize=9.2, fontweight="bold", color=PAL["forest"], va="top")
    ax.text(0.04, 0.245, "To prove Brigalow didn't just memorise local trees, two major clearing regions β€” Mulga Lands (3,260 clearings) and Desert Uplands\n"
                         "(1,763 clearings) β€” were excluded from EVERY training year and calibration window. On 2023-24, Brigalow still achieved:\n"
                         "   β€’ Mulga Lands:     95.4% recall / 61.4% precision (standard)  |  83.6% recall / 90.5% precision (high confidence)\n"
                         "   β€’ Desert Uplands:  93.5% recall / 64.2% precision (standard)  |  72.7% recall / 89.4% precision (high confidence, 1.01x SLATS area)",
            fontsize=7.9, color="#222", va="top", linespacing=1.38)

    fig.tight_layout()
    fig.savefig(os.path.join(OUT, "exp5_fair_test.png"), bbox_inches="tight")
    plt.close(fig)


def exp6_strengths_and_limits():
    setup()
    fig, ax = plt.subplots(figsize=(11.6, 5.2))
    ax.set_xlim(0, 1); ax.set_ylim(0, 1); ax.axis("off")

    ax.text(0.01, 0.965, "At a glance: What Brigalow is great at β€” and where to double-check",
            fontsize=11.6, fontweight="bold", color=PAL["ink"], va="top")

    p1 = FancyBboxPatch((0.015, 0.04), 0.455, 0.85, boxstyle="round,pad=0.015,rounding_size=0.025",
                        facecolor="#F0FAF4", edgecolor=PAL["forest"], lw=1.8)
    ax.add_patch(p1)
    ax.text(0.035, 0.86, "WHERE BRIGALOW EXCELS", fontsize=10.0, fontweight="bold", color=PAL["forest"], va="top")
    strengths = [
        ("Broad-scale pasture & block clearing", "94.8% recall (std), 80.6% (high conf) across 20,469 patches."),
        ("Large clearings (>= 25 ha)", "96–98% recall (std) & 88–90% (high); 95.9% of cleared ha."),
        ("Plantations, mines, settlements, roads", "96–99% recall even on sharp geometric footprints."),
        ("Unseen dry-woodland bioregions", "94–95% recall & ~90% high-conf prec (Mulga & Desert Uplands)."),
        ("Running anywhere without state masks", "Sentinel-2-only mode still finds 87% of clearings (94% ha)."),
        ("Consistent across dates & tiles", "0.77 date-subset IoU & 0.91 shift IoU; 99.98% QLD covered."),
    ]
    yy = 0.775
    for head, desc in strengths:
        ax.plot(0.040, yy - 0.012, "o", color=PAL["forest"], ms=7)
        ax.text(0.060, yy, head, fontsize=8.4, fontweight="bold", color=PAL["ink"], va="top")
        ax.text(0.060, yy - 0.042, desc, fontsize=7.5, color="#333", va="top")
        yy -= 0.122

    p2 = FancyBboxPatch((0.525, 0.04), 0.455, 0.85, boxstyle="round,pad=0.015,rounding_size=0.025",
                        facecolor="#FFF5F0", edgecolor=PAL["coral"], lw=1.8)
    ax.add_patch(p2)
    ax.text(0.545, 0.86, "WHERE TO DOUBLE-CHECK (LIMITS)", fontsize=10.0, fontweight="bold", color=PAL["coral"], va="top")
    limits = [
        ("Light thinning & selective forestry", "Standing canopy lowers high-conf recall to 37–42% (use Candidates)."),
        ("Arid floodplains with minimal clearing", "In Channel Country (207 ha SLATS), soil shifts cut prec (1% / 31%)."),
        ("Very small clearings (< 0.52 ha)", "Patches under 13 pixels (20 m grid) are filtered to stop noise."),
        ("Fire scars when fire masks are absent", "In Immediate mode (no current fire map), ~12% of candidates are fire."),
        ("Persistent tropical cloud cover", "9 coastal / Cape York / Torres Strait tiles have <99.5% clear sky."),
        ("Not a legal determination", "Detects physical tree loss only β€” knows nothing of permits/tenure."),
    ]
    yy = 0.775
    for head, desc in limits:
        ax.plot(0.550, yy - 0.012, "o", color=PAL["coral"], ms=7)
        ax.text(0.570, yy, head, fontsize=8.4, fontweight="bold", color=PAL["ink"], va="top")
        ax.text(0.570, yy - 0.042, desc, fontsize=7.5, color="#333", va="top")
        yy -= 0.122

    fig.savefig(os.path.join(OUT, "exp6_strengths_and_limits.png"), bbox_inches="tight")
    plt.close(fig)


def main():
    os.makedirs(OUT, exist_ok=True)
    for fn in [exp1_how_satellites_see, exp2_three_seasons, exp3_local_contrast_and_committee,
               exp4_two_dials, exp5_fair_test, exp6_strengths_and_limits]:
        fn()
        print("wrote", fn.__name__)


if __name__ == "__main__":
    main()