Basic Networks#
The general procedure for creating a network is:
Create one or more
Library
objects containing the rates that you want. This can start with a list of nuclei or a list of rate names (like"c12(a,g)o16"
).There are multiple sources of rates in pynucastro, so sometimes several libraries will be created, filtering the desired rates from the different sources.
Remove any duplicate rates between the libraries. Usually this means keeping tabulated rates over ReacLib rates, since the tabulated rates are more general.
Rederive the inverse rates from ReacLib using detailed balance.
Create a network using either
RateCollection
or one of the classes derived from it.Approximate some of the nuclei out of the network by introducing \((\alpha, p)(p,\gamma)\) or other rate approximations.
pynucastro gives you control over each of these steps, which is needed for some complex network types. But if you just want to create a network that has all possible links connecting a set of nuclei, then the
network_helper
function is enough.
Here’s an example of a CNO network with some breakout.
import pynucastro as pyna
nuclei = ["p", "he4",
"c12", "c13",
"n13", "n14", "n15",
"o14", "o15", "o16", "o17", "o18",
"f17", "f18", "f19",
"ne18", "ne19", "ne20", "ne21"]
net = pyna.network_helper(nuclei)
warning: C12 was not able to be linked
warning: O15 was not able to be linked
warning: Ne21 was not able to be linked
warning: N13 was not able to be linked
warning: He4 was not able to be linked
warning: O14 was not able to be linked
warning: Ne20 was not able to be linked
warning: C13 was not able to be linked
warning: N15 was not able to be linked
warning: p was not able to be linked
warning: O16 was not able to be linked
warning: N14 was not able to be linked
modifying N13 ⟶ p + C12 from C12 + p ⟶ N13 + 𝛾
modifying N14 ⟶ p + C13 from C13 + p ⟶ N14 + 𝛾
modifying O14 ⟶ p + N13 from N13 + p ⟶ O14 + 𝛾
modifying O15 ⟶ p + N14 from N14 + p ⟶ O15 + 𝛾
modifying O16 ⟶ p + N15 from N15 + p ⟶ O16 + 𝛾
modifying O16 ⟶ He4 + C12 from C12 + He4 ⟶ O16 + 𝛾
modifying F17 ⟶ p + O16 from O16 + p ⟶ F17 + 𝛾
modifying F18 ⟶ p + O17 from O17 + p ⟶ F18 + 𝛾
modifying F18 ⟶ He4 + N14 from N14 + He4 ⟶ F18 + 𝛾
modifying F19 ⟶ p + O18 from O18 + p ⟶ F19 + 𝛾
modifying F19 ⟶ He4 + N15 from N15 + He4 ⟶ F19 + 𝛾
modifying Ne18 ⟶ p + F17 from F17 + p ⟶ Ne18 + 𝛾
modifying Ne18 ⟶ He4 + O14 from O14 + He4 ⟶ Ne18 + 𝛾
modifying Ne19 ⟶ p + F18 from F18 + p ⟶ Ne19 + 𝛾
modifying Ne19 ⟶ He4 + O15 from O15 + He4 ⟶ Ne19 + 𝛾
modifying Ne20 ⟶ p + F19 from F19 + p ⟶ Ne20 + 𝛾
modifying Ne20 ⟶ He4 + O16 from O16 + He4 ⟶ Ne20 + 𝛾
modifying Ne21 ⟶ He4 + O17 from O17 + He4 ⟶ Ne21 + 𝛾
modifying C12 ⟶ 3 He4 from 3 He4 ⟶ C12 + 𝛾
modifying C12 + He4 ⟶ p + N15 from N15 + p ⟶ He4 + C12
modifying N14 + He4 ⟶ p + O17 from O17 + p ⟶ He4 + N14
modifying N15 + He4 ⟶ p + O18 from O18 + p ⟶ He4 + N15
modifying O15 + He4 ⟶ p + F18 from F18 + p ⟶ He4 + O15
modifying O16 + p ⟶ He4 + N13 from N13 + He4 ⟶ p + O16
modifying O16 + He4 ⟶ p + F19 from F19 + p ⟶ He4 + O16
modifying F17 + p ⟶ He4 + O14 from O14 + He4 ⟶ p + F17
modifying F17 + He4 ⟶ p + Ne20 from Ne20 + p ⟶ He4 + F17
modifying Ne20 + He4 ⟶ C12 + C12 from C12 + C12 ⟶ He4 + Ne20
modifying Ne21 + p ⟶ He4 + F18 from F18 + He4 ⟶ p + Ne21
Tip
By default, network_helper
will create a PythonNetwork
, but
this can be changed via the network_type
argument.
type(net)
pynucastro.networks.python_network.PythonNetwork
By default, network_helper
will look at both ReacLibLibrary
and TabularLibrary
to find rates. The warnings we see above about not being able to link nuclei are from the TabularLibrary
, since those nuclei do not have tabulated weak rates.
fig = net.plot(rotated=True, hide_xalpha=True)

We can see that it is using some tabulated weak rates for some links:
net.summary()
Network summary
---------------
explicitly carried nuclei: 19
approximated-out nuclei: 0
inert nuclei (included in carried): 0
total number of rates: 69
rates explicitly connecting nuclei: 69
hidden rates: 0
reaclib rates: 32
tabular rates: 8
approximate rates: 0
derived rates: 29
modified rates: 0
custom rates: 0
We can highlight these weak rates in the plot
fig = net.plot(rotated=True, hide_xalpha=True,
highlight_filter_function=lambda r: isinstance(r, pyna.rates.TabularRate))

Also notice that network_helper
includes both the forward and reverse rates for all links.
The notebooks following show how to have finer control when creating a network, allowing you to manually filter rates from libraries, remove duplicates, compute reverse rates, and introduce approximations.