Closed seirios closed 1 year ago
Hello @seirios, and thanks for opening this issue. Could you please provide a minimal example to reproduce this error? Thank you!
Sure @eleftherioszisis !
This works (assumes only three dimensions):
vc.VoxelData(np.zeros((1,1,1)),(1,1,1)).lookup((-1,-1,-1),0)
But this does not (fourth dim is 1):
vc.VoxelData(np.zeros((1,1,1,1)),(1,1,1)).lookup((-1,-1,-1),0)
Neither does this (fourth dim is 2, as in flat map):
vc.VoxelData(np.zeros((1,1,1,2)),(1,1,1)).lookup((-1,-1,-1),(0,0))
Hello @seirios , may I ask what version of python and pandas are you using?
Hi! I'm using unstable modules in BB5, so python 3.10.8
and pandas 1.5.1
. Also, it's voxcell 3.1.4
.
Hello @seirios , please try the py-voxcell 3.1.5 so we can close this issue :slightly_smiling_face:
@seirios can you have a look at this to see if it fixes your issue?
ping @seirios?
Hi! Sorry for the big delay! I have tested it now, and it works as expected in isolation and in the context of my use case. Thanks!
Thanks for following up @seirios.
When doing a lookup in a VoxelData object where the per-voxel value has dimension 2 (e.g., a flat map), specifying
outer_value
leads to error because the shape of the result is assumed to be 1-dimensional.E.g., setting
outer_value = np.array([-2,-2])
leads to:The issue is that the dimension of
result
in voxel_data.py:179 does not match the dimension of the values it should store (2 in this example).A possible fix is the following:
This way we keep the shape of the array values, and also the original dtype (otherwise it takes it from
outer_value
).