Skip to content

complex numbers in RDataFrame (PyROOT) #10522

Open
@ianna

Description

@ianna
  • Checked for duplicates

Describe the bug

GetValue of an RDF complex type column gives the following error:

Column type: _Complex double
<cppyy.gbl.ROOT.RDF.RResultPtr<vector<_Complex double> > object at 0x7fc929ee8430>
Error pythonizing class std::vector<_Complex double>:
Traceback (most recent call last):
  File "/Users/yana/Projects/ROOT/ROOT-master/21.04.2022/root_install/lib/ROOT/_pythonization/__init__.py", line 233, in _invoke
    user_pythonizor(klass, fqn)
  File "/Users/yana/Projects/ROOT/ROOT-master/21.04.2022/root_install/lib/ROOT/_pythonization/_stl_vector.py", line 37, in pythonize_stl_vector
    if klass.value_type == 'char':
AttributeError: <class cppyy.gbl.std.vector<_Complex double> at 0x7fc929c29e20> has no attribute 'value_type'. Full details:
  type object 'vector<_Complex double>' has no attribute 'value_type'
  'std::vector<_Complex double>::value_type' is not a known C++ class
  'value_type' is not a known C++ template
  'value_type' is not a known C++ enum

Expected behavior

To Reproduce

data_frame = ROOT.RDataFrame(10).Define("x", "gRandom->Rndm()")
data_frame_xy = data_frame.Define("y", "x*2 +1j")
data_frame_xy.Display().Print()

ok so far.

column="y"
data_frame_rnode = cppyy.gbl.ROOT.RDF.AsRNode(data_frame_xy)
column_type = data_frame_rnode.GetColumnType(column)
print("Column type:", column_type)
result_ptrs = data_frame_rnode.Take[column_type](column)
cpp_reference = result_ptrs.GetValue()

Setup

  1. locally built ROOT-master from 21.04.20222.
cmake -DCMAKE_INSTALL_PREFIX=../root_install -Dbuiltin_glew=ON -Dclad=OFF -Dtmva-pymva=OFF -DCMAKE_CXX_STANDARD=17 ../root_src
  1. MacOS 11.63.
  2. Python 3.10.1 (main, Jan 10 2022, 12:04:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions