pynucastro.networks.numpy_network module#
- class pynucastro.networks.numpy_network.NumpyNetwork(rate_files=None, libraries=None, rates=None, inert_nuclei=None, symmetric_screening=False, do_screening=True)[source]#
Bases:
RateCollection
A network that uses numpy arrays to evaluate rates more efficiently.
- yfac#
Array storing the molar fraction component of each rate (Y of each reactant raised to the appropriate power).
Depends on composition only.
- prefac#
Array storing the prefactor for each rate, which includes both the statistical prefactor and mass density raised to the corresponding density exponent.
Depends on composition and density.
- clear_arrays()[source]#
Clear all cached arrays stored by the
update_yfac_arr()
andupdate_prefac_arr()
member functions, freeing up memory.
- property coef_arr#
Reaclib rate coefficient array, with shape
(number_of_rates, number_of_sets, 7)
- property coef_mask#
Boolean mask array determining how many sets to include in the final rate evaluation, with shape
(number_of_rates, number_of_sets)
.
- evaluate_activity_arr(T)[source]#
Sum over all of the terms contributing to dY/dt for a specific temperature, neglecting sign, assuming necessary precalculations have been carried out (calling the methods
update_yfac_arr()
andupdate_prefac_arr()
to set the composition and density).This performs a vectorized calculation, and returns an array ordered by the nuclei in the
unique_nuclei
member variable. This does not support tabular rates.See
evaluate_activity()
for the non-vectorized version. Relative performance between the two varies based on the setup. Seeclear_arrays()
for freeing memory post calculation.
- evaluate_rates_arr(T)[source]#
Evaluate the rates in the network for a specific temperature, assuming necessary precalculations have been carried out (calling the methods
update_yfac_arr()
andupdate_prefac_arr()
to set the composition and density).This performs a vectorized calculation, and returns an array ordered by the rates in the
rates
member variable. This does not support tabular rates.See
evaluate_rates()
for the non-vectorized version. Relative performance between the two varies based on the setup. Seeclear_arrays()
for freeing memory post calculation.
- evaluate_ydots_arr(T)[source]#
Evaluate net rate of change of molar abundance for each nucleus in the network for a specific temperature, assuming necessary precalculations have been carried out (calling the methods
update_yfac_arr()
andupdate_prefac_arr()
to set the composition and density).This performs a vectorized calculation, and returns an array ordered by the nuclei in the
unique_nuclei
member variable. This does not support tabular rates.See
evaluate_ydots()
for the non-vectorized version. Relative performance between the two varies based on the setup. Seeclear_arrays()
for freeing memory post calculation.
- property nuc_cons_count#
Array storing the count of each nucleus in rates consuming that nucleus, with shape
(number_of_species, number_of_rates)
.
- property nuc_prod_count#
Array storing the count of each nucleus in rates producing that nucleus, with shape
(number_of_species, number_of_rates)
- property nuc_used#
A boolean matrix of whether the nucleus is involved in the reaction or not, with shape
(number_of_species, number_of_rates)