rootloader 1.2.4__tar.gz → 1.2.6__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.
Files changed (26) hide show
  1. {rootloader-1.2.4 → rootloader-1.2.6}/PKG-INFO +1 -1
  2. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/th1.py +1 -1
  3. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/ttree.py +54 -3
  4. rootloader-1.2.6/rootloader/version.py +1 -0
  5. rootloader-1.2.4/rootloader/version.py +0 -1
  6. {rootloader-1.2.4 → rootloader-1.2.6}/.gitignore +0 -0
  7. {rootloader-1.2.4 → rootloader-1.2.6}/LICENSE +0 -0
  8. {rootloader-1.2.4 → rootloader-1.2.6}/README.md +0 -0
  9. {rootloader-1.2.4 → rootloader-1.2.6}/docs/README.md +0 -0
  10. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/attrdict.md +0 -0
  11. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/index.md +0 -0
  12. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/tdirectory.md +0 -0
  13. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/tfile.md +0 -0
  14. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/th1.md +0 -0
  15. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/th2.md +0 -0
  16. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/tleaf.md +0 -0
  17. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/ttree.md +0 -0
  18. {rootloader-1.2.4 → rootloader-1.2.6}/docs/rootloader/version.md +0 -0
  19. {rootloader-1.2.4 → rootloader-1.2.6}/gen_documentation.bash +0 -0
  20. {rootloader-1.2.4 → rootloader-1.2.6}/pyproject.toml +0 -0
  21. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/__init__.py +0 -0
  22. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/attrdict.py +0 -0
  23. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/tdirectory.py +0 -0
  24. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/tfile.py +0 -0
  25. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/th2.py +0 -0
  26. {rootloader-1.2.4 → rootloader-1.2.6}/rootloader/tleaf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rootloader
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: Read simple root files into memory
5
5
  Project-URL: Homepage, https://github.com/ucn-triumf/rootloader
6
6
  Project-URL: Bug Tracker, https://github.com/ucn-triumf/rootloader/issues
@@ -39,7 +39,7 @@ class th1(object):
39
39
  if hist is None:
40
40
  return
41
41
 
42
- if type(hist) is pd.DataFrame:
42
+ if isinstance(hist, pd.DataFrame):
43
43
  self._from_dataframe(hist)
44
44
  return
45
45
 
@@ -1,4 +1,4 @@
1
- # TTree object for the giant UCN hits trees
1
+ # TTree object for the giant UCN hits trees
2
2
  # Derek Fujimoto
3
3
  # June 2025
4
4
 
@@ -12,6 +12,7 @@ import ROOT
12
12
  ROOT.EnableImplicitMT()
13
13
 
14
14
  # pre-compile stats functions to avoid memory creep during JIT compilations
15
+
15
16
  cpp_code = """
16
17
  Double_t RDF_min_d(ROOT::RDataFrame df, string col){
17
18
  return df.Min<Double_t>(col).GetValue();
@@ -52,6 +53,50 @@ Int_t RDF_std_i(ROOT::RDataFrame df, string col){
52
53
  Int_t RDF_sum_i(ROOT::RDataFrame df, string col){
53
54
  return df.Sum<Int_t>(col).GetValue();
54
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();
69
+ }
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
+
55
100
  """
56
101
  ROOT.gInterpreter.Declare(cpp_code)
57
102
 
@@ -337,7 +382,7 @@ class ttree(object):
337
382
  df = pd.DataFrame(df)
338
383
 
339
384
  # set index
340
- if self._index is not None:
385
+ if self._index is not None and len(df.columns) > 1:
341
386
  df.set_index(self._index, inplace=True)
342
387
 
343
388
  # convert to series?
@@ -385,11 +430,17 @@ class ttree(object):
385
430
  vals = []
386
431
  for col in self._columns:
387
432
  dtype = self._rdf.GetColumnType(col)
433
+
388
434
  if dtype == 'Double_t':
389
435
  vals.append(double_fn(self._rdf, col))
390
436
  elif dtype == 'Int_t':
391
437
  vals.append(int_fn(self._rdf, col))
392
- return pd.Series(vals, index=self._columns)
438
+
439
+ # for len = 1 outputs return only the value
440
+ if len(vals) == 1:
441
+ return vals[0]
442
+ else:
443
+ return pd.Series(vals, index=self._columns)
393
444
 
394
445
  def min(self): return self._getstat('min')
395
446
  def max(self): return self._getstat('max')
@@ -0,0 +1 @@
1
+ __version__ = '1.2.6'
@@ -1 +0,0 @@
1
- __version__ = '1.2.4'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes