uproot.WritableBranch

Defined in uproot.writing.writable on line 1864.

class uproot.writing.writable.WritableBranch(tree, datum)

Represents a TBranch from a uproot.WritableTree.

This object exists only to be able to assign compression settings differently on each TBranch:

my_directory["tree"]["branch1"].compression = uproot.ZLIB(1)
my_directory["tree"]["branch2"].compression = uproot.LZMA(9)

Note that compression settings on all TBranches can be set through uproot.writing.writable.WritableTree.compression:

my_directory["tree"].compression = {"branch1": uproot.ZLIB(1),
                                    "branch2": uproot.LZMA(9)}

type

WritableBranch.type

The type used to initialize this TBranch.

compression

WritableBranch.compression

Compression algorithm and level (uproot.compression.Compression or None) for new TBaskets added to the TBranch.

This property can be changed and doesn’t have to be the same as the compression of the file or the rest of the TTree, which allows you to write different objects with different compression settings.

The following are equivalent:

my_directory["tree"]["branch1"].compression = uproot.ZLIB(1)
my_directory["tree"]["branch2"].compression = uproot.LZMA(9)

and

my_directory["tree"].compression = {"branch1": uproot.ZLIB(1),
                                    "branch2": uproot.LZMA(9)}