scikit-hep / scikit-hep/vector
Single component value can not be changed in VectorNumpy3D
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 99
- Forks
- 42
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 6
Description
I am using the vector library in a computer-vision software to store the prediction results. There I have a two-step workflow where I first have to calculate some values, then refine a part of them (for example the depth component z). After implementing everything I never got the right results and wondered why.
I noticed that it is possible to set a single component in a vector-object:
v = vector.obj(x=1.1, y=2.2)
v.x = 25
print(v)
# vector.obj(x=25, y=2.2)
But this is not possible as soon as I work with VectorNumpy3D (and 2D, 4D):
v = vector.array({
"x": [1.0, 2.0],
"y": [1.1, 2.2],
"z": [0.1, 0.2],
})
v[1].x = 25
print(v)
# [(1., 1.1, 0.1) (2., 2.2, 0.2)]
Either there should be an error message, that it is not possible to set single component values in VectorNumpy3D arrays or the value should be set. Atm the line of code seems just like being ignored.
Is there a way to change a single value inside of this array structure?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported assignment with VectorNumpy3D, including v[1].x = 25, and inspect the VectorNumpy3D component-access behavior. Add a regression test covering single-component assignment and define completion as either updating the underlying array or raising a clear error instead of silently ignoring the operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100