- Add demo_renders/ (LFS-tracked) with 96 pre-rendered example images
for all CV and TPD mechanisms
- Add example dropdown + gallery preview to CV and TPD "From Image" tabs
- Users can select a mechanism, preview expected outputs, and load
physical images as input with pre-filled scan rates / heating rates
Made-with: Cursor
Add example loader for CV and TPD demo data
Bing Yan
7fcacad
- Add dropdown + "Load Example" button in both CV and TPD tabs
so users can try the demo without uploading their own data
- Auto-discovers 6 CV and 6 TPD examples from demo_data/ metadata
- Pre-fills file uploads, scan rates/heating rates, and physical params
- Remove "in milliseconds" from subtitle (demo runs on CPU)
Made-with: Cursor
Restore full app.py with multi-image support and all prior fixes
Bing Yan
e854c2f
Restores from commit 58cb8ee which had:
- Multi-image upload for CV and TPD (one image per scan rate)
- Per-image axis detection via OCR
- Per-image current unit detection
- Robust tick fitting and outlier removal
- Median E0 estimation across images
- Current unit dropdown (auto/µA/mA/A/nA)
Then applies the recent UI cleanup:
- Remove summary markdown tables, use param_table figure instead
- Clean sequential layout: classification -> dropdown -> posteriors+table -> recon -> conc
- Horizontal advanced parameters layout
Made-with: Cursor
Move advanced parameters under scan rates in horizontal layout
Bing Yan
c63c873
- All input sections now flow vertically: upload -> rates -> advanced accordion -> analyze
- Advanced parameters laid out horizontally in rows (3 per row for CV CSV)
- Axis overrides also horizontal (4 fields in one row)
- Posterior samples slider + Analyze button in a single row at the bottom
- Consistent layout across all 4 input tabs (CV CSV, CV Image, TPD CSV, TPD Image)
Made-with: Cursor
Clean up result display: remove summary tables, show figures only
Bing Yan
94f60e1
- Remove markdown summary text and all mechanism probability tables
- Layout: classification plot -> mechanism dropdown -> posteriors + param table -> reconstruction -> concentration
- Parameter estimates shown as a matplotlib table figure instead of markdown
- Remove _build_summary_text, _build_mechanism_summary, _format_mech_name
- Simplify callbacks to return only plot figures
Made-with: Cursor
- Add full mechanism names to classification bar chart and probability tables
- Mechanism dropdown now updates the summary/parameter table (not just plots)
- Add _build_mechanism_summary() for per-mechanism parameter display
- Remove "oxidative"/"reductive" labels from concentration profile arrows
- Reorganize output layout: classification plot + summary side by side
- Define mechanism abbreviations (MECH_FULL_NAMES_EC/TPD) in both app.py and plotting.py
Made-with: Cursor
Fix theme parameter: move from launch() to Blocks() constructor
Bing Yan
72c624f
Made-with: Cursor
Switch TPD to Summary-ECFlow model (21-dim hand-crafted features)
Bing Yan
ad63797
- Replace v8 full-signal TPD model with Summary-ECFlow ablation checkpoint
(better classification: LH_Surface 99.5% vs 78.1%, all 6 mechs correct)
- Add extract_tpd_summary_stats() to preprocessing.py for feature extraction
- Update inference.py to auto-detect use_summary_features from checkpoint args
and compute/pass summary features during prediction
- Regenerate FirstOrder TPD demo data (sample_000090) for better compatibility
Made-with: Cursor
Switch to v9 EC + v8 TPD noise-augmented models for robustness
Bing Yan
0da091b
EC: v9 noise-augmented (93% clean, 87% noisy accuracy) — best balance
of precision and robustness for real user data. Supports all 6 mechanisms.
TPD: v8 noise-augmented (93% clean, 92.5% noisy accuracy) — best
noise-robust classification across all 6 TPD mechanisms.
Also regenerated FirstOrder TPD demo data (previous sample was
confusable with LH_Surface across all model versions).
Made-with: Cursor
Fix image digitization: robust axis tick disambiguation and mapping
Bing Yan
58cb8ee
Three fixes for image-based CV analysis:
1. Improved tick disambiguation: when OCR detections appear in both
x-axis and y-axis candidate lists (bottom-left corner), assign
each to the axis whose alignment coordinate it matches better,
instead of filtering by position distance from median.
2. Robust tick-to-pixel mapping: when OCR misses intermediate tick
labels (e.g. only detecting [0.5, -1.0, -1.5] instead of
[1.0, 0.5, 0.0, -0.5, -1.0, -1.5]), the simple polyfit produces
a wrong slope. New _robust_tick_fit uses the minimum |Δvalue/Δpixel|
ratio among adjacent pairs as the true scale.
3. Outlier tick removal and decimal misread correction: detects OCR
misreads like "1.0" → "10" using leave-one-out residuals and
decimal-point-drop heuristics.
Also widened left margin crop (8% → 12%) for y-axis unit detection
and added "HA" as OCR misread pattern for "µA".
Made-with: Cursor
Switch to v7 model checkpoints to support all 6 EC mechanisms including Nernst
Bing Yan
41896af
v8 model was not trained on Nernst data. Reverting to v7 which supports
BV, MHC, Ads, EC, LH, and Nernst. Added Nernst demo data (96.2% confidence).
Made-with: Cursor
Fix CSV parser column detection and regenerate LH demo data
Bing Yan
c2d475b
1. Fix parse_cv_csv: the generic pattern ("i", 1.0) was matching
"potential" as a substring, causing both e_col and i_col to point
to column 0. Now tracks assigned columns to prevent double-matching.
2. Regenerate LH demo data: the previous LH sample had asymmetric
peaks that caused estimate_E0 to be off by 30mV, shifting theta
enough to confuse the classifier. New sample (sample_125030) has
<3mV E0 estimation error and classifies as LH with 99.7% confidence.
3. Remove Nernst demo data: Nernst mechanism was not included in the
v8 training dataset (0 samples), so the model cannot classify it.
All 5 EC mechanisms now classify correctly:
BV 60%, MHC 99.3%, Ads 100%, EC 100%, LH 99.7%
Made-with: Cursor
Switch to v8 last-epoch checkpoints (ep400)
Bing Yan
cbd2bfa
Last-epoch checkpoints outperform best-val-loss checkpoints on demo data:
- EC: Avg R² 0.973 vs 0.971, better EC recon (0.874 vs 0.866)
- TPD: Higher confidence on SecondOrder (96% vs 87%), LH_Surface (78% vs 70%)
Made-with: Cursor
Upgrade to v8 model checkpoints
Bing Yan
6c7a5ad
Replace v7 checkpoints with v8 (noise augmentation) models:
- EC: epoch 360 from multi_variablescan_v8_noiseaug (best val loss -7.53)
- TPD: epoch 160 from tpd_multiheat_v8_noiseaug (best val loss 5.91)
v8 models were fine-tuned from v7 with noise augmentation and improved
calibration, providing better robustness to noisy real-world data.
Made-with: Cursor
Update parameter table when mechanism selection changes
Bing Yan
5382ec4
The parameter inference table and reconstruction metrics now update
when the user selects a different mechanism from the dropdown.
Previously only the posterior and reconstruction plots changed.
Also adds reconstruction NRMSE/R² to the summary card.
Made-with: Cursor
Tick-based pixel-to-data mapping and OCR minus-sign recovery
Bing Yan
7eb0f3b
Two critical fixes for image digitization accuracy:
1. Tick-position mapping: Instead of mapping axis-line endpoints to
x_min/x_max, use OCR tick positions (pixel, value) pairs to fit a
linear mapping via polyfit. This correctly extrapolates for data
extending beyond the last tick mark. Previously, data beyond the
rightmost tick (e.g. 0.3 V) was mapped to 0.3, truncating the
E range. Now the full range is captured (matching CSV to <0.001 V).
2. Monotonicity-based minus-sign recovery: OCR frequently drops minus
signs from tick labels (e.g. "-0.1" read as "0.1", "-40" read as
"10"). New _fix_missing_negatives tries all 2^n sign assignments
and picks the one producing the most evenly-spaced monotonic
sequence, correctly recovering dropped negatives.
Result on BV demo images: classification BV 89% (was EC 94%),
reconstruction R²=0.995 (was 0.78), E0 error <0.003 V (was 0.05 V).
Made-with: Cursor
Per-image axis bounds and current unit detection
Bing Yan
ba72d0f
- Fix OCR: handle tilde (~) as minus sign in tick label parsing
- Add y-axis unit detection: rotate left margin 90° and OCR to read
the rotated axis label (e.g. "I (µA)" vs "I (mA)")
- Handle OCR misreading µ as M (uppercase MA → µA)
- auto_detect_axis_bounds now returns per-image bounds with y_unit
- Add current unit dropdown (auto/µA/mA/A/nA) to image analysis UI
- Use median E0 across all images (matching CSV path behavior)
- Two-pass processing: digitize all images first, then nondimensionalize
with shared E0
Each uploaded image now gets independent axis range detection and
unit identification, so images with different current scales (e.g.
µA at slow scan rates, mA at fast) are handled correctly.
Made-with: Cursor
Support multiple image uploads for CV and TPD analysis
Bing Yan
8e295bb
Both image tabs now accept multiple files (one per scan rate / heating
rate) via gr.File with file_count="multiple", matching the CSV tab
pattern. Each image is independently digitized with per-image OCR axis
detection, then all curves are fed to the model together.
This enables multi-scan-rate image analysis, which dramatically
improves classification accuracy (e.g. BV vs MHC disambiguation).
Made-with: Cursor
Rewrite image digitizer: column-scan instead of contour tracing
Bing Yan
7e3de92
The contour-based approach traced the outline of the ink blob, producing
zigzag artifacts from alternating top/bottom edges of the curve line.
This caused huge flux oscillations and wrong classification.
New approach scans each pixel column independently:
- For each x column in the plot region, find clusters of dark pixels
- Take the midline (mean row) of each cluster
- If two clusters exist (CV closed loop), separate into upper/lower branches
- Construct proper potentiostat-style sweep: high E → low E → high E
Results on test BV image:
- Before: NRMSE=0.23, R²=-0.24, classified as Ads
- After: NRMSE=0.05, R²=0.95, classified as MHC/BV (expected ambiguity
with single scan rate; CSV with 3 rates correctly gives BV)
Made-with: Cursor
Fix image digitization: proper axis detection and CV loop extraction
Bing Yan
0823f22
Root cause: digitizer used contour bounding box as plot area, producing
wrong pixel-to-data mapping. CV closed loops were also not handled,
causing interleaved forward/reverse sweeps.
Fixes:
- Use HoughLinesP to detect actual axis lines for plot area boundaries
- Mask curve extraction to detected plot region (excludes labels/title)
- Add _extract_cv_trace to properly split closed-loop CVs into
forward (upper) and reverse (lower) sweeps via y-binning
- Switch default threshold from 128 to 0 (Otsu auto-threshold)
- Use more aggressive morphological closing (5x5, 2 iterations)
to connect thin/broken curve segments
Tested: BV CV image now correctly classified as BV (90.8%) instead
of Ads, with proper nondimensionalized flux range (~0.1).
Made-with: Cursor
Show full mechanism names in classification bar chart
Bing Yan
621a722
Adds full-name mappings (e.g. BV → Butler–Volmer, MHC → Marcus–Hush–Chidsey)
so abbreviations are defined on first encounter in the bar chart y-axis labels.
Made-with: Cursor
Add back scan direction arrows on concentration profiles without labels
Bing Yan
8e57515
Made-with: Cursor
Redesign UI layout and fix plot rendering issues
Bing Yan
32e051e
- Restructure results: preprocessing info first, then classification,
parameter inference, reconstruction, and concentration profiles
- Move advanced parameters to horizontal layout under scan rates
- Update instructions with Time(s) as optional column and header examples
- Fix cropped plot titles (use tight_layout rect instead of suptitle y offset)
- Move NRMSE/R2 metrics into subplot titles to avoid legend overlap
- Show legend only on first subplot to reduce clutter
- Remove oxidative/reductive sweep annotations from concentration plots
- Use median instead of mean for parameter estimates
- Add preproc-card CSS styling for preprocessing info
Made-with: Cursor
- Centered header with description instead of raw markdown
- Summary card with styled parameter table
- KDE posterior plots with rug marks replacing violin plots
- Higher DPI (140), tighter figure sizing
- Custom CSS for spacing, card styling, section headings
- Cleaner About tab with comparison table
Made-with: Cursor
Fix: pin Gradio 5.29.0 to fix API info crash
Bing Yan
d47e6c6
Made-with: Cursor
Fix: move theme to gr.Blocks() for Gradio 5
Bing Yan
ae4a09a
Made-with: Cursor
Fix: replace gr.update() with gr.Dropdown() for Gradio 5 compat
Bing Yan
09e4689
Made-with: Cursor
Fix: upgrade to Gradio 5.x for Python 3.13 compatibility
Bing Yan
890bfac
Made-with: Cursor
Initial ECFlow deployment
Bing Yan
d6b782e
Amortized Bayesian inference for mechanism identification and parameter
estimation in electrochemistry (CV) and catalysis (TPD).
- v7 targeted calibration checkpoints (EC + TPD)
- Gradio web UI with CSV and image upload
- Demo data for all 12 mechanisms
Made-with: Cursor