Comments (3)
It was not clear what approach is best. I understand your point but in
the case of MDSplus users who have been using only tdi and IDL for
decades and just starting to use python might find the behavior of
python slicing to be strange. If one wants numpy/python behavior then
you can always use the data() method on an MDSplus array to get the
numpy array and slice that. The same is true for "slicing" signals. I
don't think we'd want to change the tdi subscripting behavior of signals
to resemble python slicing. It is a tough decision as to whether to use
tdi slicing of MDSplus objects or python slicing. I intentionally chose
to use tdi slicing for MDSplus objects when I implemented the python
module to retain MDSplus behavior on MDSplus objects. If this is
undesirable we could probably add a global setting to select tdi or
python slicing behavior.
On 4/18/2016 12:26 PM, Brian Standley wrote:
Python (native and numpy) interprets the end index as the first
element not included when slicing arrays, whereas TDI includes the
end element (like IDL). Since indexing in mdsobjects (see
|getitem| in mdsdata.py) eventually calls TdiExecute, MDSplus
arrays behave a bit unexpectedly:
|>>> a = numpy.array([0.4, 0.5, 0.6, 0.7])|
|>>> b = MDSplus.Float32Array(a)|
|>>> a[0:2]|
|array([ 0.4, 0.5])|
|>>> b[0:2]|
|[.4,.5,.6]|I am happy to make a patch if you think it makes sense to fix it,
probably by adjusting the end index in the aforementioned function.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#452
from mdsplus.
OK, now I understand the reasoning. I do not think a global setting is necessary, but it could not hurt to highlight the implications of MDSplus vs. native types on the wiki. I will see what I can do.
from mdsplus.
I added a note to the wiki:
http://www.mdsplus.org/index.php/Documentation:Tutorial:MdsObjects#Python_Specific_Issues
from mdsplus.
Related Issues (20)
- Add locks to MDSip so that copying references to trees in threads works
- Failure to error catch when using the C++ API
- Accessing Visual Basic files HOT 4
- Remove the ALIAS feature
- Incorrect JAVASOURCE in Makefile.am? HOT 6
- .deb and .rpm packages do not install jDevices.jar HOT 5
- bootstrap class path warnings
- MDSplus for Windows installs 56 files in the System32 directory
- MDSplus contains Java 6 source code which cannot be compiled with modern JDKs HOT 2
- Can not store array of nids in a numeric node HOT 2
- jTraverser2 fails to display VMS floating point numbers (DTYPE_F) HOT 3
- The "alpine*-armhf" images in Docker Hub (for the MDSplus build system) don't have a working Java HOT 2
- Multiple alpha build versions' IDL fails on first MDSconnect HOT 3
- windows python install incompatible with recent numpy versions HOT 3
- mdsplus8: traverser does not allow adding long node names
- mdsplus8: jTraverser does not allow renaming nodes with long names
- mdsplus8: jTraverser2 does not allow renaming nodes with long names
- numpy deprecation warning for .tostring() HOT 3
- mdsplus8: the v7 versions of MDSplus should check to see if accessing a v8 tree
- Datafile locks can take ~30 seconds/lock when tree files are on a NFS volume HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdsplus.