{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2ee1d062",
   "metadata": {},
   "outputs": [],
   "source": [
    "# This code is written by Nooshin Abdollahi\n",
    "# Information about this code:\n",
    "# - Motor axons are not included\n",
    "# - there are not transverse connections between Boundary and Boundary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "af4c646e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# show the time of execution\n",
    "from datetime import datetime\n",
    "start_time = datetime.now()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "493e7e8a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from neuron import h\n",
    "import netpyne \n",
    "from netpyne import specs, sim   \n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from typing import Tuple, List\n",
    "import math\n",
    "import sys\n",
    "\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d05a8722",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import nesseccery files from Matlab\n",
    "\n",
    "R = np.loadtxt(\"R.txt\")    # All axons with different radius\n",
    "G = np.loadtxt(\"G.txt\")    # Axon's groups\n",
    "C = np.loadtxt(\"C.txt\")    # Coordinates of each axon (x,y)\n",
    "neighboringAxon = np.loadtxt(\"neighboringAxon.txt\")\n",
    "dist = np.loadtxt(\"dist.txt\")    \n",
    "dist_edge = np.loadtxt(\"Distance_edge.txt\") \n",
    "AVE_area_around_axon = np.loadtxt(\"Ave_area_around_axon.txt\")\n",
    "\n",
    "unique_radius = np.loadtxt(\"unique_radius.txt\")          # including different types\n",
    "Number_of_nodes = np.loadtxt(\"Number_of_nodes.txt\")      # Number of nodes for the specified axon total length\n",
    "\n",
    "parameters = np.loadtxt(\"parameters.txt\")  \n",
    "\n",
    "# importing all the connections\n",
    "import scipy.io as io\n",
    "\n",
    "for i in range(1,2):\n",
    "    for j in range(1,2):\n",
    "        if j>=i:\n",
    "            l = [i, j]\n",
    "            z = ''.join([str(n) for n in l])\n",
    "            Input = io.loadmat('Connect_types_{}.mat'.format(z) , squeeze_me=True)  \n",
    "            I = Input['SAVE']; \n",
    "            locals()[\"Connect_types_\"+str(z)]=[]\n",
    "            for v in range(len(I)):\n",
    "                D = I[v].strip()  \n",
    "                locals()[\"Connect_types_\"+str(z)].append(D)  \n",
    "\n",
    "\n",
    "# Boundary connections\n",
    "for i in range(1,2):\n",
    "    Input = io.loadmat('Boundary_to_{}.mat'.format(i) , squeeze_me=True)  \n",
    "    I = Input['SAVE']; \n",
    "    locals()[\"Boundary_to_\"+str(i)]=[]\n",
    "    for v in range(len(I)):\n",
    "        D = I[v].strip()  \n",
    "        locals()[\"Boundary_to_\"+str(i)].append(D) \n",
    "    \n",
    "\n",
    "\n",
    "#\n",
    "Boundary_coordinates = np.loadtxt(\"Boundary_coordinates.txt\")\n",
    "Boundary_neighboring = np.loadtxt(\"Boundary_neighboring.txt\")\n",
    "Boundary_dist = np.loadtxt(\"Boundary_dist.txt\") \n",
    "\n",
    "\n",
    "############## importing files related to transverse resistance (Rg) and Areas\n",
    "\n",
    "for i in range(1,2):\n",
    "    for j in range(1,2):\n",
    "        if j>=i:\n",
    "            l = [i, j]\n",
    "            z = ''.join([str(n) for n in l])\n",
    "            Input = np.loadtxt('Rg_{}.txt'.format(z) )  \n",
    "            locals()[\"Rg_\"+str(z)]=Input\n",
    "  \n",
    "\n",
    "\n",
    "                \n",
    "for i in range(1,2):\n",
    "    Input = np.loadtxt('Boundary_Rg_{}.txt'.format(i) )  \n",
    "    locals()[\"Boundary_Rg_\"+str(i)]=Input\n",
    "\n",
    "    \n",
    "    \n",
    "        \n",
    "        \n",
    "for i in range(1,2):\n",
    "    for j in range(1,2):\n",
    "        if j>i:\n",
    "            l = [i, j]\n",
    "            z = ''.join([str(n) for n in l])\n",
    "            Input = np.loadtxt('Areas_{}.txt'.format(z) )  \n",
    "            locals()[\"Areas_\"+str(z)]=Input\n",
    "            \n",
    "            \n",
    "            \n",
    "            \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cf1c9f69",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Network parameters\n",
    "netParams = specs.NetParams()\n",
    "\n",
    "netParams.sizeX=3000\n",
    "netParams.sizeY=3000\n",
    "netParams.sizeZ=3000\n",
    "\n",
    "\n",
    "################################# Importing Axons(including C fibers and the others) and Boundary ####################################\n",
    "\n",
    "netParams.importCellParams(\n",
    "    cellInstance=True,\n",
    "    label='Boundary', \n",
    "    conds={'cellType': 'Boundary', 'cellModel': 'Boundary'},\n",
    "    fileName='Boundarycable.hoc', \n",
    "    cellName='Boundary', \n",
    "    importSynMechs=True) ;\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "# Myelinated axons have different types (i.e. diameters)\n",
    "# How many types... do I have?  print(len(unique_radius)-1),  -1 because the first eleman is for C fiber\n",
    "# each type is a specific diameter\n",
    "\n",
    "netParams.importCellParams(\n",
    "    cellInstance=True,\n",
    "    label='type1', \n",
    "    conds={'cellType': 'type1', 'cellModel': 'type1'},\n",
    "    fileName='type1.hoc', \n",
    "    cellName='type1', \n",
    "    importSynMechs=True) ;\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d5ef8f97",
   "metadata": {},
   "outputs": [],
   "source": [
    "###################################### Locating each axon in specific (x,y) #################################################\n",
    "\n",
    "\n",
    "\n",
    "netParams.popParams[\"Axon0\"] = {\n",
    "    'cellType': 'type1', \n",
    "    'numCells':1 ,                                         \n",
    "    'cellModel': 'type1', \n",
    "    'xRange':[C[0][0], C[0][0]], \n",
    "    'yRange':[0, 0], \n",
    "    'zRange':[C[0][1], C[0][1]]} \n",
    "\n",
    "netParams.popParams[\"Axon1\"] = {\n",
    "    'cellType': 'type1', \n",
    "    'numCells':1 ,                                         \n",
    "    'cellModel': 'type1', \n",
    "    'xRange':[C[1][0], C[1][0]], \n",
    "    'yRange':[0, 0], \n",
    "    'zRange':[C[1][1], C[1][1]]}\n",
    "                    \n",
    "        \n",
    "        \n",
    "        \n",
    "        \n",
    "########################################### Locating Boundary Cables ########################################################\n",
    "\n",
    "\n",
    "\n",
    "    \n",
    "netParams.popParams[\"Boundary0\"] = {\n",
    "    'cellType': 'Boundary', \n",
    "    'numCells':1 ,                                         \n",
    "    'cellModel': 'Boundary', \n",
    "    'xRange':[Boundary_coordinates[0][0], Boundary_coordinates[0][0]], \n",
    "    'yRange':[0, 0], \n",
    "    'zRange':[Boundary_coordinates[0][1], Boundary_coordinates[0][1]]} \n",
    "\n",
    "\n",
    "                    \n",
    "    \n",
    "netParams.popParams[\"Boundary1\"] = {\n",
    "    'cellType': 'Boundary', \n",
    "    'numCells':1 ,                                         \n",
    "    'cellModel': 'Boundary', \n",
    "    'xRange':[Boundary_coordinates[1][0], Boundary_coordinates[1][0]], \n",
    "    'yRange':[0, 0], \n",
    "    'zRange':[Boundary_coordinates[1][1], Boundary_coordinates[1][1]]} \n",
    "\n",
    "                    \n",
    "                    \n",
    "\n",
    "# in Total, how many Cells does Netpyne generate?  Length(R)+len(Boundary_coordinates)\n",
    "print(len(R)+len(Boundary_coordinates))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4adc83be",
   "metadata": {},
   "outputs": [],
   "source": [
    "################################################### Stimulation ############################################################\n",
    "# Which group of axons do you want to stimulate?\n",
    "# Group1: motor axons   Group2: C fibers    Group3: Adelta     Group4: Abeta\n",
    "\n",
    "\n",
    "#netParams.stimSourceParams['Input1'] = {'type': 'IClamp', 'del': 1, 'dur': 0.1, 'amp': 0.4}\n",
    "netParams.stimSourceParams['Input1'] = {'type': 'VClamp', 'dur': [1, 0.02, 0], 'amp':[-80, 0, 0]}\n",
    "\n",
    " \n",
    "netParams.stimTargetParams['Input1->Stim_1'] = {'source': 'Input1', 'sec':'node_0', 'loc': 0.5, 'conds': {'pop':\"Axon0\"}}    \n",
    "#netParams.stimTargetParams['Input1->Stim_2'] = {'source': 'Input1', 'sec':'node_0', 'loc': 0.5, 'conds': {'pop':\"Axon1\"}}       \n",
    "\n",
    "\n",
    "\n",
    "\n",
    "XG1 = 1e-9     # 1e-9: disconnect from ground     1e9: Connect to ground\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "90a2f08b",
   "metadata": {},
   "outputs": [],
   "source": [
    "simConfig = specs.SimConfig()\n",
    "simConfig.hParams = {'celsius': 37 }\n",
    "\n",
    "simConfig.dt = 0.005            # Internal integration timestep to use default is 0.025\n",
    "simConfig.duration = 6\n",
    "simConfig.recordStim = True\n",
    "simConfig.recordStep = 0.005       # Step size in ms to save data (e.g. V traces, LFP, etc) default is 0.1\n",
    "#simConfig.cache_efficient = True\n",
    "#simConfig.cvode_active = True\n",
    "# simConfig.cvode_atol=0.0001\n",
    "# simConfig.cvode_rtol=0.0001\n",
    "\n",
    "\n",
    "simConfig.recordTraces = {'V_node_0' :{'sec':'node_0','loc':0.5,'var':'v'}}\n",
    "simConfig.analysis['plotTraces'] = {'include':  ['allCells']}                              # ['Axon0','Axon1']\n",
    "\n",
    "simConfig.analysis['plot2Dnet'] = True\n",
    "simConfig.analysis['plot2Dnet'] = {'include': ['allCells'], 'view': 'xz'}\n",
    "\n",
    "\n",
    "\n",
    "#simConfig.recordLFP = [[56.39,-4000,51.74]]     # Determine the location of the LFP electrode\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "sim.create(netParams, simConfig)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9045099d",
   "metadata": {},
   "source": [
    "### xraxial and transverese conductances"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "41af5705",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Since by default Netpyne does not insert the parameters of the extracellular mechanism, I insert them in this section\n",
    "# this section includes \"longitudinal\" resistivities (i.e. xraxial)\n",
    "\n",
    "#Total_Length=10000\n",
    "\n",
    "number_boundary = 4000                                   #Total_Length/Section_Length \n",
    "number_boundary = int(number_boundary)\n",
    "\n",
    "\n",
    "\n",
    "rhoa=0.7e6 \n",
    "mycm=0.1 \n",
    "mygm=0.001 \n",
    "\n",
    "space_p1=0.002  \n",
    "space_p2=0.004\n",
    "space_i=0.004\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "############################# For Boundary Cables #################################################\n",
    "\n",
    "# soma section is just for LFP recording, LFP in Netpyne does not work if at least one section is not called soma \n",
    "\n",
    "\n",
    "for j in range(len(R),len(R)+len(Boundary_coordinates)):\n",
    "        \n",
    "    S = sim.net.cells[j].secs[\"soma\"][\"hObj\"]     \n",
    "    for seg in S:\n",
    "        seg.xraxial[0] = 1e9\n",
    "        seg.xraxial[1] = 1e9\n",
    "        seg.xg[0] = 1e9\n",
    "        seg.xg[1] = 1e9\n",
    "        seg.xc[0] = 0\n",
    "        seg.xc[1] = 0\n",
    "\n",
    "\n",
    "    for i in range(number_boundary):        \n",
    "        S = sim.net.cells[j].secs[\"section_%s\" %i][\"hObj\"]\n",
    "        for seg in S:\n",
    "            seg.xraxial[0] = 1e9\n",
    "            seg.xraxial[1] = 1e9\n",
    "            seg.xg[0] = 1e9\n",
    "            seg.xg[1] = 1e9\n",
    "            seg.xc[0] = 0\n",
    "            seg.xc[1] = 0\n",
    "            \n",
    "            \n",
    "            \n",
    "            \n",
    "\n",
    "        \n",
    "            \n",
    "\n",
    "        \n",
    "############################## For myelinated sensory axons ##################################### \n",
    "\n",
    "\n",
    "rho2 = 1211 * 1e-6   # Mohm-cm\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "for j in range(len(R)):\n",
    "    if G[j]!=2:         # if it is not a C fiber \n",
    "        x = np.where(unique_radius == R[j])        \n",
    "        x = int(x[0])\n",
    "        nodes = Number_of_nodes\n",
    "        nodes=int(nodes)\n",
    "        \n",
    "        \n",
    "        nl = parameters[4]\n",
    "        nodeD = parameters[1]\n",
    "        paraD1 = nodeD\n",
    "        axonD = parameters[0]\n",
    "        paraD2 = axonD\n",
    "        \n",
    "        Rpn0 = (rhoa*.01)/((math.pi)*((((nodeD/2)+space_p1)**2)-((nodeD/2)**2)))\n",
    "        Rpn1 = (rhoa*.01)/((math.pi)*((((paraD1/2)+space_p1)**2)-((paraD1/2)**2)))\n",
    "        Rpn2 = (rhoa*.01)/((math.pi)*((((paraD2/2)+space_p2)**2)-((paraD2/2)**2)))\n",
    "        Rpx  = (rhoa*.01)/((math.pi)*((((axonD/2)+space_i)**2)-((axonD/2)**2)))\n",
    "        \n",
    "        \n",
    "        ################### xraxial[1]\n",
    "        \n",
    "        radi = R[j]\n",
    "        \n",
    "        AVE = (AVE_area_around_axon[j]+0) /2\n",
    "        \n",
    "        xr = rho2 /  ((math.pi)*(((radi+AVE)**2) - (radi**2)) * 1e-8)       # Mohm/cm\n",
    "        \n",
    "        xr = xr /1\n",
    "        \n",
    "        print(AVE_area_around_axon[j]+0)\n",
    "        print(xr)\n",
    "        \n",
    "        ##################\n",
    "        \n",
    "        \n",
    "        \n",
    "\n",
    "        S = sim.net.cells[j].secs[\"soma\"][\"hObj\"]\n",
    "        for seg in S:\n",
    "            seg.xraxial[0] = Rpn1\n",
    "            seg.xraxial[1] = xr \n",
    "            seg.xg[0] = mygm/(nl*2)\n",
    "            seg.xg[1] = XG1               # disconnect from ground\n",
    "            seg.xc[0] = mycm/(nl*2)\n",
    "            seg.xc[1] = 0\n",
    "\n",
    "            \n",
    "        for i in range(nodes):\n",
    "            S = sim.net.cells[j].secs[\"node_%s\" %i][\"hObj\"]\n",
    "            for seg in S:\n",
    "                seg.xraxial[0] = Rpn0\n",
    "                seg.xraxial[1] = xr\n",
    "                seg.xg[0] = 3.54e+03                                        #######1e6\n",
    "                seg.xg[1] = XG1\n",
    "                seg.xc[0] = 0\n",
    "                seg.xc[1] = 0\n",
    "\n",
    "\n",
    "        for i in range(2*nodes):\n",
    "            S = sim.net.cells[j].secs[\"MYSA_%s\" %i][\"hObj\"]\n",
    "            for seg in S:\n",
    "                seg.xraxial[0] = Rpn1\n",
    "                seg.xraxial[1] = xr\n",
    "                seg.xg[0] = mygm/(nl*2)\n",
    "                seg.xg[1] = XG1\n",
    "                seg.xc[0] = mycm/(nl*2)\n",
    "                seg.xc[1] = 0\n",
    "\n",
    "\n",
    "        for i in range(10*nodes):\n",
    "            S = sim.net.cells[j].secs[\"FLUT_%s\" %i][\"hObj\"]\n",
    "            for seg in S:\n",
    "                seg.xraxial[0] = Rpn2\n",
    "                seg.xraxial[1] = xr\n",
    "                seg.xg[0] = mygm/(nl*2)\n",
    "                seg.xg[1] = XG1\n",
    "                seg.xc[0] = mycm/(nl*2)\n",
    "                seg.xc[1] = 0 \n",
    "\n",
    "\n",
    "        for i in range(40*nodes):\n",
    "            S = sim.net.cells[j].secs[\"STIN_%s\" %i][\"hObj\"]\n",
    "            for seg in S:\n",
    "                seg.xraxial[0] = Rpx\n",
    "                seg.xraxial[1] = xr\n",
    "                seg.xg[0] = mygm/(nl*2)\n",
    "                seg.xg[1] = XG1\n",
    "                seg.xc[0] = mycm/(nl*2)\n",
    "                seg.xc[1] = 0\n",
    "        \n",
    "        \n",
    "        \n",
    "        \n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "afaf323f",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "##############################This section is about transverse connections between axons #####################################\n",
    "# *** If you do not want to include ephaptic interaction, do not run this section\n",
    "# To model ephaptic effect, \"LinearMechanism\" in NEURON is used.\n",
    "\n",
    "\n",
    "\n",
    "rho = 1211 * 10000  # ohm-micron\n",
    "\n",
    "count = 0\n",
    "\n",
    "for i in range(len(R)):    \n",
    "\n",
    "    \n",
    "    for j in range(len(R)):   \n",
    "        \n",
    "        if neighboringAxon[i][j]==1:\n",
    "            \n",
    "\n",
    "            a1 = np.where(unique_radius == R[i])      # find type of R[i]\n",
    "            a1 = a1[0][0]+1\n",
    "            a2 = np.where(unique_radius == R[j])      # find type of R[j]\n",
    "            a2 = a2[0][0]+1\n",
    "\n",
    "\n",
    "            NSEG = 0\n",
    "\n",
    "\n",
    "\n",
    "            if a1==a2:\n",
    "                SEC = locals()[\"Connect_types_\"+str(a1)+str(a1)]\n",
    "                RG = locals()[\"Rg_\"+str(a1)+str(a1)]\n",
    "                area = (math.pi)*(parameters[1])*(np.ones((len(RG),1)))    # micron^2\n",
    "                area = area * 1e-8   #cm^2\n",
    "                b1=i\n",
    "                b2=j\n",
    "                if a1==0:\n",
    "                    area = (math.pi)*0.8*10*(np.ones((len(RG),1)))    # micron^2\n",
    "                    area = area * 1e-8   #cm^2\n",
    "                    \n",
    "              \n",
    "\n",
    "            if a1<a2:\n",
    "                SEC = locals()[\"Connect_types_\"+str(a1)+str(a2)]\n",
    "                RG = locals()[\"Rg_\"+str(a1)+str(a2)]\n",
    "                b1=i\n",
    "                b2=j\n",
    "                if a1==0:\n",
    "                    area = (math.pi)*(parameters[a2][1])*(np.ones((len(RG),1)))\n",
    "                    area = area * 1e-8   #cm^2\n",
    "                    b1=j\n",
    "                    b2=i\n",
    "              \n",
    "                else:\n",
    "                    area = locals()[\"Areas_\"+str(a1)+str(a2)]\n",
    "                    area = area[ : , np.newaxis]\n",
    "                    area = area * 1e-8\n",
    "                    \n",
    "                    \n",
    "\n",
    "            if a1>a2:\n",
    "                SEC = locals()[\"Connect_types_\"+str(a2)+str(a1)]\n",
    "                RG = locals()[\"Rg_\"+str(a2)+str(a1)]\n",
    "                b1=j\n",
    "                b2=i\n",
    "                if a2==0:\n",
    "                    area = (math.pi)*(parameters[a1][1])*(np.ones((len(RG),1)))\n",
    "                    area = area * 1e-8   #cm^2\n",
    "                    b1=i\n",
    "                    b2=j\n",
    "  \n",
    "                else:\n",
    "                    area = locals()[\"Areas_\"+str(a2)+str(a1)]\n",
    "                    area = area[ : , np.newaxis]\n",
    "                    area = area * 1e-8\n",
    "                \n",
    "                \n",
    "                \n",
    "                \n",
    "                \n",
    "\n",
    "\n",
    "            locals()[\"sl\"+str(count)] = h.SectionList()\n",
    "\n",
    "            for z1 in range(int(len(SEC)/2)):  \n",
    "\n",
    "                S = sim.net.cells[b1].secs[SEC[z1]][\"hObj\"]\n",
    "                NSEG=NSEG+S.nseg\n",
    "                locals()[\"sl\"+str(count)].append(S)\n",
    "\n",
    "            for z2 in range(int(len(SEC)/2),int(len(SEC))):\n",
    "\n",
    "                S = sim.net.cells[b2].secs[SEC[z2]][\"hObj\"]\n",
    "                locals()[\"sl\"+str(count)].append(S)   \n",
    "                \n",
    "                \n",
    "\n",
    "            nsegs=int(NSEG)\n",
    "\n",
    "            locals()[\"gmat\"+str(count)] =h.Matrix(2*nsegs, 2*nsegs)\n",
    "            locals()[\"cmat\"+str(count)] =h.Matrix(2*nsegs, 2*nsegs)\n",
    "            locals()[\"bvec\"+str(count)] =h.Vector(2*nsegs)\n",
    "            locals()[\"xl\"+str(count)] =h.Vector(2*nsegs)\n",
    "            locals()[\"layer\"+str(count)] =h.Vector(2*nsegs)\n",
    "            locals()[\"layer\"+str(count)].fill(2)                 # connect layer 2\n",
    "            locals()[\"e\"+str(count)] = h.Vector(2*nsegs)\n",
    "\n",
    "            for z3 in range(2*nsegs):\n",
    "                locals()[\"xl\"+str(count)][z3] = 0.5\n",
    "                \n",
    "            \n",
    "            \n",
    "            \n",
    "            \n",
    "            \n",
    "            d = dist_edge[i][j] + 0            #dist[i][j]\n",
    "            rd = rho*d\n",
    "            s = ((unique_radius*2)+(unique_radius*2))/2\n",
    "            locals()[\"RG\"+str(count)] = np.array(RG)*s\n",
    "            locals()[\"Resistance\"+str(count)] =  rd/locals()[\"RG\"+str(count)]\n",
    "            locals()[\"Conductance\"+str(count)]=[]\n",
    "            for z4 in range(len(locals()[\"Resistance\"+str(count)])):\n",
    "                locals()[\"Conductance\"+str(count)].append(1/(locals()[\"Resistance\"+str(count)][z4]*area[z4]))\n",
    "                \n",
    "\n",
    "          \n",
    "            for z5 in range(0,nsegs,1):\n",
    "\n",
    "                locals()[\"gmat\"+str(count)].setval(z5, z5, locals()[\"Conductance\"+str(count)][z5][0] )\n",
    "                locals()[\"gmat\"+str(count)].setval(z5, nsegs+z5, -locals()[\"Conductance\"+str(count)][z5][0])\n",
    "                locals()[\"gmat\"+str(count)].setval(nsegs+z5, z5, -locals()[\"Conductance\"+str(count)][z5][0])\n",
    "                locals()[\"gmat\"+str(count)].setval(nsegs+z5, nsegs+z5, locals()[\"Conductance\"+str(count)][z5][0])\n",
    "                \n",
    "                \n",
    "            locals()[\"GMAT\"+str(i)+str(j)] = locals()[\"gmat\"+str(count)]\n",
    "                \n",
    "            \n",
    "                  \n",
    "     \n",
    "                \n",
    "            \n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "#             geA= 1000\n",
    "    \n",
    "#             for z5 in range(0,nsegs,1):\n",
    "#                 locals()[\"gmat\"+str(count)].setval(z5, z5,  geA)\n",
    "#                 locals()[\"gmat\"+str(count)].setval(z5, nsegs+z5, -geA)\n",
    "#                 locals()[\"gmat\"+str(count)].setval(nsegs+z5, z5, -geA)\n",
    "#                 locals()[\"gmat\"+str(count)].setval(nsegs+z5, nsegs+z5, geA)\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "            locals()[\"lm\"+str(count)] = h.LinearMechanism(locals()[\"cmat\"+str(count)], locals()[\"gmat\"+str(count)], locals()[\"e\"+str(count)], locals()[\"bvec\"+str(count)], locals()[\"sl\"+str(count)], locals()[\"xl\"+str(count)], locals()[\"layer\"+str(count)])\n",
    "\n",
    "            count=count+1\n",
    "            \n",
    "            SEC.clear\n",
    "            del RG\n",
    "            del area\n",
    "            \n",
    "            \n",
    "\n",
    "            \n",
    "#print(count)            \n",
    "            \n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b71ff07f",
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "GMAT01.printf()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9f7204b0",
   "metadata": {},
   "outputs": [],
   "source": [
    "            \n",
    "            \n",
    "            \n",
    "############################### Transverse connections between Boundary cables and Axons ######################################\n",
    "\n",
    "\n",
    "rho = 1.136e5 * 10000 * 4.7e-4 * 10000  # ohm-micron^2\n",
    "\n",
    "\n",
    "\n",
    "rows = len(Boundary_neighboring)\n",
    "\n",
    "for i in range(rows):\n",
    "    \n",
    "    for j in range(len(R)):\n",
    "        \n",
    "        if Boundary_neighboring[i][j]==1:\n",
    "        \n",
    "            NSEG = 0\n",
    "\n",
    "            a2 = np.where(unique_radius == R[j])    # find type \n",
    "            a2 = a2[0][0]+1\n",
    "            \n",
    "            Boundary_RG = locals()[\"Boundary_Rg_\"+str(a2)]\n",
    "            area = (math.pi)*(parameters[1])*(np.ones((len(Boundary_RG),1)))\n",
    "            area = area * 1e-8   #cm^2\n",
    " \n",
    "\n",
    "            SEC = locals()[\"Boundary_to_\"+str(a2)]\n",
    "\n",
    "\n",
    "            locals()[\"sl\"+str(count)] = h.SectionList()\n",
    "\n",
    "            for z1 in range(int(len(SEC)/2)):  \n",
    "\n",
    "                S = sim.net.cells[j].secs[SEC[z1]][\"hObj\"]\n",
    "                NSEG=NSEG+S.nseg\n",
    "                locals()[\"sl\"+str(count)].append(S)\n",
    "\n",
    "            for z2 in range(int(len(SEC)/2),int(len(SEC))):\n",
    "\n",
    "                S = sim.net.cells[len(R)+i].secs[SEC[z2]][\"hObj\"]\n",
    "                locals()[\"sl\"+str(count)].append(S)   \n",
    "\n",
    "\n",
    "\n",
    "\n",
    "            nsegs=int(NSEG)\n",
    "\n",
    "            locals()[\"gmat\"+str(count)] =h.Matrix(2*nsegs, 2*nsegs)\n",
    "            locals()[\"cmat\"+str(count)] =h.Matrix(2*nsegs, 2*nsegs)\n",
    "            locals()[\"bvec\"+str(count)] =h.Vector(2*nsegs)\n",
    "            locals()[\"xl\"+str(count)] =h.Vector(2*nsegs)\n",
    "            locals()[\"layer\"+str(count)] =h.Vector(2*nsegs)\n",
    "            locals()[\"layer\"+str(count)].fill(2)                   # connect layer 2\n",
    "            locals()[\"e\"+str(count)] = h.Vector(2*nsegs)\n",
    "\n",
    "            for z3 in range(2*nsegs):\n",
    "                locals()[\"xl\"+str(count)][z3] = 0.5\n",
    "\n",
    "\n",
    "            \n",
    "            \n",
    "            rd = rho\n",
    "            s = (unique_radius*2)\n",
    "            locals()[\"Boundary_RG\"+str(count)] = np.array(Boundary_RG)*s\n",
    "            locals()[\"Resistance\"+str(count)] =  rd/locals()[\"Boundary_RG\"+str(count)]\n",
    "            locals()[\"Conductance\"+str(count)]=[]\n",
    "            for z4 in range(len(locals()[\"Resistance\"+str(count)])):\n",
    "                locals()[\"Conductance\"+str(count)].append(1/(locals()[\"Resistance\"+str(count)][z4]*area[z4]))\n",
    "\n",
    "        \n",
    "            for z5 in range(0,nsegs,1):\n",
    "\n",
    "                locals()[\"gmat\"+str(count)].setval(z5, z5,  locals()[\"Conductance\"+str(count)][z5][0] * 1)\n",
    "                locals()[\"gmat\"+str(count)].setval(z5, nsegs+z5, - locals()[\"Conductance\"+str(count)][z5][0] * 1)\n",
    "                locals()[\"gmat\"+str(count)].setval(nsegs+z5, z5, - locals()[\"Conductance\"+str(count)][z5][0] * 1)\n",
    "                locals()[\"gmat\"+str(count)].setval(nsegs+z5, nsegs+z5,  locals()[\"Conductance\"+str(count)][z5][0] * 1)\n",
    "                \n",
    "               \n",
    "            \n",
    "            locals()[\"GMAT_BOUNDARY\"+str(i)+str(j)] = locals()[\"gmat\"+str(count)]\n",
    "                \n",
    "                \n",
    "      \n",
    "           \n",
    "            \n",
    "\n",
    "\n",
    "\n",
    "            \n",
    "#             geB= 1\n",
    "            \n",
    "#             for z6 in range(0,nsegs,1):\n",
    "\n",
    "#                 locals()[\"gmat\"+str(count)].setval(z6, z6,  geB)\n",
    "#                 locals()[\"gmat\"+str(count)].setval(z6, nsegs+z6, -geB)\n",
    "#                 locals()[\"gmat\"+str(count)].setval(nsegs+z6, z6, -geB)\n",
    "#                 locals()[\"gmat\"+str(count)].setval(nsegs+z6, nsegs+z6, geB)\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "            locals()[\"lm\"+str(count)] = h.LinearMechanism(locals()[\"cmat\"+str(count)], locals()[\"gmat\"+str(count)], locals()[\"e\"+str(count)], locals()[\"bvec\"+str(count)], locals()[\"sl\"+str(count)], locals()[\"xl\"+str(count)], locals()[\"layer\"+str(count)])\n",
    "\n",
    "            count=count+1\n",
    "            \n",
    "                        \n",
    "            SEC.clear\n",
    "            del Boundary_RG\n",
    "            del area\n",
    "            \n",
    "            \n",
    "          \n",
    "            \n",
    "            \n",
    "\n",
    "#print(count)             \n",
    "            \n",
    "            \n",
    "            \n",
    "# from IPython.display import clear_output\n",
    "\n",
    "# clear_output(wait=True)\n",
    "\n",
    "\n",
    "        \n",
    "#gmat0.printf()  \n",
    "\n",
    "# for sec in sl0:\n",
    "#     print(sec)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2f2f0781",
   "metadata": {},
   "outputs": [],
   "source": [
    "len(Boundary_neighboring)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7808a6c6",
   "metadata": {},
   "outputs": [],
   "source": [
    "GMAT_BOUNDARY11.printf()  "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b2a6c256",
   "metadata": {},
   "source": [
    "#### Recordings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d1494f97",
   "metadata": {},
   "outputs": [],
   "source": [
    "## Recording vext\n",
    "\n",
    "\n",
    "# v1 = sim.net.cells[45].secs[\"node_0\"][\"hObj\"]\n",
    "# ap1 = h.Vector()\n",
    "# t = h.Vector()\n",
    "# ap1.record(v1(0.5)._ref_v)\n",
    "\n",
    "# t.record(h._ref_t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5dbd4f4b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# for i1 in range(36):\n",
    "\n",
    "#     locals()[\"Abeta0_imembrane\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "#     locals()[\"Abeta0_imembrane_node\"+str(i1)] = h.Vector()\n",
    "#     locals()[\"Abeta0_imembrane_node\"+str(i1)].record(locals()[\"Abeta0_imembrane\"+str(i1)](0.5)._ref_i_membrane)\n",
    "    \n",
    "    \n",
    "    \n",
    "# for i1 in range(12):\n",
    "\n",
    "#     locals()[\"Abeta0_icap\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "#     locals()[\"Abeta0_icap_node\"+str(i1)] = h.Vector()\n",
    "#     locals()[\"Abeta0_icap_node\"+str(i1)].record(locals()[\"Abeta0_icap\"+str(i1)](0.5)._ref_i_cap)    \n",
    "    \n",
    "\n",
    "    \n",
    "    \n",
    "# for i1 in range(12):\n",
    "\n",
    "#     locals()[\"Abeta0_ik\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "#     locals()[\"Abeta0_ik_node\"+str(i1)] = h.Vector()\n",
    "#     locals()[\"Abeta0_ik_node\"+str(i1)].record(locals()[\"Abeta0_ik\"+str(i1)](0.5)._ref_ik_axnode)        \n",
    "    \n",
    "    \n",
    "    \n",
    "# for i1 in range(12):\n",
    "\n",
    "#     locals()[\"Abeta0_il\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "#     locals()[\"Abeta0_il_node\"+str(i1)] = h.Vector()\n",
    "#     locals()[\"Abeta0_il_node\"+str(i1)].record(locals()[\"Abeta0_il\"+str(i1)](0.5)._ref_il_axnode)        \n",
    "    \n",
    "    \n",
    "\n",
    "# for i1 in range(36):\n",
    "\n",
    "#     locals()[\"Abeta0_ina\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "#     locals()[\"Abeta0_ina_node\"+str(i1)] = h.Vector()\n",
    "#     locals()[\"Abeta0_ina_node\"+str(i1)].record(locals()[\"Abeta0_ina\"+str(i1)](0.5)._ref_ina_axnode)    \n",
    "    \n",
    "    \n",
    "    \n",
    "    \n",
    "# for i1 in range(12):\n",
    "\n",
    "#     locals()[\"Abeta0_inap\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "#     locals()[\"Abeta0_inap_node\"+str(i1)] = h.Vector()\n",
    "#     locals()[\"Abeta0_inap_node\"+str(i1)].record(locals()[\"Abeta0_inap\"+str(i1)](0.5)._ref_inap_axnode)        \n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ca5603a0",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "## Recording v and vext[0],  Abeta\n",
    "\n",
    "###################################################### Abeta0\n",
    "\n",
    "\n",
    "for i1 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_v\"+str(i1)] = sim.net.cells[0].secs[\"node_%s\"%i1][\"hObj\"]\n",
    "    locals()[\"Abeta0_v_node\"+str(i1)] = h.Vector()\n",
    "    locals()[\"Abeta0_v_node\"+str(i1)].record(locals()[\"Abeta0_v\"+str(i1)](0.5)._ref_v)\n",
    "\n",
    "\n",
    "# for i2 in range(36):\n",
    "\n",
    "#     locals()[\"Abeta0_vex\"+str(i2)] = sim.net.cells[0].secs[\"node_%s\"%i2][\"hObj\"]\n",
    "#     locals()[\"Abeta0_vext0_05_node\"+str(i2)] = h.Vector()\n",
    "#     locals()[\"Abeta0_vext0_05_node\"+str(i2)].record(locals()[\"Abeta0_vex\"+str(i2)](0.5)._ref_vext[0])\n",
    "\n",
    "    \n",
    "##################################################################################################    \n",
    "    \n",
    "for i2 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_vex\"+str(i2)] = sim.net.cells[0].secs[\"node_%s\"%i2][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext0_node05\"+str(i2)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext0_node05\"+str(i2)].record(locals()[\"Abeta0_vex\"+str(i2)](0.5)._ref_vext[0])\n",
    "\n",
    "\n",
    "for ii2 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_vex\"+str(ii2)] = sim.net.cells[0].secs[\"node_%s\"%ii2][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext0_node1\"+str(ii2)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext0_node1\"+str(ii2)].record(locals()[\"Abeta0_vex\"+str(ii2)](1)._ref_vext[0])    \n",
    "    \n",
    "    \n",
    "for ij2 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_vex\"+str(ij2)] = sim.net.cells[0].secs[\"node_%s\"%ij2][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext0_node0\"+str(ij2)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext0_node0\"+str(ij2)].record(locals()[\"Abeta0_vex\"+str(ij2)](0)._ref_vext[0])    \n",
    "        \n",
    "    \n",
    "for i3 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_vex1\"+str(i3)] = sim.net.cells[0].secs[\"node_%s\"%i3][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext1_node05\"+str(i3)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext1_node05\"+str(i3)].record(locals()[\"Abeta0_vex1\"+str(i3)](0.5)._ref_vext[1])    \n",
    "      \n",
    "    \n",
    "    \n",
    "    \n",
    "for i5 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_vexx\"+str(i5)] = sim.net.cells[0].secs[\"node_%s\"%i5][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext1_node0\"+str(i5)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext1_node0\"+str(i5)].record(locals()[\"Abeta0_vexx\"+str(i5)](0)._ref_vext[1])\n",
    "    \n",
    "\n",
    "    \n",
    "for i6 in range(36):\n",
    "\n",
    "    locals()[\"Abeta0_vexg\"+str(i6)] = sim.net.cells[0].secs[\"node_%s\"%i6][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext1_node1\"+str(i6)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext1_node1\"+str(i6)].record(locals()[\"Abeta0_vexg\"+str(i6)](1)._ref_vext[1])\n",
    "        \n",
    "    \n",
    "    \n",
    "    \n",
    "\n",
    "for i4 in range(36):\n",
    "\n",
    "    locals()[\"Abeta1_vex\"+str(i4)] = sim.net.cells[1].secs[\"node_%s\"%i4][\"hObj\"]\n",
    "    locals()[\"Abeta1_vext1_node05\"+str(i4)] = h.Vector()\n",
    "    locals()[\"Abeta1_vext1_node05\"+str(i4)].record(locals()[\"Abeta1_vex\"+str(i4)](0.5)._ref_vext[1])\n",
    "\n",
    "    \n",
    "\n",
    "i8=1663    \n",
    "locals()[\"v1Mext\"+str(i8)] = sim.net.cells[2].secs[\"section_1663\"][\"hObj\"]\n",
    "locals()[\"boundary0_vext1_section\"+str(i8)] = h.Vector()\n",
    "locals()[\"boundary0_vext1_section\"+str(i8)].record(locals()[\"v1Mext\"+str(i8)](0.5)._ref_vext[1])    \n",
    "\n",
    "        \n",
    "    \n",
    "for ii3 in range(36*2):\n",
    "\n",
    "    locals()[\"Abeta0_vexe\"+str(ii3)] = sim.net.cells[0].secs[\"MYSA_%s\"%ii3][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext0_MYSA05\"+str(ii3)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext0_MYSA05\"+str(ii3)].record(locals()[\"Abeta0_vexe\"+str(ii3)](0.5)._ref_vext[0])\n",
    "    \n",
    "    \n",
    "for ii4 in range(36*2):\n",
    "\n",
    "    locals()[\"Abeta0_vexxx\"+str(ii4)] = sim.net.cells[0].secs[\"MYSA_%s\"%ii4][\"hObj\"]\n",
    "    locals()[\"Abeta0_vext1_MYSA05\"+str(ii4)] = h.Vector()\n",
    "    locals()[\"Abeta0_vext1_MYSA05\"+str(ii4)].record(locals()[\"Abeta0_vexxx\"+str(ii4)](0.5)._ref_vext[1])\n",
    "    \n",
    "     \n",
    "    \n",
    "# for i3 in range(0,36*2):\n",
    "    \n",
    "#     locals()[\"Abeta_v0Mext\"+str(i3)] = sim.net.cells[0].secs[\"MYSA_%s\"%i3][\"hObj\"]\n",
    "#     locals()[\"Abeta0_vext0_MYSA\"+str(i3)] = h.Vector()\n",
    "#     locals()[\"Abeta0_vext0_MYSA\"+str(i3)].record(locals()[\"Abeta_v0Mext\"+str(i3)](0.5)._ref_vext[0])\n",
    "    \n",
    "    \n",
    "    \n",
    "# for i3 in range(0,36*2):\n",
    "    \n",
    "#     locals()[\"Abeta_v1Mext\"+str(i3)] = sim.net.cells[0].secs[\"MYSA_%s\"%i3][\"hObj\"]\n",
    "#     locals()[\"Abeta0_vext1_MYSA\"+str(i3)] = h.Vector()\n",
    "#     locals()[\"Abeta0_vext1_MYSA\"+str(i3)].record(locals()[\"Abeta_v1Mext\"+str(i3)](0.5)._ref_vext[1])    \n",
    "\n",
    "\n",
    "# i3=1663    \n",
    "# locals()[\"v1Mext\"+str(i3)] = sim.net.cells[2].secs[\"section_1663\"][\"hObj\"]\n",
    "# locals()[\"boundary0_vext1_section\"+str(i3)] = h.Vector()\n",
    "# locals()[\"boundary0_vext1_section\"+str(i3)].record(locals()[\"v1Mext\"+str(i3)](0.5)._ref_vext[1])    \n",
    "\n",
    "\n",
    "    \n",
    "# for i4 in range(12):\n",
    "\n",
    "#     locals()[\"Abeta1_vext1\"+str(i4)] = sim.net.cells[1].secs[\"node_%s\"%i4][\"hObj\"]\n",
    "#     locals()[\"Abeta1_vext1_node\"+str(i4)] = h.Vector()\n",
    "#     locals()[\"Abeta1_vext1_node\"+str(i4)].record(locals()[\"Abeta1_vext1\"+str(i4)](0.5)._ref_vext[1])   \n",
    "    \n",
    "    \n",
    "    \n",
    "# locals()[\"Abeta_vSext\"+str(220)] = sim.net.cells[0].secs[\"STIN_220\"][\"hObj\"]\n",
    "# locals()[\"Abeta0_vext1_STIN\"+str(220)] = h.Vector()\n",
    "# locals()[\"Abeta0_vext1_STIN\"+str(220)].record(locals()[\"Abeta_vSext\"+str(220)](0.5)._ref_vext[1])    \n",
    "    \n",
    "# locals()[\"Abeta_v\"+str(220)] = sim.net.cells[0].secs[\"STIN_220\"][\"hObj\"]\n",
    "# locals()[\"Abeta0_v_STIN\"+str(220)] = h.Vector()\n",
    "# locals()[\"Abeta0_v_STIN\"+str(220)].record(locals()[\"Abeta_v\"+str(220)](0.5)._ref_v)    \n",
    "    \n",
    "    \n",
    "        \n",
    "t = h.Vector()\n",
    "t.record(h._ref_t)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d83f15db",
   "metadata": {},
   "source": [
    "#### Simulate and Analyze"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd6d9f09",
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "sim.simulate()\n",
    "sim.analyze()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ceb34061",
   "metadata": {},
   "outputs": [],
   "source": [
    "# plotting\n",
    "\n",
    "#sim.analysis.plotLFP(  plots = ['timeSeries', 'locations'] , electrodes=[ 'all'], lineWidth=1000 ,  fontSize=14, saveFig=True)\n",
    "\n",
    "# from matplotlib import pyplot\n",
    "# %matplotlib inline\n",
    "# pyplot.plot(t, ap1 )\n",
    "# #pyplot.xlim((0, 10))\n",
    "# pyplot.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ddb4904a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# show the execution time\n",
    "\n",
    "end_time = datetime.now()\n",
    "print('Duration: {}'.format(end_time - start_time))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eb4751f0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d18ce34b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Longitudinal Current: picoamp\n",
    "\n",
    "\n",
    "\n",
    "# xraxia = xr*1e6   #ohm/cm\n",
    "# xraxia = xraxia*2*1e-4    # ohm,  length between node to MYSA is 2 micron\n",
    "\n",
    "\n",
    "# v_diff_00 = (Abeta0_vext1_node0-Abeta0_vext1_MYSA0)/1000     #volt\n",
    "# Longi_Current_node0_MYSA0 = v_diff_00/xraxia   #amp\n",
    "# Longi_Current_node0_MYSA0 = Longi_Current_node0_MYSA0*1e12   #picoamp\n",
    "\n",
    "# v_diff_12 = (Abeta0_vext1_node1-Abeta0_vext1_MYSA2)/1000     #volt\n",
    "# Longi_Current_node1_MYSA2 = v_diff_12/xraxia   \n",
    "# Longi_Current_node1_MYSA2 = Longi_Current_node1_MYSA2*1e12   \n",
    "\n",
    "# v_diff_24 = (Abeta0_vext1_node2-Abeta0_vext1_MYSA4)/1000     #volt\n",
    "# Longi_Current_node2_MYSA4 = v_diff_24/xraxia  \n",
    "# Longi_Current_node2_MYSA4 = Longi_Current_node2_MYSA4*1e12  \n",
    "\n",
    "# v_diff_36 = (Abeta0_vext1_node3-Abeta0_vext1_MYSA6)/1000     #volt\n",
    "# Longi_Current_node3_MYSA6 = v_diff_36/xraxia   \n",
    "# Longi_Current_node3_MYSA6 = Longi_Current_node3_MYSA6*1e12  \n",
    "\n",
    "# v_diff_48 = (Abeta0_vext1_node4-Abeta0_vext1_MYSA8)/1000     #volt\n",
    "# Longi_Current_node4_MYSA8 = v_diff_48/xraxia  \n",
    "# Longi_Current_node4_MYSA8 = Longi_Current_node4_MYSA8*1e12  \n",
    "\n",
    "# v_diff_510 = (Abeta0_vext1_node5-Abeta0_vext1_MYSA10)/1000     #volt\n",
    "# Longi_Current_node5_MYSA10 = (v_diff_510/xraxia)*1e12  \n",
    "\n",
    "# v_diff_612 = (Abeta0_vext1_node6-Abeta0_vext1_MYSA12)/1000     #volt\n",
    "# Longi_Current_node6_MYSA12 = (v_diff_612/xraxia)*1e12  \n",
    "\n",
    "# v_diff_714 = (Abeta0_vext1_node7-Abeta0_vext1_MYSA14)/1000     #volt\n",
    "# Longi_Current_node7_MYSA14 = (v_diff_714/xraxia)*1e12 \n",
    "\n",
    "# v_diff_816 = (Abeta0_vext1_node8-Abeta0_vext1_MYSA16)/1000     #volt\n",
    "# Longi_Current_node8_MYSA16 = (v_diff_816/xraxia)*1e12  \n",
    "\n",
    "# v_diff_918 = (Abeta0_vext1_node9-Abeta0_vext1_MYSA18)/1000     #volt\n",
    "# Longi_Current_node9_MYSA18 = (v_diff_918/xraxia)*1e12  \n",
    "\n",
    "# v_diff_1020 = (Abeta0_vext1_node10-Abeta0_vext1_MYSA20)/1000     #volt\n",
    "# Longi_Current_node10_MYSA20 = (v_diff_1020/xraxia)*1e12 \n",
    "\n",
    "# v_diff_1122 = (Abeta0_vext1_node11-Abeta0_vext1_MYSA22)/1000     #volt\n",
    "# Longi_Current_node11_MYSA22 = (v_diff_1122/xraxia)*1e12  \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09bf554d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# print(xraxia)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d833f599",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Transverse current: Picoamp/micron^2\n",
    "\n",
    "\n",
    "# TC = 2.3e+03\n",
    "\n",
    "\n",
    "# v_diff00 = (Abeta0_vext1_node0 - Abeta1_vext1_node0)/1000    #volt\n",
    "# Trans_Current_node0_node0 = (v_diff00 * TC )*1e12/1e8  #volt*S/cm2 = Amp/cm2 = PicoAMP/cm2 = PicoAMP/micron^2\n",
    "\n",
    "# v_diff11 = (Abeta0_vext1_node1 - Abeta1_vext1_node1)/1000    #volt\n",
    "# Trans_Current_node1_node1 = v_diff11 * TC *1e12/1e8   \n",
    "\n",
    "# v_diff22 = (Abeta0_vext1_node2 - Abeta1_vext1_node2)/1000    #volt\n",
    "# Trans_Current_node2_node2 = v_diff22 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff33 = (Abeta0_vext1_node3 - Abeta1_vext1_node3)/1000    #volt\n",
    "# Trans_Current_node3_node3 = v_diff33 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff44 = (Abeta0_vext1_node4 - Abeta1_vext1_node4)/1000    #volt\n",
    "# Trans_Current_node4_node4 = v_diff44 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff55 = (Abeta0_vext1_node5 - Abeta1_vext1_node5)/1000    #volt\n",
    "# Trans_Current_node5_node5 = v_diff55 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff66 = (Abeta0_vext1_node6 - Abeta1_vext1_node6)/1000    #volt\n",
    "# Trans_Current_node6_node6 = v_diff66 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff77 = (Abeta0_vext1_node7 - Abeta1_vext1_node7)/1000    #volt\n",
    "# Trans_Current_node7_node7 = v_diff77 * TC *1e12/1e8 \n",
    "\n",
    "# v_diff88 = (Abeta0_vext1_node8 - Abeta1_vext1_node8)/1000    #volt\n",
    "# Trans_Current_node8_node8 = v_diff88 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff99 = (Abeta0_vext1_node9 - Abeta1_vext1_node9)/1000    #volt\n",
    "# Trans_Current_node9_node9 = v_diff99 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff1010 = (Abeta0_vext1_node10 - Abeta1_vext1_node10)/1000    #volt\n",
    "# Trans_Current_node10_node10 = v_diff1010 * TC *1e12/1e8  \n",
    "\n",
    "# v_diff1111 = (Abeta0_vext1_node11 - Abeta1_vext1_node11)/1000    #volt\n",
    "# Trans_Current_node11_node11 = v_diff1111 * TC *1e12/1e8  \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b812647a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# import csv\n",
    "\n",
    "# with open('v_diff66_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , v_diff66 ))\n",
    "        \n",
    "        \n",
    "        \n",
    "        \n",
    "import csv\n",
    "\n",
    "# with open('vext1_node15_MYSA30_stimulateonlyAbeta0_edgedist2_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t ,Abeta0_vext1_node15  ,  Abeta0_vext1_MYSA30 ))       \n",
    "\n",
    "\n",
    "\n",
    "# with open('ALLExtraVoltages_stimulateonlyAbeta0_edgedist2_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_vext0_node0515 ,  Abeta0_vext1_node0515  , Abeta0_vext1_node015  , Abeta0_vext1_node115  , Abeta1_vext1_node0515 , boundary0_vext1_section1663 ,  Abeta0_vext0_node115 ,  Abeta0_vext0_MYSA0530 ,  Abeta0_vext1_MYSA0530 , Abeta0_vext0_node015))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8f3b15f1",
   "metadata": {},
   "source": [
    "#### saving the data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "890baeb5",
   "metadata": {},
   "outputs": [],
   "source": [
    "## saving the data\n",
    "\n",
    "\n",
    "import csv\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "   \n",
    "# with open('nodexg0changed_v_Abeta0_stimulateonlyAbeta0_edgedist2_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_v_node0 , Abeta0_v_node1 , Abeta0_v_node2 , Abeta0_v_node3 , Abeta0_v_node4 , Abeta0_v_node5 , Abeta0_v_node6 , Abeta0_v_node7 , Abeta0_v_node8 , Abeta0_v_node9 , Abeta0_v_node10 , Abeta0_v_node11 , Abeta0_v_node12 , Abeta0_v_node13 , Abeta0_v_node14 , Abeta0_v_node15 , Abeta0_v_node16 , Abeta0_v_node17 , Abeta0_v_node18 , Abeta0_v_node19 , Abeta0_v_node20 , Abeta0_v_node21 , Abeta0_v_node22 , Abeta0_v_node23 , Abeta0_v_node24 , Abeta0_v_node25 , Abeta0_v_node26 , Abeta0_v_node27 , Abeta0_v_node28 , Abeta0_v_node29 , Abeta0_v_node30 , Abeta0_v_node31 , Abeta0_v_node32 , Abeta0_v_node33 , Abeta0_v_node34 , Abeta0_v_node35 )) \n",
    "\n",
    "\n",
    "        \n",
    "        \n",
    "# with open('imembrane_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_imembrane_node0 , Abeta0_imembrane_node1 , Abeta0_imembrane_node2 , Abeta0_imembrane_node3 , Abeta0_imembrane_node4 , Abeta0_imembrane_node5 , Abeta0_imembrane_node6 , Abeta0_imembrane_node7 , Abeta0_imembrane_node8 , Abeta0_imembrane_node9 , Abeta0_imembrane_node10 , Abeta0_imembrane_node11 , Abeta0_imembrane_node12 , Abeta0_imembrane_node13 , Abeta0_imembrane_node14 , Abeta0_imembrane_node15 , Abeta0_imembrane_node16 , Abeta0_imembrane_node17 , Abeta0_imembrane_node18 , Abeta0_imembrane_node19 , Abeta0_imembrane_node20 , Abeta0_imembrane_node21 , Abeta0_imembrane_node22 , Abeta0_imembrane_node23 , Abeta0_imembrane_node24 , Abeta0_imembrane_node25 , Abeta0_imembrane_node26 , Abeta0_imembrane_node27 , Abeta0_imembrane_node28 , Abeta0_imembrane_node29 , Abeta0_imembrane_node30 , Abeta0_imembrane_node31 , Abeta0_imembrane_node32 , Abeta0_imembrane_node33 , Abeta0_imembrane_node34 , Abeta0_imembrane_node35 )) \n",
    "        \n",
    "        \n",
    "\n",
    "# ####################################  Connected to ground \n",
    "\n",
    "# with open('ConnectGround_v_Abeta0_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_v_node0 , Abeta0_v_node1 , Abeta0_v_node2 , Abeta0_v_node3 , Abeta0_v_node4 , Abeta0_v_node5 , Abeta0_v_node6 , Abeta0_v_node7 , Abeta0_v_node8 , Abeta0_v_node9 , Abeta0_v_node10 , Abeta0_v_node11 )) \n",
    "\n",
    "\n",
    "# with open('NotConnectGround_vext1_Abeta0_stimulateonlyAbeta0_edgedist1_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_vext1_node0 , Abeta0_vext1_node1 , Abeta0_vext1_node2 , Abeta0_vext1_node3 , Abeta0_vext1_node4 , Abeta0_vext1_node5 , Abeta0_vext1_node6 , Abeta0_vext1_node7 , Abeta0_vext1_node8 , Abeta0_vext1_node9 , Abeta0_vext1_node10 , Abeta0_vext1_node11 )) \n",
    "\n",
    "\n",
    "\n",
    "# with open('ConnectGround_LongiCurrent_Abeta0_NodetoMYSA_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Longi_Current_node0_MYSA0 , Longi_Current_node1_MYSA2 , Longi_Current_node2_MYSA4 , Longi_Current_node3_MYSA6 , Longi_Current_node4_MYSA8 , Longi_Current_node5_MYSA10 , Longi_Current_node6_MYSA12 , Longi_Current_node7_MYSA14 , Longi_Current_node8_MYSA16 , Longi_Current_node9_MYSA18 , Longi_Current_node10_MYSA20 , Longi_Current_node11_MYSA22   ))\n",
    "    \n",
    "    \n",
    "\n",
    "# with open('ConnectGround_TransCurrent_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Trans_Current_node0_node0 , Trans_Current_node1_node1 , Trans_Current_node2_node2 , Trans_Current_node3_node3 , Trans_Current_node4_node4 , Trans_Current_node5_node5 , Trans_Current_node6_node6 , Trans_Current_node7_node7 , Trans_Current_node8_node8 , Trans_Current_node9_node9 , Trans_Current_node10_node10 , Trans_Current_node11_node11 ))\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "    \n",
    "# ##################################### Not connected to ground, Stimulate only one fiber     \n",
    "\n",
    "   \n",
    "# with open('v_Abeta0_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_v_node0 , Abeta0_v_node1 , Abeta0_v_node2 , Abeta0_v_node3 , Abeta0_v_node4 , Abeta0_v_node5 , Abeta0_v_node6 , Abeta0_v_node7 , Abeta0_v_node8 , Abeta0_v_node9 , Abeta0_v_node10 , Abeta0_v_node11 )) \n",
    "\n",
    "\n",
    "   \n",
    "# with open('current_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_v_node0 , Abeta0_v_node1 , Abeta0_v_node2 , Abeta0_v_node3 , Abeta0_v_node4 , Abeta0_v_node5 , Abeta0_v_node6 , Abeta0_v_node7 , Abeta0_v_node8 , Abeta0_v_node9 , Abeta0_v_node10 , Abeta0_v_node11 )) \n",
    "\n",
    "\n",
    "\n",
    "# with open('LongiCurrent_Abeta0_NodetoMYSA_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Longi_Current_node0_MYSA0 , Longi_Current_node1_MYSA2 , Longi_Current_node2_MYSA4 , Longi_Current_node3_MYSA6 , Longi_Current_node4_MYSA8 , Longi_Current_node5_MYSA10 , Longi_Current_node6_MYSA12 , Longi_Current_node7_MYSA14 , Longi_Current_node8_MYSA16 , Longi_Current_node9_MYSA18 , Longi_Current_node10_MYSA20 , Longi_Current_node11_MYSA22   ))\n",
    "    \n",
    "    \n",
    "\n",
    "# with open('TransCurrent_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Trans_Current_node0_node0 , Trans_Current_node1_node1 , Trans_Current_node2_node2 , Trans_Current_node3_node3 , Trans_Current_node4_node4 , Trans_Current_node5_node5 , Trans_Current_node6_node6 , Trans_Current_node7_node7 , Trans_Current_node8_node8 , Trans_Current_node9_node9 , Trans_Current_node10_node10 , Trans_Current_node11_node11 ))\n",
    "    \n",
    "\n",
    "    \n",
    "    \n",
    "    \n",
    "    \n",
    "    \n",
    "# ##################################### Not connected to ground, Stimulate BOTH fibers    \n",
    "\n",
    "\n",
    "# with open('v_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_v_node0 , Abeta0_v_node1 , Abeta0_v_node2 , Abeta0_v_node3 , Abeta0_v_node4 , Abeta0_v_node5 , Abeta0_v_node6 , Abeta0_v_node7 , Abeta0_v_node8 , Abeta0_v_node9 , Abeta0_v_node10 , Abeta0_v_node11 )) \n",
    "\n",
    "\n",
    "\n",
    "# with open('LongiCurrent_Abeta0_NodetoMYSA_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Longi_Current_node0_MYSA0 , Longi_Current_node1_MYSA2 , Longi_Current_node2_MYSA4 , Longi_Current_node3_MYSA6 , Longi_Current_node4_MYSA8 , Longi_Current_node5_MYSA10 , Longi_Current_node6_MYSA12 , Longi_Current_node7_MYSA14 , Longi_Current_node8_MYSA16 , Longi_Current_node9_MYSA18 , Longi_Current_node10_MYSA20 , Longi_Current_node11_MYSA22   ))\n",
    "    \n",
    "    \n",
    "\n",
    "# with open('TransCurrent_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Trans_Current_node0_node0 , Trans_Current_node1_node1 , Trans_Current_node2_node2 , Trans_Current_node3_node3 , Trans_Current_node4_node4 , Trans_Current_node5_node5 , Trans_Current_node6_node6 , Trans_Current_node7_node7 , Trans_Current_node8_node8 , Trans_Current_node9_node9 , Trans_Current_node10_node10 , Trans_Current_node11_node11 ))\n",
    "    \n",
    "    \n",
    "    \n",
    " \n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7a4d2e6a",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# with open('i_vext1_Abeta1_stimulateonlyAbeta0_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta1_vext1_node0 , Abeta1_vext1_node1 , Abeta1_vext1_node2 , Abeta1_vext1_node3 , Abeta1_vext1_node4 , Abeta1_vext1_node5 , Abeta1_vext1_node6 , Abeta1_vext1_node7 , Abeta1_vext1_node8 , Abeta1_vext1_node9 , Abeta1_vext1_node10 , Abeta1_vext1_node11 )) \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a594bc51",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8e386b67",
   "metadata": {},
   "outputs": [],
   "source": [
    "   \n",
    "# with open('icap_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_icap_node0 , Abeta0_icap_node1 , Abeta0_icap_node2 , Abeta0_icap_node3 , Abeta0_icap_node4 , Abeta0_icap_node5 , Abeta0_icap_node6 , Abeta0_icap_node7 , Abeta0_icap_node8 , Abeta0_icap_node9 , Abeta0_icap_node10 , Abeta0_icap_node11 )) \n",
    "\n",
    "        \n",
    "        \n",
    "# with open('ik_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_ik_node0 , Abeta0_ik_node1 , Abeta0_ik_node2 , Abeta0_ik_node3 , Abeta0_ik_node4 , Abeta0_ik_node5 , Abeta0_ik_node6 , Abeta0_ik_node7 , Abeta0_ik_node8 , Abeta0_ik_node9 , Abeta0_ik_node10 , Abeta0_ik_node11 )) \n",
    "\n",
    "\n",
    "        \n",
    "# with open('il_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_il_node0 , Abeta0_il_node1 , Abeta0_il_node2 , Abeta0_il_node3 , Abeta0_il_node4 , Abeta0_il_node5 , Abeta0_il_node6 , Abeta0_il_node7 , Abeta0_il_node8 , Abeta0_il_node9 , Abeta0_il_node10 , Abeta0_il_node11 )) \n",
    "\n",
    "\n",
    "# with open('ina_Abeta0_stimulateonlyAbata0_edgedist2_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_ina_node0 , Abeta0_ina_node1 , Abeta0_ina_node2 , Abeta0_ina_node3 , Abeta0_ina_node4 , Abeta0_ina_node5 , Abeta0_ina_node6 , Abeta0_ina_node7 , Abeta0_ina_node8 , Abeta0_ina_node9 , Abeta0_ina_node10 , Abeta0_ina_node11 , Abeta0_ina_node12 , Abeta0_ina_node13 , Abeta0_ina_node14 , Abeta0_ina_node15 , Abeta0_ina_node16 , Abeta0_ina_node17 , Abeta0_ina_node18 , Abeta0_ina_node19 , Abeta0_ina_node20 )) \n",
    "\n",
    "# with open('imembrane_Abeta0_stimulateonlyAbata0_edgedist2_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_imembrane_node0 , Abeta0_imembrane_node1 , Abeta0_imembrane_node2 , Abeta0_imembrane_node3 , Abeta0_imembrane_node4 , Abeta0_imembrane_node5 , Abeta0_imembrane_node6 , Abeta0_imembrane_node7 , Abeta0_imembrane_node8 , Abeta0_imembrane_node9 , Abeta0_imembrane_node10 , Abeta0_imembrane_node11 , Abeta0_imembrane_node12 , Abeta0_imembrane_node13 , Abeta0_imembrane_node14 , Abeta0_imembrane_node15 , Abeta0_imembrane_node16 , Abeta0_imembrane_node17 , Abeta0_imembrane_node18 , Abeta0_imembrane_node19 , Abeta0_imembrane_node20 )) \n",
    "\n",
    "        \n",
    "# with open('inap_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_inap_node0 , Abeta0_inap_node1 , Abeta0_inap_node2 , Abeta0_inap_node3 , Abeta0_inap_node4 , Abeta0_inap_node5 , Abeta0_inap_node6 , Abeta0_inap_node7 , Abeta0_inap_node8 , Abeta0_inap_node9 , Abeta0_inap_node10 , Abeta0_inap_node11 )) \n",
    "\n",
    "        \n",
    "        \n",
    "# with open('imembrane_Abeta0_stimulateBOTH_edgedist3_.csv', 'w', newline='') as f:\n",
    "#      csv.writer(f).writerows(zip( t , Abeta0_imembrane_node0 , Abeta0_imembrane_node1 , Abeta0_imembrane_node2 , Abeta0_imembrane_node3 , Abeta0_imembrane_node4 , Abeta0_imembrane_node5 , Abeta0_imembrane_node6 , Abeta0_imembrane_node7 , Abeta0_imembrane_node8 , Abeta0_imembrane_node9 , Abeta0_imembrane_node10 , Abeta0_imembrane_node11 )) \n",
    "        \n",
    "  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5bcb410c",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(xr)"
   ]
  }
 ],
 "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.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}