Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
touch up documentation some more
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed May 21, 2019
1 parent 0c10c05 commit 3a8a0ff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ For a list of all functions, classes, methods, and their parameters, click below

- `uproot.open <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-open>`__
- `uproot.xrootd <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-xrootd>`__
- `uproot.http <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-http>`__
- `uproot.iterate <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-iterate>`__
- `uproot.pandas.iterate <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-pandas-iterate>`__
- `uproot.lazyarray(s) <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-lazyarray-and-lazyarrays>`__
- `uproot.daskarray/daskframe <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-daskarray-and-daskframe>`__
- `uproot.numentries <http://uproot.readthedocs.io/en/latest/opening-files.html#uproot-numentries>`__

* `ROOT I/O <http://uproot.readthedocs.io/en/latest/root-io.html>`__

Expand Down
23 changes: 15 additions & 8 deletions docs/source/opening-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,44 @@ Unlike ROOT, uproot strongly assumes that the input file does not change while y
uproot.open
-----------

All ROOT objects come from ROOT files, so :py:func:`open <uproot.rootio.open>` is probably the first function you'll call. The :py:class:`ROOTDirectory <uproot.rootio.ROOTDirectory>` object it returns is a handle for accessing contents deeper within the file.
All ROOT objects come from ROOT files, so :py:func:`uproot.open <uproot.rootio.open>` is probably the first function you'll call. The :py:class:`ROOTDirectory <uproot.rootio.ROOTDirectory>` object it returns is a handle for accessing contents deeper within the file. If the file is remote, use ``"root://"`` or ``"http://"`` in the file name to invoke a remote protocol.

.. autofunction:: uproot.rootio.open

uproot.xrootd
-------------

Although :py:func:`open <uproot.open>` opens files regardless of whether they're local or remote, you can explicitly invoke XRootD with :py:func:`xrootd <uproot.xrootd>`. You get the same kind of :py:class:`ROOTDirectory <uproot.rootio.ROOTDirectory>` as from :py:func:`open <uproot.open>`.
Although :py:func:`uproot.open <uproot.rootio.open>` opens files regardless of whether they're local or remote, you can explicitly invoke XRootD with :py:func:`uproot.xrootd <uproot.rootio.xrootd>`. You get the same kind of :py:class:`ROOTDirectory <uproot.rootio.ROOTDirectory>` as from :py:func:`uproot.open <uproot.rootio.open>`.

.. autofunction:: uproot.rootio.xrootd

uproot.http
-----------

You can also open files through the HTTP protocol (and some XRootD servers support HTTP, too). The :py:func:`uproot.http <uproot.rootio.http>` function opens files via HTTP.

.. autofunction:: uproot.rootio.http

uproot.iterate
--------------

With a :py:class:`ROOTDirectory <uproot.rootio.ROOTDirectory>`, you can dig into a file and extract objects, subdirectories, or TTree data, but sometimes you know exactly where to find a TTree and have a collection of identically-typed files to iterate through.

The :py:func:`iterate <uproot.iterate>` function gives you an iterator over groups of arrays just like :py:meth:`TreeMethods.iterate <uproot.tree.TreeMethods.iterate>`, except that it iterates over a large set of files (and verifies that the selected TTree branches are compatible). This serves essentially the same function as ROOT's TChain, allowing you to use TTrees in a set of files the same way you would use a single TTree.
The :py:func:`uproot.iterate <uproot.tree.iterate>` function gives you an iterator over groups of arrays just like :py:meth:`TreeMethods.iterate <uproot.tree.TreeMethods.iterate>`, except that it iterates over a large set of files (and verifies that the selected TTree branches are compatible). This serves essentially the same function as ROOT's TChain, allowing you to use TTrees in a set of files the same way you would use a single TTree.

.. autofunction:: uproot.tree.iterate

uproot.pandas.iterate
---------------------

Like the above, except that it iterates over Pandas DataFrames (as though you passed ``outputtype=pandas.DataFrame`` and changed some defaults).
The :py:func`uproot.pandas.iterate <uproot.pandas.iterate>` function is like the above, except that it iterates over Pandas DataFrames (as though you passed ``outputtype=pandas.DataFrame`` and changed some defaults).

.. autofunction:: uproot.pandas.iterate

uproot.lazyarray and lazyarrays
-------------------------------

The :py:func:`lazyarray <uproot.lazyarray>` and :py:func:`lazyarrays <uproot.lazyarrays>` give you a lazy view into a whole collection of files. They behave like the :py:meth:`TTreeMethods.lazyarray <uproot.tree.TTreeMethods.lazyarray>` and :py:meth:`TTreeMethods.lazyarrays <uproot.tree.TTreeMethods.lazyarrays>` methods except that they wildcarded filenames and a TTree name as the first arguments.
The :py:func:`uproot.lazyarray <uproot.tree.lazyarray>` and :py:func:`uproot.lazyarrays <uproot.tree.lazyarrays>` give you a lazy view into a whole collection of files. They behave like the :py:meth:`TTreeMethods.lazyarray <uproot.tree.TTreeMethods.lazyarray>` and :py:meth:`TTreeMethods.lazyarrays <uproot.tree.TTreeMethods.lazyarrays>` methods except that they wildcarded filenames and a TTree name as the first arguments.

.. autofunction:: uproot.tree.lazyarray

Expand All @@ -45,14 +52,14 @@ The :py:func:`lazyarray <uproot.lazyarray>` and :py:func:`lazyarrays <uproot.laz
uproot.daskarray and daskframe
------------------------------

Like the above, but presents the data as `Dask <https://dask.org/>`__ objects.
The following are the above, but presents the data as `Dask <https://dask.org/>`__ objects.

.. autofunction:: uproot.tree.daskarray

.. autofunction:: uproot.tree.daskframe

uproot.tree.numentries
----------------------
uproot.numentries
-----------------

If you need to know the total number of entries of a set of files before processing them (e.g. for normalization or setting weights), you could open each file and TTree individually, but the function below is faster because it skips some steps that aren't needed when you only want the number of files.

Expand Down

0 comments on commit 3a8a0ff

Please sign in to comment.