displayInitFieldY_170419 > v0.1 - v0.4 > display Ex.r[] 

```txt:Environment
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 14.04 LTS desktop amd64
TensorFlow v0.11
cuDNN v5.1 for Linux
CUDA v8.0
Python 2.7.6
IPython 5.1.0 -- An enhanced Interactive Python.
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
GNU bash, version 4.3.8(1)-release (x86_64-pc-linux-gnu)
```

### data preparation

```
$ ./adda -grid 25 -store_int_field -maxiter 100
```

## v0.1

### code 

Jupyter code

The code displays Ex.r[] without limiting [PICK_UP_ZZ_VALUE].

```py:displayInitFieldY_170419.ipynb
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import sys


'''
v0.1 Apr. 19, 2017
   - display Ex.r[] without limiting [PICK_UP_ZZ_VALUE]
'''

data = np.genfromtxt('IntField-Y', delimiter=' ')
#print(data[:,0])  # 1st columne
#print(data[:,1])  # 2nd columne

xs, ys, zs = data[1:, 0], data[1:, 1], data[1:, 2]
Exr = data[1:,4]

print(zs)

plt_y1 = np.array([])
PICK_UP_ZZ_VALUE = -0.20943951023931953

SIZE_MAP_X, SIZE_MAP_Y = 30, 30
MIN_X, MIN_Y = -6, -6  # -6: based on coordinate values
RANGE_X = 6 - MIN_X  # 6: based on coordinate values
RANGE_Y = 6 - MIN_Y  # 6: based on coordinate values
rmap = [[0.0 for yi in range(SIZE_MAP_Y)] for xi in range(SIZE_MAP_X)]

for idx, xyz in enumerate(zip(xs, ys, zs)):
    xx, yy, zz = xyz
    #if abs(zz - PICK_UP_ZZ_VALUE) >= sys.float_info.epsilon:
    #    continue
    xidx = int(SIZE_MAP_X * (xx - MIN_X) / RANGE_X )
    yidx = int(SIZE_MAP_Y * (yy - MIN_Y) / RANGE_Y )
    rmap[xidx][yidx] = Exr[idx]

wrkarr = np.array(rmap)
figmap = np.reshape(wrkarr, (SIZE_MAP_X, SIZE_MAP_Y))
plt.imshow(figmap, extent=(0, SIZE_MAP_X, 0, SIZE_MAP_Y), cmap=cm.jet)
plt.tight_layout()
plt.show()
```

### result

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/d55f827f-1e61-e462-c0f4-a602086fe91f.png)

## v0.2

The code displays Ex.r[] for the selected zz value from the list.

### code 

Jupyter code

```python:displayInitFieldY_170419.ipynb
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import sys


'''
v0.2 Apr. 20, 2017
   - set [PICK_UP_ZZ_VALUE] from zz_unique[]
   - use [ALLOWABLE_DIFF_ZZ]
v0.1 Apr. 19, 2017
   - display Ex.r[] without limiting [PICK_UP_ZZ_VALUE]
'''
# codingrule:PEP8

data = np.genfromtxt('IntField-Y', delimiter=' ')
xs, ys, zs = data[1:, 0], data[1:, 1], data[1:, 2]
Exr = data[1:, 4]

#print(zs)
zz_unique = np.unique(zs)
print(len(zz_ary))
plt_y1 = np.array([])
#PICK_UP_ZZ_VALUE = -0.20943951023931953
PICK_UP_ZZ_VALUE = zz_unique[18]

SIZE_MAP_X, SIZE_MAP_Y = 30, 30
MIN_X, MIN_Y = -6, -6  # -6: based on coordinate values
RANGE_X = 6 - MIN_X  # 6: based on coordinate values
RANGE_Y = 6 - MIN_Y  # 6: based on coordinate values
rmap = [[0.0 for yi in range(SIZE_MAP_Y)] for xi in range(SIZE_MAP_X)]

# instead of [sys.float_info.epsilon], which is 2.22044604925e-16
ALLOWABLE_DIFF_ZZ = 1.0e-10

for idx, xyz in enumerate(zip(xs, ys, zs)):
    xx, yy, zz = xyz
    if abs(zz - PICK_UP_ZZ_VALUE) >= ALLOWABLE_DIFF_ZZ:
        continue
    xidx = int(SIZE_MAP_X * (xx - MIN_X) / RANGE_X)
    yidx = int(SIZE_MAP_Y * (yy - MIN_Y) / RANGE_Y)
    rmap[xidx][yidx] = Exr[idx]

wrkarr = np.array(rmap)
figmap = np.reshape(wrkarr, (SIZE_MAP_X, SIZE_MAP_Y))
plt.imshow(figmap, extent=(0, SIZE_MAP_X, 0, SIZE_MAP_Y), cmap=cm.jet)
plt.tight_layout()
plt.show()

```

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/0600899d-ff56-0cfe-f742-ac5b2b72b0d2.png)

