analysis-protocol
Skill0 starsChanged 6 months agoMITView on GitHub
Evidence gate for spectroscopic peak-fitting / deconvolution. Run fit_validator.py after every lmfit (or equivalent) deconvolution before emitting any figure, bar chart, or written claim. Hard-fails on bad fits (parameter at bound, vestigial amplitude, large residual, high reduced chi-square, raw-envelope mismatch); soft-flags rank disagreement for human review. Generic across NH3-TPD, Py-DRIFTS, TPO, XPS, XRD deconvolution.
In this repository15 other files it gives its agents.
- blender-atom-renderSkill
- corpus-phrase-checkSkill
- docx-scientific-formattingSkill
- html-minimalSkill
- layout-guardSkill
- matplotlib-scientificSkill
- paper-sectionsSkill
- paper-sentence-loopSkill
- paper-styleSkill
- reference-crosscheckSkill
- slide-auditSkill
- smart-compactSkill
- transcript2htmlSkill
- youtube2mp4Skill
- youtubeSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
After every lmfit (or equivalent) deconvolution — XPS, NH3-TPD, Py-DRIFTS, TPO, XRD, etc.
- Very specific: line 43
If quant or visual fail lists are non-empty: HARD FAIL — do not emit anything.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
analysis-protocol — fit validation gate
This is the shareable, self-contained core of a larger experimental-data analysis protocol. Two pieces ship here:
fit_validator.py— a mandatory validator that decides whether a peak-fitting result is trustworthy enough to become a figure or a claim.METHODOLOGY.md— a generic, vendor-neutral methodology reference for 12 catalyst-characterization techniques (XPS, XRD, H2-TPR, NH3-TPD, BET, CO-chemisorption, CO-DRIFTS, GC, Raman, TEM/STEM, TGA, XAS).
The original protocol also wired a private, workflow-specific methodology library (tuned per-technique parameter databases, figure standards, project configs) that is deliberately not included — only the generic engine and methodology reference are shared here.
When to use
After every lmfit (or equivalent) deconvolution — XPS, NH3-TPD,
Py-DRIFTS, TPO, XRD, etc. — and before you draw the figure or write the
sentence that depends on it.
How it works
fit_validator.py runs three check categories:
- Quant (hard) — parameter pinned at its boundary, vestigial peak amplitude, residual norm over threshold, reduced chi-square over threshold.
- Visual (hard) — raw signal vs. fitted envelope correlation, peak amplitude positivity.
- Sanity (soft) — fitted-quantity rank vs. an expected activity/stability rank. Surfaced as a warning, never auto-corrected: it forces a human decision between "the fit is wrong" and "the fit is right but the narrative needs a different descriptor".
If quant or visual fail lists are non-empty: HARD FAIL — do not
emit anything. Loosen bounds / change peak count / change peak function /
expand the fit window, retry up to ~5 times, then escalate.
Usage
from fit_validator import validate_fit
report = validate_fit(
result=lmfit_result,
raw_y=y_raw,
envelope_y=lmfit_result.eval(x=x_raw),
peaks=[(p.name, p.value) for p in lmfit_result.params.values()
if 'amplitude' in p.name],
sample_values={"SampleA": 1.0e6, "SampleB": 1.5e6}, # optional
expected_rank={"SampleA": 1, "SampleB": 2}, # optional
descriptor_name="total acid site density", # optional
)
if report['quant'] or report['visual']:
... # HARD FAIL: do not output; self-iterate or escalate
else:
for w in report['sanity_flag']:
... # WARN: human review
... # OK to output figure / bar / narrativeThe sample_values / expected_rank / descriptor_name arguments are
optional — omit them to run only the hard quant + visual gates.
Dependencies
numpy, and an lmfit (or compatible) result object exposing .params
and .redchi.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

