Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better documentation of multi-dimensional arrays in MDSplus #419

Closed
tfredian opened this issue Mar 17, 2016 · 3 comments
Closed

Better documentation of multi-dimensional arrays in MDSplus #419

tfredian opened this issue Mar 17, 2016 · 3 comments
Assignees
Labels
documentation This is a need for, or an addition to the documentation

Comments

@tfredian
Copy link
Contributor

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"

@tfredian tfredian added the documentation This is a need for, or an addition to the documentation label Mar 17, 2016
@alkhwarizmi
Copy link
Contributor

Hi all,

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]")

In[11]: d1.shape
Out[12]: (69, 4)
In[13]: d2.shape
Out[14]: (69, 1)
In[15]: d3.shape
Out[16]: (69,)
In[17]: type(d1)
Out[18]: MDSplus.mdsarray.Float32Array

@tfredian
Copy link
Contributor Author

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.

@tfredian
Copy link
Contributor Author

More documentation on MDSplus arrays has been added by Gabriele to the MDSplus web site at: http://www.mdsplus.org/index.php/Documentation:Tutorial:MdsObjects#More_on_Arrays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a need for, or an addition to the documentation
Projects
None yet
Development

No branches or pull requests

3 participants