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

Printing the data of dask array #584

Open
cheongw opened this issue Nov 15, 2022 · 1 comment
Open

Printing the data of dask array #584

cheongw opened this issue Nov 15, 2022 · 1 comment

Comments

@cheongw
Copy link

cheongw commented Nov 15, 2022

Hi,

I am trying out the example in “Predict Local Properties” section of the webpage (PyMKS (Dask) Introduction — PyMKS)

-------------Script---------------------------------------------------------

x_delta = generate_delta(n_phases=2, shape=(21,21))

y_delta = solve_fe(x_delta,
elastic_modulus=(100,150),
poissons_ratio=(0.3,0.3),
macro_strain=0.001)['strain'][...,0]


Prior to the model fitting step (which kept generating errors), I was trying to view the “y_delta” array with the print statements.
I obtained the following descriptions of the array.

print('y_delta \n',y_delta)
y_delta
dask.array<getitem, shape=(2, 21, 21), dtype=float64, chunksize=(2, 21, 21), chunktype=numpy.ndarray>
print('da.array(y_delta) \n',da.array(y_delta))
da.array(y_delta)
dask.array<getitem, shape=(2, 21, 21), dtype=float64, chunksize=(2, 21, 21), chunktype=numpy.ndarray>

Are there any way to print the numerical data themselves rather than printing the description of the dask array?

For example, I was able to print the “X_delta” array with “numpy.array()” function, but I got error messages when I used the function, “numpy.array(y_delta)”.

print('np.arrary(x_delta) \n',np.array(x_delta))
np.arrary(x_delta)
[[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]

[[1 1 1 ... 1 1 1]
[1 1 1 ... 1 1 1]
[1 1 1 ... 1 1 1]
...
[1 1 1 ... 1 1 1]
[1 1 1 ... 1 1 1]
[1 1 1 ... 1 1 1]]]

Thank you in advance
Woo-Jae

@wd15
Copy link
Contributor

wd15 commented Dec 19, 2022

For example, I was able to print the “X_delta” array with “numpy.array()” function, but I got error messages when I used the function, “numpy.array(y_delta)”.

What was the error message?

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