mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-30 18:56:16 +00:00
Lean: update Semantics modules, add new numerics/physics data files Hardware: update FPGA bitstreams (tangnano9k_uart_loopback) Infra: k3s-flake tests, netcup-vps configuration, VCN compute substrate Docs: ARCHITECTURE, specs, citation updates
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
fetch_hepdata.py — Fetch LHCb B→K*μμ angular observables from HEPData API
|
|
|
|
Usage:
|
|
python3 fetch_hepdata.py > lhcb_data.json
|
|
|
|
The data comes from:
|
|
LHCb Collaboration, JHEP 02 (2016) 104
|
|
HEPData record: https://www.hepdata.net/record/74247
|
|
Table 23: CP-averaged angular observables (FL, P1-P8')
|
|
"""
|
|
|
|
import json
|
|
import urllib.request
|
|
import sys
|
|
|
|
# HEPData API endpoints
|
|
BASE_URL = "https://www.hepdata.net"
|
|
RECORD_ID = "74247" # LHCb B→K*μμ angular analysis
|
|
|
|
def fetch_table(record_id, table_num):
|
|
"""Fetch a specific table from HEPData."""
|
|
url = f"{BASE_URL}/api/record/{record_id}/table/{table_num}"
|
|
try:
|
|
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
|
|
with urllib.request.urlopen(req, timeout=30) as response:
|
|
return json.loads(response.read().decode())
|
|
except Exception as e:
|
|
print(f"Error fetching table {table_num}: {e}", file=sys.stderr)
|
|
return None
|
|
|
|
def main():
|
|
"""Fetch the angular observables data."""
|
|
print("Fetching LHCb B→K*μμ data from HEPData...", file=sys.stderr)
|
|
|
|
# Table 23 contains the CP-averaged angular observables
|
|
data = fetch_table(RECORD_ID, 23)
|
|
|
|
if data:
|
|
print(json.dumps(data, indent=2))
|
|
else:
|
|
# Fallback: use the data I already extracted from the papers
|
|
print(json.dumps({
|
|
"description": "LHCb B→K*μμ angular observables (fallback data)",
|
|
"source": "JHEP 02 (2016) 104 + arXiv:2405.10882",
|
|
"observables": [
|
|
{"q2_bin": "[4.0, 6.0]", "P5pMeasured": -0.79, "P5pSM": -0.44, "sigma": 3.4}
|
|
]
|
|
}, indent=2))
|
|
|
|
if __name__ == "__main__":
|
|
main()
|