...
 
Commits (2)
......@@ -90,13 +90,6 @@
"np.savetxt(\"../CCCN_z_pts.dat\", crank.z_pts)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
......
......@@ -23,7 +23,7 @@
"#diff_coeff = 0\n",
"#diff_coeff = 1e-4\n",
"disp_coeff = -1j*k_2/2\n",
"#disp_coeff = 1j * 1e-25\n",
"disp_coeff = 1j * 1e-27\n",
"#disp_coeff = 0\n",
"\n",
"print('diff :', diff_coeff)\n",
......@@ -77,7 +77,14 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"fig, ax = plt.subplots()\n",
"mesh = ax.pcolormesh(z_pts, r_pts, E_matrix.T)\n",
"ax.set_xlabel('z')\n",
"ax.set_ylabel('r')\n",
"plt.colorbar(mesh, ax=ax)\n",
"fig.show()"
]
}
],
"metadata": {
......
......@@ -17,34 +17,97 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%matplotlib notebook\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.animation as animation"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data_path = '../HSCN_'\n",
"\n",
"\n",
"def import_data(path):\n",
" data_array = np.loadtxt(path + 'E.npy', encoding='latin1')\n",
" r_pts = np.load(path + 'r_pts.npy', encoding='latin1')\n",
" z_pts = np.load(path + 'z_pts.npy', encoding='latin1')\n",
" t_pts = np.load(path + 't_pts.npy', encoding='latin1')\n",
" data_array = np.load(path + 'E.npy')\n",
" r_pts = np.real(np.load(path + 'r_pts.npy'))\n",
" z_pts = np.real(np.load(path + 'z_pts.npy'))\n",
" t_pts = np.real(np.load(path + 't_pts.npy'))\n",
" return data_array, r_pts, z_pts, t_pts\n",
"\n",
"\n",
"def plot_data(r_pts, t_pts, E_matrix):\n",
" fig, ax = plt.subplots()\n",
" mesh = ax.pcolormesh(t_pts, r_pts, E_matrix[0,:,:].T)\n",
" ax.set_xlabel('t')\n",
" ax.set_ylabel('r')\n",
" plt.colorbar(mesh, ax=ax)\n",
" fig.show()\n",
"E_matrix, r_pts, z_pts, t_pts = import_data(data_path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"full_r_pts = np.concatenate((np.flip(-r_pts), r_pts))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"t_pts *= c\n",
"\n",
"fig = plt.figure()\n",
"plt.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])), cmap=plt.cm.RdBu)\n",
"plt.title('Position=%d' % 0)\n",
"\n",
"\n",
"def update(i):\n",
" plt.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,:], axis=0), E_matrix[i,:,:])), cmap=plt.cm.RdBu)\n",
" plt.title('Position=%d' % i)\n",
"\n",
"data_ary, r_pts, z_pts, t_pts = import_data(data_path)\n",
"plot_data(r_pts, t_pts, data_ary)"
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[0], interval=100, repeat=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"\n",
"z_from_t_pts = t_pts * c + z_pts\n",
"\n",
"E_matrix = np.concatenate((E_matrix, np.zeros((E_matrix.shape[0], E_matrix.shape[1], E_matrix.shape[0]))), axis=2)\n",
"\n",
"fig = plt.figure()\n",
"plt.pcolormesh(z_from_t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])), cmap=plt.cm.RdBu)\n",
"plt.title('Image = %d' % 0)\n",
"\n",
"np.roll(E_matrix[i,:,:], -1, axis=1)\n",
"\n",
"\n",
"def update(i):\n",
" plt.pcolormesh(z_from_t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,:], axis=0), E_matrix[i,:,:])), cmap=plt.cm.RdBu)\n",
" plt.title('Image = %d' % i)\n",
"\n",
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[0], interval=100, repeat=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......