Skip to content

to_numpy improvements for views #413

@henryiii

Description

@henryiii

Currently, to_numpy just dumps the same histogram view that .view() produces when you do to_numpy. This is probably not what you'd expect; you are asking for numpy-style output and numpy would not give you a boost-histogram view. It should give .view().value for accumulators. If you want a boost-histogram view, you can always do:

_, *edges = h.to_numpy()
view = h.view()

We could add an errors method to match Uproot 4, and mplhep could use this to plot errors for both libraries.

@HDembinski Do you agree or have further input? Using .to_numpy() will be common in Uproot 4, and it would be nice to be as similar as reasonable, so a natural "upgrade" will be .to_boost() ... do work ... .to_numpy().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions