Open ajohlander opened 5 years ago
Dear @ajohlander, thanks for letting us know of this issue.
I am not sure exactly how you tried to force tensorOrder to 0 but the TSeries function would require some more changes than simply changing line 1529 to have 'TensorOrder',0
(or teno-1
) this as the TSeries created on line 1535 also have arguments regarding representation
and TensorBasis
of this E.x scalar. A scalar TSeries() is created if no TensorBasis or representation is given, with 'TensorOrder', 0
, see for instance irf.ts_scalar().
This code segment should perhaps be changed to not add TensorBasis and loop through adding repres
for the special case of nd==1
...
Having looked at the code for TSeries.m, I found something looking rather strange.. (I am writing it here mainly to keep track, hope you do not mind!).
Just above the code which is causing you problem, nd
is computed:
https://github.com/irfu/irfu-matlab/blob/f34a102eaf15a39a4923dd14bd923fdaf4f007ec/TSeries.m#L1499
and then we have:
https://github.com/irfu/irfu-matlab/blob/f34a102eaf15a39a4923dd14bd923fdaf4f007ec/TSeries.m#L1514-L1528
Especially note the case 5
where we must have had ndims(obj.data_) == 6
...
This problem with dimensions appears to have appeared elsewhere as well (but here it should not matter that much, as higher dimensions, value 1, are always included regardless): https://github.com/irfu/irfu-matlab/blob/f34a102eaf15a39a4923dd14bd923fdaf4f007ec/TSeries.m#L1461-L1468
Step 1: Latest code?
git pull
this is still a problem).Step 2: Describe your environment
Step 3: Describe the problem
Expected behavior
A component of a time series object should return a time series object with the variable "tensorOrder" set to 0, i.e. a scalar .
Actual behavior
Components of TSeries objects inherit the tensor order of the original objects. True for both vectors (i.e. E.x) and tensors (i.e. Ti.xx).
This is annoying when trying to add time series together.
Steps to reproduce:
Relevant code:
ans =
WHAT I TRIED
I tried just forcing tensorOrder to 0 in TSeries.getComponent (lines: 1529 & 1559) but this causes an error:
Error using TSeries (line 247) Representation already set for all DATA dimensions
I don't know what to do about that.