Reading binary eta from c++ program


In [9]:
import numpy as np
import matplotlib.pyplot as plt

filepath = "../output/initial_conf.bin"
nx = 1024
ny = 1024
nc = 3
flat = np.fromfile(filepath, dtype=np.complex128, count=-1, sep="")
eta = flat.reshape(nc, nx, ny)

In [10]:
def print_comp(eta_):
    for i in range(nx):
        print("|", end="")
        for j in range(ny):
            print("%11.4e"%eta_[i, j], end="")
        print("|")

In [ ]:
val = np.abs(eta[0]) + np.abs(eta[1]) + np.abs(eta[2])
plt.pcolormesh(val)
plt.xlim([0, nx])
plt.ylim([0, ny])
plt.show()

In [ ]:


In [ ]: