@wentorai/research-plugins 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -22
- package/curated/analysis/README.md +71 -56
- package/curated/domains/README.md +176 -67
- package/curated/literature/README.md +71 -47
- package/curated/research/README.md +91 -58
- package/curated/tools/README.md +88 -87
- package/curated/writing/README.md +80 -45
- package/mcp-configs/cloud-docs/confluence-mcp.json +37 -0
- package/mcp-configs/cloud-docs/google-drive-mcp.json +35 -0
- package/mcp-configs/cloud-docs/notion-mcp.json +29 -0
- package/mcp-configs/communication/discord-mcp.json +29 -0
- package/mcp-configs/communication/slack-mcp.json +29 -0
- package/mcp-configs/communication/telegram-mcp.json +28 -0
- package/mcp-configs/database/neo4j-mcp.json +37 -0
- package/mcp-configs/database/postgres-mcp.json +28 -0
- package/mcp-configs/database/sqlite-mcp.json +29 -0
- package/mcp-configs/dev-platform/github-mcp.json +31 -0
- package/mcp-configs/dev-platform/gitlab-mcp.json +34 -0
- package/mcp-configs/email/email-mcp.json +40 -0
- package/mcp-configs/email/gmail-mcp.json +37 -0
- package/mcp-configs/registry.json +178 -149
- package/mcp-configs/repository/dataverse-mcp.json +33 -0
- package/mcp-configs/repository/huggingface-mcp.json +29 -0
- package/openclaw.plugin.json +2 -2
- package/package.json +2 -2
- package/skills/analysis/dataviz/algorithm-visualizer-guide/SKILL.md +259 -0
- package/skills/analysis/dataviz/bokeh-visualization-guide/SKILL.md +270 -0
- package/skills/analysis/dataviz/chart-image-generator/SKILL.md +229 -0
- package/skills/analysis/dataviz/d3-visualization-guide/SKILL.md +281 -0
- package/skills/analysis/dataviz/echarts-visualization-guide/SKILL.md +250 -0
- package/skills/analysis/dataviz/metabase-analytics-guide/SKILL.md +242 -0
- package/skills/analysis/dataviz/plotly-interactive-guide/SKILL.md +266 -0
- package/skills/analysis/dataviz/redash-analytics-guide/SKILL.md +284 -0
- package/skills/analysis/econometrics/econml-causal-guide/SKILL.md +163 -0
- package/skills/analysis/econometrics/mostly-harmless-guide/SKILL.md +139 -0
- package/skills/analysis/econometrics/panel-data-analyst/SKILL.md +259 -0
- package/skills/analysis/econometrics/python-causality-guide/SKILL.md +134 -0
- package/skills/analysis/econometrics/stata-accounting-guide/SKILL.md +269 -0
- package/skills/analysis/econometrics/stata-analyst-guide/SKILL.md +245 -0
- package/skills/analysis/statistics/data-anomaly-detection/SKILL.md +157 -0
- package/skills/analysis/statistics/ml-experiment-tracker/SKILL.md +212 -0
- package/skills/analysis/statistics/pywayne-statistics-guide/SKILL.md +192 -0
- package/skills/analysis/statistics/quantitative-methods-guide/SKILL.md +193 -0
- package/skills/analysis/statistics/senior-data-scientist-guide/SKILL.md +223 -0
- package/skills/analysis/wrangling/csv-data-analyzer/SKILL.md +170 -0
- package/skills/analysis/wrangling/data-cleaning-pipeline/SKILL.md +266 -0
- package/skills/analysis/wrangling/data-cog-guide/SKILL.md +178 -0
- package/skills/analysis/wrangling/stata-data-cleaning/SKILL.md +276 -0
- package/skills/analysis/wrangling/survey-data-processing/SKILL.md +298 -0
- package/skills/domains/ai-ml/ai-model-benchmarking/SKILL.md +209 -0
- package/skills/domains/ai-ml/annotated-dl-papers-guide/SKILL.md +159 -0
- package/skills/domains/ai-ml/dl-transformer-finetune/SKILL.md +239 -0
- package/skills/domains/ai-ml/generative-ai-guide/SKILL.md +146 -0
- package/skills/domains/ai-ml/huggingface-inference-guide/SKILL.md +196 -0
- package/skills/domains/ai-ml/keras-deep-learning/SKILL.md +210 -0
- package/skills/domains/ai-ml/llm-from-scratch-guide/SKILL.md +124 -0
- package/skills/domains/ai-ml/ml-pipeline-guide/SKILL.md +295 -0
- package/skills/domains/ai-ml/nlp-toolkit-guide/SKILL.md +247 -0
- package/skills/domains/ai-ml/pytorch-guide/SKILL.md +281 -0
- package/skills/domains/ai-ml/pytorch-lightning-guide/SKILL.md +244 -0
- package/skills/domains/ai-ml/tensorflow-guide/SKILL.md +241 -0
- package/skills/domains/biomedical/bioagents-guide/SKILL.md +308 -0
- package/skills/domains/biomedical/medgeclaw-guide/SKILL.md +345 -0
- package/skills/domains/biomedical/medical-imaging-guide/SKILL.md +305 -0
- package/skills/domains/business/architecture-design-guide/SKILL.md +279 -0
- package/skills/domains/business/innovation-management-guide/SKILL.md +257 -0
- package/skills/domains/business/operations-research-guide/SKILL.md +258 -0
- package/skills/domains/chemistry/molecular-dynamics-guide/SKILL.md +237 -0
- package/skills/domains/chemistry/pubchem-api-guide/SKILL.md +180 -0
- package/skills/domains/chemistry/spectroscopy-analysis-guide/SKILL.md +290 -0
- package/skills/domains/cs/distributed-systems-guide/SKILL.md +268 -0
- package/skills/domains/cs/formal-verification-guide/SKILL.md +298 -0
- package/skills/domains/ecology/species-distribution-guide/SKILL.md +343 -0
- package/skills/domains/economics/imf-data-api-guide/SKILL.md +174 -0
- package/skills/domains/economics/post-labor-economics/SKILL.md +254 -0
- package/skills/domains/economics/pricing-psychology-guide/SKILL.md +273 -0
- package/skills/domains/economics/world-bank-data-guide/SKILL.md +179 -0
- package/skills/domains/education/assessment-design-guide/SKILL.md +213 -0
- package/skills/domains/education/educational-research-methods/SKILL.md +179 -0
- package/skills/domains/education/mooc-analytics-guide/SKILL.md +206 -0
- package/skills/domains/finance/portfolio-optimization-guide/SKILL.md +279 -0
- package/skills/domains/finance/risk-modeling-guide/SKILL.md +260 -0
- package/skills/domains/finance/stata-accounting-research/SKILL.md +372 -0
- package/skills/domains/geoscience/climate-modeling-guide/SKILL.md +215 -0
- package/skills/domains/geoscience/satellite-remote-sensing/SKILL.md +193 -0
- package/skills/domains/geoscience/seismology-data-guide/SKILL.md +208 -0
- package/skills/domains/humanities/ethical-philosophy-guide/SKILL.md +244 -0
- package/skills/domains/humanities/history-research-guide/SKILL.md +260 -0
- package/skills/domains/humanities/political-history-guide/SKILL.md +241 -0
- package/skills/domains/law/legal-nlp-guide/SKILL.md +236 -0
- package/skills/domains/law/patent-analysis-guide/SKILL.md +257 -0
- package/skills/domains/law/regulatory-compliance-guide/SKILL.md +267 -0
- package/skills/domains/math/symbolic-computation-guide/SKILL.md +263 -0
- package/skills/domains/math/topology-data-analysis/SKILL.md +305 -0
- package/skills/domains/pharma/clinical-trial-design-guide/SKILL.md +271 -0
- package/skills/domains/pharma/drug-target-interaction/SKILL.md +242 -0
- package/skills/domains/pharma/pharmacovigilance-guide/SKILL.md +216 -0
- package/skills/domains/physics/astrophysics-data-guide/SKILL.md +305 -0
- package/skills/domains/physics/particle-physics-guide/SKILL.md +287 -0
- package/skills/domains/social-science/network-analysis-guide/SKILL.md +310 -0
- package/skills/domains/social-science/psychology-research-guide/SKILL.md +270 -0
- package/skills/domains/social-science/sociology-research-guide/SKILL.md +238 -0
- package/skills/literature/discovery/paper-recommendation-guide/SKILL.md +120 -0
- package/skills/literature/discovery/semantic-paper-radar/SKILL.md +144 -0
- package/skills/literature/discovery/zotero-arxiv-daily-guide/SKILL.md +94 -0
- package/skills/literature/fulltext/core-api-guide/SKILL.md +144 -0
- package/skills/literature/fulltext/institutional-repository-guide/SKILL.md +212 -0
- package/skills/literature/fulltext/open-access-mining-guide/SKILL.md +341 -0
- package/skills/literature/metadata/academic-paper-summarizer/SKILL.md +101 -0
- package/skills/literature/metadata/wikidata-api-guide/SKILL.md +156 -0
- package/skills/literature/search/arxiv-batch-reporting/SKILL.md +133 -0
- package/skills/literature/search/arxiv-paper-processor/SKILL.md +141 -0
- package/skills/literature/search/baidu-scholar-guide/SKILL.md +110 -0
- package/skills/literature/search/chatpaper-guide/SKILL.md +122 -0
- package/skills/literature/search/deep-literature-search/SKILL.md +149 -0
- package/skills/literature/search/deepgit-search-guide/SKILL.md +147 -0
- package/skills/literature/search/pasa-paper-search-guide/SKILL.md +138 -0
- package/skills/research/automation/ai-scientist-v2-guide/SKILL.md +284 -0
- package/skills/research/automation/aim-experiment-guide/SKILL.md +234 -0
- package/skills/research/automation/datagen-research-guide/SKILL.md +131 -0
- package/skills/research/automation/kedro-pipeline-guide/SKILL.md +216 -0
- package/skills/research/automation/mle-agent-guide/SKILL.md +139 -0
- package/skills/research/automation/paper-to-agent-guide/SKILL.md +116 -0
- package/skills/research/automation/rd-agent-guide/SKILL.md +246 -0
- package/skills/research/automation/research-paper-orchestrator/SKILL.md +254 -0
- package/skills/research/deep-research/academic-deep-research/SKILL.md +190 -0
- package/skills/research/deep-research/auto-deep-research-guide/SKILL.md +141 -0
- package/skills/research/deep-research/deep-research-pro/SKILL.md +213 -0
- package/skills/research/deep-research/deep-research-work/SKILL.md +204 -0
- package/skills/research/deep-research/deep-searcher-guide/SKILL.md +253 -0
- package/skills/research/deep-research/gpt-researcher-guide/SKILL.md +191 -0
- package/skills/research/deep-research/khoj-research-guide/SKILL.md +200 -0
- package/skills/research/deep-research/local-deep-research-guide/SKILL.md +253 -0
- package/skills/research/deep-research/tongyi-deep-research-guide/SKILL.md +217 -0
- package/skills/research/funding/eu-horizon-guide/SKILL.md +244 -0
- package/skills/research/funding/grant-budget-guide/SKILL.md +284 -0
- package/skills/research/funding/nih-reporter-api-guide/SKILL.md +166 -0
- package/skills/research/funding/nsf-award-api-guide/SKILL.md +133 -0
- package/skills/research/methodology/academic-mentor-guide/SKILL.md +169 -0
- package/skills/research/methodology/claude-scientific-guide/SKILL.md +122 -0
- package/skills/research/methodology/deep-innovator-guide/SKILL.md +242 -0
- package/skills/research/methodology/osf-api-guide/SKILL.md +165 -0
- package/skills/research/methodology/research-paper-kb/SKILL.md +263 -0
- package/skills/research/methodology/research-town-guide/SKILL.md +263 -0
- package/skills/research/paper-review/automated-review-guide/SKILL.md +281 -0
- package/skills/research/paper-review/paper-compare-guide/SKILL.md +238 -0
- package/skills/research/paper-review/paper-digest-guide/SKILL.md +240 -0
- package/skills/research/paper-review/paper-research-assistant/SKILL.md +231 -0
- package/skills/research/paper-review/research-quality-filter/SKILL.md +261 -0
- package/skills/research/paper-review/review-response-guide/SKILL.md +275 -0
- package/skills/tools/code-exec/google-colab-guide/SKILL.md +276 -0
- package/skills/tools/code-exec/kaggle-api-guide/SKILL.md +216 -0
- package/skills/tools/code-exec/overleaf-cli-guide/SKILL.md +279 -0
- package/skills/tools/diagram/code-flow-visualizer/SKILL.md +197 -0
- package/skills/tools/diagram/excalidraw-diagram-guide/SKILL.md +170 -0
- package/skills/tools/diagram/json-data-visualizer/SKILL.md +270 -0
- package/skills/tools/diagram/mermaid-architect-guide/SKILL.md +219 -0
- package/skills/tools/diagram/tldraw-whiteboard-guide/SKILL.md +397 -0
- package/skills/tools/document/docsgpt-guide/SKILL.md +130 -0
- package/skills/tools/document/large-document-reader/SKILL.md +202 -0
- package/skills/tools/document/paper-parse-guide/SKILL.md +243 -0
- package/skills/tools/knowledge-graph/citation-network-builder/SKILL.md +244 -0
- package/skills/tools/knowledge-graph/concept-map-generator/SKILL.md +284 -0
- package/skills/tools/knowledge-graph/graphiti-guide/SKILL.md +219 -0
- package/skills/tools/ocr-translate/pdf-math-translate-guide/SKILL.md +141 -0
- package/skills/tools/ocr-translate/zotero-pdf-translate-guide/SKILL.md +95 -0
- package/skills/tools/ocr-translate/zotero-pdf2zh-guide/SKILL.md +143 -0
- package/skills/tools/scraping/dataset-finder-guide/SKILL.md +253 -0
- package/skills/tools/scraping/easy-spider-guide/SKILL.md +250 -0
- package/skills/tools/scraping/google-scholar-scraper/SKILL.md +255 -0
- package/skills/tools/scraping/repository-harvesting-guide/SKILL.md +310 -0
- package/skills/writing/citation/academic-citation-manager/SKILL.md +314 -0
- package/skills/writing/citation/jabref-reference-guide/SKILL.md +127 -0
- package/skills/writing/citation/jasminum-zotero-guide/SKILL.md +103 -0
- package/skills/writing/citation/obsidian-citation-guide/SKILL.md +164 -0
- package/skills/writing/citation/obsidian-zotero-guide/SKILL.md +137 -0
- package/skills/writing/citation/papersgpt-zotero-guide/SKILL.md +132 -0
- package/skills/writing/citation/papis-cli-guide/SKILL.md +213 -0
- package/skills/writing/citation/zotero-better-bibtex-guide/SKILL.md +107 -0
- package/skills/writing/citation/zotero-better-notes-guide/SKILL.md +121 -0
- package/skills/writing/citation/zotero-gpt-guide/SKILL.md +111 -0
- package/skills/writing/citation/zotero-mcp-guide/SKILL.md +164 -0
- package/skills/writing/citation/zotero-mdnotes-guide/SKILL.md +162 -0
- package/skills/writing/citation/zotero-reference-guide/SKILL.md +139 -0
- package/skills/writing/citation/zotero-scholar-guide/SKILL.md +294 -0
- package/skills/writing/citation/zotfile-attachment-guide/SKILL.md +140 -0
- package/skills/writing/composition/ml-paper-writing/SKILL.md +163 -0
- package/skills/writing/composition/paper-debugger-guide/SKILL.md +143 -0
- package/skills/writing/composition/scientific-writing-resources/SKILL.md +151 -0
- package/skills/writing/composition/scientific-writing-wrapper/SKILL.md +153 -0
- package/skills/writing/latex/latex-drawing-collection/SKILL.md +154 -0
- package/skills/writing/latex/latex-templates-collection/SKILL.md +159 -0
- package/skills/writing/latex/md-to-pdf-academic/SKILL.md +230 -0
- package/skills/writing/latex/tex-render-guide/SKILL.md +243 -0
- package/skills/writing/polish/academic-tone-guide/SKILL.md +209 -0
- package/skills/writing/polish/conciseness-editing-guide/SKILL.md +225 -0
- package/skills/writing/polish/paper-polish-guide/SKILL.md +160 -0
- package/skills/writing/templates/graphical-abstract-guide/SKILL.md +183 -0
- package/skills/writing/templates/novathesis-guide/SKILL.md +152 -0
- package/skills/writing/templates/scientific-article-pdf/SKILL.md +261 -0
- package/skills/writing/templates/sjtuthesis-guide/SKILL.md +197 -0
- package/skills/writing/templates/thuthesis-guide/SKILL.md +181 -0
- package/skills/literature/fulltext/repository-harvesting-guide/SKILL.md +0 -207
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: particle-physics-guide
|
|
3
|
+
description: "Particle physics data analysis with ROOT, HEPData, and event processing"
|
|
4
|
+
metadata:
|
|
5
|
+
openclaw:
|
|
6
|
+
emoji: "cyclone"
|
|
7
|
+
category: "domains"
|
|
8
|
+
subcategory: "physics"
|
|
9
|
+
keywords: ["particle-physics", "root", "hepdata", "collider", "event-analysis", "high-energy-physics"]
|
|
10
|
+
source: "wentor"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Particle Physics Guide
|
|
14
|
+
|
|
15
|
+
A skill for analyzing particle physics data, covering event reconstruction, histogram analysis, statistical methods for discovery, and the standard tools used in high-energy physics (HEP) research. Includes ROOT, uproot, pyhf, and HEPData workflows.
|
|
16
|
+
|
|
17
|
+
## Data Formats and Access
|
|
18
|
+
|
|
19
|
+
### HEP Data Ecosystem
|
|
20
|
+
|
|
21
|
+
| Format | Description | Typical Size | Access Tool |
|
|
22
|
+
|--------|-------------|-------------|-------------|
|
|
23
|
+
| ROOT (.root) | Columnar binary format, HEP standard | GB-TB | ROOT, uproot |
|
|
24
|
+
| NanoAOD | Compact analysis format (CMS) | ~1 KB/event | uproot, coffea |
|
|
25
|
+
| DAOD_PHYS | Derived analysis format (ATLAS) | ~10 KB/event | ROOT, uproot |
|
|
26
|
+
| HepMC | Monte Carlo event record | Variable | pyhepmc |
|
|
27
|
+
| HEPData | Published results (YAML/JSON) | KB | hepdata_lib |
|
|
28
|
+
|
|
29
|
+
### Reading ROOT Files with uproot
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import uproot
|
|
33
|
+
import awkward as ak
|
|
34
|
+
import numpy as np
|
|
35
|
+
|
|
36
|
+
def load_nanoaod(filepath: str, tree_name: str = "Events",
|
|
37
|
+
branches: list[str] = None) -> ak.Array:
|
|
38
|
+
"""
|
|
39
|
+
Load a NanoAOD ROOT file into an awkward array.
|
|
40
|
+
branches: list of branch names to load (None = all)
|
|
41
|
+
"""
|
|
42
|
+
with uproot.open(filepath) as f:
|
|
43
|
+
tree = f[tree_name]
|
|
44
|
+
if branches is None:
|
|
45
|
+
branches = tree.keys()
|
|
46
|
+
events = tree.arrays(branches, library="ak")
|
|
47
|
+
|
|
48
|
+
print(f"Loaded {len(events)} events")
|
|
49
|
+
print(f"Branches: {events.fields}")
|
|
50
|
+
return events
|
|
51
|
+
|
|
52
|
+
# Example: Load muon data
|
|
53
|
+
events = load_nanoaod("nano_data.root", branches=[
|
|
54
|
+
"nMuon", "Muon_pt", "Muon_eta", "Muon_phi", "Muon_mass",
|
|
55
|
+
"Muon_charge", "Muon_pfRelIso04_all", "Muon_tightId",
|
|
56
|
+
])
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Event Selection and Reconstruction
|
|
60
|
+
|
|
61
|
+
### Dimuon Invariant Mass
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
def compute_invariant_mass(pt1, eta1, phi1, mass1,
|
|
65
|
+
pt2, eta2, phi2, mass2):
|
|
66
|
+
"""
|
|
67
|
+
Compute invariant mass of a particle pair from 4-momentum components.
|
|
68
|
+
Uses the relativistic energy-momentum relation.
|
|
69
|
+
"""
|
|
70
|
+
# Convert to Cartesian 4-vectors
|
|
71
|
+
px1 = pt1 * np.cos(phi1)
|
|
72
|
+
py1 = pt1 * np.sin(phi1)
|
|
73
|
+
pz1 = pt1 * np.sinh(eta1)
|
|
74
|
+
e1 = np.sqrt(px1**2 + py1**2 + pz1**2 + mass1**2)
|
|
75
|
+
|
|
76
|
+
px2 = pt2 * np.cos(phi2)
|
|
77
|
+
py2 = pt2 * np.sin(phi2)
|
|
78
|
+
pz2 = pt2 * np.sinh(eta2)
|
|
79
|
+
e2 = np.sqrt(px2**2 + py2**2 + pz2**2 + mass2**2)
|
|
80
|
+
|
|
81
|
+
# Invariant mass of the pair
|
|
82
|
+
m_inv = np.sqrt(
|
|
83
|
+
(e1 + e2)**2 - (px1 + px2)**2 - (py1 + py2)**2 - (pz1 + pz2)**2
|
|
84
|
+
)
|
|
85
|
+
return m_inv
|
|
86
|
+
|
|
87
|
+
def select_z_candidates(events):
|
|
88
|
+
"""
|
|
89
|
+
Select Z -> mu+mu- candidates from NanoAOD events.
|
|
90
|
+
Requires exactly 2 opposite-sign muons passing quality cuts.
|
|
91
|
+
"""
|
|
92
|
+
# Quality cuts
|
|
93
|
+
muon_mask = (
|
|
94
|
+
(events.Muon_pt > 20) & # pT > 20 GeV
|
|
95
|
+
(abs(events.Muon_eta) < 2.4) & # |eta| < 2.4
|
|
96
|
+
(events.Muon_tightId == True) & # tight muon ID
|
|
97
|
+
(events.Muon_pfRelIso04_all < 0.15) # relative isolation
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Apply mask and require exactly 2 muons
|
|
101
|
+
good_muons = events[muon_mask]
|
|
102
|
+
dimuon_events = good_muons[ak.num(good_muons.Muon_pt) == 2]
|
|
103
|
+
|
|
104
|
+
# Opposite sign requirement
|
|
105
|
+
opposite_sign = (
|
|
106
|
+
dimuon_events.Muon_charge[:, 0] * dimuon_events.Muon_charge[:, 1] < 0
|
|
107
|
+
)
|
|
108
|
+
z_candidates = dimuon_events[opposite_sign]
|
|
109
|
+
|
|
110
|
+
# Compute invariant mass
|
|
111
|
+
m_inv = compute_invariant_mass(
|
|
112
|
+
z_candidates.Muon_pt[:, 0], z_candidates.Muon_eta[:, 0],
|
|
113
|
+
z_candidates.Muon_phi[:, 0], z_candidates.Muon_mass[:, 0],
|
|
114
|
+
z_candidates.Muon_pt[:, 1], z_candidates.Muon_eta[:, 1],
|
|
115
|
+
z_candidates.Muon_phi[:, 1], z_candidates.Muon_mass[:, 1],
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return m_inv
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Statistical Methods for Discovery
|
|
122
|
+
|
|
123
|
+
### Hypothesis Testing with pyhf
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
import pyhf
|
|
127
|
+
|
|
128
|
+
def build_counting_model(signal: float, background: float,
|
|
129
|
+
bkg_uncertainty: float) -> dict:
|
|
130
|
+
"""
|
|
131
|
+
Build a simple counting experiment model in pyhf.
|
|
132
|
+
signal: expected signal yield
|
|
133
|
+
background: expected background yield
|
|
134
|
+
bkg_uncertainty: relative uncertainty on background
|
|
135
|
+
"""
|
|
136
|
+
model = pyhf.simplemodels.uncorrelated_background(
|
|
137
|
+
signal=[signal],
|
|
138
|
+
bkg=[background],
|
|
139
|
+
bkg_uncertainty=[bkg_uncertainty * background],
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# Observed data (background-only for expected limit)
|
|
143
|
+
data = [background] + model.config.auxdata
|
|
144
|
+
|
|
145
|
+
return {"model": model, "data": data}
|
|
146
|
+
|
|
147
|
+
def compute_cls(model, data, poi_values=None):
|
|
148
|
+
"""
|
|
149
|
+
Compute CLs exclusion limits (frequentist hypothesis test).
|
|
150
|
+
Uses the CLs method standard in HEP.
|
|
151
|
+
"""
|
|
152
|
+
if poi_values is None:
|
|
153
|
+
poi_values = np.linspace(0, 5, 50)
|
|
154
|
+
|
|
155
|
+
obs_cls = []
|
|
156
|
+
exp_cls = []
|
|
157
|
+
|
|
158
|
+
for mu in poi_values:
|
|
159
|
+
result = pyhf.infer.hypotest(
|
|
160
|
+
mu, data, model["model"],
|
|
161
|
+
test_stat="qtilde",
|
|
162
|
+
return_expected_set=True,
|
|
163
|
+
)
|
|
164
|
+
obs_cls.append(float(result[0]))
|
|
165
|
+
exp_cls.append([float(v) for v in result[1]])
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
"poi_values": poi_values.tolist(),
|
|
169
|
+
"observed_cls": obs_cls,
|
|
170
|
+
"expected_cls": exp_cls,
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Discovery Significance
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
def discovery_significance(n_observed: float, n_background: float,
|
|
178
|
+
sigma_b: float = 0) -> dict:
|
|
179
|
+
"""
|
|
180
|
+
Compute discovery significance for a counting experiment.
|
|
181
|
+
n_observed: number of observed events
|
|
182
|
+
n_background: expected background
|
|
183
|
+
sigma_b: uncertainty on background
|
|
184
|
+
"""
|
|
185
|
+
from scipy.stats import norm
|
|
186
|
+
|
|
187
|
+
if sigma_b == 0:
|
|
188
|
+
# Simple Poisson significance
|
|
189
|
+
# Z = sqrt(2 * (n * ln(n/b) - (n - b)))
|
|
190
|
+
if n_observed <= n_background:
|
|
191
|
+
z = 0
|
|
192
|
+
else:
|
|
193
|
+
z = np.sqrt(2 * (
|
|
194
|
+
n_observed * np.log(n_observed / n_background)
|
|
195
|
+
- (n_observed - n_background)
|
|
196
|
+
))
|
|
197
|
+
else:
|
|
198
|
+
# With systematic uncertainty (profile likelihood approximation)
|
|
199
|
+
tau = n_background / sigma_b**2
|
|
200
|
+
n = n_observed
|
|
201
|
+
b = n_background
|
|
202
|
+
z = np.sqrt(2 * (
|
|
203
|
+
n * np.log((n * (b + tau)) / (b**2 + n * tau))
|
|
204
|
+
- (b**2 / tau) * np.log(1 + tau * (n - b) / (b * (b + tau)))
|
|
205
|
+
))
|
|
206
|
+
|
|
207
|
+
p_value = 1 - norm.cdf(z)
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
"z_significance": round(z, 4),
|
|
211
|
+
"p_value": p_value,
|
|
212
|
+
"is_evidence": z >= 3.0, # 3 sigma = evidence
|
|
213
|
+
"is_discovery": z >= 5.0, # 5 sigma = discovery
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Histogram Analysis
|
|
218
|
+
|
|
219
|
+
### Binned Fitting
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
from scipy.optimize import curve_fit
|
|
223
|
+
|
|
224
|
+
def fit_breit_wigner_plus_bg(bin_centers: np.ndarray,
|
|
225
|
+
bin_contents: np.ndarray,
|
|
226
|
+
mass_range: tuple = (80, 100)) -> dict:
|
|
227
|
+
"""
|
|
228
|
+
Fit a Breit-Wigner (resonance) + polynomial background to a mass histogram.
|
|
229
|
+
Standard approach for Z boson mass measurement.
|
|
230
|
+
"""
|
|
231
|
+
def model(m, N_sig, M_Z, Gamma_Z, a0, a1):
|
|
232
|
+
# Breit-Wigner
|
|
233
|
+
bw = N_sig * Gamma_Z / (2 * np.pi) / (
|
|
234
|
+
(m - M_Z)**2 + (Gamma_Z / 2)**2
|
|
235
|
+
)
|
|
236
|
+
# Linear background
|
|
237
|
+
bg = a0 + a1 * (m - 91.0)
|
|
238
|
+
return bw + bg
|
|
239
|
+
|
|
240
|
+
mask = (bin_centers >= mass_range[0]) & (bin_centers <= mass_range[1])
|
|
241
|
+
x = bin_centers[mask]
|
|
242
|
+
y = bin_contents[mask]
|
|
243
|
+
|
|
244
|
+
p0 = [1000, 91.2, 2.5, 10, 0] # initial guess
|
|
245
|
+
popt, pcov = curve_fit(model, x, y, p0=p0, sigma=np.sqrt(y + 1))
|
|
246
|
+
perr = np.sqrt(np.diag(pcov))
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
"M_Z": f"{popt[1]:.3f} +/- {perr[1]:.3f} GeV",
|
|
250
|
+
"Gamma_Z": f"{popt[2]:.3f} +/- {perr[2]:.3f} GeV",
|
|
251
|
+
"N_signal": f"{popt[0]:.0f} +/- {perr[0]:.0f}",
|
|
252
|
+
"chi2_ndf": round(np.sum(((y - model(x, *popt))**2 / (y + 1))) / (len(x) - 5), 2),
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Monte Carlo Simulation
|
|
257
|
+
|
|
258
|
+
### Event Generation Pipeline
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
1. Matrix element calculation (MadGraph, Sherpa, POWHEG)
|
|
262
|
+
--> Hard scattering process (e.g., pp -> Z -> mu+mu-)
|
|
263
|
+
|
|
264
|
+
2. Parton shower (Pythia, Herwig)
|
|
265
|
+
--> QCD radiation, initial/final state radiation
|
|
266
|
+
|
|
267
|
+
3. Hadronization (Pythia string model, Herwig cluster model)
|
|
268
|
+
--> Quarks/gluons -> hadrons
|
|
269
|
+
|
|
270
|
+
4. Detector simulation (Geant4 via CMSSW/Athena, or Delphes for fast sim)
|
|
271
|
+
--> Particle interactions with detector material
|
|
272
|
+
|
|
273
|
+
5. Reconstruction
|
|
274
|
+
--> Raw hits -> tracks, clusters, physics objects
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Tools and Software
|
|
278
|
+
|
|
279
|
+
- **ROOT**: C++ data analysis framework (CERN), ubiquitous in HEP
|
|
280
|
+
- **uproot**: Pure Python ROOT file reader (no ROOT dependency)
|
|
281
|
+
- **awkward-array**: Columnar data with variable-length nested structure
|
|
282
|
+
- **coffea**: Analysis framework built on uproot + awkward + dask
|
|
283
|
+
- **pyhf**: Pure Python HistFactory for statistical models
|
|
284
|
+
- **MadGraph5_aMC@NLO**: Automated matrix element generation
|
|
285
|
+
- **Pythia 8**: Monte Carlo event generator (parton shower + hadronization)
|
|
286
|
+
- **Delphes**: Fast detector simulation framework
|
|
287
|
+
- **HEPData**: Repository for published HEP measurements
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: network-analysis-guide
|
|
3
|
+
description: "Social network analysis methods, metrics, and visualization tools"
|
|
4
|
+
metadata:
|
|
5
|
+
openclaw:
|
|
6
|
+
emoji: "globe_with_meridians"
|
|
7
|
+
category: "domains"
|
|
8
|
+
subcategory: "social-science"
|
|
9
|
+
keywords: ["social network analysis", "graph theory", "centrality", "community detection", "network visualization", "SNA"]
|
|
10
|
+
source: "wentor-research-plugins"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Network Analysis Guide
|
|
14
|
+
|
|
15
|
+
A skill for conducting social network analysis (SNA) in research contexts. Covers network data collection and representation, key structural metrics (centrality, density, clustering), community detection algorithms, ego network analysis, longitudinal network models, and visualization best practices using Python NetworkX, igraph, and Gephi.
|
|
16
|
+
|
|
17
|
+
## Network Data Fundamentals
|
|
18
|
+
|
|
19
|
+
### Representing Network Data
|
|
20
|
+
|
|
21
|
+
Networks consist of nodes (actors) and edges (relationships). The first decision in any SNA project is how to represent the data.
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Network data formats:
|
|
25
|
+
|
|
26
|
+
Edge List (simplest):
|
|
27
|
+
source, target, weight
|
|
28
|
+
Alice, Bob, 3
|
|
29
|
+
Alice, Carol, 1
|
|
30
|
+
Bob, David, 5
|
|
31
|
+
|
|
32
|
+
Adjacency Matrix (for small networks):
|
|
33
|
+
Alice Bob Carol David
|
|
34
|
+
Alice 0 3 1 0
|
|
35
|
+
Bob 3 0 0 5
|
|
36
|
+
Carol 1 0 0 0
|
|
37
|
+
David 0 5 0 0
|
|
38
|
+
|
|
39
|
+
Network types:
|
|
40
|
+
Undirected: friendship, co-authorship, physical contact
|
|
41
|
+
Directed: email, citation, following on social media
|
|
42
|
+
Weighted: frequency of interaction, strength of tie
|
|
43
|
+
Bipartite: two types of nodes (e.g., people and events)
|
|
44
|
+
Multiplex: multiple types of edges between same nodes
|
|
45
|
+
Temporal: edges have timestamps or time windows
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Data Collection Methods
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Common SNA data collection approaches:
|
|
52
|
+
|
|
53
|
+
Survey-based (name generators):
|
|
54
|
+
"List up to 5 people you go to for work advice."
|
|
55
|
+
Advantages: captures subjective relationship perception
|
|
56
|
+
Limitations: recall bias, boundary specification problem
|
|
57
|
+
Best for: organizational networks, personal networks
|
|
58
|
+
|
|
59
|
+
Archival data:
|
|
60
|
+
Email logs, collaboration records, co-authorship
|
|
61
|
+
Advantages: objective, complete within data boundaries
|
|
62
|
+
Limitations: may not reflect relationship quality
|
|
63
|
+
Best for: large-scale communication networks
|
|
64
|
+
|
|
65
|
+
Observation:
|
|
66
|
+
Systematic recording of interactions
|
|
67
|
+
Advantages: captures actual behavior
|
|
68
|
+
Limitations: time-intensive, observer effects
|
|
69
|
+
Best for: small groups, classroom networks
|
|
70
|
+
|
|
71
|
+
Digital trace data:
|
|
72
|
+
Social media follows, retweets, mentions
|
|
73
|
+
Advantages: large-scale, timestamped
|
|
74
|
+
Limitations: platform-specific behavior, not generalizable
|
|
75
|
+
Best for: online community studies
|
|
76
|
+
|
|
77
|
+
Important considerations:
|
|
78
|
+
- Boundary specification: who is included in the network?
|
|
79
|
+
- Complete vs sampled networks require different methods
|
|
80
|
+
- IRB/ethics approval needed for human subjects research
|
|
81
|
+
- Node anonymization required for publication
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Core Network Metrics
|
|
85
|
+
|
|
86
|
+
### Node-Level Centrality
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import networkx as nx
|
|
90
|
+
|
|
91
|
+
def compute_centrality_measures(G):
|
|
92
|
+
"""
|
|
93
|
+
Compute the four classic centrality measures for all nodes.
|
|
94
|
+
|
|
95
|
+
Each captures a different dimension of node importance:
|
|
96
|
+
- Degree: connectivity (popular nodes)
|
|
97
|
+
- Betweenness: brokerage (bridge nodes)
|
|
98
|
+
- Closeness: reachability (efficient nodes)
|
|
99
|
+
- Eigenvector: prestige (connected to important nodes)
|
|
100
|
+
"""
|
|
101
|
+
centralities = {}
|
|
102
|
+
|
|
103
|
+
# Degree centrality: proportion of nodes connected to
|
|
104
|
+
centralities["degree"] = nx.degree_centrality(G)
|
|
105
|
+
|
|
106
|
+
# Betweenness: proportion of shortest paths through node
|
|
107
|
+
centralities["betweenness"] = nx.betweenness_centrality(
|
|
108
|
+
G, weight="weight", normalized=True
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
# Closeness: inverse of average shortest path to all others
|
|
112
|
+
centralities["closeness"] = nx.closeness_centrality(G)
|
|
113
|
+
|
|
114
|
+
# Eigenvector: connected to other high-centrality nodes
|
|
115
|
+
try:
|
|
116
|
+
centralities["eigenvector"] = nx.eigenvector_centrality(
|
|
117
|
+
G, max_iter=1000, weight="weight"
|
|
118
|
+
)
|
|
119
|
+
except nx.PowerIterationFailedConvergence:
|
|
120
|
+
centralities["eigenvector"] = {}
|
|
121
|
+
|
|
122
|
+
return centralities
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Network-Level Metrics
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
def compute_network_metrics(G):
|
|
129
|
+
"""
|
|
130
|
+
Compute network-level structural properties.
|
|
131
|
+
"""
|
|
132
|
+
metrics = {}
|
|
133
|
+
|
|
134
|
+
n = G.number_of_nodes()
|
|
135
|
+
m = G.number_of_edges()
|
|
136
|
+
metrics["nodes"] = n
|
|
137
|
+
metrics["edges"] = m
|
|
138
|
+
|
|
139
|
+
# Density: actual edges / possible edges
|
|
140
|
+
metrics["density"] = nx.density(G)
|
|
141
|
+
|
|
142
|
+
# Average clustering coefficient: transitivity tendency
|
|
143
|
+
metrics["avg_clustering"] = nx.average_clustering(G)
|
|
144
|
+
|
|
145
|
+
# Global clustering (transitivity)
|
|
146
|
+
metrics["transitivity"] = nx.transitivity(G)
|
|
147
|
+
|
|
148
|
+
# Connected components
|
|
149
|
+
if G.is_directed():
|
|
150
|
+
metrics["weakly_connected_components"] = (
|
|
151
|
+
nx.number_weakly_connected_components(G)
|
|
152
|
+
)
|
|
153
|
+
else:
|
|
154
|
+
metrics["connected_components"] = (
|
|
155
|
+
nx.number_connected_components(G)
|
|
156
|
+
)
|
|
157
|
+
if nx.is_connected(G):
|
|
158
|
+
metrics["diameter"] = nx.diameter(G)
|
|
159
|
+
metrics["avg_shortest_path"] = (
|
|
160
|
+
nx.average_shortest_path_length(G)
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
# Degree distribution statistics
|
|
164
|
+
degrees = [d for n, d in G.degree()]
|
|
165
|
+
metrics["avg_degree"] = sum(degrees) / len(degrees)
|
|
166
|
+
metrics["max_degree"] = max(degrees)
|
|
167
|
+
|
|
168
|
+
return metrics
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def interpret_metrics(metrics):
|
|
172
|
+
"""
|
|
173
|
+
Provide interpretive context for network metrics.
|
|
174
|
+
"""
|
|
175
|
+
interpretations = []
|
|
176
|
+
|
|
177
|
+
if metrics["density"] > 0.5:
|
|
178
|
+
interpretations.append(
|
|
179
|
+
"High density: most actors are connected. "
|
|
180
|
+
"Information spreads quickly but network is "
|
|
181
|
+
"resource-intensive to maintain."
|
|
182
|
+
)
|
|
183
|
+
elif metrics["density"] < 0.1:
|
|
184
|
+
interpretations.append(
|
|
185
|
+
"Low density: sparse connections. Network "
|
|
186
|
+
"may have structural holes and brokerage "
|
|
187
|
+
"opportunities."
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
if metrics["avg_clustering"] > 0.5:
|
|
191
|
+
interpretations.append(
|
|
192
|
+
"High clustering: strong tendency to form "
|
|
193
|
+
"closed triads. Indicates group cohesion "
|
|
194
|
+
"and potential echo chambers."
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
return interpretations
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Community Detection
|
|
201
|
+
|
|
202
|
+
### Algorithms for Finding Groups
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
import community as community_louvain
|
|
206
|
+
|
|
207
|
+
def detect_communities_multiple(G):
|
|
208
|
+
"""
|
|
209
|
+
Apply multiple community detection algorithms and compare.
|
|
210
|
+
Different algorithms may reveal different structural patterns.
|
|
211
|
+
"""
|
|
212
|
+
results = {}
|
|
213
|
+
|
|
214
|
+
# Louvain method (modularity optimization)
|
|
215
|
+
results["louvain"] = community_louvain.best_partition(
|
|
216
|
+
G, weight="weight"
|
|
217
|
+
)
|
|
218
|
+
results["louvain_modularity"] = (
|
|
219
|
+
community_louvain.modularity(results["louvain"], G)
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
# Label Propagation (fast, non-deterministic)
|
|
223
|
+
lp_communities = nx.community.label_propagation_communities(G)
|
|
224
|
+
lp_partition = {}
|
|
225
|
+
for i, comm in enumerate(lp_communities):
|
|
226
|
+
for node in comm:
|
|
227
|
+
lp_partition[node] = i
|
|
228
|
+
results["label_propagation"] = lp_partition
|
|
229
|
+
|
|
230
|
+
# Girvan-Newman (edge betweenness, slow but interpretable)
|
|
231
|
+
# Only practical for small networks (< 1000 nodes)
|
|
232
|
+
if G.number_of_nodes() < 500:
|
|
233
|
+
gn_communities = nx.community.girvan_newman(G)
|
|
234
|
+
top_level = next(gn_communities)
|
|
235
|
+
gn_partition = {}
|
|
236
|
+
for i, comm in enumerate(top_level):
|
|
237
|
+
for node in comm:
|
|
238
|
+
gn_partition[node] = i
|
|
239
|
+
results["girvan_newman"] = gn_partition
|
|
240
|
+
|
|
241
|
+
return results
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Ego Network Analysis
|
|
245
|
+
|
|
246
|
+
### Analyzing Individual Networks
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
Ego network concepts:
|
|
250
|
+
|
|
251
|
+
Ego: the focal actor
|
|
252
|
+
Alters: ego's direct contacts
|
|
253
|
+
Ties: connections between alters (not through ego)
|
|
254
|
+
|
|
255
|
+
Key ego network measures:
|
|
256
|
+
- Size: number of alters
|
|
257
|
+
- Density: proportion of possible alter-alter ties that exist
|
|
258
|
+
- Constraint: Burt's measure of structural holes
|
|
259
|
+
- Low constraint = access to diverse information
|
|
260
|
+
- High constraint = redundant contacts
|
|
261
|
+
- Effective size: size minus redundancy of contacts
|
|
262
|
+
- Ego betweenness: brokerage within the ego network
|
|
263
|
+
|
|
264
|
+
Research applications:
|
|
265
|
+
- Social support and health outcomes
|
|
266
|
+
- Innovation diffusion and adoption
|
|
267
|
+
- Career success and social capital
|
|
268
|
+
- Information access and decision-making
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Visualization Best Practices
|
|
272
|
+
|
|
273
|
+
### Layout and Design
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
Network visualization guidelines:
|
|
277
|
+
|
|
278
|
+
Layout algorithms:
|
|
279
|
+
- Force-directed (Fruchterman-Reingold, ForceAtlas2):
|
|
280
|
+
Best for: showing clusters, general structure
|
|
281
|
+
Use when: exploring data, presenting to general audience
|
|
282
|
+
|
|
283
|
+
- Circular: Best for: showing connectivity patterns
|
|
284
|
+
Use when: comparing density across groups
|
|
285
|
+
|
|
286
|
+
- Hierarchical (Sugiyama): Best for: directed acyclic graphs
|
|
287
|
+
Use when: showing flow or hierarchy
|
|
288
|
+
|
|
289
|
+
Visual encoding:
|
|
290
|
+
- Node size: proportional to centrality or attribute value
|
|
291
|
+
- Node color: community membership or categorical attribute
|
|
292
|
+
- Edge width: relationship strength or frequency
|
|
293
|
+
- Edge color: relationship type (in multiplex networks)
|
|
294
|
+
|
|
295
|
+
Publication standards:
|
|
296
|
+
- Use colorblind-friendly palettes
|
|
297
|
+
- Include a legend for all visual encodings
|
|
298
|
+
- Report the layout algorithm used
|
|
299
|
+
- State N (nodes) and M (edges) in the caption
|
|
300
|
+
- For large networks, consider filtering to top-k nodes
|
|
301
|
+
- Provide the network data in supplementary materials
|
|
302
|
+
|
|
303
|
+
Tools:
|
|
304
|
+
- Gephi: interactive exploration, ForceAtlas2 layout
|
|
305
|
+
- Python pyvis: interactive HTML visualizations
|
|
306
|
+
- R igraph: publication-quality static figures
|
|
307
|
+
- Cytoscape: biological networks, rich plugin ecosystem
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Social network analysis provides a structural perspective on social phenomena that complements traditional individual-level analyses. By examining patterns of relationships rather than attributes of individuals, SNA reveals how position in a social structure shapes behavior, information access, influence, and outcomes.
|