## v0.4

### code

The code displays real and imaginary part of Ex,Ey,Ez for various zz values.

```python:displayInitFieldY_170419.ipynb
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import sys


'''
v0.4 Apr. 20, 2017
   - show [Ex.r], [Ex.i], [Ey.r], [Er.i], [Ez.r], [Ez.i]
v0.3 Apr. 20, 2017
   - display for various [zz] values
   - add show_xymap()
v0.2 Apr. 20, 2017
   - set [PICK_UP_ZZ_VALUE] from zz_unique[]
   - use [ALLOWABLE_DIFF_ZZ]
v0.1 Apr. 19, 2017
   - display Ex.r[] without limiting [PICK_UP_ZZ_VALUE]
'''
# codingrule:PEP8

data = np.genfromtxt('IntField-Y', delimiter=' ')
xs, ys, zs = data[1:, 0], data[1:, 1], data[1:, 2]
Exr, Exi = data[1:, 4], data[2:, 4]
Eyr, Eyi = data[3:, 4], data[4:, 4]
Ezr, Ezi = data[5:, 4], data[6:, 4]

#print(zs)
zz_unique = np.unique(zs)
print(len(zz_unique))
plt_y1 = np.array([])
#PICK_UP_ZZ_VALUE = -0.20943951023931953
#PICK_UP_ZZ_VALUE = zz_unique[18]


def show_xymap(pick_up_zz, target):
    SIZE_MAP_X, SIZE_MAP_Y = 30, 30
    MIN_X, MIN_Y = -6, -6  # -6: based on coordinate values
    RANGE_X = 6 - MIN_X  # 6: based on coordinate values
    RANGE_Y = 6 - MIN_Y  # 6: based on coordinate values
    rmap = [[0.0 for yi in range(SIZE_MAP_Y)] for xi in range(SIZE_MAP_X)]

    # instead of [sys.float_info.epsilon], which is 2.22044604925e-16
    ALLOWABLE_DIFF_ZZ = 1.0e-10

    for idx, xyz in enumerate(zip(xs, ys, zs)):
        xx, yy, zz = xyz
        if abs(zz - pick_up_zz) >= ALLOWABLE_DIFF_ZZ:
            continue
        xidx = int(SIZE_MAP_X * (xx - MIN_X) / RANGE_X)
        yidx = int(SIZE_MAP_Y * (yy - MIN_Y) / RANGE_Y)
        #rmap[xidx][yidx] = Exr[idx]
        rmap[xidx][yidx] = target[idx]

    wrkarr = np.array(rmap)
    figmap = np.reshape(wrkarr, (SIZE_MAP_X, SIZE_MAP_Y))
    plt.imshow(figmap, extent=(0, SIZE_MAP_X, 0, SIZE_MAP_Y), cmap=cm.jet)


def show_group(atarget):
    plt.subplot(331)
    show_xymap(zz_unique[8], atarget)
    plt.subplot(332)
    show_xymap(zz_unique[10], atarget)
    plt.subplot(333)
    show_xymap(zz_unique[12], atarget)
    plt.subplot(334)
    show_xymap(zz_unique[14], atarget)
    plt.subplot(335)
    show_xymap(zz_unique[16], atarget)
    plt.subplot(336)
    show_xymap(zz_unique[18], atarget)
    plt.subplot(337)
    show_xymap(zz_unique[20], atarget)
    plt.subplot(338)
    show_xymap(zz_unique[22], atarget)
    plt.subplot(339)
    show_xymap(zz_unique[24], atarget)

    plt.tight_layout()
    plt.show()

print('Ex.r[]')
show_group(Exr)
print('Ex.i[]')
show_group(Exi)

print('Ey.r[]')
show_group(Eyr)
print('Ey.i[]')
show_group(Eyi)

print('Ez.r[]')
show_group(Ezr)
print('Ez.i[]')
show_group(Ezi)

```

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/89884083-9f0b-5d19-75ad-ad93ee87edb2.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/5323c9c0-fa1c-9c8b-c15e-01468485783a.png)

![qiita.png](https://qiita-image-store.s3.amazonaws.com/0/32870/32d3c622-8702-b913-3431-9c9389736e31.png)