You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The layout of multi-dimensional arrays use a Fortran ordering. This is not documented on the wiki. Perhaps some examples in the tutorials should be added.
" When I do descr(type, data, dim1, dim2, dim3); mdsput(...) in C for a C-style array defined as int a[dim1][dim2][dim3], and I read it back out of mdsplus in any language (python, idl, c, etc), it comes out as int a[dim3][dim2][dim1]. So, for now, I'm just going to write it in reverse and hope for the best. But, it'd be good to have this documented somewhere, as this is fundamentally backwards for C and certainly not intuitive. The only documentation I found was a note that multidimensional recording was possible but not documented there:
I was wondering how the MDSplus arrays work when I casually found this issue. I think it is not just matter of documentation: people do not understand how they works because they do not work as expected.
A very common operation one normally wants to apply to multi-dimensional arrays is slicing. MDSplus slicing seems not to work as the experienced user expects both in an MDSplus expression and on the Python mdsarray object. What I mean is that in the example below one expects d3 to have shape (4,1).
It seems to me that mdsplus arrays work more like list of lists than like multidimensional arrays. What about returning numpy arrays directly? That's what users need.
Sincerely
from MDSplus import * c = Connection("somemachine.someplace.comecountry") c.openTree("test", 11) d1 = c.get("SIG1") d2 = c.get("SIG1[0, *]") d3 = c.get("SIG1[*, 0]")
MDSplus arrays are implemented using numpy arrays. To get to the numpy array you just use the data() method. In the example above, d1.data() would return the numpy array.
The layout of multi-dimensional arrays use a Fortran ordering. This is not documented on the wiki. Perhaps some examples in the tutorials should be added.
" When I do descr(type, data, dim1, dim2, dim3); mdsput(...) in C for a C-style array defined as int a[dim1][dim2][dim3], and I read it back out of mdsplus in any language (python, idl, c, etc), it comes out as int a[dim3][dim2][dim1]. So, for now, I'm just going to write it in reverse and hope for the best. But, it'd be good to have this documented somewhere, as this is fundamentally backwards for C and certainly not intuitive. The only documentation I found was a note that multidimensional recording was possible but not documented there:
http://www.mdsplus.org/documentation/tutorial/DataAccess.shtml"
The text was updated successfully, but these errors were encountered: