Giter Club home page Giter Club logo

Comments (3)

alkhwarizmi avatar alkhwarizmi commented on May 23, 2024

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

from mdsplus.

tfredian avatar tfredian commented on May 23, 2024

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.

from mdsplus.

tfredian avatar tfredian commented on May 23, 2024

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

from mdsplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.