analysis-scripts
Skill69 starsChanged 7 months agoApache-2.0View on GitHub
Write and run Python scripts to analyze quantum experiment data stored in HDF5 files. Use when the user asks to analyze experiment results, fit peaks or curves, extract features from measurement arrays, or when reusable analysis logic should be saved alongside an experiment for future reuse.
In this repository5 other files it gives its agents.
- experiment-executionSkill
- vlm-configurationSkill
- workflow-executionSkill
- workflow-planningSkill
- writing-experiment-scriptsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Write Python scripts to analyze experiment data.
- Very specific: line 90
Check for existing scripts: ls {file_path.replace('.h5', '_scripts/')}
- Distinctive: line 91
If script exists: run it
- Distinctive: line 92
If not: write new script using template, then run it
≈ “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 Scripts
Write Python scripts to analyze experiment data. Scripts are saved alongside the experiment for reuse.
Storage Location
Scripts go in a subfolder next to the experiment's HDF5 file:
data/experiments/
├── YYYYMMDD_HHMMSS_type.h5 # Experiment data
└── YYYYMMDD_HHMMSS_type_scripts/ # Scripts for this experiment
└── analysis_name.pyTo find the scripts folder:
- Get experiment:
lab(action="history_show", experiment_id="...") - Response includes
file_path(e.g.,.../20240315_143022_qubit_spectroscopy.h5) - Scripts folder: replace
.h5with_scripts/
Script Template
#!/usr/bin/env python
"""Description of what this script does."""
import sys
import json
from pathlib import Path
# Import core storage
from core import storage
DATA_DIR = Path(__file__).parent.parent.parent # data/experiments/
# Get experiment ID from command line
experiment_id = sys.argv[1]
# Load experiment data
exp = storage.load_experiment(experiment_id, DATA_DIR)
if exp is None:
print(json.dumps({"error": f"Experiment {experiment_id} not found"}))
sys.exit(1)
data = exp.to_dict()
# =============================================================================
# Your analysis code here
# =============================================================================
import numpy as np
# Available data:
# data['params'] - input parameters dict
# data['results'] - scalar results dict
# data['arrays'] - numerical arrays dict (e.g., frequencies, amplitudes)
# data['plots'] - plot data list
# Example:
# frequencies = np.array(data['arrays']['frequencies'])
# amplitudes = np.array(data['arrays']['amplitudes'])
result = {
"status": "success",
# your results here
}
print(json.dumps(result))Running a Script
python /path/to/script.py <experiment_id>Example:
python data/experiments/20240315_143022_qubit_spectroscopy_scripts/fit_peak.py 20240315_143022_qubit_spectroscopyWorkflow
- User asks to analyze an experiment
- Get experiment info:
lab(action="history_show", experiment_id="...") - Check for existing scripts:
ls {file_path.replace('.h5', '_scripts/')} - If script exists: run it
- If not: write new script using template, then run it
Finding Scripts from Similar Experiments
# Find experiments of same type
lab(action="history_list", filter_type="qubit_spectroscopy")
# Check each for scripts
ls data/experiments/20240315_143022_qubit_spectroscopy_scripts/
# Read a script to copy/adapt
cat data/experiments/.../fit_peak.pyDoes 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.

