Agent skill
vector-awkward
Use when working in Python with scikit-hep vector and Awkward Array to build vector records, register behaviors, compute deltaR or invariant masses, combine or boost vectors, or access vector properties from ak.zip records of type (Momentum3D/Momentum4D/Vector4D). Vector is only useful if you are also using Awkward.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/vector-awkward
SKILL.md
Vector Awkward
Overview
Create Awkward Arrays that behave like vector objects and use vector methods without writing custom kinematic math. Use these steps to register behaviors, build records with the right field names, and perform common HEP operations like deltaR and invariant mass.
Quick Start
- Register vector behaviors once per session:
import vector
vector.register_awkward()
- Build vector records with standard field names and a vector type name:
import awkward as ak
events = ak.Array({
"electron": ak.zip(
{"pt": [50.0, 30.2], "eta": [1.4, -0.8], "phi": [2.1, 0.5], "mass": [0.0005, 0.0005]},
with_name="Momentum4D",
)
})
Build Vector Records
- Use
ak.zip(..., with_name="Momentum3D")for 3D operations like deltaR. - Use
ak.zip(..., with_name="Momentum4D")for 4D operations like invariant mass or boosts. - Prefer standard names like
pt/eta/phi/massorpx/py/pz/Eso vector can infer coordinate systems. - Call
vector.register_awkward()before accessing vector properties or methods.
Access Vector Properties
particles = ak.zip({"px": px, "py": py, "pz": pz, "E": E}, with_name="Vector4D")
particles.pt
particles.phi
particles.eta
particles.mass
Common Operations
Calculate deltaR between two collections:
pairs = ak.cartesian([events.electron, events.muon])
electrons, muons = ak.unzip(pairs)
dR = electrons.deltaR(muons)
Combine 4-vectors and compute invariant mass:
first_e, second_e = ak.unzip(ak.combinations(events.electron, 2))
inv_mass = (first_e + second_e).mass
Boost to a parent rest frame:
parent = particle1 + particle2
particle1_rf = particle1.boostCM_of_p4(parent)
Reference Material
Load references/vector-hints.md for more examples, method notes, and advanced snippets.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
riot-games
Manage Riot Games account, track stats across League, Valorant, and more
parcel
Provides comprehensive guidance for Parcel bundler including zero-configuration setup, asset handling, hot module replacement, and production builds. Use when the user asks about Parcel, needs to set up a build tool quickly, or work with Parcel's automatic configuration.
bbs
Manage issues with The Fold's CAS-native BBS (Bulletin Board System). Use for creating, updating, searching, and tracking issues. Invoke when the user wants to create tickets, find work, check issue status, or manage dependencies.
jito-bundles-and-priority-fees
Master Jito bundles for MEV protection and priority fee optimization on Solana - bundle submission, tip strategies, and transaction landing. Use for trading bots, high-priority transactions, and MEV-aware applications.
observability-monitoring-monitor-setup
You are a monitoring and observability expert specializing in implementing comprehensive monitoring solutions. Set up metrics collection, distributed tracing, log aggregation, and create insightful da
makefile-review
Didn't find tool you were looking for?