pymks icon indicating copy to clipboard operation
pymks copied to clipboard

Printing the data of dask array

Open cheongw opened this issue 2 years ago • 1 comments

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

cheongw avatar Nov 15 '22 16:11 cheongw

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?

wd15 avatar Dec 19 '22 19:12 wd15