pynucastro.rates.library module#
- class pynucastro.rates.library.FFNLibrary[source]#
Bases:
TabularLibrary
Create a
Library
containing all of the tabular rates inside the “ffn” subdirectory.
- class pynucastro.rates.library.LangankeLibrary[source]#
Bases:
TabularLibrary
Create a
Library
containing all of the tabular rates inside the “langanke” subdirectory.
- class pynucastro.rates.library.Library(libfile=None, rates=None)[source]#
Bases:
object
A Library is a container storing multiple rates that allows for filtering rates based on rules, managing duplicate rates, and selecting subsets of rates based on properties. At its heart is a
dict
of rates keyed by the rate id.A library may contain rates from a single source, or be created by adding or subtracting existing Library objects.
- Parameters:
- add_rate(rate)[source]#
Manually add a rate to the library.
- Parameters:
rate (Rate) – The rate to add
- backward()[source]#
Select only the reverse rates, obtained by detailed balance. Note: “reverse” here means that it was derived by detailed balance, and not that Q < 0.
- Return type:
- derived_backward(compute_Q=False, use_pf=False)[source]#
Loop over all of the forward rates that can be used to derive inverse rates (as returned by
forward_for_detailed_balance()
) and derive the inverses, potentially taking into account the partition function and recomputing Q.
- filter(filter_spec)[source]#
Filter the rates in the library based on a set of rules.
- Parameters:
filter_spec (RateFilter, list) – a filter (or list of filters) to apply to the library to define a subset of rates.
- Return type:
- find_duplicate_links()[source]#
Find instances of multiple rates having the same reactants and products. These may not be the same Rate object (e.g., one could be tabular the other a simple decay), but they will present themselves in the network as the same link.
- Returns:
duplicate_rates – a list where each entry is a list of all the rates that share the same link.
- Return type:
- forward()[source]#
Select only the forward rates, discarding the inverse rates obtained by detailed balance. Note: “forward” here means that it is not a reverse rate derived from detailed balance, and does not necessarily mean Q > 0.
- Return type:
- forward_for_detailed_balance()[source]#
Loop over the forward rates (as filtered by
forward()
) and return those that can be used to derive reverse rates via detailed balance. This means that they cannot be tabular or weak rates.- Return type:
- get_rate_by_name(name)[source]#
Given a string representing a rate in the form ‘A(x,y)B’ (or a list of strings for multiple rates) return the Rate objects that match from the Library. If there are multiple inputs, then a list of Rate objects is returned.
- get_rate_by_nuclei(reactants, products)[source]#
Given a list of reactants and products, return any matching rates
- linking_nuclei(nuclist, *, with_reverse=True, print_warning=True)[source]#
Return a library containing the rates linking the list of nuclei passed in.
- class pynucastro.rates.library.RateFilter(reactants=None, products=None, exact=True, reverse=None, min_reactants=None, max_reactants=None, min_products=None, max_products=None, filter_function=None)[source]#
Bases:
object
RateFilter filters out a specified rate or set of rates A RateFilter stores selection rules specifying a rate or group of rates to assist in searching for rates stored in a Library.
- class pynucastro.rates.library.ReacLibLibrary[source]#
Bases:
Library
Create a
Library
containing all of the rates in the latest stored version of the ReacLib library.
- class pynucastro.rates.library.SuzukiLibrary[source]#
Bases:
TabularLibrary
Create a
Library
containing all of the tabular rates inside the “suzuki” subdirectory.
- class pynucastro.rates.library.TabularLibrary(ordering=None)[source]#
Bases:
Library
Create a
Library
containing all of the tabular rates we know (excluding duplications) across multiple sources.- Parameters:
ordering (list of str) – The list of sources of the rates from lowest to highest precedence. We will read from the first source, and then for any later sources, for any duplicate rates, we will replace the existing rate with the version from the higher-priority library. The default ordering is
["ffn", "langanke", "suzuki"]
- lib_path = PosixPath('/home/runner/work/pynucastro/pynucastro/pynucastro/library/tabular')#