TASK: Generate publication-quality, O-Prize-standard visuals for an MCM/ICM paper on smartphone battery drain. You MUST output the COMPLETE generation code for each required figure (plots + flowcharts/diagrams), plus a single “run-all” entrypoint that reproduces every figure deterministically. CRITICAL REQUIREMENT (NON-NEGOTIABLE): PRESERVE EXISTING CONTENT INTEGRITY - You MUST NOT rewrite, restructure, or renumber ANY existing paper sections or text. - You MUST NOT change any existing model equations or definitions. - Your job is ONLY to output code + figure manifest + validation checks that produce the visuals. - Do NOT output new narrative paragraphs for the paper (captions are allowed only as a separate manifest field). INPUTS (use only the uploaded files + user-provided data paths): A) “Required diagrams list” markdown: defines the figure lineup and intent for Fig 1–15. B) Current model/paper markdown: defines variables and equations (z, v_p, T_b, S, w; L, C, N, Ψ, T_a; power mapping; CPL closure; etc.). C) Any existing workflow/flowchart markdown (e.g., Mermaid) if provided. D) Simulation outputs / datasets: YOU MUST NOT invent filenames. Instead, you must require a user-editable config file to provide file paths. DETERMINISM REQUIREMENTS: - Fix all random seeds (one global seed constant). - No dependence on system time. - All figures must be reproducible bitwise given identical inputs. - Use explicit figure sizes, DPI, font sizes, line widths, and layout parameters. - Avoid any “automatic styling” that can vary by environment. VISUAL QUALITY REQUIREMENTS (O-Prize standard): - Export BOTH vector and raster: - Vector: PDF (preferred) or SVG for diagrams. - Raster: PNG at 300+ DPI for embedding. - Consistent typography and sizing: - Use a serif family (Times-like), mathtext enabled. - Axis labels with units, readable ticks, uncluttered legends. - No chartjunk: remove unnecessary spines, avoid overcrowding, use consistent margins. - Every figure must have a clear “message” aligned with the diagram spec. ALLOWED TOOLS / LIBS (Python): - matplotlib (primary plotting) - numpy, pandas - scipy (curve fitting if needed) - graphviz (preferred for flowcharts/diagrams via DOT) - (Optional) matplotlib 3D for surfaces; must remain deterministic OUTPUTS YOU MUST PRODUCE (exact order): 1) FIGURE_MANIFEST_v1 (JSON) 2) CODE_PACKAGE_v1 (multiple code files; each in its own code fence with file path header) 3) RUN_INSTRUCTIONS_v1 (plain text; exact commands) 4) VALIDATION_REPORT_v1 (JSON schema + what each check prints) ──────────────────────────────────────────────────────── METHODOLOGY (follow exactly) ──────────────────────────────────────────────────────── STEP 1 — Parse the required figure specification - Read the “required diagrams list” markdown and extract Fig 1–15. For each figure, store: - fig_id (1..15) - title (verbatim) - intended location/section (if provided) - required chart type (flowchart, 3D surface, stacked area, heatmap, etc.) - required axes/annotations (e.g., ΔTTE arrow, R² > 0.99 display, “95% Confidence TTE” marker) Do NOT add or remove figures. STEP 2 — Define a strict data contract via a user-editable config Because you cannot assume filenames, you MUST implement: - config/figure_config.yaml This YAML must specify input paths for each figure, such as: - ocv_samples_csv - scenario_trajectories: mapping scenario_name -> csv_path - mc_trajectories_path or mc_summary_csv (TTE samples) - sensitivity_results_csv or parameter_sweep_csv - heatmap_grid_csv (T_a, Ψ, TTE) - aging_lifecycle_csv (cycle, SOH, TTE_full) - radar_scores_csv (mode, metrics...) Each figure script MUST read only its declared inputs from this config. STEP 3 — Enforce a common plotting style module (single source of truth) Create scripts/plot_style.py that: - Sets matplotlib rcParams (font family, font size, mathtext, line width, figure dpi for save) - Defines helper utilities: - save_figure(fig, out_basepath): writes .pdf and .png (png at >=300 dpi) - format_axes(ax): consistent grid/ticks/spines All figure scripts MUST import and use plot_style.py. STEP 4 — Implement one script per figure (Fig 01 … Fig 15) Folder: scripts/figures/ Naming: - fig01_macro_logic_flowchart.py - fig02_system_interaction_diagram.py ... - fig15_radar_user_guide.py Each figure script MUST: - Define a single public function: make_figure(config: dict) -> dict - Return a dict containing: - output_files: list[str] - computed_metrics: dict (e.g., R², quantiles) - validation_flags: dict[str,bool] - Save outputs under figures/ with fixed filenames: figures/Fig01.pdf, figures/Fig01.png, ... figures/Fig15.* STEP 5 — Required figure-by-figure implementation details You MUST implement all figures listed below exactly as specified. FIG 1 (Macro-Logic Flowchart) - Type: diagram/flowchart - Tool: Graphviz DOT (preferred) + python wrapper to render - Nodes: Data Processing → Core Modeling → Application (must match spec wording) - Output: Fig01.pdf + Fig01.png FIG 2 (System Interaction Diagram) - Type: diagram - Must show inputs around system: L, C, N, G (GPS proxy), T_a; outputs: TTE, SOH - Use Graphviz DOT with clusters: Inputs / Internal Modules / Outputs - Output: Fig02.* FIG 3 (OCV Curve Fitting) - Inputs: ocv_samples_csv with columns: z, V_oc_meas - Method: Fit to the paper’s chosen OCV form (use the exact OCV function from the paper markdown) - Plot: scatter of data + fitted curve line - Display: R² in the plot (must meet threshold in validation) - Output: Fig03.* FIG 4 (Internal Resistance Surface) - Inputs: either (a) parameterized function R0(T_b,z or S) OR (b) a grid csv with columns (T_b, z, R0) - Plot: 3D surface with labeled axes and units - Output: Fig04.* FIG 5 (Tail Energy Illustration) - Inputs (preferred): a trajectory csv containing time, N(t), w(t), P_net(t) OR a small synthetic pulse-definition in config - Plot: two-panel figure: - Top: data burst indicator (N or packet events) - Bottom: power state persistence (P_net or tail component k_tail*w) - Must visually demonstrate “short burst → long tail” - Output: Fig05.* FIG 6 (CPL Avalanche Loop) - Type: causal loop diagram - Must show: V↓ → I↑ → Loss↑ → V↓↓ (exact concept) - Use Graphviz DOT with arrow labels - Output: Fig06.* FIG 7 (Baseline Validation 2×2) - Inputs: baseline trajectory csv with columns (t, z, V_term, I, T_b) - Plot: 2×2 subplots: SOC, Voltage, Current, Temperature vs time - Must visually confirm CPL signature: as V_term declines, I increases (include a note/annotation) - Output: Fig07.* FIG 8 (Power Breakdown Stacked Area) - Inputs: baseline trajectory csv with columns (t, P_bg, P_scr, P_cpu, P_net, [P_gps if present]) - Plot: stacked area of power components vs time - Output: Fig08.* FIG 9 (Scenario Comparison & GPS Impact) - Inputs: multiple scenario csvs with columns (t, z) and TTE summary values - Plot: overlay 3–4 SOC curves (baseline, video, gaming, navigation) - Must annotate ΔTTE due to GPS/navigation with a double-arrow and numeric label - Output: Fig09.* FIG 10 (Tornado Diagram) - Inputs: sensitivity_results_csv with columns: parameter_name, low_TTE, base_TTE, high_TTE (or delta) - Plot: horizontal tornado bars sorted by absolute impact - Must include GPS, signal quality, temperature, brightness (as available) - Output: Fig10.* FIG 11 (Two-Parameter Heatmap) - Inputs: heatmap_grid_csv with columns: T_a, Psi, TTE - Plot: heatmap (T_a on x, Psi on y) colored by TTE (hours) - Output: Fig11.* FIG 12 (Monte Carlo Spaghetti Plot) - Inputs: mc_trajectories file(s) OR a single tidy csv: run_id, t, z - Plot: many thin SOC curves + one thick mean curve - Use fixed seed only for any sampling/downselection - Output: Fig12.* FIG 13 (Reliability / Survival Curve) - Inputs: tte_samples_csv with column: TTE - Plot: empirical survival S(t)=P(TTE>t) as a step function - Must mark “95% Confidence TTE” = 5th percentile (or specify explicitly) with a vertical line + label - Output: Fig13.* FIG 14 (Lifecycle Degradation) - Inputs: aging_lifecycle_csv with columns: cycle_index, SOH, TTE_full - Plot: dual-axis (SOH vs cycle, TTE_full vs cycle) with clear legends and units - Output: Fig14.* FIG 15 (User Guide Radar Chart) - Inputs: radar_scores_csv with columns: mode, screen, cpu, location, network, experience (or exact metrics listed) - Plot: radar comparing “power-saving mode” vs “high-performance mode” - Output: Fig15.* STEP 6 — Add a run-all pipeline Create run_all_figures.py that: - Loads config/figure_config.yaml - Calls each make_figure in numerical order - Writes a single artifacts/figure_build_report.json with metrics + flags - Exits with non-zero code if any validation fails STEP 7 — Validation (must be implemented, not just described) Each figure must have at least one deterministic validation check: - Fig03: R² >= 0.99 (configurable threshold but default 0.99) - Fig07: correlation check showing CPL tendency (e.g., corr(V_term, I) < 0 under baseline) - Fig09: ΔTTE annotation value matches computed TTE difference within tolerance - Fig12: M >= 100 runs unless user sets otherwise - Fig13: survival curve starts at 1 and ends near 0; 95% marker equals empirical percentile - All plots: output files exist and are non-empty; axis labels present ──────────────────────────────────────────────────────── DELIVERABLE FORMATS (STRICT) ──────────────────────────────────────────────────────── 1) FIGURE_MANIFEST_v1 (JSON only) Schema: { "global": { "seed": 12345, "output_dir": "figures", "formats": ["pdf","png"], "dpi_png": 300 }, "figures": [ { "fig_id": 1, "title": "...", "script": "scripts/figures/fig01_....py", "inputs_from_config": ["..."], "outputs": ["figures/Fig01.pdf","figures/Fig01.png"], "caption_suggestion": "..." }, ... ] } 2) CODE_PACKAGE_v1 - Output multiple code fences. - Each code fence MUST start with a single line comment containing the file path, e.g.: # scripts/plot_style.py - Include at minimum: - config/figure_config.yaml (template with placeholders) - scripts/plot_style.py - scripts/config_io.py (loads yaml) - scripts/validation.py (shared checks) - scripts/figures/fig01_*.py … scripts/figures/fig15_*.py - run_all_figures.py - requirements.txt 3) RUN_INSTRUCTIONS_v1 (plain text) Must include exact commands: - pip install -r requirements.txt - python run_all_figures.py 4) VALIDATION_REPORT_v1 (JSON only) Schema: { "status": "PASS" or "FAIL", "failed_figures": [ ... ], "details": { "Fig03": {"R2": 0.995, "pass": true}, ... } } FORBIDDEN: - Do NOT modify paper text. - Do NOT invent data. If a required input path is missing in config, raise a clear error message and stop. - Do NOT output partial scripts; every file must be complete and runnable. - Do NOT output any additional commentary outside the four deliverables. NOW EXECUTE: produce the four deliverables exactly.