@@ -4,62 +4,68 @@ Here are some examples of how to use the ServiceX client to extract data from a
4
4
examples shows the three ways to specify a request: as a YAML file, as a Python dictionary, and
5
5
as a typed Python object.
6
6
7
- The ServiceX Deliver Function
8
- -----------------------------
9
- The `deliver ` function is used to submit a request to ServiceX. It takes a request in one of the
10
- three formats and returns a list `TransformedResult ` objects. Each `TransformedResult ` object
11
- is represents the result of a single sample in the request. The `TransformedResult ` object
12
- contains the name of the sample, the output format, and a list of URLs or local file paths
13
- where the results can be found.
14
7
15
- How to Use YAML Specification
16
- -----------------------------
17
- In order to consume the YAML specification and pass it to the ServiceX `deliver ` function
18
- you can use the following code:
8
+ Examples For Each Query Type
9
+ ------------------
10
+ Examples for each query type (Uproot-Raw, Func_ADL Uproot, Python Function)
11
+ and three different representations (Python Dictionary, Python Typed Object, and YAML).
12
+ Note that all examples extract the same branch of the same tree (`ROOT TTree `) from
13
+ the same :ref: `dataset <label_dataset >`.
19
14
20
- .. code :: python
21
15
22
- from servicex import deliver
16
+ Uproot-Raw Query Example
17
+ ~~~~~~~~~~~~~~~~~~~~
18
+ This example uses the raw uproot query type to extract the `AnalysisElectronsAuxDyn.pt ` branch
19
+ from the `CollectionTree ` tree in ATLAS PHYSLITE OpenData Dataset.
23
20
24
- print (
25
- deliver( " config_Uproot_FuncADL.yaml " )
26
- )
21
+ .. tabs ::
22
+
23
+ .. tab :: *Python Dict*
27
24
28
- Raw Uproot Example
29
- ------------------
30
- This example uses the raw uproot query type to extract the ` AnalysisElectronsAuxDyn.pt ` branch from the ` CollectionTree ` tree
31
- in ATLAS PHYSLITE OpenData Dataset.
25
+ .. literalinclude :: ../examples/UprootRaw_Dict.py
26
+ :language: python
27
+
28
+ .. tab :: *Python Typed Object*
32
29
33
- .. tabs ::
30
+ .. literalinclude :: ../examples/UprootRaw_Typed.py
31
+ :language: python
34
32
35
33
.. tab :: *YAML*
36
34
37
35
.. literalinclude :: ../examples/config_UprootRaw.yaml
38
36
:language: yaml
39
37
38
+
39
+ Func_ADL Uproot Query Example
40
+ ~~~~~~~~~~~~~~~~~~~~
41
+ This example uses an Func_ADL to extract the `AnalysisElectronsAuxDyn.pt ` branch
42
+ from the `CollectionTree ` tree in ATLAS PHYSLITE OpenData Dataset.
43
+
44
+ .. tabs ::
45
+
40
46
.. tab :: *Python Dict*
41
47
42
- .. literalinclude :: ../examples/UprootRaw_Dict .py
48
+ .. literalinclude :: ../examples/FuncADL_Uproot_Dict .py
43
49
:language: python
44
-
50
+
45
51
.. tab :: *Python Typed Object*
46
52
47
- .. literalinclude :: ../examples/UprootRaw_Typed .py
53
+ .. literalinclude :: ../examples/FuncADL_Uproot_Typed .py
48
54
:language: python
49
55
56
+ .. tab :: *YAML*
50
57
51
- Python Function Example
52
- -----------------------
53
- This example uses an uproot python function to extract the `AnalysisElectronsAuxDyn.pt ` branch from the `CollectionTree ` tree
54
- in ATLAS PHYSLITE OpenData Dataset. Note that you can specify a python function
55
- even in a yaml file.
58
+ .. literalinclude :: ../examples/config_FuncADL_Uproot.yaml
59
+ :language: yaml
56
60
57
- .. tabs ::
58
61
59
- .. tab :: *YAML*
62
+ Python Function Query Example
63
+ ~~~~~~~~~~~~~~~~~~~~
64
+ This example uses an uproot python function to extract the `AnalysisElectronsAuxDyn.pt ` branch
65
+ from the `CollectionTree ` tree in ATLAS PHYSLITE OpenData Dataset.
66
+ Note that you can specify a python function even in a yaml file.
60
67
61
- .. literalinclude :: ../examples/config_PythonFunction.yaml
62
- :language: yaml
68
+ .. tabs ::
63
69
64
70
.. tab :: *Python Dict*
65
71
@@ -71,25 +77,35 @@ even in a yaml file.
71
77
.. literalinclude :: ../examples/PythonFunction_Typed.py
72
78
:language: python
73
79
80
+ .. tab :: *YAML*
74
81
75
- Func_ADL Uproot Example
76
- -----------------------
77
- This example uses an Func_ADL to extract the `AnalysisElectronsAuxDyn.pt ` branch from the `CollectionTree ` tree
78
- in ATLAS PHYSLITE OpenData Dataset.
82
+ .. literalinclude :: ../examples/config_PythonFunction.yaml
83
+ :language: yaml
79
84
80
- .. tabs ::
81
85
82
- .. tab :: *YAML*
86
+ The ServiceX Deliver Function
87
+ -----------------------------
88
+ The `deliver ` function is used to submit a request to ServiceX. It takes a request in one of the
89
+ three formats and returns a python dictionary with the name of the sample as a key
90
+ and a list of URLs or local file paths as a value.
83
91
84
- .. literalinclude :: ../examples/config_FuncADL_Uproot.yaml
85
- :language: yaml
86
92
87
- .. tab :: *Python Dict*
93
+ How to Use YAML Specification
94
+ -----------------------------
95
+ YAML specification can be consumed by passing it to the ServiceX `deliver ` function.
96
+ You can use the following code:
88
97
89
- .. literalinclude :: ../examples/FuncADL_Uproot_Dict.py
90
- :language: python
98
+ .. code :: python
91
99
92
- .. tab :: *Python Typed Object*
100
+ from servicex import deliver
93
101
94
- .. literalinclude :: ../examples/FuncADL_Uproot_Typed.py
95
- :language: python
102
+ print (
103
+ deliver(" config_Uproot_FuncADL.yaml" )
104
+ )
105
+
106
+ .. _label_dataset :
107
+ The Dataset in Examples
108
+ -----------------------
109
+ The dataset in the examples is publically accessible ATLAS Open Data
110
+ (`ATLAS DAOD PHYSLITE format Run 2 2016 proton-proton collision data
111
+ <https://opendata.cern.ch/record/80001> `_).
0 commit comments