pynucastro.networks.python_network module#
Support modules to write a pure python reaction network ODE source.
- class pynucastro.networks.python_network.PythonNetwork(rate_files=None, libraries=None, rates=None, inert_nuclei=None, do_screening=True, verbose=False)[source]#
- Bases: - RateCollection- A pure python reaction network. This can create a python module as a file that contains everything needed to evaluate the reaction rates and construct the righthand side and Jacobian functions. - full_jacobian_element_string(ydot_i_nucleus, y_j_nucleus, indent='')[source]#
- Construct a string containing the python code for a single element of the Jacobian, dYdot(ydot_i_nucleus)/dY(y_j_nucleus) - Parameters:
- ydot_i_nucleus (Nucleus) – The nucleus representing the dY/dt term we are differentiating. This is the row of the Jacobian. 
- ydot_j_nucleus (Nucleus) – The nucleus we are differentiating with respect to. This is the column of the Jacobian. 
- indent (str) – A string that will be prepended to each line of the output, typically consisting of just spaces representing the amount of indent desired. 
 
- Return type:
 
 - full_ydot_string(nucleus, indent='')[source]#
- Construct a string containing the python code for dY(nucleus)/dt by considering every reaction that involves nucleus, adding terms that result in its creation and subtracting terms representing its destruction. 
 - rates_string(indent='')[source]#
- Create the python code that calls the evaluation function for each rate. Typically this is of the form - name(rate_eval, ...), where- rate_evalis a container class in the output network that stores the rate values. This also calls- screening_string()after the main rates are evaluated but before the approximate rates are constructed.
 
