Superconductors

Extracts synthesis procedures and critical temperatures (Tc) from superconductor papers. Tc is read twice — once from the text, and once geometrically from ρ(T) or R(T) plots — which gives a built-in cross-check on both readings.

Sourceexamples/scripts/case_study_superconductors/

ScriptWhat it does
keyword_search.pyFilters LeMat-Synth-Papers by the Superconductor category and the keyword resistivityresults/db_superconductors.pkl
downsample_with_llm.pyGemini pass that keeps only papers with a genuine ρ(T)/R(T) plot
run.pyStandard batch run — synthesis + text Tc + VLM Tctc_master.csv
batch_run_tc.pyEarlier standalone Tc runner, kept for reproducing published numbers
batch_run_tc_new_snippet.pyAdds a bottom-left crop (“snippet”) VLM pass for hard-to-read plots → tc_master_snippet.csv

Matching exploratory notebooks live in examples/notebooks/dev/: superconductivity_tc_extraction.ipynb (single-paper walkthrough), superconductivity_tc_extraction_plus_snippet.ipynb (same, with the snippet pass), visualisation_tc.ipynb (Tc-vs-year, text/VLM agreement, synthesis-method breakdowns) and visualisation_tc_with_human_annotation.ipynb (the same plots against human annotations).

Note
Notebooks under examples/notebooks/dev/ are working copies: they are kept runnable but are not maintained to the same standard as the tutorials.

Step 1 — Build a corpus

Screen the published paper dataset down to plausible candidates:

uv run examples/scripts/case_study_superconductors/keyword_search.py

Filters on the Superconductor category field and the keyword resistivity in abstracts, writes results/db_superconductors.pkl, and opens a pull request on HuggingFace with the filtered subset.

Step 2 — Downsample with an LLM

Requires GEMINI_API_KEY. Verifies each paper actually contains a ρ(T) or R(T) plot rather than a pure field-sweep study:

# Concise prompt
uv run examples/scripts/case_study_superconductors/downsample_with_llm.py --prompt default

# Detailed prompt with explicit magnetic-field exclusion rules (recommended)
uv run examples/scripts/case_study_superconductors/downsample_with_llm.py --prompt long

Pushes the filtered list to HuggingFace and downloads up to 100 sample PDFs.

Step 3 — Extract

uv run examples/scripts/case_study_superconductors/run.py <pdf_dir> <output_dir> \
    --skip-existing

Writes one JSON per paper plus a growing tc_master.csv — one row per (paper, material) with both the text-derived and plot-derived Tc.

Flags: --max N (first N papers only), --skip-existing (resume an interrupted run), --skip-figures (text-only, no VLM — much faster and cheaper).

Defaults: gemini-3.0-flash for synthesis and linking, gemini-3.0-pro for material extraction, claude-sonnet-4-20250514 for plot reading. Edit the constants at the top of run.py to change them.

Snippet-based extraction for hard plots

Some ρ(T) curves drop to zero in a small corner of a busy multi-panel figure. batch_run_tc_new_snippet.py adds a second VLM pass over a bottom-left crop of each plot, which recovers the transition when the full-figure read misses it:

uv run examples/scripts/case_study_superconductors/batch_run_tc_new_snippet.py \
    /path/to/superconductor_pdfs --skip-existing

Outputs <pdf_folder>/results_snippet/tc_master_snippet.csv.


What makes this domain different

The domain config is DomainConfig.for_superconductivity(), which differs from the generic pipeline in three ways:

  1. Plot filterPlotFilterConfig.for_superconductivity() keeps resistance and resistivity against temperature, and vetoes anything mentioning field, so magnetoresistance panels never reach the VLM.
  2. Material prompt — asks for each doping level and stoichiometry as a separate entry, because Tc is what varies between them.
  3. A domain metric processor — an extra VLM pass that locates the superconducting transition on the curve, rather than just digitising it.

That third piece is a BaseVLMMetricProcessor; see Building your own case study for how to write one.