{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T09:35:16.599312Z",
     "start_time": "2021-02-19T09:35:16.055868Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import numba as nb # code accelerator. coding in C-style to make your code faster."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T09:47:38.161077Z",
     "start_time": "2021-02-19T09:47:38.087275Z"
    }
   },
   "outputs": [],
   "source": [
    "import scipy.special as spe\n",
    "# from numpy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-19T16:54:28.774740Z",
     "start_time": "2021-01-19T16:54:28.768741Z"
    }
   },
   "outputs": [],
   "source": [
    "# @nb.jit(nopython = True)\n",
    "def phin(n,y):\n",
    "    if(n<0):\n",
    "        return 1\n",
    "    if(n==0):\n",
    "        return pi**(-0.25)*exp(-0.5*y**2)\n",
    "    if(n==1):\n",
    "        return pi**(-0.25)*sqrt(2)*y*exp(-0.5*y**2)\n",
    "    if(n>=2):\n",
    "        return sqrt(2/(n))*y*phin(n-1,y)-sqrt((n-1)/n)*phin(n-2,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T12:06:48.012840Z",
     "start_time": "2020-12-13T12:06:47.685434Z"
    }
   },
   "outputs": [],
   "source": [
    "x = np.linspace(-10,10,100)\n",
    "h0 = np.zeros(100, dtype=float)\n",
    "for j in range(100):\n",
    "    h0[j] = phin(5,x[j])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T12:06:48.509722Z",
     "start_time": "2020-12-13T12:06:48.355521Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x265ecb3f4a8>]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 17476 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(x,h0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T10:00:06.695053Z",
     "start_time": "2020-12-13T10:00:06.598312Z"
    }
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'ddy' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-6-4c57db5d41a3>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m# phin(5,0.8)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mddy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0.8\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'ddy' is not defined"
     ]
    }
   ],
   "source": [
    "# phin(5,0.8)\n",
    "ddy(0.8,1,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-10T12:38:10.130646Z",
     "start_time": "2020-12-10T12:38:10.127615Z"
    }
   },
   "outputs": [],
   "source": [
    "# H0 = spe.hermite(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:24:17.801671Z",
     "start_time": "2021-01-20T11:24:17.796683Z"
    }
   },
   "outputs": [],
   "source": [
    "# @nb.jit(nopython = True)\n",
    "def hermite_self(n,y):\n",
    "    if(n<=0):\n",
    "        return 1\n",
    "    elif(n==1):\n",
    "        return 2*y\n",
    "    elif(n>=2):\n",
    "        return 2*y*hermite_self(n-1,y)-2*(n-1)*hermite_self(n-2,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:24:18.181445Z",
     "start_time": "2021-01-20T11:24:18.178443Z"
    }
   },
   "outputs": [],
   "source": [
    "# @nb.jit(nopython = True)\n",
    "def phi(y,p,o):\n",
    "    nn = 1\n",
    "    for i in range(o):\n",
    "        nn *= o+1\n",
    "#     print(nn)\n",
    "    return np.exp(-y**2/(2*p**2))*hermite_self(o,y/p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T09:30:57.363865Z",
     "start_time": "2020-12-12T09:30:57.043579Z"
    }
   },
   "outputs": [],
   "source": [
    "from math import sqrt,exp\n",
    "from numpy import *\n",
    "from pylab import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 304,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T10:45:26.209576Z",
     "start_time": "2020-12-12T10:45:26.178457Z"
    }
   },
   "outputs": [],
   "source": [
    "def phi(n, x):\n",
    "    if n==0:\n",
    "        return ones_like(x)*pi**(-0.25)*exp(-x**2/2)\n",
    "    if n==1:\n",
    "        return sqrt(2.)*x*exp(-x**2/2)*pi**(-0.25)\n",
    "    h_i_2=ones_like(x)*pi**(-0.25)\n",
    "    h_i_1=sqrt(2.)*x*pi**(-0.25)\n",
    "    sum_log_scale=zeros_like(x)\n",
    "    for i in range(2, int(n)+1):\n",
    "        h_i=sqrt(2./i)*x*h_i_1-sqrt((i-1.)/i)*h_i_2\n",
    "        if(h_i==0):\n",
    "            print('error')\n",
    "        h_i_2, h_i_1=h_i_1, h_i\n",
    "        log_scale=log(abs(h_i)).round()\n",
    "#         print(log_scale)\n",
    "        scale=exp(-log_scale)\n",
    "        h_i=h_i*scale\n",
    "        h_i_1=h_i_1*scale\n",
    "        h_i_2=h_i_2*scale\n",
    "        sum_log_scale+=log_scale\n",
    "    return h_i*exp(-x**2/2+sum_log_scale)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T10:16:38.493567Z",
     "start_time": "2020-12-12T10:16:38.488579Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([990.])"
      ]
     },
     "execution_count": 194,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m = 4.99\n",
    "np.array([989.6]).round()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 305,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T10:45:29.297951Z",
     "start_time": "2020-12-12T10:45:29.139373Z"
    }
   },
   "outputs": [],
   "source": [
    "x = np.linspace(-10,10,1000)\n",
    "h0 = np.zeros(1000, dtype=float)\n",
    "for j in range(1000):\n",
    "    h0[j] = phi(10,x[j])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 303,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T10:44:55.297009Z",
     "start_time": "2020-12-12T10:44:55.135441Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x233cdfdbf28>]"
      ]
     },
     "execution_count": 303,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 22356 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(x,h0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:42.925045Z",
     "start_time": "2021-01-20T11:59:42.921056Z"
    }
   },
   "outputs": [],
   "source": [
    "tao_r = 1 # radiation time \n",
    "tao_d = 1# drag time\n",
    "p = (tao_r/tao_d)**(1/4) # Prandtl number \n",
    "k = 0.5 # wave number "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 201,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:43.263141Z",
     "start_time": "2021-01-20T11:59:43.259152Z"
    }
   },
   "outputs": [],
   "source": [
    "def S(x,y,k,p):\n",
    "    return np.cos(k*x)*np.exp(-0.5*y**2) / tao_r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:43.575306Z",
     "start_time": "2021-01-20T11:59:43.455626Z"
    }
   },
   "outputs": [],
   "source": [
    "s_0 = np.zeros((100,200))\n",
    "x = np.linspace(-2*np.pi,2*np.pi,200)\n",
    "y = np.linspace(-np.pi,np.pi,100)\n",
    "for i in range(100):\n",
    "    for j in range(200):\n",
    "        s_0[i,j] = S(x[j],y[i],k,p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 203,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:43.656091Z",
     "start_time": "2021-01-20T11:59:43.650106Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 200)"
      ]
     },
     "execution_count": 203,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s_0.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:44.168720Z",
     "start_time": "2021-01-20T11:59:43.746851Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'Northward distance')"
      ]
     },
     "execution_count": 204,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 117232 characters]\n",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,4))\n",
    "plt.contourf(x,y,s_0,20,alpha=0.75,cmap=plt.cm.hot)\n",
    "#8:8+2=10,将高分为10部分，\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(x,y,s_0,20,colors='black',linewidth=0.1 )\n",
    "\n",
    "#adding label\n",
    "plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:44.176700Z",
     "start_time": "2021-01-20T11:59:44.170715Z"
    }
   },
   "outputs": [],
   "source": [
    "alpha = 1/tao_d\n",
    "gamma = 1/tao_r\n",
    "q0 = np.sqrt(alpha)*(np.sqrt(alpha*gamma)-k*1j)/(alpha*gamma+k**2) / tao_r\n",
    "q2 = (alpha**(3/2)*k**2+3*alpha*gamma**(1/2)+alpha**(5/2)*gamma+1j*k*alpha**(1/2))\\\n",
    "/(2*((alpha*k**2+3*(alpha*gamma)**(1/2)+alpha**2*gamma)**2+k**2)) / tao_r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:44.189664Z",
     "start_time": "2021-01-20T11:59:44.178698Z"
    }
   },
   "outputs": [],
   "source": [
    "v1 = (1j*k+np.sqrt(alpha*gamma))/(alpha*gamma)**(1/4)*q2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 207,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:44.196646Z",
     "start_time": "2021-01-20T11:59:44.191659Z"
    }
   },
   "outputs": [],
   "source": [
    "r0 = (4+2*alpha**(3/2)*np.sqrt(gamma)+2*alpha*1j*k)*q2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:45.509137Z",
     "start_time": "2021-01-20T11:59:44.917719Z"
    }
   },
   "outputs": [],
   "source": [
    "Nx = 200\n",
    "Ny = 100\n",
    "q = np.zeros((Ny,Nx),dtype=  complex)\n",
    "r = np.zeros((Ny,Nx),dtype=  complex)\n",
    "v = np.zeros((Ny,Nx),dtype=  complex)\n",
    "\n",
    "\n",
    "x = np.linspace(-2*np.pi,2*np.pi,Nx)\n",
    "y = np.linspace(-np.pi,np.pi,Ny)\n",
    "\n",
    "for i in range(Ny):\n",
    "    for j in range(Nx):\n",
    "        q[i,j] = (q0*phi(y[i],p,0)+q2*phi(y[i],p,2))*np.exp(1j*k*x[j])\n",
    "        r[i,j] = r0*phi(y[i],p,0)*np.exp(1j*k*x[j])\n",
    "        v[i,j] = v1*phi(y[i],p,1)*np.exp(1j*k*x[j])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:45.597903Z",
     "start_time": "2021-01-20T11:59:45.592913Z"
    }
   },
   "outputs": [],
   "source": [
    "eta = (q+r)/(2*gamma**(1/2))\n",
    "u = (q-r)/(2*alpha**(1/2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.042711Z",
     "start_time": "2021-01-20T11:59:45.688658Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'Northward distance')"
      ]
     },
     "execution_count": 210,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 103796 characters]\n",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,4))\n",
    "plt.contourf(x,y,np.real(eta),20,alpha=0.75,cmap=plt.cm.hot)\n",
    "#8:8+2=10,将高分为10部分，\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "plt.quiver(x[::5],y[::5],np.real(u[::5,::5]),np.real(v[::5,::5]),scale = 7,scale_units = 'inches',color = 'black',angles = 'uv',headwidth = 3)  \n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(x,y,np.real(eta),20,colors='black',linewidth=0.1,alpha = 0.3)\n",
    "\n",
    "#adding label\n",
    "# plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 211,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.124514Z",
     "start_time": "2021-01-20T11:59:46.121500Z"
    }
   },
   "outputs": [],
   "source": [
    "u = np.real(u)\n",
    "v = np.real(v)\n",
    "h = np.real(eta) + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 212,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.137460Z",
     "start_time": "2021-01-20T11:59:46.126487Z"
    }
   },
   "outputs": [],
   "source": [
    "Q = np.zeros((Ny,Nx))\n",
    "Ru = np.zeros((Ny,Nx))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 213,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.438653Z",
     "start_time": "2021-01-20T11:59:46.298028Z"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(Ny):\n",
    "    for j in range(Nx):\n",
    "#         Q[i,j] = (np.pi**(-0.25)*np.exp(-0.5*y[i]**2+1j*k_x*x[j]) -h[i,j])/ tao_r\n",
    "        Q[i,j] = (np.exp(-0.5*y[i]**2)*np.cos(k*x[j])+1 -h[i,j])/ tao_r\n",
    "# Q = np.real(Q)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 214,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.467576Z",
     "start_time": "2021-01-20T11:59:46.440647Z"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(Ny):\n",
    "    for j in range(Nx):\n",
    "        if(Q[i,j]>0):\n",
    "#             print(1)\n",
    "            Ru[i,j] = -Q[i,j]*u[i,j]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 215,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.559334Z",
     "start_time": "2021-01-20T11:59:46.554343Z"
    }
   },
   "outputs": [],
   "source": [
    "u_bar = np.zeros(Ny)\n",
    "v_bar = np.zeros(Ny)\n",
    "h_bar = np.zeros(Ny)\n",
    "hv_bar = np.zeros(Ny)\n",
    "Q_bar = np.zeros(Ny)\n",
    "Ru_bar = np.zeros(Ny)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 216,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.734861Z",
     "start_time": "2021-01-20T11:59:46.723890Z"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(Ny):\n",
    "    u_bar[i] = np.mean(u[i,:])\n",
    "    v_bar[i] = np.mean(v[i,:])\n",
    "    h_bar[i] = np.mean(h[i,:])\n",
    "    hv_bar[i] = np.mean(h[i,:]*v[i,:])\n",
    "    Q_bar[i] = np.mean(Q[i,:])\n",
    "    Ru_bar[i] = np.mean(Ru[i,:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 217,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:46.978210Z",
     "start_time": "2021-01-20T11:59:46.974221Z"
    }
   },
   "outputs": [],
   "source": [
    "u_dev = np.zeros((Ny,Nx))\n",
    "v_dev = np.zeros((Ny,Nx))\n",
    "h_dev = np.zeros((Ny,Nx))\n",
    "hv_dev=np.zeros((Ny,Nx))\n",
    "Q_dev=np.zeros((Ny,Nx))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 218,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T11:59:47.204604Z",
     "start_time": "2021-01-20T11:59:47.111854Z"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(Ny):\n",
    "    for j in range(Nx):\n",
    "        u_dev[i,j] = u[i,j]-u_bar[i]\n",
    "        v_dev[i,j] = v[i,j]-v_bar[i]\n",
    "        h_dev[i,j] = h[i,j]-h_bar[i]\n",
    "        hv_dev[i,j] = h[i,j]*v[i,j]-hv_bar[i]\n",
    "        Q_dev[i,j] = Q[i,j]-Q_bar[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 225,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T12:50:14.229456Z",
     "start_time": "2021-01-20T12:50:14.196547Z"
    }
   },
   "outputs": [],
   "source": [
    "def term1_func(y,u_bar,v,h_bar):\n",
    "    Ny = len(y)\n",
    "    dy = y[2]-y[1]\n",
    "    tmp1 = np.zeros(Ny)\n",
    "    tmp2 = np.zeros(Ny)\n",
    "    for i in range(Ny):\n",
    "        tmp1[i] = np.mean(v[i,:]*h[i,:])/h_bar[i]\n",
    "    for i in range(1,Ny-1):\n",
    "        tmp2[i] = y[i]-(u_bar[i+1]-u_bar[i-1])/(2*dy)\n",
    "    return tmp1*tmp2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 226,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T12:50:26.872903Z",
     "start_time": "2021-01-20T12:50:26.866917Z"
    }
   },
   "outputs": [],
   "source": [
    "def term2_func(h_bar,hv_dev,u_dev,y):\n",
    "    Ny = len(y)\n",
    "    dy = y[2]-y[1]\n",
    "    tmp = np.zeros(Ny)\n",
    "    dtmp = np.zeros(Ny)\n",
    "    for i in range(Ny):\n",
    "        tmp[i] = np.mean(hv_dev[i,:]*u_dev[i,:])\n",
    "    for i in range(1,Ny-1):\n",
    "        dtmp[i] = -(tmp[i+1]-tmp[i-1])/(2*dy*h_bar[i])\n",
    "    return dtmp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 227,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T12:50:27.692693Z",
     "start_time": "2021-01-20T12:50:27.688674Z"
    }
   },
   "outputs": [],
   "source": [
    "def term3_func(u_dev,Q_dev,Ru,h_bar):\n",
    "    tmp = np.zeros(Ny)\n",
    "    for i in range(Ny):\n",
    "        tmp[i] = np.mean(u_dev[i,:]*Q_dev[i,:] + Ru[i,:])/h_bar[i]\n",
    "    return tmp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 228,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T12:50:28.112552Z",
     "start_time": "2021-01-20T12:50:28.107556Z"
    }
   },
   "outputs": [],
   "source": [
    "def term4_func(u,h,h_bar):\n",
    "    tmp = np.zeros(Ny)\n",
    "    for i in range(Ny):\n",
    "        tmp[i] = -np.mean(h[i,:]*u[i,:])/h_bar[i]/tao_d\n",
    "    return tmp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 229,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T12:50:28.588270Z",
     "start_time": "2021-01-20T12:50:28.577300Z"
    }
   },
   "outputs": [],
   "source": [
    "term1 = term1_func(y,u_bar,v,h_bar)\n",
    "term2 = term2_func(h_bar,hv_dev,u_dev,y)\n",
    "term3 = term3_func(u_dev,Q_dev,Ru,h_bar)\n",
    "term4 = term4_func(u,h,h_bar)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 231,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-20T12:50:40.386236Z",
     "start_time": "2021-01-20T12:50:40.141895Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x136608a01d0>"
      ]
     },
     "execution_count": 231,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 76720 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,8))\n",
    "plt.plot(term1,y,linewidth = 2.5,color ='green',label = 'term1')\n",
    "plt.plot(term2,y,linewidth = 2.5,color ='black',label = 'term2')\n",
    "plt.plot(term3,y,linewidth = 2.5,color = 'b',label = 'term3')\n",
    "plt.plot(term4,y,linewidth = 2.5,color = 'y',label = 'term4')\n",
    "plt.plot(term1+term2+term3,y,linewidth = 2.5,color = 'red',label = 'total')\n",
    "# plt.xlim(-0.04,0.04)\n",
    "plt.plot([0.0]*5,np.linspace(-4,4,5),'--',color = 'black')\n",
    "plt.ylim(-np.pi,np.pi)\n",
    "plt.xlabel('Accelerations',fontsize = 20)\n",
    "plt.ylabel('y',fontsize = 20)\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Fortran 接口 test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-24T03:24:32.843768Z",
     "start_time": "2020-11-24T03:24:27.317752Z"
    }
   },
   "outputs": [],
   "source": [
    "from ctypes import c_int\n",
    "import numpy as np\n",
    "import test2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-11-24T03:24:35.562879Z",
     "start_time": "2020-11-24T03:24:35.551385Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "matrix2 = transfermat2for(matrix,[n1,n2])\n",
      "\n",
      "Wrapper for ``transfermat2for``.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "matrix : in/output rank-2 array('d') with bounds (n1,n2)\n",
      "\n",
      "Other Parameters\n",
      "----------------\n",
      "n1 : input int, optional\n",
      "    Default: shape(matrix,0)\n",
      "n2 : input int, optional\n",
      "    Default: shape(matrix,1)\n",
      "\n",
      "Returns\n",
      "-------\n",
      "matrix2 : rank-2 array('d') with bounds (n1,n2)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(test2.py2f90.transfermat2for.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = np.zeros(shape = (2,5),dtype='f8',order='f')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = test2.py2f90.transfermat2for"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "f(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "print(x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Fortran 接口"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:11.526133Z",
     "start_time": "2021-02-19T10:37:11.514165Z"
    }
   },
   "outputs": [],
   "source": [
    "# Parameters:\n",
    "T = 3000 # steps\n",
    "nx = 200 # computing grids\n",
    "ny = 200 \n",
    "x = 4*np.pi # physical domain\n",
    "y = 4*np.pi\n",
    "tau_d = 5 # drag time\n",
    "tau_r = 5 # radiation time\n",
    "dt = 0.02 # time interval \n",
    "Q_list = np.zeros((ny,nx,3,T)) # data for each steps\n",
    "heq = np.zeros((ny,nx)) # equilibrated height\n",
    "Q_ini = np.zeros((ny,nx,3)) # initial condition\n",
    "H = 1 # mean height\n",
    "delta_heq = 0.01 * H # deviation from H"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$h_{eq} = H + \\Delta h_{eq} Hermite$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:12.858532Z",
     "start_time": "2021-02-19T10:37:12.851729Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(200, 200, 3, 3000)"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_list.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:13.048203Z",
     "start_time": "2021-02-19T10:37:13.044036Z"
    }
   },
   "outputs": [],
   "source": [
    "# define the source term (0 order Hermite function)\n",
    "def phi(y,p,o):\n",
    "    return np.exp(-y**2/(2*p**2))*spe.hermite(o)(y/p)\n",
    "def S(x,y,k,p):\n",
    "    return np.cos(k*x)*phi(y,p,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:13.239692Z",
     "start_time": "2021-02-19T10:37:13.235734Z"
    }
   },
   "outputs": [],
   "source": [
    "p = (tau_r/tau_d)**(1/4) # Prandtl number \n",
    "k = 0.5 # wave number "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:21.284115Z",
     "start_time": "2021-02-19T10:37:15.027839Z"
    }
   },
   "outputs": [],
   "source": [
    "# define the heq array and plot it.\n",
    "xx = np.linspace(-x/2,x/2,nx)\n",
    "yy = np.linspace(-y/2,y/2,ny)\n",
    "for i in range(ny):\n",
    "    for j in range(nx):\n",
    "        heq[i,j] = S(xx[j],yy[i],k,p) * delta_heq + H"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:21.644108Z",
     "start_time": "2021-02-19T10:37:21.312994Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'Northward distance')"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 60192 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (4,4))\n",
    "plt.contourf(xx,yy,heq,20,alpha=0.75,cmap=plt.cm.hot)\n",
    "#8:8+2=10,将高分为10部分，\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(xx,yy,heq,20,colors='black',linewidth=0.1 )\n",
    "\n",
    "#adding label\n",
    "plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:37:25.141107Z",
     "start_time": "2021-02-19T10:37:25.126758Z"
    }
   },
   "outputs": [],
   "source": [
    "# define the initial conditon\n",
    "for i in range(ny):\n",
    "    for j in range(nx):\n",
    "        Q_ini[i,j,0] =1.0 \n",
    "#         Q_ini[i,j,1] = 1e-3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:36:20.644983Z",
     "start_time": "2021-02-19T10:36:20.640022Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 0., 0., ..., 0., 0., 0.],\n",
       "       [0., 0., 0., ..., 0., 0., 0.],\n",
       "       [0., 0., 0., ..., 0., 0., 0.],\n",
       "       ...,\n",
       "       [0., 0., 0., ..., 0., 0., 0.],\n",
       "       [0., 0., 0., ..., 0., 0., 0.],\n",
       "       [0., 0., 0., ..., 0., 0., 0.]])"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_ini[:,:,1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:36:23.451061Z",
     "start_time": "2021-02-19T10:36:23.441097Z"
    }
   },
   "outputs": [],
   "source": [
    "# interface with Fortran90\n",
    "import shallow_water_TVD_WENO_jet as main"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:36:23.777494Z",
     "start_time": "2021-02-19T10:36:23.738598Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "q_list = evolve(t,x,y,tau_d,tau_r,heq,dt,q_ini,[n_x,n_y])\n",
      "\n",
      "Wrapper for ``evolve``.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "t : input int\n",
      "x : input float\n",
      "y : input float\n",
      "tau_d : input float\n",
      "tau_r : input float\n",
      "heq : input rank-2 array('d') with bounds (n_y,n_x)\n",
      "dt : input float\n",
      "q_ini : input rank-3 array('d') with bounds (n_y,n_x,3)\n",
      "\n",
      "Other Parameters\n",
      "----------------\n",
      "n_x : input int, optional\n",
      "    Default: shape(heq,1)\n",
      "n_y : input int, optional\n",
      "    Default: shape(heq,0)\n",
      "\n",
      "Returns\n",
      "-------\n",
      "q_list : rank-4 array('d') with bounds (n_y,n_x,3,t)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(main.evolve.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:48:02.193408Z",
     "start_time": "2021-02-19T10:37:29.265503Z"
    }
   },
   "outputs": [],
   "source": [
    "Q_list = main.evolve(T,x,y,tau_d,tau_r,heq,dt,Q_ini,nx,ny)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:49:42.286517Z",
     "start_time": "2021-02-19T10:49:42.280533Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 5.29439013e-10,  4.81121589e-10,  4.10620772e-10, ...,\n",
       "         5.18351350e-10,  5.49375733e-10,  5.52805354e-10],\n",
       "       [ 1.96478342e-10,  1.61889564e-10,  1.10250138e-10, ...,\n",
       "         1.80318435e-10,  2.06708023e-10,  2.11889895e-10],\n",
       "       [ 8.99673682e-12, -1.56719811e-11, -5.52326582e-11, ...,\n",
       "        -2.09030697e-11,  7.18020082e-12,  1.69973123e-11],\n",
       "       ...,\n",
       "       [-9.13673239e-10, -8.73794538e-10, -8.18533618e-10, ...,\n",
       "        -9.26895105e-10, -9.41001402e-10, -9.36447992e-10],\n",
       "       [-8.72715549e-10, -8.29204591e-10, -7.68277909e-10, ...,\n",
       "        -8.81453494e-10, -8.99839928e-10, -8.96724647e-10],\n",
       "       [-8.49709818e-10, -7.98272356e-10, -7.24462169e-10, ...,\n",
       "        -8.47079181e-10, -8.75420366e-10, -8.76034266e-10]])"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_list[:,:,1,2999]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:49:46.411904Z",
     "start_time": "2021-02-19T10:49:44.670831Z"
    }
   },
   "outputs": [],
   "source": [
    "u = Q_list[:,:,1,:] / Q_list[:,:,0,:]\n",
    "v = Q_list[:,:,2,:] / Q_list[:,:,0,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T10:49:48.460092Z",
     "start_time": "2021-02-19T10:49:48.053977Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'Northward distance')"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 124428 characters]\n",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,4))\n",
    "plt.contourf(xx,yy,Q_list[:,:,0,1499],20,alpha=0.8,cmap=plt.cm.hot)\n",
    "#8:8+2=10,将高分为10部分，\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(xx,yy,Q_list[:,:,0,1499],20,colors='black',linewidth=0.1,alpha = 0.8)\n",
    "\n",
    "#adding label\n",
    "plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)\n",
    "# plt.savefig('..\\img/offset.png',dpi = 300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-19T12:38:44.238943Z",
     "start_time": "2021-02-19T12:38:43.523637Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 192644 characters]\n",
      "text/plain": [
       "<Figure size 576x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,5))\n",
    "tstep = 2999\n",
    "plt.contourf(xx,yy,Q_list[:,:,0,tstep],20,alpha=0.9,cmap=plt.cm.hot)\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "plt.quiver(xx[::5],yy[::5],u[::5,::5,tstep],v[::5,::5,tstep],scale = 0.008,scale_units = 'inches',color = 'black',angles = 'uv',headwidth = 3,width = 0.0015)  \n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(xx,yy,Q_list[:,:,0,tstep],20,colors='black',linewidth=0.1,alpha = 0.3)\n",
    "plt.ylim(-np.pi,np.pi)\n",
    "#adding label\n",
    "# plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.title('$\\\\tau_{rad} = 5$, $\\\\tau_{drag} = 5$',fontsize = 15)\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)\n",
    "plt.savefig('F:/exoplanet/Exoplanet_SWE_weno_tvd/thesis-master/image/main/'+'showman3.pdf',dpi = 300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(25, 100)"
      ]
     },
     "execution_count": 204,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u[::4,::2,2500].shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 327,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "&lt;Figure size 576x288 with 0 Axes&gt;"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for i in range(0,T,5):\n",
    "    fig = plt.figure(figsize = (8,4))\n",
    "    plt.contourf(xx,yy,Q_list[:,:,0,i],20,alpha=0.8,cmap=plt.cm.hot)\n",
    "    #8:8+2=10,将高分为10部分，\n",
    "    #alpha：透明度\n",
    "    #cmap：color map\n",
    "\n",
    "    #use plt.contour to add contour lines\n",
    "    C=plt.contour(xx,yy,Q_list[:,:,0,i],20,colors='black',linewidth=0.1,alpha = 0.3)\n",
    "\n",
    "    #adding label\n",
    "    # plt.clabel(C,inline=True,fontsize=10)\n",
    "    #clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "    plt.xlabel('Eastward distance',fontsize = 15)\n",
    "    plt.ylabel('Northward distance',fontsize = 15)\n",
    "    plt.title('Time:'+str('%.3f'% float(i*dt)))\n",
    "    filename='F://exoplanet//showman//img//202010062//'+str('%05d'%i)+'.png'\n",
    "    plt.savefig(filename,dpi = 50)\n",
    "    plt.clf()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pseudo-spectral method for linearized equations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## showman's case (pure dynamic)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T01:26:21.544009Z",
     "start_time": "2020-12-15T01:26:21.537341Z"
    }
   },
   "outputs": [],
   "source": [
    "# operator \\partial/ \\partial y\n",
    "@nb.jit(nopython = True)\n",
    "def ddy(y,p,o):\n",
    "    if(o ==0):\n",
    "        return -y*pi**(-0.25)*exp(-0.5*y**2)\n",
    "    elif(o ==1):\n",
    "        return sqrt(2.0)*pi**(-0.25)*exp(-0.5*y**2)*(1.0-y**2)\n",
    "    elif(o>=2):\n",
    "        return -y*phin(o,y) + sqrt(2.0*o)*phin(o-1,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:20.274128Z",
     "start_time": "2020-12-15T02:22:20.268448Z"
    }
   },
   "outputs": [],
   "source": [
    "n_order = 5 # number of basis functions  j\n",
    "n_p = n_order\n",
    "n_eqt = 3 # number of equations  k\n",
    "n_var = 3 # number of varibles  l\n",
    "k_x = 0.5 # wave number\n",
    "mu = 0.0 # magnetic diffusion coefficient\n",
    "B_0 = 0.0 # external vertical magnetic field\n",
    "\n",
    "tao_r = 10 # radiation time \n",
    "tao_d =10# drag time\n",
    "p = (tao_r/tao_d)**(1/4) # Prandtl number "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 238,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:20.772592Z",
     "start_time": "2020-12-15T02:22:20.753963Z"
    }
   },
   "outputs": [],
   "source": [
    "# colloation matrix\n",
    "H = np.zeros((n_p*n_eqt,n_order*n_var),dtype=complex)\n",
    "H2 = np.zeros((n_p*n_eqt,n_order*n_var),dtype=complex)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 239,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:21.016353Z",
     "start_time": "2020-12-15T02:22:21.011540Z"
    }
   },
   "outputs": [],
   "source": [
    "# y_collo = np.array([])\n",
    "# for n in range(n_order-1):\n",
    "#     y_collo = np.append(y_collo,spe.roots_hermite(n+1)[0])\n",
    "y_collo = spe.roots_hermite(n_order)[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 240,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:21.241712Z",
     "start_time": "2020-12-15T02:22:21.228150Z"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(n_p):\n",
    "    for j in range(n_order):\n",
    "        phi_ij = phin(j,y_collo[i]/p)\n",
    "#         print(i,j)\n",
    "        H[i+n_p*0,j+n_order*0] = 1/tao_d*phi_ij\n",
    "        H[i+n_p*1,j+n_order*0] = y_collo[i] * phi_ij\n",
    "        H[i+n_p*2,j+n_order*0] = 1j * k_x * phi_ij\n",
    "        H[i+n_p*0,j+n_order*1] = -H[i+n_p*1,j+n_order*0]\n",
    "        H[i+n_p*1,j+n_order*1] = 1/tao_d*phi_ij\n",
    "        H[i+n_p*2,j+n_order*1] = ddy(y_collo[i],p,j)\n",
    "        H[i+n_p*0,j+n_order*2] = H[i+n_p*2,j+n_order*0]\n",
    "        H[i+n_p*1,j+n_order*2] = H[i+n_p*2,j+n_order*1]\n",
    "        H[i+n_p*2,j+n_order*2] = 1/tao_r*phi_ij"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 241,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:21.728254Z",
     "start_time": "2020-12-15T02:22:21.713754Z"
    }
   },
   "outputs": [],
   "source": [
    "for j in range(n_p):\n",
    "    for i in range(n_order):\n",
    "        phi_ij = phin(j,y_collo[i]/p)\n",
    "#         print(i,j)\n",
    "        H2[i+n_p*0,j+n_order*0] = 1/tao_d*phi_ij\n",
    "        H2[i+n_p*1,j+n_order*0] = y_collo[i] * phi_ij\n",
    "        H2[i+n_p*2,j+n_order*0] = 1j * k_x * phi_ij\n",
    "        H2[i+n_p*0,j+n_order*1] = -H[i+n_p*1,j+n_order*0]\n",
    "        H2[i+n_p*1,j+n_order*1] = 1/tao_d*phi_ij\n",
    "        H2[i+n_p*2,j+n_order*1] = ddy(y_collo[i],p,j)\n",
    "        H2[i+n_p*0,j+n_order*2] = H[i+n_p*2,j+n_order*0]\n",
    "        H2[i+n_p*1,j+n_order*2] = H[i+n_p*2,j+n_order*1]\n",
    "        H2[i+n_p*2,j+n_order*2] = 1/tao_r*phi_ij"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 242,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:22.108955Z",
     "start_time": "2020-12-15T02:22:22.097459Z"
    }
   },
   "outputs": [],
   "source": [
    "# source term matrix \n",
    "f = np.zeros((n_eqt*n_p),dtype=complex)\n",
    "for i in range(n_p):\n",
    "    f[2*n_p+i] = phin(0,y_collo[i]/p) / tao_r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 243,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:22.308763Z",
     "start_time": "2020-12-15T02:22:22.299886Z"
    }
   },
   "outputs": [],
   "source": [
    "from scipy import linalg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:22.840598Z",
     "start_time": "2020-12-15T02:22:22.829503Z"
    }
   },
   "outputs": [],
   "source": [
    "a = linalg.solve(H,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 245,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:22:23.636280Z",
     "start_time": "2020-12-15T02:22:23.120044Z"
    }
   },
   "outputs": [],
   "source": [
    "Nx = 100\n",
    "Ny = 100\n",
    "x = np.linspace(-2*np.pi,2*np.pi,Nx)\n",
    "y = np.linspace(-np.pi,np.pi,Ny)\n",
    "u = np.zeros((Ny,Nx),dtype=complex)\n",
    "v = np.zeros((Ny,Nx),dtype=complex)\n",
    "eta = np.zeros((Ny,Nx),dtype=complex)\n",
    "for i in range(Ny):\n",
    "#         print(i)\n",
    "    for j in range(Nx):\n",
    "        for k in range(n_order):\n",
    "            u[i,j] +=  phin(k,y[i]/p)*a[k]\n",
    "            v[i,j] +=  phin(k,y[i]/p)*a[n_order*1+k]\n",
    "            eta[i,j] +=  phin(k,y[i]/p)*a[n_order*2+k]\n",
    "        u[i,j] *=np.exp(1j*k_x*x[j])\n",
    "        v[i,j] *=np.exp(1j*k_x*x[j])\n",
    "        eta[i,j] *=np.exp(1j*k_x*x[j])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 253,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:34:49.674597Z",
     "start_time": "2020-12-15T02:34:48.122181Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\numpy\\ma\\core.py:2832: ComplexWarning: Casting complex values to real discards the imaginary part\n",
      "  order=order, subok=True, ndmin=ndmin)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 213404 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,8))\n",
    "plt.contourf(x,y,eta,20,alpha=0.75,cmap=plt.cm.hot)\n",
    "plt.quiver(x[::2],y[::2],np.real(u[::2,::2]),np.real(v[::2,::2]),scale = 0.5,scale_units = 'inches',color = 'black',angles = 'uv',headwidth = 3,width = 0.0015)  \n",
    "\n",
    "#8:8+2=10,将高分为10部分，\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "# C=plt.contour(x,y,eta,20,colors='black',linewidth=0.1 )\n",
    "\n",
    "#adding label\n",
    "plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)\n",
    "plt.savefig('test.png',dpi = 300)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## MHD case"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:37:40.127836Z",
     "start_time": "2020-12-13T11:37:40.120860Z"
    }
   },
   "outputs": [],
   "source": [
    "# operator \\partial/ \\partial y\n",
    "@nb.jit(nopython = True)\n",
    "def ddy(y,p,o):\n",
    "    return -phi(y,p,o+1) / p + y*phi(y,p,o)/p**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T06:50:19.273873Z",
     "start_time": "2020-12-12T06:50:19.258119Z"
    }
   },
   "outputs": [],
   "source": [
    "# second order derivative\n",
    "@nb.jit(nopython = True)\n",
    "def dddy(y,p,o):\n",
    "    return 1/p**2 *(-(2*o+1)+y**2/p**2) *phi(y,p,o)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 345,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:16.190756Z",
     "start_time": "2020-12-15T02:45:16.184086Z"
    }
   },
   "outputs": [],
   "source": [
    "n_order = 40 # number of basis functions  j\n",
    "n_p = n_order\n",
    "n_eqt = 5 # number of equations  k\n",
    "n_var = 5 # number of varibles  l\n",
    "k_x = 0.5 # wave number\n",
    "mu = 0.01 # magnetic diffusion coefficient\n",
    "B_0 = 0.00001 # external vertical magnetic field\n",
    "\n",
    "tao_r = 10 # radiation time \n",
    "tao_d =10# drag time\n",
    "p = (tao_r/tao_d)**(1/4) # Prandtl number "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 346,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:17.434107Z",
     "start_time": "2020-12-15T02:45:17.429179Z"
    },
    "code_folding": []
   },
   "outputs": [],
   "source": [
    "y_collo = spe.roots_hermite(n_order)[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 256,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:35:55.307035Z",
     "start_time": "2020-12-15T02:35:55.300492Z"
    }
   },
   "outputs": [],
   "source": [
    "# # colloation matrix\n",
    "# H = np.zeros((n_p*n_eqt,n_order*n_var),dtype=complex)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 245,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T06:36:28.642955Z",
     "start_time": "2020-12-12T06:36:28.635979Z"
    }
   },
   "outputs": [],
   "source": [
    "# @nb.jit(nopython = True)\n",
    "# def main2(H):\n",
    "#     for i in range(n_p):\n",
    "#         for j in range(n_order):\n",
    "#             phi_ij = phi(y_collo[i],p,j)\n",
    "#             H[i+n_p*0,j+n_order*0] = 1/tao_d*phi_ij\n",
    "#             H[i+n_p*1,j+n_order*0] = y_collo[i] * phi_ij\n",
    "#             H[i+n_p*2,j+n_order*0] = 1j * k_x * phi_ij\n",
    "#             H[i+n_p*3,j+n_order*0] = B_0* phi_ij\n",
    "\n",
    "#             H[i+n_p*0,j+n_order*1] = -H[i+n_p*1,j+n_order*0]\n",
    "#             H[i+n_p*1,j+n_order*1] = 1/tao_d*phi_ij\n",
    "#             H[i+n_p*2,j+n_order*1] = ddy(y_collo[i],p,j)\n",
    "#             H[i+n_p*4,j+n_order*1] = B_0* phi_ij\n",
    "\n",
    "#             H[i+n_p*0,j+n_order*2] = H[i+n_p*2,j+n_order*0]\n",
    "#             H[i+n_p*1,j+n_order*2] = H[i+n_p*2,j+n_order*1]\n",
    "#             H[i+n_p*2,j+n_order*2] = 1/tao_r*phi_ij\n",
    "\n",
    "#             H[i+n_p*0,j+n_order*3] = H[i+n_p*3,j+n_order*0]\n",
    "#             H[i+n_p*3,j+n_order*3] = mu*(-k_x**2*phi_ij+dddy(y_collo[i],p,j))\n",
    "\n",
    "#             H[i+n_p*1,j+n_order*4] = H[i+n_p*4,j+n_order*1]\n",
    "#             H[i+n_p*4,j+n_order*4] = H[i+n_p*3,j+n_order*3]\n",
    "#     return H"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 249,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T06:36:41.081615Z",
     "start_time": "2020-12-12T06:36:40.374970Z"
    }
   },
   "outputs": [],
   "source": [
    "# H=main2(H)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-14T12:16:15.275931Z",
     "start_time": "2020-12-14T12:16:15.271870Z"
    }
   },
   "outputs": [],
   "source": [
    "# # source term matrix \n",
    "# f = np.zeros((n_eqt*n_p),dtype=complex)\n",
    "# for i in range(n_p):\n",
    "#     f[2*n_p+i] = phi(y_collo[i],p,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 257,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:35:59.186331Z",
     "start_time": "2020-12-15T02:35:59.174301Z"
    }
   },
   "outputs": [],
   "source": [
    "from scipy import linalg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 258,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:35:59.542263Z",
     "start_time": "2020-12-15T02:35:59.524762Z"
    }
   },
   "outputs": [],
   "source": [
    "import pseudo_spectral as ps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T00:40:41.232076Z",
     "start_time": "2020-12-15T00:40:41.224829Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "h,f = assign(n_eqt,n_var,p,y_collo,b_0,mu,k_x,tao_r,tao_d,phi_const,[n_order,n_p])\n",
      "\n",
      "Wrapper for ``assign``.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "n_eqt : input int\n",
      "n_var : input int\n",
      "p : input float\n",
      "y_collo : input rank-1 array('d') with bounds (n_p)\n",
      "b_0 : input float\n",
      "mu : input float\n",
      "k_x : input float\n",
      "tao_r : input float\n",
      "tao_d : input float\n",
      "phi_const : input rank-2 array('D') with bounds (n_order,n_order)\n",
      "\n",
      "Other Parameters\n",
      "----------------\n",
      "n_order : input int, optional\n",
      "    Default: shape(phi_const,0)\n",
      "n_p : input int, optional\n",
      "    Default: len(y_collo)\n",
      "\n",
      "Returns\n",
      "-------\n",
      "h : rank-2 array('D') with bounds (n_p*n_eqt,n_order*n_var)\n",
      "f : rank-1 array('D') with bounds (n_eqt*n_p)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(ps.assign.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T00:40:41.769072Z",
     "start_time": "2020-12-15T00:40:41.763353Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "u,v,eta,bx,by = assign_3d(n_var,k_x,a,x,phi_const,[n_order,ny,nx])\n",
      "\n",
      "Wrapper for ``assign_3d``.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "n_var : input int\n",
      "k_x : input float\n",
      "a : input rank-1 array('D') with bounds (n_order*n_var)\n",
      "x : input rank-1 array('d') with bounds (nx)\n",
      "phi_const : input rank-2 array('D') with bounds (ny,n_order)\n",
      "\n",
      "Other Parameters\n",
      "----------------\n",
      "n_order : input int, optional\n",
      "    Default: shape(phi_const,1)\n",
      "ny : input int, optional\n",
      "    Default: shape(phi_const,0)\n",
      "nx : input int, optional\n",
      "    Default: len(x)\n",
      "\n",
      "Returns\n",
      "-------\n",
      "u : rank-2 array('D') with bounds (ny,nx)\n",
      "v : rank-2 array('D') with bounds (ny,nx)\n",
      "eta : rank-2 array('D') with bounds (ny,nx)\n",
      "bx : rank-2 array('D') with bounds (ny,nx)\n",
      "by : rank-2 array('D') with bounds (ny,nx)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(ps.assign_3d.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 259,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:36:06.216151Z",
     "start_time": "2020-12-15T02:36:06.206254Z"
    }
   },
   "outputs": [],
   "source": [
    "import test2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T00:40:45.906491Z",
     "start_time": "2020-12-15T00:40:45.900565Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "phi_ij = phi_matrix_collo(y_collo,p,[n_order])\n",
      "\n",
      "Wrapper for ``phi_matrix_collo``.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "y_collo : input rank-1 array('d') with bounds (n_order)\n",
      "p : input float\n",
      "\n",
      "Other Parameters\n",
      "----------------\n",
      "n_order : input int, optional\n",
      "    Default: len(y_collo)\n",
      "\n",
      "Returns\n",
      "-------\n",
      "phi_ij : rank-2 array('D') with bounds (n_order,n_order)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(test2.phi_matrix_collo.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T00:40:46.313506Z",
     "start_time": "2020-12-15T00:40:46.306434Z"
    }
   },
   "outputs": [],
   "source": [
    "# phi40 = test2.phi_matrix_collo(y_collo,p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T00:40:47.701355Z",
     "start_time": "2020-12-15T00:40:47.689444Z"
    }
   },
   "outputs": [],
   "source": [
    "import pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-14T12:34:37.609667Z",
     "start_time": "2020-12-14T12:34:37.604654Z"
    }
   },
   "outputs": [],
   "source": [
    "# with open('phi40.pkl', 'wb') as f:\n",
    "#     pickle.dump(phi40, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 260,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:36:11.143298Z",
     "start_time": "2020-12-15T02:36:11.137524Z"
    }
   },
   "outputs": [],
   "source": [
    "with open('phi40.pkl', 'rb') as f:\n",
    "    phi40 = pickle.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-14T08:21:52.020470Z",
     "start_time": "2020-12-14T08:21:52.014525Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "phi_ik = phi_matrix_grid(y,n_order,p,[ny])\n",
      "\n",
      "Wrapper for ``phi_matrix_grid``.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "y : input rank-1 array('d') with bounds (ny)\n",
      "n_order : input int\n",
      "p : input float\n",
      "\n",
      "Other Parameters\n",
      "----------------\n",
      "ny : input int, optional\n",
      "    Default: len(y)\n",
      "\n",
      "Returns\n",
      "-------\n",
      "phi_ik : rank-2 array('D') with bounds (n_order,n_order)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(test2.phi_matrix_grid.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 347,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:24.862961Z",
     "start_time": "2020-12-15T02:45:24.839762Z"
    }
   },
   "outputs": [],
   "source": [
    "H1,f1 = ps.assign(n_eqt,n_var,p,y_collo,B_0,mu,k_x,tao_r,tao_d,phi40)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 348,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:25.225171Z",
     "start_time": "2020-12-15T02:45:25.207834Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((200, 200), (200,))"
      ]
     },
     "execution_count": 348,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "H1.shape, f1.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 349,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:25.646380Z",
     "start_time": "2020-12-15T02:45:25.628279Z"
    }
   },
   "outputs": [],
   "source": [
    "a1 = linalg.solve(H1,f1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 350,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:26.677047Z",
     "start_time": "2020-12-15T02:45:26.183490Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1e1c7ef8320>]"
      ]
     },
     "execution_count": 350,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 27224 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.axes(yscale = \"log\")\n",
    "plt.plot(abs(a1[n_order:n_order*2-1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 351,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:27.608069Z",
     "start_time": "2020-12-15T02:45:27.190064Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1e1c53f01d0>]"
      ]
     },
     "execution_count": 351,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 28392 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.axes(yscale = \"log\")\n",
    "plt.plot(abs(a1[n_order*2:n_order*3-1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 352,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:28.599947Z",
     "start_time": "2020-12-15T02:45:28.250614Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1e1c4f31a58>]"
      ]
     },
     "execution_count": 352,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 32624 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.axes(yscale = \"log\")\n",
    "plt.plot(abs(a1[n_order*3:n_order*4-1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 353,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:29.619565Z",
     "start_time": "2020-12-15T02:45:29.611871Z"
    }
   },
   "outputs": [],
   "source": [
    "Nx = 100\n",
    "Ny = 100\n",
    "u = np.zeros((Ny,Nx),dtype=complex)\n",
    "v = np.zeros((Ny,Nx),dtype=complex)\n",
    "eta = np.zeros((Ny,Nx),dtype=complex)\n",
    "bx = np.zeros((Ny,Nx),dtype=complex)\n",
    "by = np.zeros((Ny,Nx),dtype=complex)\n",
    "x = np.linspace(-2*np.pi,2*np.pi,Nx)\n",
    "y = np.linspace(-2*np.pi,2*np.pi,Ny)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 310,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:41:38.671474Z",
     "start_time": "2020-12-15T02:41:38.663917Z"
    }
   },
   "outputs": [],
   "source": [
    "# phi40_grid = test2.phi_matrix_grid(y,n_order,p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-14T16:12:45.703607Z",
     "start_time": "2020-12-14T16:12:45.698578Z"
    }
   },
   "outputs": [],
   "source": [
    "# import pickle\n",
    "# with open('phi40_grid.pkl', 'wb') as f:\n",
    "#     pickle.dump(phi40_grid, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T00:41:23.651261Z",
     "start_time": "2020-12-15T00:41:23.613509Z"
    }
   },
   "outputs": [],
   "source": [
    "with open('phi40_grid.pkl', 'rb') as f:\n",
    "    phi40_grid = pickle.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 354,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:32.159220Z",
     "start_time": "2020-12-15T02:45:32.123157Z"
    }
   },
   "outputs": [],
   "source": [
    "u,v,eta,bx,by = ps.assign_3d(n_var,k_x,a1,x,phi40_grid)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 217,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T06:23:39.444259Z",
     "start_time": "2020-12-12T06:23:39.441266Z"
    }
   },
   "outputs": [],
   "source": [
    "import numba as nb # code accelerator. coding in C-style to make your code faster."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T06:52:42.978924Z",
     "start_time": "2020-12-12T06:52:42.957190Z"
    }
   },
   "outputs": [],
   "source": [
    "# @nb.jit(nopython = True)\n",
    "# def main(ny,nx,norder,phii,u,v,eta,bx,by,a):\n",
    "#     for i in range(ny):\n",
    "# #         print(i)\n",
    "#         for j in range(nx):\n",
    "#             for k in range(norder):\n",
    "#                 u[i,j] +=  phii(y[i],p,k)*a[k]\n",
    "#                 v[i,j] +=  phii(y[i],p,k)*a[norder+k]\n",
    "#                 eta[i,j] +=  phii(y[i],p,k)*a[norder*2+k]\n",
    "#                 bx[i,j] +=  phii(y[i],p,k)*a[norder*3+k]\n",
    "#                 by[i,j] +=  phii(y[i],p,k)*a[norder*4+k]\n",
    "#             u[i,j] *=np.exp(1j*k_x*x[j])\n",
    "#             v[i,j] *=np.exp(1j*k_x*x[j])\n",
    "#             eta[i,j] *=np.exp(1j*k_x*x[j])\n",
    "#             bx[i,j] *=np.exp(1j*k_x*x[j])\n",
    "#             by[i,j] *=np.exp(1j*k_x*x[j])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-14T12:17:03.351430Z",
     "start_time": "2020-12-14T12:17:03.347402Z"
    }
   },
   "outputs": [],
   "source": [
    "# main(Ny,Nx,n_order,phi,u,v,eta,bx,by,a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 355,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:35.698056Z",
     "start_time": "2020-12-15T02:45:35.685307Z"
    }
   },
   "outputs": [],
   "source": [
    "u = u/np.max(u)\n",
    "v = v/np.max(v)\n",
    "eta = eta/np.max(eta)\n",
    "bx = bx/np.max(bx)\n",
    "by = by/np.max(by)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 356,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:37.485085Z",
     "start_time": "2020-12-15T02:45:35.971159Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 156888 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,8))\n",
    "plt.contourf(x,y,np.real(eta),20,alpha=0.75,cmap=plt.cm.hot)\n",
    "#8:8+2=10,将高分为10部分，\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(x,y,np.real(eta),15,colors='black',linewidth=0.1,alpha = 0.7)\n",
    "\n",
    "#adding label\n",
    "plt.clabel(C,inline=True,fontsize=8)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.title('$B_0$ ='+'%.3f' %(B_0/0.38*10)+'Gs, $\\mu$ ='+'%.3f'%(mu/9.87*1e6)+'$m^{2}/s$'+'\\n'+'$\\\\tau_{rad} =$'+str(tao_r)+', $\\\\tau_{drag} =$'+str(tao_d),fontsize = 15)\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)\n",
    "plt.savefig('..\\img/'+'%.3f' %(B_0/0.38*10)+'Gs_h'+'%.3f'%(mu/9.87*1e6)+'mu.png',dpi = 300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 357,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:40.073461Z",
     "start_time": "2020-12-15T02:45:38.643662Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 195800 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,8))\n",
    "plt.contourf(x,y,np.real(eta),20,alpha=0.8,cmap=plt.cm.hot)\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "plt.quiver(x[::3],y[::3],np.real(u[::3,::3]),np.real(v[::3,::3]),scale = 5,scale_units = 'inches',color = 'black',angles = 'uv',headwidth = 3,width = 0.0015)  \n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(x,y,np.real(eta),20,colors='black',linewidth=0.1,alpha = 0.3)\n",
    "# plt.ylim(-np.pi/4,np.pi/4)\n",
    "#adding label\n",
    "# plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.title('$B_0$ ='+'%.3f' %(B_0/0.38*10)+'Gs, $\\mu$ ='+'%.3f'%(mu/9.87*1e6)+'$m^{2}/s$'+'\\n'+'{$v_x,v_y$}'+',$\\\\tau_{rad} =$'+str(tao_r)+', $\\\\tau_{drag} =$'+str(tao_d),fontsize = 15)\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)\n",
    "plt.savefig('..\\img/'+'%.3f' %(B_0/0.38*10)+'Gs_h'+'%.3f'%(mu/9.87*1e6)+'mu_v.png',dpi = 300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 358,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-15T02:45:48.392815Z",
     "start_time": "2020-12-15T02:45:46.872045Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda3\\conda\\lib\\site-packages\\matplotlib\\contour.py:1004: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 235724 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize = (8,8))\n",
    "plt.contourf(x,y,np.real(eta),20,alpha=0.8,cmap=plt.cm.hot)\n",
    "#alpha：透明度\n",
    "#cmap：color map\n",
    "plt.quiver(x[::3],y[::3],np.real(bx[::3,::3]),np.real(by[::3,::3]),scale = 5,scale_units = 'inches',color = 'black',angles = 'uv',headwidth = 3,width = 0.0015)  \n",
    "\n",
    "#use plt.contour to add contour lines\n",
    "C=plt.contour(x,y,np.real(eta),20,colors='black',linewidth=0.1,alpha = 0.3)\n",
    "# plt.ylim(-np.pi/4,np.pi/4)\n",
    "#adding label\n",
    "# plt.clabel(C,inline=True,fontsize=10)\n",
    "#clabel:cycle的label，inline=True表示label在line内，fontsize表示label的字体大小\n",
    "plt.title('$B_0$ ='+'%.3f' %(B_0/0.38*10)+'Gs, $\\mu$ ='+'%.3f'%(mu/9.87*1e6)+'$m^{2}/s$'+'\\n'+'{$b_x,b_y$}'+' ,$\\\\tau_{rad} =$'+str(tao_r)+', $\\\\tau_{drag} =$'+str(tao_d),fontsize = 15)\n",
    "plt.xlabel('Eastward distance',fontsize = 15)\n",
    "plt.ylabel('Northward distance',fontsize = 15)\n",
    "plt.savefig('..\\img/'+'%.3f' %(B_0/0.38*10)+'Gs_h'+'%.3f'%(mu/9.87*1e6)+'mu_b.png',dpi = 300)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 无量纲化量对照"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-08T15:29:55.706979Z",
     "start_time": "2020-12-08T15:29:55.702986Z"
    }
   },
   "outputs": [],
   "source": [
    "gh = 3700*1000\n",
    "beta = 4*np.pi/(69911e3*72*3600)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-08T15:31:26.976169Z",
     "start_time": "2020-12-08T15:31:26.972184Z"
    }
   },
   "outputs": [],
   "source": [
    "L = (gh**0.5/beta)**0.5\n",
    "U = gh**0.5\n",
    "T = (gh**0.5*beta)**(-0.5)\n",
    "H = 200e3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-08T15:33:12.102024Z",
     "start_time": "2020-12-08T15:33:12.098014Z"
    }
   },
   "outputs": [],
   "source": [
    "mu_nondim = T / L**2 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-08T15:34:12.051418Z",
     "start_time": "2020-12-08T15:34:12.045404Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.009871050715264283"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mu_nondim*1000*10**6"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# python fortran数组对照"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:00:05.759993Z",
     "start_time": "2020-12-13T11:00:05.664023Z"
    }
   },
   "outputs": [],
   "source": [
    "import test2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:00:33.399376Z",
     "start_time": "2020-12-13T11:00:33.392830Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r_out = matrix()\n",
      "\n",
      "Wrapper for ``matrix``.\n",
      "\n",
      "Returns\n",
      "-------\n",
      "r_out : rank-2 array('i') with bounds (5,4)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(test2.matrix.__doc__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:01:00.884142Z",
     "start_time": "2020-12-13T11:01:00.879247Z"
    }
   },
   "outputs": [],
   "source": [
    "c =test2.matrix()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:01:01.383591Z",
     "start_time": "2020-12-13T11:01:01.371517Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0, -1, -2, -3],\n",
       "       [ 1,  0, -1, -2],\n",
       "       [ 2,  1,  0, -1],\n",
       "       [ 3,  2,  1,  0],\n",
       "       [ 4,  3,  2,  1]], dtype=int32)"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:02:18.851387Z",
     "start_time": "2020-12-13T11:02:18.847053Z"
    }
   },
   "outputs": [],
   "source": [
    "c2 = np.zeros((5,4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:02:46.702747Z",
     "start_time": "2020-12-13T11:02:46.696603Z"
    }
   },
   "outputs": [],
   "source": [
    "for j in range(5):\n",
    "    for i in range(4):\n",
    "        c2[j,i] = j-i"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T11:03:59.830623Z",
     "start_time": "2020-12-13T11:03:59.824344Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0., -1., -2., -3.],\n",
       "       [ 1.,  0., -1., -2.],\n",
       "       [ 2.,  1.,  0., -1.],\n",
       "       [ 3.,  2.,  1.,  0.],\n",
       "       [ 4.,  3.,  2.,  1.]])"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "position": {
    "height": "415.181px",
    "left": "1498.56px",
    "right": "20px",
    "top": "156.431px",
    "width": "483px"
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
