<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 NOTE
This notebook doesn't work yet. I have previously written my own version of lambdify here.
Don't know if that's the path to go, or wait for next release of numba.
In this notebook we will use numba the increase the performance of our callbacks produced by lambdify in SymPy.
Step1:  The ODEsys class and convenience functions from previous notebook (35) has been put in two modules for easy importing. Recapping what we did last
Step2:  so that is the benchmark to beat.
Step3:  Just to see that everything looks alright
<ASSISTANT_TASK:>
Python Code:
import json
import numpy as np
import sympy as sym
from scipy2017codegen.odesys import ODEsys
from scipy2017codegen.chem import mk_rsys
Explanation: NOTE
This notebook doesn't work yet. I have previously written my own version of lambdify here.
Don't know if that's the path to go, or wait for next release of numba.
In this notebook we will use numba the increase the performance of our callbacks produced by lambdify in SymPy.
End of explanation
watrad_data = json.load(open('../scipy2017codegen/data/radiolysis_300_Gy_s.json'))
watrad = mk_rsys(ODEsys, **watrad_data)
tout = np.logspace(-6, 3, 200)  # close to one hour of operation
c0 = {'H2O': 55.4e3, 'H+': 1e-4, 'OH-': 1e-4}
y0 = [c0.get(symb.name, 0) for symb in watrad.y]
%timeit yout, info = watrad.integrate_odeint(tout, y0)
Explanation: The ODEsys class and convenience functions from previous notebook (35) has been put in two modules for easy importing. Recapping what we did last:
End of explanation
from numba import njit
watrad_numba = mk_rsys(ODEsys, **watrad_data, lambdify=lambda *args: njit(sym.lambdify(*args, modules="numpy")))
watrad_numba.integrate_odeint(tout, y0)
%timeit watrad_numba.integrate_odeint(tout, y0)
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: so that is the benchmark to beat.
End of explanation
fig, ax = plt.subplots(1, 1, figsize=(14, 6))
watrad_numba.plot_result(tout, *watrad_numba.integrate_odeint(tout, y0), ax=ax)
ax.set_xscale('log')
ax.set_yscale('log')
Explanation: Just to see that everything looks alright:
End of explanation
<END_TASK>