rootloader 1.2.7__tar.gz → 1.3.1__tar.gz
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.
- {rootloader-1.2.7 → rootloader-1.3.1}/PKG-INFO +1 -1
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/ttree.md +83 -32
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/ttree.py +56 -102
- rootloader-1.3.1/rootloader/version.py +1 -0
- rootloader-1.2.7/rootloader/version.py +0 -1
- {rootloader-1.2.7 → rootloader-1.3.1}/.gitignore +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/LICENSE +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/README.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/README.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/attrdict.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/index.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/tdirectory.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/tfile.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/th1.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/th2.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/tleaf.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/docs/rootloader/version.md +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/gen_documentation.bash +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/pyproject.toml +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/__init__.py +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/attrdict.py +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/tdirectory.py +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/tfile.py +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/th1.py +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/th2.py +0 -0
- {rootloader-1.2.7 → rootloader-1.3.1}/rootloader/tleaf.py +0 -0
|
@@ -19,17 +19,19 @@
|
|
|
19
19
|
- [ttree.min](#ttreemin)
|
|
20
20
|
- [ttree.reset](#ttreereset)
|
|
21
21
|
- [ttree.reset_columns](#ttreereset_columns)
|
|
22
|
-
- [ttree.rms](#ttreerms)
|
|
23
22
|
- [ttree.set_filter](#ttreeset_filter)
|
|
24
23
|
- [ttree.set_index](#ttreeset_index)
|
|
25
24
|
- [ttree.size](#ttreesize)
|
|
26
25
|
- [ttree.std](#ttreestd)
|
|
26
|
+
- [ttree.sum](#ttreesum)
|
|
27
|
+
- [ttree.to_array](#ttreeto_array)
|
|
27
28
|
- [ttree.to_dataframe](#ttreeto_dataframe)
|
|
28
29
|
- [ttree.to_dict](#ttreeto_dict)
|
|
30
|
+
- [ttree.values](#ttreevalues)
|
|
29
31
|
|
|
30
32
|
## ttree
|
|
31
33
|
|
|
32
|
-
[Show source in ttree.py:
|
|
34
|
+
[Show source in ttree.py:103](../../rootloader/ttree.py#L103)
|
|
33
35
|
|
|
34
36
|
Extract ROOT.TTree with lazy operation. Looks like a dataframe in most ways
|
|
35
37
|
|
|
@@ -48,7 +50,7 @@ class ttree(object):
|
|
|
48
50
|
|
|
49
51
|
### ttree.__getitem__
|
|
50
52
|
|
|
51
|
-
[Show source in ttree.py:
|
|
53
|
+
[Show source in ttree.py:165](../../rootloader/ttree.py#L165)
|
|
52
54
|
|
|
53
55
|
Fetch a new dataframe with fewer 'columns', as a memory view
|
|
54
56
|
|
|
@@ -60,7 +62,9 @@ def __getitem__(self, key): ...
|
|
|
60
62
|
|
|
61
63
|
### ttree.columns
|
|
62
64
|
|
|
63
|
-
[Show source in ttree.py:
|
|
65
|
+
[Show source in ttree.py:420](../../rootloader/ttree.py#L420)
|
|
66
|
+
|
|
67
|
+
Return list of column (branch) names
|
|
64
68
|
|
|
65
69
|
#### Signature
|
|
66
70
|
|
|
@@ -71,7 +75,9 @@ def columns(self): ...
|
|
|
71
75
|
|
|
72
76
|
### ttree.filters
|
|
73
77
|
|
|
74
|
-
[Show source in ttree.py:
|
|
78
|
+
[Show source in ttree.py:424](../../rootloader/ttree.py#L424)
|
|
79
|
+
|
|
80
|
+
Return list of RDataFrame filters
|
|
75
81
|
|
|
76
82
|
#### Signature
|
|
77
83
|
|
|
@@ -82,7 +88,7 @@ def filters(self): ...
|
|
|
82
88
|
|
|
83
89
|
### ttree.hist1d
|
|
84
90
|
|
|
85
|
-
[Show source in ttree.py:
|
|
91
|
+
[Show source in ttree.py:214](../../rootloader/ttree.py#L214)
|
|
86
92
|
|
|
87
93
|
Return histogram of column
|
|
88
94
|
|
|
@@ -107,7 +113,7 @@ def hist1d(self, column=None, nbins=None, step=None, edges=None): ...
|
|
|
107
113
|
|
|
108
114
|
### ttree.hist2d
|
|
109
115
|
|
|
110
|
-
[Show source in ttree.py:
|
|
116
|
+
[Show source in ttree.py:267](../../rootloader/ttree.py#L267)
|
|
111
117
|
|
|
112
118
|
Return histogram of two columns
|
|
113
119
|
|
|
@@ -131,7 +137,9 @@ def hist2d(
|
|
|
131
137
|
|
|
132
138
|
### ttree.index
|
|
133
139
|
|
|
134
|
-
[Show source in ttree.py:
|
|
140
|
+
[Show source in ttree.py:428](../../rootloader/ttree.py#L428)
|
|
141
|
+
|
|
142
|
+
Return ttree of just the index data
|
|
135
143
|
|
|
136
144
|
#### Signature
|
|
137
145
|
|
|
@@ -142,7 +150,9 @@ def index(self): ...
|
|
|
142
150
|
|
|
143
151
|
### ttree.index_name
|
|
144
152
|
|
|
145
|
-
[Show source in ttree.py:
|
|
153
|
+
[Show source in ttree.py:432](../../rootloader/ttree.py#L432)
|
|
154
|
+
|
|
155
|
+
Return string of the name of the index branch
|
|
146
156
|
|
|
147
157
|
#### Signature
|
|
148
158
|
|
|
@@ -153,7 +163,9 @@ def index_name(self): ...
|
|
|
153
163
|
|
|
154
164
|
### ttree.loc
|
|
155
165
|
|
|
156
|
-
[Show source in ttree.py:
|
|
166
|
+
[Show source in ttree.py:436](../../rootloader/ttree.py#L436)
|
|
167
|
+
|
|
168
|
+
Return a ttree that can be indexed like a pandas dataframe
|
|
157
169
|
|
|
158
170
|
#### Signature
|
|
159
171
|
|
|
@@ -164,7 +176,9 @@ def loc(self): ...
|
|
|
164
176
|
|
|
165
177
|
### ttree.max
|
|
166
178
|
|
|
167
|
-
[Show source in ttree.py:
|
|
179
|
+
[Show source in ttree.py:473](../../rootloader/ttree.py#L473)
|
|
180
|
+
|
|
181
|
+
Return the max value of the tree, for each branch
|
|
168
182
|
|
|
169
183
|
#### Signature
|
|
170
184
|
|
|
@@ -174,7 +188,9 @@ def max(self): ...
|
|
|
174
188
|
|
|
175
189
|
### ttree.mean
|
|
176
190
|
|
|
177
|
-
[Show source in ttree.py:
|
|
191
|
+
[Show source in ttree.py:476](../../rootloader/ttree.py#L476)
|
|
192
|
+
|
|
193
|
+
Return the mean value of the tree, for each branch
|
|
178
194
|
|
|
179
195
|
#### Signature
|
|
180
196
|
|
|
@@ -184,7 +200,9 @@ def mean(self): ...
|
|
|
184
200
|
|
|
185
201
|
### ttree.min
|
|
186
202
|
|
|
187
|
-
[Show source in ttree.py:
|
|
203
|
+
[Show source in ttree.py:470](../../rootloader/ttree.py#L470)
|
|
204
|
+
|
|
205
|
+
Return the min value of the tree, for each branch
|
|
188
206
|
|
|
189
207
|
#### Signature
|
|
190
208
|
|
|
@@ -194,7 +212,7 @@ def min(self): ...
|
|
|
194
212
|
|
|
195
213
|
### ttree.reset
|
|
196
214
|
|
|
197
|
-
[Show source in ttree.py:
|
|
215
|
+
[Show source in ttree.py:339](../../rootloader/ttree.py#L339)
|
|
198
216
|
|
|
199
217
|
Make a new tree
|
|
200
218
|
|
|
@@ -206,7 +224,7 @@ def reset(self): ...
|
|
|
206
224
|
|
|
207
225
|
### ttree.reset_columns
|
|
208
226
|
|
|
209
|
-
[Show source in ttree.py:
|
|
227
|
+
[Show source in ttree.py:343](../../rootloader/ttree.py#L343)
|
|
210
228
|
|
|
211
229
|
Include all columns again
|
|
212
230
|
|
|
@@ -216,19 +234,9 @@ Include all columns again
|
|
|
216
234
|
def reset_columns(self): ...
|
|
217
235
|
```
|
|
218
236
|
|
|
219
|
-
### ttree.rms
|
|
220
|
-
|
|
221
|
-
[Show source in ttree.py:364](../../rootloader/ttree.py#L364)
|
|
222
|
-
|
|
223
|
-
#### Signature
|
|
224
|
-
|
|
225
|
-
```python
|
|
226
|
-
def rms(self): ...
|
|
227
|
-
```
|
|
228
|
-
|
|
229
237
|
### ttree.set_filter
|
|
230
238
|
|
|
231
|
-
[Show source in ttree.py:
|
|
239
|
+
[Show source in ttree.py:353](../../rootloader/ttree.py#L353)
|
|
232
240
|
|
|
233
241
|
Set a filter on the dataframe to select a subset of the data
|
|
234
242
|
|
|
@@ -240,7 +248,7 @@ def set_filter(self, expression, inplace=False): ...
|
|
|
240
248
|
|
|
241
249
|
### ttree.set_index
|
|
242
250
|
|
|
243
|
-
[Show source in ttree.py:
|
|
251
|
+
[Show source in ttree.py:347](../../rootloader/ttree.py#L347)
|
|
244
252
|
|
|
245
253
|
Set the index column name
|
|
246
254
|
|
|
@@ -252,7 +260,9 @@ def set_index(self, column): ...
|
|
|
252
260
|
|
|
253
261
|
### ttree.size
|
|
254
262
|
|
|
255
|
-
[Show source in ttree.py:
|
|
263
|
+
[Show source in ttree.py:440](../../rootloader/ttree.py#L440)
|
|
264
|
+
|
|
265
|
+
Return the number of rows in the ttree
|
|
256
266
|
|
|
257
267
|
#### Signature
|
|
258
268
|
|
|
@@ -263,7 +273,9 @@ def size(self): ...
|
|
|
263
273
|
|
|
264
274
|
### ttree.std
|
|
265
275
|
|
|
266
|
-
[Show source in ttree.py:
|
|
276
|
+
[Show source in ttree.py:482](../../rootloader/ttree.py#L482)
|
|
277
|
+
|
|
278
|
+
Return the standard deviationif the of values the tree, for each branch
|
|
267
279
|
|
|
268
280
|
#### Signature
|
|
269
281
|
|
|
@@ -271,11 +283,35 @@ def size(self): ...
|
|
|
271
283
|
def std(self): ...
|
|
272
284
|
```
|
|
273
285
|
|
|
286
|
+
### ttree.sum
|
|
287
|
+
|
|
288
|
+
[Show source in ttree.py:479](../../rootloader/ttree.py#L479)
|
|
289
|
+
|
|
290
|
+
Return the sum of the values of the tree, for each branch
|
|
291
|
+
|
|
292
|
+
#### Signature
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
def sum(self): ...
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### ttree.to_array
|
|
299
|
+
|
|
300
|
+
[Show source in ttree.py:364](../../rootloader/ttree.py#L364)
|
|
301
|
+
|
|
302
|
+
Return ttree data as 1D or 2D numpy array (depending on number of columns)
|
|
303
|
+
|
|
304
|
+
#### Signature
|
|
305
|
+
|
|
306
|
+
```python
|
|
307
|
+
def to_array(self): ...
|
|
308
|
+
```
|
|
309
|
+
|
|
274
310
|
### ttree.to_dataframe
|
|
275
311
|
|
|
276
|
-
[Show source in ttree.py:
|
|
312
|
+
[Show source in ttree.py:375](../../rootloader/ttree.py#L375)
|
|
277
313
|
|
|
278
|
-
Return
|
|
314
|
+
Return ttree data as pandas dataframe
|
|
279
315
|
|
|
280
316
|
#### Signature
|
|
281
317
|
|
|
@@ -285,10 +321,25 @@ def to_dataframe(self): ...
|
|
|
285
321
|
|
|
286
322
|
### ttree.to_dict
|
|
287
323
|
|
|
288
|
-
[Show source in ttree.py:
|
|
324
|
+
[Show source in ttree.py:409](../../rootloader/ttree.py#L409)
|
|
325
|
+
|
|
326
|
+
Return ttree data as dict of numpy arrays
|
|
289
327
|
|
|
290
328
|
#### Signature
|
|
291
329
|
|
|
292
330
|
```python
|
|
293
331
|
def to_dict(self): ...
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### ttree.values
|
|
335
|
+
|
|
336
|
+
[Show source in ttree.py:444](../../rootloader/ttree.py#L444)
|
|
337
|
+
|
|
338
|
+
Convert ttree 1D or 2D numpy array (depending on number of columns)
|
|
339
|
+
|
|
340
|
+
#### Signature
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
@property
|
|
344
|
+
def values(self): ...
|
|
294
345
|
```
|
|
@@ -11,94 +11,13 @@ import os
|
|
|
11
11
|
import ROOT
|
|
12
12
|
ROOT.EnableImplicitMT()
|
|
13
13
|
|
|
14
|
-
# pre-compile stats functions to avoid memory creep during JIT compilations
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return df.
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
Double_t RDF_max_d(ROOT::RDataFrame df, string col){
|
|
22
|
-
return df.Max<Double_t>(col).GetValue();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
Double_t RDF_mean_d(ROOT::RDataFrame df, string col){
|
|
26
|
-
return df.Mean<Double_t>(col).GetValue();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
Double_t RDF_std_d(ROOT::RDataFrame df, string col){
|
|
30
|
-
return df.StdDev<Double_t>(col).GetValue();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
Double_t RDF_sum_d(ROOT::RDataFrame df, string col){
|
|
34
|
-
return df.Sum<Double_t>(col).GetValue();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Int_t RDF_min_i(ROOT::RDataFrame df, string col){
|
|
38
|
-
return df.Min<Int_t>(col).GetValue();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Int_t RDF_max_i(ROOT::RDataFrame df, string col){
|
|
42
|
-
return df.Max<Int_t>(col).GetValue();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
Int_t RDF_mean_i(ROOT::RDataFrame df, string col){
|
|
46
|
-
return df.Mean<Int_t>(col).GetValue();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
Int_t RDF_std_i(ROOT::RDataFrame df, string col){
|
|
50
|
-
return df.StdDev<Int_t>(col).GetValue();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
Int_t RDF_sum_i(ROOT::RDataFrame df, string col){
|
|
54
|
-
return df.Sum<Int_t>(col).GetValue();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/////////////////////////////////////////////////////////////////
|
|
58
|
-
|
|
59
|
-
Double_t RDF_min_d(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
60
|
-
return df.Min<Double_t>(col).GetValue();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
Double_t RDF_max_d(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
64
|
-
return df.Max<Double_t>(col).GetValue();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
Double_t RDF_mean_d(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
68
|
-
return df.Mean<Double_t>(col).GetValue();
|
|
14
|
+
# template to pre-compile stats functions to avoid memory creep during JIT compilations
|
|
15
|
+
# used in ttree._get_stat
|
|
16
|
+
cpp_template = """
|
|
17
|
+
{TYPE2} RDF_{FNNAME}_{TYPE2}({DTYPE} df, string col){
|
|
18
|
+
return df.{FNNAME}<{TYPE2}>(col).GetValue();
|
|
69
19
|
}
|
|
70
|
-
|
|
71
|
-
Double_t RDF_std_d(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
72
|
-
return df.StdDev<Double_t>(col).GetValue();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Double_t RDF_sum_d(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
76
|
-
return df.Sum<Double_t>(col).GetValue();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Int_t RDF_min_i(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
80
|
-
return df.Min<Int_t>(col).GetValue();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
Int_t RDF_max_i(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
84
|
-
return df.Max<Int_t>(col).GetValue();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Int_t RDF_mean_i(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
88
|
-
return df.Mean<Int_t>(col).GetValue();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
Int_t RDF_std_i(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
92
|
-
return df.StdDev<Int_t>(col).GetValue();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
Int_t RDF_sum_i(ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void> df, string col){
|
|
96
|
-
return df.Sum<Int_t>(col).GetValue();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
20
|
"""
|
|
101
|
-
ROOT.gInterpreter.Declare(cpp_code)
|
|
102
21
|
|
|
103
22
|
class ttree(object):
|
|
104
23
|
"""Extract ROOT.TTree with lazy operation. Looks like a dataframe in most ways
|
|
@@ -361,8 +280,19 @@ class ttree(object):
|
|
|
361
280
|
new.set_filter(expression, inplace=True)
|
|
362
281
|
return new
|
|
363
282
|
|
|
283
|
+
def to_array(self):
|
|
284
|
+
"""Return ttree data as 1D or 2D numpy array (depending on number of columns)"""
|
|
285
|
+
df = self.to_dict()
|
|
286
|
+
output = np.stack([df[k] for k in df.keys()])
|
|
287
|
+
|
|
288
|
+
# single array output for one column
|
|
289
|
+
if output.shape[0] == 1:
|
|
290
|
+
return output[0]
|
|
291
|
+
else:
|
|
292
|
+
return output
|
|
293
|
+
|
|
364
294
|
def to_dataframe(self):
|
|
365
|
-
"""Return
|
|
295
|
+
"""Return ttree data as pandas dataframe"""
|
|
366
296
|
|
|
367
297
|
df = self.to_dict()
|
|
368
298
|
|
|
@@ -396,7 +326,7 @@ class ttree(object):
|
|
|
396
326
|
return df
|
|
397
327
|
|
|
398
328
|
def to_dict(self):
|
|
399
|
-
|
|
329
|
+
"""Return ttree data as dict of numpy arrays"""
|
|
400
330
|
# ensure index is loaded
|
|
401
331
|
if self._index not in self._columns and self._index is not None:
|
|
402
332
|
columns = [*self._columns, self._index]
|
|
@@ -408,37 +338,51 @@ class ttree(object):
|
|
|
408
338
|
# PROPERTIES ===========================
|
|
409
339
|
@property
|
|
410
340
|
def columns(self):
|
|
341
|
+
"""Return list of column (branch) names"""
|
|
411
342
|
return self._columns
|
|
412
343
|
@property
|
|
413
344
|
def filters(self):
|
|
345
|
+
"""Return list of RDataFrame filters"""
|
|
414
346
|
return self._filters
|
|
415
347
|
@property
|
|
416
348
|
def index(self):
|
|
349
|
+
"""Return ttree of just the index data"""
|
|
417
350
|
return self[self._index]
|
|
418
351
|
@property
|
|
419
352
|
def index_name(self):
|
|
353
|
+
"""Return string of the name of the index branch"""
|
|
420
354
|
return self._index
|
|
421
355
|
@property
|
|
422
356
|
def loc(self):
|
|
357
|
+
"""Return a ttree that can be indexed like a pandas dataframe"""
|
|
423
358
|
return _ttree_indexed(self)
|
|
424
359
|
@property
|
|
425
360
|
def size(self):
|
|
361
|
+
"""Return the number of rows in the ttree"""
|
|
426
362
|
return self._rdf.Count().GetValue()
|
|
427
|
-
|
|
363
|
+
@property
|
|
364
|
+
def values(self):
|
|
365
|
+
"""Convert ttree 1D or 2D numpy array (depending on number of columns)"""
|
|
366
|
+
return self.to_array()
|
|
367
|
+
|
|
428
368
|
# STATS ================================
|
|
429
369
|
def _getstat(self, fnname):
|
|
430
|
-
|
|
431
|
-
double_fn = getattr(ROOT, f'RDF_{fnname}_d')
|
|
432
|
-
int_fn = getattr(ROOT, f'RDF_{fnname}_i')
|
|
433
|
-
|
|
434
370
|
vals = []
|
|
435
371
|
for col in self._columns:
|
|
436
372
|
dtype = self._rdf.GetColumnType(col)
|
|
437
373
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
374
|
+
# pre-compile function
|
|
375
|
+
fn_name = f'RDF_{fnname}_{dtype}'
|
|
376
|
+
if not hasattr(ROOT, fn_name):
|
|
377
|
+
for type1 in [r'ROOT::RDataFrame',
|
|
378
|
+
r'ROOT::RDF::RInterface<ROOT::Detail::RDF::RJittedFilter,void>']:
|
|
379
|
+
cpp_code = cpp_template.replace('{DTYPE}', type1)
|
|
380
|
+
cpp_code = cpp_code.replace('{TYPE2}', dtype)
|
|
381
|
+
cpp_code = cpp_code.replace('{FNNAME}', fnname)
|
|
382
|
+
ROOT.gInterpreter.Declare(cpp_code)
|
|
383
|
+
|
|
384
|
+
# do the computation
|
|
385
|
+
vals.append(getattr(ROOT, fn_name)(self._rdf, col))
|
|
442
386
|
|
|
443
387
|
# for len = 1 outputs return only the value
|
|
444
388
|
if len(vals) == 1:
|
|
@@ -446,11 +390,21 @@ class ttree(object):
|
|
|
446
390
|
else:
|
|
447
391
|
return pd.Series(vals, index=self._columns)
|
|
448
392
|
|
|
449
|
-
def min(self):
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
def
|
|
453
|
-
|
|
393
|
+
def min(self):
|
|
394
|
+
"""Return the min value of the tree, for each branch"""
|
|
395
|
+
return self._getstat('Min')
|
|
396
|
+
def max(self):
|
|
397
|
+
"""Return the max value of the tree, for each branch"""
|
|
398
|
+
return self._getstat('Max')
|
|
399
|
+
def mean(self):
|
|
400
|
+
"""Return the mean value of the tree, for each branch"""
|
|
401
|
+
return self._getstat('Mean')
|
|
402
|
+
def sum(self):
|
|
403
|
+
"""Return the sum of the values of the tree, for each branch"""
|
|
404
|
+
return self._getstat('Sum')
|
|
405
|
+
def std(self):
|
|
406
|
+
"""Return the standard deviationif the of values the tree, for each branch"""
|
|
407
|
+
return self._getstat('StdDev')
|
|
454
408
|
|
|
455
409
|
# ttree but slice on time
|
|
456
410
|
class _ttree_indexed(object):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.3.1'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.2.7'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|