Affiliation
SPC/EPFL
Version(s) Affected
stable_release-7-158-2
I tested this back to version stable_release-7-0-X but not before and all versions seem to have the same behaviour.
Platform(s)
Ubuntu 24.04
Installation Method(s)
DEB package
Describe the bug
Starting from a 2D signal (or any signal with more than 1 dimensions) where the dimensions are explicitely defined. If this signal is subscripted using a scalar value along its last dimension, the resulting signal has 1D data but still 2 explicit dimensions.
As a result of this any attempt to subscript this new signal will fail since it will not pass the test
|
if (narg - 1 > dimct || (psig && psig->ndesc - 2 > dimct)) |
(number of descriptors minus 2 is larger than the number of dimensions of the data).
To Reproduce
Steps to reproduce the behavior:
- Open
tdic
- Create a 2D signal with dimensions
TDI> _aa = make_Signal([5:15,-5:5],*,make_dim(*,(0:10)*1e-3),make_dim(*,[0.903,1.010]))
- Create a new signal by subscripting it along its second dimension with a scalar value
TDI> _bb = _aa[*,0.903]
- Attempt to subscript signal
_bb will result in an error
TDI> _bb[*:*:1e-2]
%TDI Error in SUBSCRIPT(_bb, * : * : .01)
%TDI Error in EXECUTE("_bb[*:*:1e-2]")
Expected behavior
The result of the first subscripting operation should be a well-formed signal with consistent number of dimensions for the data and the signal, which should allow subsequent uses of the subscript function.
Screenshots
N/A
Additional context
This issue does not appear if the last dimension of the original signal is not defined (or replaced by *) or if it is not a signal (pure data array).
I think the fix should simply get rid of the trailing scalar dimensions. If one is interested in keeping these last dimensions, subscripting with an array of size 1 instead of a scalar value will provide a well-formed signal.
Affiliation
SPC/EPFL
Version(s) Affected
stable_release-7-158-2I tested this back to version
stable_release-7-0-Xbut not before and all versions seem to have the same behaviour.Platform(s)
Ubuntu 24.04
Installation Method(s)
DEB package
Describe the bug
Starting from a 2D signal (or any signal with more than 1 dimensions) where the dimensions are explicitely defined. If this signal is subscripted using a scalar value along its last dimension, the resulting signal has 1D data but still 2 explicit dimensions.
As a result of this any attempt to subscript this new signal will fail since it will not pass the test
mdsplus/tdishr/TdiSubscript.c
Line 182 in cd2031b
To Reproduce
Steps to reproduce the behavior:
tdicTDI> _aa = make_Signal([5:15,-5:5],*,make_dim(*,(0:10)*1e-3),make_dim(*,[0.903,1.010]))TDI> _bb = _aa[*,0.903]_bbwill result in an errorExpected behavior
The result of the first subscripting operation should be a well-formed signal with consistent number of dimensions for the data and the signal, which should allow subsequent uses of the
subscriptfunction.Screenshots
N/A
Additional context
This issue does not appear if the last dimension of the original signal is not defined (or replaced by
*) or if it is not a signal (pure data array).I think the fix should simply get rid of the trailing scalar dimensions. If one is interested in keeping these last dimensions, subscripting with an array of size 1 instead of a scalar value will provide a well-formed signal.