コード例 #1
0
# load trained parameters
model_parameters = save_path + 'model_parameters.hdf'
model.load_weights(model_parameters)

# calculate new reconstructions with the NN
g_nn = model.predict(f)
# resize to original resolution
g_nn = bib_utils.resize_NN_image(g_nn, training=False)

print 'g_nn:', g_nn.shape, g_nn.dtype

f = np.hstack((f[:, -32:], f[:, :-32]))
# ----------------------------------------------------------
# Import lines of sight and vessel

ri, rf, zi, zf = bib_geom.get_los_JET(inside=False)

r, z = bib_geom.get_vessel_JET()

# ----------------------------------------------------------
# Initialize figure with zeros
# adapt the dynamic range by changing vmin and vmax as you wish

import matplotlib

matplotlib.rcParams.update({'font.size': 8})

fig = plt.figure()
ax = plt.axes()
im = ax.imshow(
    np.zeros((bib_geom.N_ROWS, bib_geom.N_COLS)),
コード例 #2
0
import matplotlib.pyplot as plt

import sys
sys.path.insert(0, '../bib/')
import bib_geom

# -----------------------------------------------------------------------------

R, Z = bib_geom.get_vessel_JET()

plt.figure()
plt.plot(R, Z, 'b')
plt.xlabel('R (m)')
plt.ylabel('Z (m)')
plt.axes().set_aspect('equal')

# -----------------------------------------------------------------------------

Ri, _, Zi, _ = bib_geom.get_los_JET(inside=False)
Ri2, Rf, Zi2, Zf = bib_geom.get_los_JET(inside=True)

for (ri, rf, zi, zf, ri2, zi2) in zip(Ri, Rf, Zi, Zf, Ri2, Zi2):
    plt.plot((ri, ri2), (zi, zi2), 'g', linewidth=.7)
    plt.plot((ri2, rf), (zi2, zf), 'r', linewidth=.7)

plt.text(3.5, 2.2, 'KB5V')
plt.text(4.5, -.3, 'KB5H')
plt.tight_layout()
plt.savefig('kb5.png', dpi=300, bbox_inches='tight')
plt.show()
コード例 #3
0
# Load M from directory to which all results from fit_M.py were saved
# All outputs generated by this program will be stored in the same directory

save_path = './Results/'
M = np.load(save_path + 'M.npy')
print 'M :', M.shape, M.dtype

if not os.path.exists(save_path + 'LOS/'):
    print 'Creating directory ', save_path + 'LOS/'
    os.makedirs(save_path + 'LOS/')

# -------------------------------------------------------------------------
# Load vessel coordinates and lines of sight

r, z = bib_geom.get_vessel_JET()
ri, rf, zi, zf = bib_geom.get_los_JET()

# -------------------------------------------------------------------------
# Plot regularization for each line of sight

font = {'family': 'normal', 'weight': 'normal', 'size': 11}

plt.rc('font', **font)

# if simple = False colorbar and labels are added
simple = True

for i in range(M.shape[1]):

    print i, M[:, i].shape, M[:, i].max(), M[:, i].min(), M[:, i].std()