G-Node / G-Node/nix

Tag extent behaviour [discussion]

Open
#802 1 comment 0 reactions 0 assignees View on GitHub
discussion
Dominant language
C++
Stars
72
Forks
36
PR merge metrics
No merged PRs in 30d

Description

We need to decide on the exact behaviour of extents for a couple of edge cases. Currently, extents are inclusive, so for a tag that has extents `(10, 20)` (assuming the interval of the underlying data is 1) the returned data has the shape `(11, 21)`. This should probably change such that the extents are equivalent to the shape.

To generalise a little, let's assume a DataArray with n-dimensions, all regularly sampled with a sampling interval for `dn` (for dimension n). In that case, a tag with position `(p1, p2, ..., pn)` and extent `(e1, e2, ..., en)` should be equivalent to slicing the underlying array as:
`[p1*d1:(p1+e1)*d1, p2*d2:(p2+e2)*d2, ..., pn*dn:(pn+en)*dn]`

This would make extents exclusive.

There's also the more complicated question of what it means for an extent to be missing, what it means if it's 0, and what it means if it's 1. If we follow the above logic (and think about it in numpy equivalent behaviour), `None`, `0`, and `1` are all different, but it might make sense if we treat `None` as `0` and take it to mean _drop this dimension_, while 1 returns an extra dimension with length 1.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.