Skip to content

Read free floating std::vector  #1179

@ioanaif

Description

@ioanaif

Add support for the following use case:

newfile =  "test_freevec.root"
f = ROOT.TFile(newfile, "recreate")
a = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64)
c = np.array([0, 1, 4, 5, 6, 7, 8, 9], dtype=np.uint32)
avec = ROOT.std.vector("double")(a)
bvec = ROOT.std.vector("unsigned int")(c)
f.WriteObject(avec, "avec")
f.WriteObject(bvec, "bvec")
f.Write()
f.Close()

with uproot.open(newfile) as f:
    assert f['avec'].tolist() == [1.0, 2.0, 3.0, 4.0]
    assert f['bvec'].tolist() == [0, 1, 4, 5, 6, 7, 8, 9]

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

Status

Done!

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions