You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-sphinx/basic.rst
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -924,6 +924,8 @@ Reading RNTuples
924
924
925
925
TTree has been the default format to store large datasets inROOT files for decades. However, it has slowly become outdated andisnot optimized for modern systems. This is where the RNTuple format comes in. It is a modern serialization format that is designed with modern systems in mind andis planned to replace TTree in the coming years. `Version 1.0.0.0 <https://cds.cern.ch/record/2923186>`__ is out and will be supported "forever".
926
926
927
+
Starting in Uproot v5.7.0, RNTuple is the default formatfor writing. When you use the dict-like syntax to write data to a file, Uproot will create an RNTuple instead of a TTree.
928
+
927
929
RNTuples are deliberately simpler than TTrees by design. For the first time, there’s an official specification, making it much easier for third-party I/O tools like Uproot to support it. Uproot already supports reading the full RNTuple specification, meaning that you can read any RNTuple you find in the wild. It also already supports writing a large part of the specification, and intends to support as much as it makes sense for data analysis.
928
930
929
931
To ease the transition into RNTuples, we are designing the interface to closely match the existing TTree interface. Many of the functionality explained in the previous subsections works in the same way. However, there the terminology is slightly different (e.g. "branch" becomes "field") and arguments may vary slightly, accordingly.
@@ -1145,8 +1147,10 @@ Writing TTrees to a file
1145
1147
TTrees are a special type of object, just as TDirectories are special: data can be cumulatively added to them.
1146
1148
1147
1149
:doc:`uproot.writing.writable.WritableTree` objects can be created using the :ref:`uproot.writing.writable.WritableDirectory.mktree` method that Uproot provides for TDirectories.
1148
-
Previously, they could be created by assigning TTree-like data to a name in a directory (e.g., ``file["tree"] = {"branch": np.arange(1000)}``). However, this syntax was deprecated,
1149
-
as Uproot will switch to writing RNTuples with syntax, since the HEP community is moving towards RNTuples.
1150
+
1151
+
.. note::
1152
+
1153
+
Starting in v5.7.0, Uproot uses RNTuples as the default formatfor writing data when using the dict-like assignment syntax (e.g., ``file["my_data"] = {"my_array": np.arange(1000)}``). If you specifically want to write a TTree, you should use the :ref:`uproot.writing.writable.WritableDirectory.mktree` method.
1150
1154
1151
1155
.. code-block:: python
1152
1156
@@ -1327,14 +1331,21 @@ Writing RNTuples
1327
1331
1328
1332
Just like with reading, writing RNTuples is similar to writing TTree objects. Since RNTuples are much simpler, we aim to be able to write almost any RNTuple that you might want.
1329
1333
1330
-
Here is an example of writing an RNTuple. Since TTree is still the default formatfor the near future, writing an RNTuple is a bit more verbose.
1334
+
RNTuples are the default formatforwriting data starting in Uproot v5.7.0. You can write an RNTuple by using a dict-like syntax:
>>> rntuple.extend(data) # Can be extended, just like TTrees
1340
+
>>>file["my_rntuple"] = data
1341
+
>>>file["my_rntuple"].extend(data) # Can be extended, just like TTrees
1342
+
1343
+
You can also use the :ref:`uproot.writing.writable.WritableDirectory.mkrntuple` method for more explicit RNTuple creation, and to have the ability to initialize an empty RNTuple from a type specification dictionary or an Awkward form.
0 commit comments