
Description
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.
SKILL.md
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.py
To 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_spectroscopy
Workflow
- 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.py
More skills from the Quantum-Calibration-Agent-Blueprint repository
View all 6 skillsexperiment-execution
run quantum calibration experiments
Jul 14BenchmarkingNVIDIAQuantum ComputingSimulationvlm-configuration
configure Vision Language Models
Jul 14AI InfrastructureLLMNVIDIAworkflow-execution
execute quantum calibration workflows
Jul 14AutomationNVIDIAQuantum ComputingWorkflow Automationworkflow-planning
plan quantum calibration workflows
Jul 14NVIDIAPlanningQuantum ComputingWorkflow Automationwriting-experiment-scripts
author quantum experiment scripts
Jul 14LaboratoryNVIDIAPythonQuantum Computing
More from NVIDIA
View publishernemoclaw-user-guide
retrieve NemoClaw documentation and configuration
NemoClaw
Jul 20DocumentationMCPSearchmcore-build-and-dependency
manage Megatron-LM development environments
Megatron-LM
Jul 14ContainersDeploymentPythonmcore-bump-base-image
update NVIDIA PyTorch base images
Megatron-LM
Jul 14CI/CDDeploymentmcore-cicd
manage CI/CD pipelines for Megatron-LM
Megatron-LM
Jul 14CI/CDDeploymentGitHubmcore-create-issue
investigate CI failures and create issues
Megatron-LM
Jul 14DebuggingGitHubTriagemcore-linting-and-formatting
lint and format Megatron-LM code
Megatron-LM
Jul 14Best PracticesCode Analysis