Skip to content

Commit 1e5df6b

Browse files
committed
Update examples doc to add examples for all types of queries
1 parent 636170f commit 1e5df6b

File tree

1 file changed

+20
-54
lines changed

1 file changed

+20
-54
lines changed

docs/examples.rst

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,83 +27,49 @@ you can use the following code:
2727
2828
Raw Uproot Example
2929
------------------
30-
This example uses the raw uproot query type to extract the `el_pt_NOSYS` branch from the `reco` tree
31-
in `user.mtost:user.mtost.singletop.p6026.Jun13` Dataset.
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.
3232

3333
.. tabs::
3434

35-
.. tab:: *yaml*
35+
.. tab:: *YAML*
3636

37-
.. literalinclude:: ../examples/config_Uproot_UprootRaw.yaml
37+
.. literalinclude:: ../examples/config_UprootRaw.yaml
3838
:language: yaml
3939

40-
.. tab:: *dict*
40+
.. tab:: *Python Dict*
4141

42-
.. literalinclude:: ../examples/Uproot_UprootRaw_Dict.py
42+
.. literalinclude:: ../examples/UprootRaw_Dict.py
43+
:language: python
44+
45+
.. tab:: *Python Typed Object*
46+
47+
.. literalinclude:: ../examples/UprootRaw_Typed.py
4348
:language: python
4449

4550

4651
Python Function Example
4752
-----------------------
48-
This example uses an uproot python function to extract the `el_pt_NOSYS` branch from the `reco` tree
49-
in `user.mtost:user.mtost.singletop.p6026.Jun13` Dataset. Note that you can specify a python function
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
5055
even in a yaml file.
5156

5257
.. tabs::
5358

54-
.. tab:: *yaml*
59+
.. tab:: *YAML*
5560

56-
.. literalinclude:: ../examples/config_Uproot_PythonFunction.yaml
61+
.. literalinclude:: ../examples/config_PythonFunction.yaml
5762
:language: yaml
5863

59-
.. tab:: *dict*
64+
.. tab:: *Python Dict*
6065

61-
.. literalinclude:: ../examples/Uproot_PythonFunction_Dict.py
66+
.. literalinclude:: ../examples/PythonFunction_Dict.py
6267
:language: python
6368

69+
.. tab:: *Python Typed Object*
6470

65-
Simple Func_ADL Example
66-
-----------------------
67-
This simple example reads a single root file form the CERN Opendata repo
68-
69-
.. code:: python
70-
71-
from servicex_client.dataset_identifier import FileListDataset
72-
from servicex_client.models import ResultFormat
73-
from servicex_client.servicex_client import ServiceXClient
74-
75-
sx = ServiceXClient(backend="localhost")
76-
dataset_id = FileListDataset("root://eospublic.cern.ch//eos/opendata/atlas/OutreachDatasets/2020-01-22/4lep/MC/mc_345060.ggH125_ZZ4lep.4lep.root") # NOQA 501
77-
78-
ds = sx.func_adl_dataset(dataset_id, codegen="uproot",
79-
title="Root",
80-
result_format=ResultFormat.parquet)
81-
82-
sx3 = ds.Select(lambda e: {'lep_pt': e['lep_pt']}). \
83-
Where(lambda e: e['lep_pt'] > 1000). \
84-
as_pandas()
85-
print(sx3)
86-
87-
Func_ADL Example With Rucio Dataset
88-
-----------------------------------
89-
This example uses the Rucio Dataset Identifier and returns a list of downloaded
90-
parquet files
91-
92-
.. code:: python
93-
94-
from servicex_client.dataset_identifier import RucioDatasetIdentifier
95-
from servicex_client.models import ResultFormat
96-
from servicex_client.servicex_client import ServiceXClient
97-
98-
sx = ServiceXClient(backend="testing4")
99-
100-
dataset_id = RucioDatasetIdentifier("user.kchoi:user.kchoi.fcnc_tHq_ML.ttH.v8")
101-
102-
ds = sx.func_adl_dataset(dataset_id)
71+
.. literalinclude:: ../examples/PythonFunction_Typed.py
72+
:language: python
10373

104-
sx2 = ds.Select(lambda e: {'el_pt': e['el_pt']})\
105-
.set_result_format(ResultFormat.parquet)\
106-
.as_files()
10774

108-
print(sx2)
10975

0 commit comments

Comments
 (0)