Skip to content

Commit 4766e9f

Browse files
committed
Tutorials rehaul
1 parent 1dd8ec9 commit 4766e9f

14 files changed

+357
-974
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,5 @@ analysis/edm4eic-true-decays/10x100/
191191
analysis/edm4eic-true-decays/18x275/
192192

193193
analysis/edm4eic-true-decays/5x41/
194+
195+
uv.lock

docs/.vitepress/config.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export default withMermaid({
6161
link: '/tutorials',
6262
items: [
6363
{ text: 'Overview', link: '/tutorials' },
64-
{ text: 'py1 Uproot', link: '/tutorials/01_using_uproot' },
65-
{ text: 'py2 Metadata', link: '/tutorials/02_metadata' },
66-
{ text: 'py3 References', link: '/tutorials/03_references' },
64+
{ text: 'py-edm4eic-01 Uproot', link: '/tutorials/01_using_uproot' },
65+
{ text: 'py-edm4eic-02 Metadata', link: '/tutorials/02_metadata' },
66+
{ text: 'py-edm4eic-03 References', link: '/tutorials/03_references' },
6767
{ text: 'cpp1 EDM4EIC', link: '/tutorials/cpp01_edm4eic' },
6868
]
6969
},

csv_data.md renamed to docs/data-csv.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# CSV Tables
1+
# CSV Data
2+
3+
24

35
The CSV (Comma-Separated Values) format is exceptionally convenient for data processing.
46
It is simple, yet processed efficiently, supported by many analysis and introspection tools,
@@ -98,7 +100,9 @@ erDiagram
98100
}
99101
```
100102

101-
## The Key Challenge: Multiple Files = Broken Relationships
103+
## Combine Multiple Files
104+
105+
The Key Challenge: Multiple Files = Broken Relationships
102106

103107
When we have multiple CSV files from different runs or datasets, each file starts its event numbering from 0:
104108

@@ -110,17 +114,16 @@ File 3: evt = [0, 1, 2, 3, 4, ...] ← ID Collision!
110114

111115
**Problem**: Event 0 from File 1 is completely different from Event 0 from File 2, but they have the same ID!
112116

113-
## Solution: Global Unique Event IDs
117+
**Solution**: Global Unique Event IDs
114118

115119
We need to create globally unique event IDs across all files:
116120

117121
```python
118122
import pandas as pd
119123
import glob
120124

121-
def concat_csvs_with_unique_events(pattern):
125+
def concat_csvs_with_unique_events(files):
122126
"""Load and concatenate CSV files with globally unique event IDs"""
123-
files = sorted(glob.glob(pattern))
124127
dfs = []
125128
offset = 0
126129

@@ -133,8 +136,8 @@ def concat_csvs_with_unique_events(pattern):
133136
return pd.concat(dfs, ignore_index=True)
134137

135138
# Load both tables with unique event IDs
136-
lambda_df = concat_csvs_with_unique_events("mcpart_lambda*.csv")
137-
dis_df = concat_csvs_with_unique_events("dis_parameters*.csv")
139+
lambda_df = concat_csvs_with_unique_events(sorted(glob.glob("mcpart_lambda*.csv")))
140+
dis_df = concat_csvs_with_unique_events(sorted(glob.glob("dis_parameters*.csv")))
138141
```
139142

140143
**Result**: Now we have globally unique event IDs:

docs/tutorials/01_using_uproot.md

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)