Skip to content

Better establish type conversion between numpy and C++ types #18390

Open
@vepadulano

Description

@vepadulano

Explain what you would like to see improved and how.

There are a few places where we need to convert numpy dtypes to C++ types, for example when adopting buffers of numpy arrays into RVecs. There are at least the following two conversion dictionaries:

  1. cpptypes = {"i2": "Short_t", "u2": "UShort_t", "i4": "int", "u4": "unsigned int", "i8": "Long64_t", "u8": "ULong64_t", "f4": "float", "f8": "double", "b1": "bool"}

Which do not contain currently the same set of semantic key-value pairs. Also, sometimes a builtin C++ type is used, sometimes a ROOT typedef is used, notably in the treatment of integer types. It would be beneficial to establish a set of all the types allowed for conversion between numpy and C++ types and resolve the inconsistencies. My preference would also be to avoid using ROOT typedefs and switch to C++ standard integer types. I expect this may lead to issues that will need to be investigated, see #18087

ROOT version

Any

Installation method

Any

Operating system

Any

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions