Skip to content

Commit

Permalink
Completed adding ROOT functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aryan26roy committed Mar 4, 2024
1 parent 8b2b178 commit 7e90d46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/formulate/AST.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ def to_python(self):
return f"np.ceil({self.arguments[0]})"
case "abs":
return f"np.abs({self.arguments[0]})"
case "even":
return f"! ({self.arguments[0]} % 2)"
case "factorial":
return f"np.math.factorial({self.arguments[0]})"
case "floor":
return f"! np.floor({self.arguments[0]})"
case "abs":
return f"np.abs({self.arguments[0]})"
case "max":
return f"root_max({self.arguments[0]})"
case "min":
Expand Down
3 changes: 3 additions & 0 deletions src/formulate/toast.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"TMATH::ATANH": "atanh",
"TMATH::CEIL": "ceil",
"TMATH::ABS": "abs",
"TMath::Even": "even",
"TMath::Factorial": "factorial",
"TMath::Floor": "floor",
"LENGTH$": "no_of_entries", #ak.num, axis = 1
"ITERATION$": "current_iteration",
"SUM$": "sum",
Expand Down

0 comments on commit 7e90d46

Please sign in to comment.