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

Numpy: Read vs [] Inconsistent #69

Open
ax3l opened this issue May 25, 2016 · 2 comments
Open

Numpy: Read vs [] Inconsistent #69

ax3l opened this issue May 25, 2016 · 2 comments

Comments

@ax3l
Copy link
Contributor

ax3l commented May 25, 2016

dear @yyalli,

while the slice [] operators work great, read() calls seem to behave a bit different when slicing variables with it. Maybe we want to adjust read() to behave correctly like [] already does (see our discussion last year).

With this example file:

import adios as ad

f = ad.file("data_compressed.bp")

f["xy"].dims
# (400L, 200L)

# correct
f["xy"][:,100].shape
# (400,)

# weird
f["xy"].read((0,100),(400,1)).shape
# (400, 1)

# very weird
f["xy"].read((0,100),(400,0)).shape
# (400, 0)
@jychoi-hpc
Copy link
Member

I intentionally separated the output style in the following way

  • using [] makes the output style close to numpy
  • However, read() remains close to the Adios representation.

I thought someone who is not familiar with numpy can get confused with the output of read() function.

Do you have any specific reason to use them together in a same script?

@ax3l
Copy link
Contributor Author

ax3l commented May 26, 2016

Do you have any specific reason to use them together in a same script?

I was just using them as synonyms and realized they are not :)

I intentionally separated the output style in the following way [...] read() remains close to the Adios representation

But wouldn't the ADIOS C-API just fill you a contigous memory chunk behind a void*? In that case, the interpretation of the dimensionality via [][][] access would be agnostic of the API and created by the user (the dims/ndims in the C-API always regard the full variable, selections are still the same in the input).

Or am I missing something?

@ax3l ax3l changed the title Python: Read vs [] Inconsistent Numpy: Read vs [] Inconsistent Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants