from parameters import *
from library_time import *
from paths import *

import numpy as np
import pylab as plt
import matplotlib.pyplot as mplt
mplt.rc('text', usetex=True)
mplt.rcParams.update({'font.size': 16})


import logging, getopt, sys
import time
import os

##########################################################################################
#       C O N F I G U R A T I O N 
##########################################################################################

# activate ylim for w
var1 = w1
var3 = w3
var5 = w5
var10 = w10
var25 = w25
mode = "w" # u or w 

##########################################################################################
#       M A I N
##########################################################################################
if __name__ == "__main__":

    if not os.path.exists('plots'):
        os.makedirs('plots')
        print('Created folder plots!')
    if not os.path.exists('plots/integral'):
        os.makedirs('plots/integral')
        print('Created folder plots/integral!')
    
    t = np.linspace(tmin, tmax, Nt)
    r = np.linspace(0,R,Nr)
    
    Ivar1  = np.zeros(Nt)
    Ivar3  = np.zeros(Nt)
    Ivar5  = np.zeros(Nt)
    Ivar10 = np.zeros(Nt)
    Ivar25 = np.zeros(Nt)
    for i in range(Nt):
        # /1000000 because of units
        Ivar1[i] = integrate(var1, i,r, Nt)/1000000
        Ivar3[i] = integrate(var3, i,r, Nt)/1000000
        Ivar5[i] = integrate(var5, i,r, Nt)/1000000
        Ivar10[i] = integrate(var10, i,r, Nt)/1000000
        Ivar25[i] = integrate(var25, i,r, Nt)/1000000
        
    mplt.plot(t, Ivar1, label=r'$\alpha = 1$')
    mplt.plot(t, Ivar3, label=r'$\alpha = 3$')
    mplt.plot(t, Ivar5, label=r'$\alpha = 5$')
    mplt.plot(t, Ivar10, label=r'$\alpha = 10$')
    mplt.plot(t, Ivar25, label=r'$\alpha = 25$')
    mplt.xlim(tmin, tmax)
    mplt.yscale('log')
    mplt.xlabel(r'$t\quad [h]$')
    mplt.ylabel(r'$\bar{'+mode+'}\quad [\mu mol]$')
##########################################################################################
    # lim for w, because some values dont make sense
    mplt.ylim(1e-11, 3e2) 
    # lim for w, because some values dont make sense
##########################################################################################
    mplt.legend(loc=1, bbox_to_anchor=(1, 0.9))
    mplt.tight_layout()
    mplt.savefig('plots/integral/int'+mode+'.pdf', format='pdf')
    mplt.show()
[((145, 173), 'matplotlib.pyplot.rc', 'mplt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (152, 173), True, 'import matplotlib.pyplot as mplt\n'), ((174, 213), 'matplotlib.pyplot.rcParams.update', 'mplt.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (194, 213), True, 'import matplotlib.pyplot as mplt\n'), ((1057, 1084), 'numpy.linspace', 'np.linspace', (['tmin', 'tmax', 'Nt'], {}), '(tmin, tmax, Nt)\n', (1068, 1084), True, 'import numpy as np\n'), ((1093, 1114), 'numpy.linspace', 'np.linspace', (['(0)', 'R', 'Nr'], {}), '(0, R, Nr)\n', (1104, 1114), True, 'import numpy as np\n'), ((1131, 1143), 'numpy.zeros', 'np.zeros', (['Nt'], {}), '(Nt)\n', (1139, 1143), True, 'import numpy as np\n'), ((1157, 1169), 'numpy.zeros', 'np.zeros', (['Nt'], {}), '(Nt)\n', (1165, 1169), True, 'import numpy as np\n'), ((1183, 1195), 'numpy.zeros', 'np.zeros', (['Nt'], {}), '(Nt)\n', (1191, 1195), True, 'import numpy as np\n'), ((1209, 1221), 'numpy.zeros', 'np.zeros', (['Nt'], {}), '(Nt)\n', (1217, 1221), True, 'import numpy as np\n'), ((1235, 1247), 'numpy.zeros', 'np.zeros', (['Nt'], {}), '(Nt)\n', (1243, 1247), True, 'import numpy as np\n'), ((1585, 1627), 'matplotlib.pyplot.plot', 'mplt.plot', (['t', 'Ivar1'], {'label': '"""$\\\\alpha = 1$"""'}), "(t, Ivar1, label='$\\\\alpha = 1$')\n", (1594, 1627), True, 'import matplotlib.pyplot as mplt\n'), ((1632, 1674), 'matplotlib.pyplot.plot', 'mplt.plot', (['t', 'Ivar3'], {'label': '"""$\\\\alpha = 3$"""'}), "(t, Ivar3, label='$\\\\alpha = 3$')\n", (1641, 1674), True, 'import matplotlib.pyplot as mplt\n'), ((1679, 1721), 'matplotlib.pyplot.plot', 'mplt.plot', (['t', 'Ivar5'], {'label': '"""$\\\\alpha = 5$"""'}), "(t, Ivar5, label='$\\\\alpha = 5$')\n", (1688, 1721), True, 'import matplotlib.pyplot as mplt\n'), ((1726, 1770), 'matplotlib.pyplot.plot', 'mplt.plot', (['t', 'Ivar10'], {'label': '"""$\\\\alpha = 10$"""'}), "(t, Ivar10, label='$\\\\alpha = 10$')\n", (1735, 1770), True, 'import matplotlib.pyplot as mplt\n'), ((1775, 1819), 'matplotlib.pyplot.plot', 'mplt.plot', (['t', 'Ivar25'], {'label': '"""$\\\\alpha = 25$"""'}), "(t, Ivar25, label='$\\\\alpha = 25$')\n", (1784, 1819), True, 'import matplotlib.pyplot as mplt\n'), ((1824, 1845), 'matplotlib.pyplot.xlim', 'mplt.xlim', (['tmin', 'tmax'], {}), '(tmin, tmax)\n', (1833, 1845), True, 'import matplotlib.pyplot as mplt\n'), ((1850, 1868), 'matplotlib.pyplot.yscale', 'mplt.yscale', (['"""log"""'], {}), "('log')\n", (1861, 1868), True, 'import matplotlib.pyplot as mplt\n'), ((1873, 1901), 'matplotlib.pyplot.xlabel', 'mplt.xlabel', (['"""$t\\\\quad [h]$"""'], {}), "('$t\\\\quad [h]$')\n", (1884, 1901), True, 'import matplotlib.pyplot as mplt\n'), ((1906, 1959), 'matplotlib.pyplot.ylabel', 'mplt.ylabel', (["('$\\\\bar{' + mode + '}\\\\quad [\\\\mu mol]$')"], {}), "('$\\\\bar{' + mode + '}\\\\quad [\\\\mu mol]$')\n", (1917, 1959), True, 'import matplotlib.pyplot as mplt\n'), ((2102, 2125), 'matplotlib.pyplot.ylim', 'mplt.ylim', (['(1e-11)', '(300.0)'], {}), '(1e-11, 300.0)\n', (2111, 2125), True, 'import matplotlib.pyplot as mplt\n'), ((2273, 2316), 'matplotlib.pyplot.legend', 'mplt.legend', ([], {'loc': '(1)', 'bbox_to_anchor': '(1, 0.9)'}), '(loc=1, bbox_to_anchor=(1, 0.9))\n', (2284, 2316), True, 'import matplotlib.pyplot as mplt\n'), ((2321, 2340), 'matplotlib.pyplot.tight_layout', 'mplt.tight_layout', ([], {}), '()\n', (2338, 2340), True, 'import matplotlib.pyplot as mplt\n'), ((2345, 2409), 'matplotlib.pyplot.savefig', 'mplt.savefig', (["('plots/integral/int' + mode + '.pdf')"], {'format': '"""pdf"""'}), "('plots/integral/int' + mode + '.pdf', format='pdf')\n", (2357, 2409), True, 'import matplotlib.pyplot as mplt\n'), ((2410, 2421), 'matplotlib.pyplot.show', 'mplt.show', ([], {}), '()\n', (2419, 2421), True, 'import matplotlib.pyplot as mplt\n'), ((820, 843), 'os.path.exists', 'os.path.exists', (['"""plots"""'], {}), "('plots')\n", (834, 843), False, 'import os\n'), ((853, 873), 'os.makedirs', 'os.makedirs', (['"""plots"""'], {}), "('plots')\n", (864, 873), False, 'import os\n'), ((924, 956), 'os.path.exists', 'os.path.exists', (['"""plots/integral"""'], {}), "('plots/integral')\n", (938, 956), False, 'import os\n'), ((966, 995), 'os.makedirs', 'os.makedirs', (['"""plots/integral"""'], {}), "('plots/integral')\n", (977, 995), False, 'import os\n')]