{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%load_ext autoreload"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%autoreload\n",
    "\n",
    "import numpy as np\n",
    "import matplotlib\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import math\n",
    "import sys\n",
    "sys.path.append(\"..\")\n",
    "import physics\n",
    "sys.path.append(\"../..\")\n",
    "from spec.spectrum import *\n",
    "import spec.spectools as spectools\n",
    "import xsecs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "class Rates(object):\n",
    "  \n",
    "    def __init__(self, E_spec, n, den=[1,1,1], dNdW=np.zeros((2,1)), rates=np.zeros(4)):\n",
    "        self.energy = E_spec.eng[n]\n",
    "        self.n = n\n",
    "        self.dNdE = E_spec.dNdE[n]\n",
    "        self.den = den\n",
    "        self.rates = rates\n",
    "        self.v = np.sqrt(2*np.array([E_spec.eng[n]])/physics.me)*physics.c #units?\n",
    "        self.mult = self.den*self.v\n",
    "        self.dNdW = np.zeros((2, self.n ))\n",
    "    \n",
    "    def ion_dNdW_calc_H(self): #uses new integration method\n",
    "        '''Fills *self.dNdW[0,:]* with the discretized singly differential xsec in rate form\n",
    "        '''\n",
    "        eng_temp = E_spec.eng[0:self.n]\n",
    "        ion_s_rates = xsecs.ionize_s_cs_H_2(self.energy, eng_temp)    #possible problem with np type\n",
    "        self.dNdW[0] = ion_s_rates *self.mult[0]                      #dNdE? ;also, [0,:]?\n",
    "        return self.dNdW\n",
    "    \n",
    "    def ion_rate_calc(self):\n",
    "        '''Fills *self.rate[1:3]* vector by calculating total xsec and then converting to rate\n",
    "        '''\n",
    "        ion_rates = xsecs.ionize_cs(self.energy*np.ones(3),np.array([1,2,3]))*self.mult\n",
    "        self.rates[1:4] = ion_rates\n",
    "        return self.rates\n",
    "    \n",
    "    def heat_rate_calc(self, x_e, rs):\n",
    "        '''Fills *self.rate[0]* vector with fraction going to heating\n",
    "            x_e and rs...\n",
    "        '''\n",
    "        dE = xsecs.heating_dE(self.energy, x_e, rs, nH=physics.nH)\n",
    "        delta_dNdE = np.zeros(len(E_spec.dNdE))\n",
    "        np.put(delta_dNdE, self.n, self.dNdE)\n",
    "        delta = Spectrum(E_spec.eng, delta_dNdE, rs)\n",
    "        shift_delta_eng = E_spec.eng+dE\n",
    "        delta.shift_eng(shift_delta_eng)\n",
    "        delta.rebin(E_spec.eng)\n",
    "        \n",
    "        heating_frac = delta.dNdE[self.n]/self.dNdE\n",
    "        self.rates[0] = 1-heating_frac #units? \n",
    "        return(self.rates)\n",
    "    \n",
    "    def E_loss(self):\n",
    "        '''loss fraction\n",
    "        '''\n",
    "        E_loss_ion=13.6*self.rates[1]\n",
    "        E_loss_heat=(E_spec.eng[self.n]-E_spec.eng[self.n-1])*self.rates[0]\n",
    "        E_frac = E_loss_ion/E_loss_heat\n",
    "        return(E_frac)\n",
    "    \n",
    "    def ion_int_calc(self):\n",
    "        '''gives total ionization rate\n",
    "        '''\n",
    "        bin_width = get_log_bin_width(E_spec.eng[0:self.n])\n",
    "        integ = 0\n",
    "        for i in range(self.n):\n",
    "            integ += self.dNdW[0,i-1]*bin_width[i]*E_spec.eng[i]\n",
    "        return integ\n",
    "        \n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def electron_low_e(E_spec, rs, ion_frac=[0.1,0.1,0.1], den=[1,1,1], dt=1 ,all_outputs=False):\n",
    "   \n",
    "    N = len(E_spec.eng)\n",
    "    den[0]=(physics.nH*(1-ion_frac[0]))*(rs)**3 #units?\n",
    "    \n",
    "    R = np.zeros((2,N))\n",
    "    R[1,0] = 1\n",
    "    R[1,1] = 1\n",
    "    R[1,2] = 1\n",
    "    \n",
    "    for n in range(3,N):\n",
    "        e_rates = Rates(E_spec, n, den)\n",
    "        e_rates.ion_rate_calc()\n",
    "        e_rates.heat_rate_calc(ion_frac[0], rs)\n",
    "        e_rates.ion_dNdW_calc_H() \n",
    "        \n",
    "        delta_E_spec = np.ediff1d(E_spec.eng)[0:(n)] #bin widths\n",
    "        \n",
    "        discrete_dN_dEdt_i = e_rates.dNdW[0]\n",
    "        \n",
    "        h_init=np.zeros(n)\n",
    "        h_init[n-2] = e_rates.rates[0]\n",
    "        h_init[n-1] = 1 - e_rates.rates[0]\n",
    "        discrete_dN_dEdt_h = h_init/delta_E_spec\n",
    "        \n",
    "        \n",
    "        R_in = ((13.6*e_rates.rates[1]) + np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_i[0:n-1]*R[0,0:n-1]*delta_E_spec[0:n-1]) \\\n",
    "            + np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*R[0,0:n-1]*delta_E_spec[0:n-1])) \\\n",
    "            /(e_rates.energy*(np.sum(discrete_dN_dEdt_i[0:n-1])+np.sum(discrete_dN_dEdt_h[0:n-1])))\n",
    "            \n",
    "        \n",
    "        R_hn = ((e_rates.energy*e_rates.rates[0]-np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*delta_E_spec[0:n-1])) \\\n",
    "            + np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_i[0:n-1]*R[1,0:n-1]*delta_E_spec[0:n-1]) \\\n",
    "            + np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*R[1,0:n-1]*delta_E_spec[0:n-1])) \\\n",
    "            /(e_rates.energy*(np.sum(discrete_dN_dEdt_i[0:n-1])+np.sum(discrete_dN_dEdt_h[0:n-1])))\n",
    "            \n",
    "\n",
    "        R[0,n] = R_in/(R_in+R_hn)\n",
    "        R[1,n] = R_hn/(R_in+R_hn)\n",
    "        \n",
    "        if n==100 or n == 325 or n == 400:\n",
    "            print('energy')\n",
    "            print(e_rates.energy)\n",
    "            print('rs')\n",
    "            print(rs)\n",
    "            print('ion')\n",
    "            print(13.6*e_rates.rates[1])\n",
    "            print(np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_i[0:n-1]*R[0,0:n-1]*delta_E_spec[0:n-1]))\n",
    "            print(np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*R[0,0:n-1]*delta_E_spec[0:n-1]))\n",
    "            print('heat')\n",
    "            print(e_rates.energy*e_rates.rates[0]-np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*delta_E_spec[0:n-1]))\n",
    "            print(np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_i[0:n-1]*R[1,0:n-1]*delta_E_spec[0:n-1]))\n",
    "            print(np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*R[1,0:n-1]*delta_E_spec[0:n-1]))\n",
    "            print('denominator')\n",
    "            print((e_rates.energy*(np.sum(discrete_dN_dEdt_i[0:n-1])+np.sum(discrete_dN_dEdt_h[0:n-1]))))\n",
    "        \n",
    "        #R[0,n] = R_in\n",
    "        #R[1,n] = R_hn\n",
    "        \n",
    "        #print(n, e_rates.energy,R_in,R_hn)\n",
    "        #print(e_rates.energy*e_rates.rates[0], np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*delta_E_spec[0:n-1]), np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_i[0:n-1]*R[1,0:n-1]*delta_E_spec[0:n-1]),np.sum(E_spec.eng[0:n-1]*discrete_dN_dEdt_h[0:n-1]*R[1,0:n-1]*delta_E_spec[0:n-1]) )\n",
    "        \n",
    "        \n",
    "    return R\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h1>Testing specific spectra:</h1>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "eng1 = np.logspace(-4.,4.,num = 500)\n",
    "#dNdE1 = np.logspace(0.,5.,num = 500)\n",
    "dNdE1 = np.ones(500)\n",
    "rs=1\n",
    "E_spec = Spectrum(eng1,dNdE1,rs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%%capture\n",
    "results_ion_frac_0 = electron_low_e(E_spec,10**3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%%capture\n",
    "results_ion_frac_1 = electron_low_e(E_spec,10**1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "10.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "4.49069930465e-08\n",
      "0.0\n",
      "5.86068193852e-07\n",
      "denominator\n",
      "0.00450426750556\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "10.0\n",
      "ion\n",
      "8.37711417924e-12\n",
      "0.0\n",
      "5.38428690949e-12\n",
      "heat\n",
      "7.05879072254e-10\n",
      "0.0\n",
      "9.206839576e-09\n",
      "denominator\n",
      "1.74914606176e-08\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "10.0\n",
      "ion\n",
      "7.64714150405e-11\n",
      "7.50845852722e-14\n",
      "5.25638730684e-10\n",
      "heat\n",
      "1.76888362143e-10\n",
      "2.60122322792e-13\n",
      "1.78288018546e-09\n",
      "denominator\n",
      "2.75132360297e-10\n",
      "0\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "20.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "3.59255944376e-07\n",
      "0.0\n",
      "4.68854555087e-06\n",
      "denominator\n",
      "0.0360341400449\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "20.0\n",
      "ion\n",
      "6.70169134339e-11\n",
      "0.0\n",
      "4.30714860031e-11\n",
      "heat\n",
      "5.64683644974e-09\n",
      "0.0\n",
      "7.36521598035e-08\n",
      "denominator\n",
      "1.39926824943e-07\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "20.0\n",
      "ion\n",
      "6.11771320324e-10\n",
      "6.00812946702e-13\n",
      "4.20604123916e-09\n",
      "heat\n",
      "1.41509054301e-09\n",
      "2.08084231781e-12\n",
      "1.42618966569e-08\n",
      "denominator\n",
      "2.20103345401e-09\n",
      "1\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "30.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "1.21248881228e-06\n",
      "0.0\n",
      "1.58238412343e-05\n",
      "denominator\n",
      "0.121615222652\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "30.0\n",
      "ion\n",
      "2.26182082839e-10\n",
      "0.0\n",
      "1.45367246823e-10\n",
      "heat\n",
      "1.90581473356e-08\n",
      "0.0\n",
      "2.48577008255e-07\n",
      "denominator\n",
      "4.72254875754e-07\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "30.0\n",
      "ion\n",
      "2.06472820609e-09\n",
      "2.02777325553e-12\n",
      "1.41954267728e-08\n",
      "heat\n",
      "4.77593058266e-09\n",
      "7.02281326221e-12\n",
      "4.81338636263e-08\n",
      "denominator\n",
      "7.42848790727e-09\n",
      "2\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "40.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "2.87404755502e-06\n",
      "0.0\n",
      "3.75083644071e-05\n",
      "denominator\n",
      "0.28827312036\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "40.0\n",
      "ion\n",
      "5.36135307471e-10\n",
      "0.0\n",
      "3.44574917537e-10\n",
      "heat\n",
      "4.51748896503e-08\n",
      "0.0\n",
      "5.89219860123e-07\n",
      "denominator\n",
      "1.11941950722e-06\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "40.0\n",
      "ion\n",
      "4.89417056259e-09\n",
      "4.80658564094e-12\n",
      "3.36453891448e-08\n",
      "heat\n",
      "1.13196797238e-08\n",
      "1.66466564752e-11\n",
      "1.14084480985e-07\n",
      "denominator\n",
      "1.76066433949e-08\n",
      "3\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "50.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "5.6133741309e-06\n",
      "0.0\n",
      "7.32585242327e-05\n",
      "denominator\n",
      "0.563033438204\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "50.0\n",
      "ion\n",
      "1.0471392724e-09\n",
      "0.0\n",
      "6.72997472418e-10\n",
      "heat\n",
      "8.82322075027e-08\n",
      "0.0\n",
      "1.15082005478e-06\n",
      "denominator\n",
      "2.18636625365e-06\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "50.0\n",
      "ion\n",
      "9.55892688006e-09\n",
      "9.387855071e-12\n",
      "6.57165094506e-08\n",
      "heat\n",
      "2.21097410257e-08\n",
      "3.2513008437e-11\n",
      "2.22831333778e-07\n",
      "denominator\n",
      "3.43895171246e-08\n",
      "4\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "60.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "9.69991049819e-06\n",
      "0.0\n",
      "0.000126590729874\n",
      "denominator\n",
      "0.972921781216\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "60.0\n",
      "ion\n",
      "1.80945666272e-09\n",
      "0.0\n",
      "1.1629396358e-09\n",
      "heat\n",
      "1.5246524436e-07\n",
      "0.0\n",
      "1.98861692149e-06\n",
      "denominator\n",
      "3.77804063345e-06\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "60.0\n",
      "ion\n",
      "1.65178256487e-08\n",
      "1.6222176786e-11\n",
      "1.13557044755e-07\n",
      "heat\n",
      "3.82053513321e-08\n",
      "5.61825153558e-11\n",
      "3.85049959003e-07\n",
      "denominator\n",
      "5.94246484268e-08\n",
      "5\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "70.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "1.54030986152e-05\n",
      "0.0\n",
      "0.000201021390495\n",
      "denominator\n",
      "1.54496375443\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "70.0\n",
      "ion\n",
      "2.87335016348e-09\n",
      "0.0\n",
      "1.84670518565e-09\n",
      "heat\n",
      "2.42109144717e-07\n",
      "0.0\n",
      "3.15784980383e-06\n",
      "denominator\n",
      "5.99938819045e-06\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "70.0\n",
      "ion\n",
      "2.62296953589e-08\n",
      "2.57602421199e-11\n",
      "1.80325457796e-07\n",
      "heat\n",
      "6.06688690821e-08\n",
      "8.92157273461e-11\n",
      "6.11446427023e-07\n",
      "denominator\n",
      "9.4364430272e-08\n",
      "6\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "80.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "2.29923804402e-05\n",
      "0.0\n",
      "0.000300066915257\n",
      "denominator\n",
      "2.30618496288\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "80.0\n",
      "ion\n",
      "4.28908245977e-09\n",
      "0.0\n",
      "2.75659802308e-09\n",
      "heat\n",
      "3.61399116946e-07\n",
      "0.0\n",
      "4.71375887895e-06\n",
      "denominator\n",
      "8.95535605142e-06\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "80.0\n",
      "ion\n",
      "3.91533645007e-08\n",
      "3.84525927791e-11\n",
      "2.69172173016e-07\n",
      "heat\n",
      "9.05605593854e-08\n",
      "1.3317334415e-10\n",
      "9.12707527064e-07\n",
      "denominator\n",
      "1.40858000799e-07\n",
      "7\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "90.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "3.27371979314e-05\n",
      "0.0\n",
      "0.000427243713325\n",
      "denominator\n",
      "3.2836110116\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "90.0\n",
      "ion\n",
      "6.10691623667e-09\n",
      "0.0\n",
      "3.92492144769e-09\n",
      "heat\n",
      "5.14570175088e-07\n",
      "0.0\n",
      "6.71158178843e-06\n",
      "denominator\n",
      "1.27508865276e-05\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "90.0\n",
      "ion\n",
      "5.57476615645e-08\n",
      "5.4749896677e-11\n",
      "3.83255402102e-07\n",
      "heat\n",
      "1.28942801124e-07\n",
      "1.89615939302e-10\n",
      "1.29953984733e-06\n",
      "denominator\n",
      "2.00557784765e-07\n",
      "8\n",
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "100.0\n",
      "ion\n",
      "0.0\n",
      "0.0\n",
      "0.0\n",
      "heat\n",
      "4.49069930472e-05\n",
      "0.0\n",
      "0.000586068193862\n",
      "denominator\n",
      "4.50426750563\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "../../darkhistory/spec/spectools.py:34: RuntimeWarning: invalid value encountered in log\n",
      "  log_bin_width_low = np.log(eng[1]) - np.log(eng[0])\n",
      "../../darkhistory/spec/spectools.py:39: RuntimeWarning: invalid value encountered in sqrt\n",
      "  bin_boundary[1:-1] = np.sqrt(eng[:-1] * eng[1:])\n",
      "../../darkhistory/spec/spectools.py:41: RuntimeWarning: invalid value encountered in log\n",
      "  low_lim = np.exp(np.log(eng[0]) - log_bin_width_low / 2)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "100.0\n",
      "ion\n",
      "8.37711417924e-09\n",
      "0.0\n",
      "5.38398030845e-09\n",
      "heat\n",
      "7.0585759332e-07\n",
      "0.0\n",
      "9.20655956723e-06\n",
      "denominator\n",
      "1.74909283764e-05\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "100.0\n",
      "ion\n",
      "7.64714150405e-08\n",
      "7.51027248107e-11\n",
      "5.25726096377e-07\n",
      "heat\n",
      "1.76875847142e-07\n",
      "2.60104183254e-10\n",
      "1.7826294901e-06\n",
      "denominator\n",
      "2.75112901237e-07\n",
      "9\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEDCAYAAAD0jzkfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG8FJREFUeJzt3XuQXOV95vHvoxlLQhd0gUEISSAhRmQlMU2UWYIdkxAb\nBwm8EbUXIjYJMsarogJJ7CSViIT17lbigj+cXZsqLsU6sGI3RpG9bNAuYC2WHW92MYYRdwmEBoFA\nQkIDBgmQEbr89o/ztqc1zHT39PRM355P1ak+fc57Tr/nVGkenfOe/rUiAjMzs0qMq3UHzMyscTlE\nzMysYg4RMzOrmEPEzMwq5hAxM7OKOUTMzKxiLR8ikv5O0tNpelXS00O0my7pu5JelPSCpE8OWP/H\nkkLSqen9eEn3SHpO0jOSLq5CX39B0o8lHZb0JyPdn5nZSLXXugNjKf0h/0JEfCG/LCJ+q2D9XwMH\nhtj8m8D3IuJfShoPTCrYbh7wG8BrBe3/Tdr/eZJOAx6W9E8j4vgIDuGnwB8AV4xgH2ZmVdPyVyJ5\nkgRcCdw3yLppwK8CfwMQER9FxLsFTf4T8KdA4Tc3FwM/SO33A+8C3Wl/v5GuKJ6U9B1JU8rpY0Ts\nj4gngCPDPT4zs9HgEOl3EfBmROwYZN0CoA+4R9JTkr4laTKApJXAnoh4ZsA2zwC/Kald0gLgl4B5\n6XbXTcAlEbEM6AH+aJSOycxsVLXE7SxJPwEmAFOAmQXjHn8WEZ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U7rZwP7a9W/MfQrwG9KehVYD3xG0n+jNc8FZP9z3B0RP0nvv0sWKq16Pi4B\nXomIvog4AtwPfIrWPR95Qx3/HmBeQbu5admIOUTqiCSR3fN+ISL+Y8GqjcDqNL8aeGCs+zbWIuLG\niJgbEfPJBgR/EBG/QwueC4CI2Ae8LunctOizwDZa9HyQ3ca6UNKk9O/ms2RjiK16PvKGOv6NwCpJ\nEyQtADqBx6vxgf7Geh2R9GngH4Hn6B8H+HOycZENwJlkZe2vjIiBA2pNS9LFwJ9ExOclnUKLngtJ\n55M9ZDAe2AlcQ/YfwVY9H/8B+C2ypxqfAr4ETKFFzoek+4CLyUq+vwn8O+DvGeL4Jf0F8EWy8/Xl\niHi4Kv1wiJiZWaV8O8vMzCrmEDEzs4o5RMzMrGIOETMzq5hDxMzMKuYQMTOzijlEzMysYv8fs+wa\nQETXeOwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10edd72e8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=np.linspace(10,100,num = 10)\n",
    "y=np.zeros((10,1))\n",
    "\n",
    "for k,rs in enumerate(x):\n",
    "    y[k] = electron_low_e(E_spec, rs)[1,400]\n",
    "    print(k)\n",
    "\n",
    "plt.plot(x,y, 'r')\n",
    "plt.show()\n",
    "#heat rate versus redshift"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEACAYAAAC6d6FnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHR1JREFUeJzt3XuQlNWd//H3d7gqAoIoRhAGHO6YRNJiDLtK1oAERZKY\nuOCFGF1Z3cXUVu0GpUyt2d+WktrSTaIYDK6ImpVrEhcEpOIqi8ZLGAzITS5BEViUizDc72f/ONO/\n7pmeGWamL8+Zfj6vqq7ufk5P94ehp7/9nOc855h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w8IOoc1QX0u8oXcDvqaUE+DeYlOvPrGIZBZS31cmypFwNE2qudKFmVK6G\nUS6KpwDkbXWyLClXw4SaK12oGZWrYZQLmuQooJnATuAkvn/s7srtI4GN+CPoDymXchVrRuVSrlxd\nNBmciEhMFUsXkIiINJAKgIhITKkAiIjElAqAiEhMqQCIiMSUCoCISEypAIiIxJQKgIhITKkAiIjE\n1P8ByAkjrlRdPKQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10fa04588>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "np.set_printoptions(threshold = np.nan)\n",
    "#print(np.transpose([E_spec.eng, results_ion_frac_0[0,:],results_ion_frac_0[1,:]]))\n",
    "#plt.plot(E_spec.eng, results_ion_frac_0[0,:], 'r')   #10**3\n",
    "plt.plot(E_spec.eng, results_ion_frac_1[0,:], 'r--') #10**1\n",
    "#plt.plot(E_spec.eng, results_ion_frac_0[1,:], 'b')\n",
    "plt.plot(E_spec.eng, results_ion_frac_1[1,:], 'b--')\n",
    "plt.xscale('log')\n",
    "plt.yscale('log')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "../../darkhistory/spec/spectools.py:34: RuntimeWarning: invalid value encountered in log\n",
      "  log_bin_width_low = np.log(eng[1]) - np.log(eng[0])\n",
      "../../darkhistory/spec/spectools.py:39: RuntimeWarning: invalid value encountered in sqrt\n",
      "  bin_boundary[1:-1] = np.sqrt(eng[:-1] * eng[1:])\n",
      "../../darkhistory/spec/spectools.py:41: RuntimeWarning: invalid value encountered in log\n",
      "  low_lim = np.exp(np.log(eng[0]) - log_bin_width_low / 2)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy\n",
      "0.00401057288086\n",
      "rs\n",
      "1000\n",
      "ion\n",
      "0.0\n",
      "nan\n",
      "nan\n",
      "heat\n",
      "0.000285435580055\n",
      "nan\n",
      "nan\n",
      "denominator\n",
      "28.6297995246\n",
      "energy\n",
      "16.2338243161\n",
      "rs\n",
      "1000\n",
      "ion\n",
      "8.37711417924e-06\n",
      "nan\n",
      "nan\n",
      "heat\n",
      "0.000705857618408\n",
      "nan\n",
      "nan\n",
      "denominator\n",
      "0.017490928998\n",
      "energy\n",
      "258.71740786\n",
      "rs\n",
      "1000\n",
      "ion\n",
      "7.64714150405e-05\n",
      "nan\n",
      "nan\n",
      "heat\n",
      "0.000176876125454\n",
      "nan\n",
      "nan\n",
      "denominator\n",
      "0.000275113333974\n"
     ]
    }
   ],
   "source": [
    "#%%capture\n",
    "results_ion_frac_t = electron_low_e(E_spec,1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/cannonvogel/anaconda/lib/python3.6/site-packages/matplotlib/axes/_base.py:3193: UserWarning: Attempting to set identical bottom==top results\n",
      "in singular transformations; automatically expanding.\n",
      "bottom=1.0, top=1.0\n",
      "  'bottom=%s, top=%s') % (bottom, top))\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEACAYAAAC9Gb03AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAACiBJREFUeJzt3F+opPddx/HPt1nbmrW20EQI2eAJtgRCoKksLaUo0hKI\nEhpRlEa0WEt71ZLghSYU8Q9qwQuJYCxEjbEYG9O0xTREUmljq1Brdtso+dPIWi3ZgmRz4Z+UgrR+\nvThTPTndszl7zpw9M19fLzgX88wzz3x/md33POeZyVZ3B4C5XnLYAwBwsIQeYDihBxhO6AGGE3qA\n4YQeYDihBxhO6AGGE3qA4YQeYLgjhz1AklxyySW9sbFx2GMArJWTJ08+192Xvth+KxH6jY2NnDhx\n4rDHAFgrVfWV3ezn0g3AcEIPMJzQAwwn9ADDCT3A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9Bk9APu3smf0ACyH0AMMJ/QAwwk9wHBCDzCc0AMMJ/QAwwk9wHBCDzDc/wD9WYIMeaBrDQAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x114130be0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(E_spec.eng, results_ion_frac_t[0,:], 'r')   #rs=1\n",
    "plt.plot(E_spec.eng, results_ion_frac_t[1,:], 'b')\n",
    "plt.xscale('log')\n",
    "plt.yscale('log')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "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.6.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
