Introduction
TCut selection for ROOT TTree to Qastle wrapper for ServiceX uproot backends.
Supported expressions
- Arithmetic operators:
+, -, *, / - Logical operators:
!, &&, || - Relational and comparison operators:
==, !=, >, <, >=, <= - Ternary operator:
(A?B:C)- has to be enclosed in parentheses - Mathematical function:
sqrt
Usage
<tree_name>: Tree name of input flat ROOT ntuple (required only for uproot)<selected_columns>: List of selected branches (or columns) to deliver. Branches are separated by comma. Deliver all branches if nothing specified.<tcut_selection>: Selection expression with a combination of the branches. No selection is applied if nothing specified.
import tcut_to_qastle
# Get Qastle query
query = tcut_to_qastle.translate(<tree_name>, <selected_columns>, <tcut_selection>)
# Get the list of columns in the TCut selection
columns_in_selection = tcut_to_qastle.get_list_of_columns_in_selection(<TCut selection>)
Example
>>> import tcut_to_qastle
>>> query = tcut_to_qastle.translate("tree", "A,B", "A && B * C>0")
>>> query
"(Select (Where (call EventDataset 'ServiceXDatasetSource' 'tree') (lambda (list event) (and (> (attr event 'A') 0) (> (* (attr event 'B') (attr event 'C')) 0)))) (lambda (list event) (dict (list 'A' 'B') (list (attr event 'A') (attr event 'B')))))"
>>> columns_in_selection = tcut_to_qastle.get_list_of_columns_in_selection("A && B * C>0")
>>> columns_in_selection
['A', 'B', 'C']
Compatibility
Current version is compatible with the following docker image tag of the uproot transformer
sslhep/servicex_func_adl_uproot_transformer:v1.0.0-rc.3sslhep/servicex_func_adl_uproot_transformer:develop
Development
Verbose mode shows intermediate steps from TCut syntax to qastle. The last arguement of the function translate() is a flag to enable the verbose mode. It prints the input TCut selection expression, translated func-adl selection expression, full func-adl query which includes the name of tree and selected branches, and full qastle query.
>>> query = tcut_to_qastle.translate("tree", "A,B", "A && B * C>0", verbose=True)
TCut selection syntax:
A && B * C>0
Translated func-adl selection syntax:
event.A > 0 and event.B * event.C > 0
Full func-adl query:
EventDataset("ServiceXDatasetSource", "tree").Where("lambda event: event.A > 0 and event.B * event.C > 0 ").Select("lambda event: {'A': event.A, 'B': event.B} ")
Full qastle query:
(Select (Where (call EventDataset 'ServiceXDatasetSource' 'tree') (lambda (list event) (and (> (attr event 'A') 0) (> (* (attr event 'B') (attr event 'C')) 0)))) (lambda (list event) (dict (list 'A' 'B') (list (attr event 'A') (attr event 'B')))))
Metadata
Release files for tcut-to-qastle 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tcut_to_qastle-0.7.tar.gz | 5.8 kB | Without provenance | Details for tcut_to_qastle-0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tcut_to_qastle-0.7-py3-none-any.whl | Python 3 | none | any | Details for tcut_to_qastle-0.7-py3-none-any.whl |
Total release size: 12.2 kB
Release files / tcut_to_qastle-0.7.tar.gz
| Download URL | tcut_to_qastle-0.7.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6cb1b370f6f17550f6d53a9be9675c46da84ac9dc1918a64aacfdfc3bd51fd93
|
|
BLAKE2b-256 checksum How to use checksums |
da8422194684f9612c7cfb24c773dbf1103c60120c24b6b5dbe76b3d1ed94654
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.4
|
Release files / tcut_to_qastle-0.7-py3-none-any.whl
| Download URL | tcut_to_qastle-0.7-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b295d62a6a7501bbb76a94a432d28a0cb245258aed404d50f18be8326af9bcc5
|
|
BLAKE2b-256 checksum How to use checksums |
8e8d1f55179d3770549841525dc85f445e0faca38f4401de316b3374d921a993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.4
|
Security for tcut-to-qastle 0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.