Skip to content

Proposal to add a value_range #482

@HDembinski

Description

@HDembinski

It may be useful to have a way to do an inclusive selection on a value range which follows the rule "keep all bins that overlap with the value range".

I think the clean way of introducing that is via a special slice-like object. I suggest value_range as a placeholder for a proper name. You would use it instead of slice inside __getitem__.

h[value_range(None, upper)] # selects all bins up to and including the bin containing upper
h[value_range(lower, None)] # selects all bins starting with the bin containing lower
h[value_range(lower, upper)] # selects all bins starting with the bin containing lower up to and including the bin container upper

bh.sum and bh.rebin and friends are supported as an optional third argument. value_range can be transformed internally into an ordinary slice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions