pynucastro.networks.network_compare module#
Helper functions for comparing the output of different backends (python, C++) for the same network. This will build and run each net and return the ydots, rates, jacobian, and energy generation
- class pynucastro.networks.network_compare.NetworkCompare(lib, *, use_screening=False, include_amrex=False, include_simple_cxx=True, python_module_name='compare_net.py', amrex_test_path=None, cxx_test_path=None)[source]#
Bases:
objectA simple class to manage building a network with different backends to facilitate comparisons.
Note
For the Jacobian, only the species terms are compared.
- Parameters:
lib (Library) – pynucastro Library containing the rates
use_screening (bool) – do we include screening in the comparison (Chugunov 2007)
include_amrex (bool) – do we build and evaluate an AmrexAstroCxxNetwork?
include_simple_cxx (bool) – do we build and evaluate a SimpleCxxNetwork?
python_module_name (str) – the name of the module file to output the python net to
amrex_test_path (pathlib.Path) – the Path to output the AMReX C++ source files and build in
cxx_test_path (pathlib.Path) – the Path to output the C++ source files and build in
- ydots_py_inline#
The dY/dt terms from the python inline network (
RateCollection.evaluate_ydots).
- ydots_py_module#
The dYdt terms from a
PythonNetworkmodule.
- ydots_amrex#
The dYdt terms parsed from a build of an
AmrexAstroCxxNetwork.
- ydots_cxx#
The dYdt terms parsed from a build of a
SimpleCxxNetwork.
- jac_py_inline#
The Jacobian terms from the python inline network (
RateCollection.evaluate_jacobian).
- jac_py_module#
The Jacobian terms from a
PythonNetworkmodule.
- jac_amrex#
The Jacobian terms parsed from a build of an
AmrexAstroCxxNetwork.
- jac_cxx#
The Jacobian terms parsed from a build of a
SimpleCxxNetwork.
- rates_py_inline#
The raw rates (e.g. N_A <σv>) from the python inline network (computed via
Rate.eval).
- rates_py_module#
The raw rates (e.g. N_A <σv>) from a
PythonNetworkmodule.
- rates_amrex#
The raw rates (e.g. N_A <σv>) parsed from a build of an
AmrexAstroCxxNetwork.
- rates_cxx#
The raw rates (e.g. N_A <σv>) parsed from a build of a
SimpleCxxNetwork.
- enuc_py_inline#
The total energy generation rate from the mass changes (just strong reactions) in erg/g/s computed via
evaluate_energy_generation.- Type:
- enuc_py_module#
The total energy generation rate from the mass changes (just strong reactions) in erg/g/s evaluated from a
PythonNetworkmodule.- Type:
- enuc_amrex#
The total energy generation rate from the mass changes (just strong reactions) in erg/g/s parsed from a build of an
AmrexAstroCxxNetwork.- Type:
- enuc_cxx#
The total energy generation rate from the mass changes (just strong reactions) in erg/g/s parsed from a build of a
SimpleCxxNetwork.- Type:
- compare_results(*, quantity='ydots', rtol=1e-11, atol=1e-30)[source]#
Perform the comparison of quantity across the different network types.
- Parameters:
- Raises:
- evaluate(rho=200000000.0, T=1000000000.0)[source]#
Evaluate the ydots from all the backends we are considering. This will compile the C++ networks if they have not already been built. This does not do any comparisons.
- print_summary(*, jac_floor=1e-90)[source]#
Print a summary of the dY/dt comparison and errors for each network type run.
- Parameters:
jac_floor (float) – Value for abs(J_{i,j}) below which to switch to an absolute error instead of relative error. This helps deal with the different ways nets floor rates.