show1D does not work if the VectorData does not have a dimension_label
show1D does not work if the VectorData does not have a dimension_label
The dimension_labels property is not mandatory for the data container nor does it show in any way when show1D is used.
This issue is present in CIL 23.0.1.
Here is a minimal working example
from cil.framework import VectorData
from cil.utilities.display import show1D
import numpy as np
v = VectorData(np.zeros(3))
# This doesn't work
show1D(v)
# This works
v.dimension_labels = {0:"blop"}
show1D(v)
Thank you very much! Great to have the minimal working example.
That does look like a bug. A possible solution would be to have a default label, if no vectorgeometry is passed, or possibly require the user to pass a geometry to vectordata. The first is probably more user friendly but should also think about consistency with imagedata.
Also, I think show1D should make use of the label when printing to be consistent with show2D.
On Fri, 24 Nov 2023, 08.19 Tommi, @.***> wrote:
show1D does not work if the VectorData does not have a dimension_label
The dimension_labels property is not mandatory for the data container nor does it show in any way when show1D is used.
This issue is present in CIL 23.0.1.
Here is a minimal working example
from cil.framework import VectorData from cil.utilities.display import show1D import numpy as np
v = VectorData(np.zeros(3))
This doesn't work
show1D(v)
This works
v.dimension_labels = {0:"blop"} show1D(v)
— Reply to this email directly, view it on GitHub https://github.com/TomographicImaging/CIL/issues/1595, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMDSCGRNB22ZODAEXQHTFLYGBDAFAVCNFSM6AAAAAA7YWPTT6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDSMRSHEYTSOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I think having a default label would be the easiest option. Especially since show1D already has a default behavior: it treats the vector values as the points on y-axis (called 'value') and has the indices evenly spaced along x-axis (called 'index').
Actually using the label would be nice. Maybe vector data could have a separate label for the indices as well (such as 'index', 'time', 'coordinate' etc.)
The vector geometry is a separate issue since I am not sure such a thing exists (this may have given me some trouble actually...). Of course slicing a 2D or 3D data and inheriting the right label from the 2D or 3D geometry is the natural way.