pynucastro.rates.tabular_rate module#
Classes and methods for describing a reaction rate that is tabulated in terms of electron density and temperature.
- class pynucastro.rates.tabular_rate.TableIndex(*values)[source]#
Bases:
EnumAn enum-like container for indexing the electron-capture tables.
- DQ = 3#
- GAMMA = 7#
- MU = 2#
- NU = 6#
- RATE = 5#
- RHOY = 0#
- T = 1#
- VS = 4#
- class pynucastro.rates.tabular_rate.TableInterpolator(*args, **kwargs)[source]#
Bases:
TableInterpolatorA class that holds a pointer to the table data and methods that allow us to interpolate a variable
- Parameters:
table_rhoy_lines (int) – the number of the (ρ Y_e) values where the rate is tabulated
table_temp_lines (int) – the number of T values where the rate is tabulated
table_data (numpy.ndarray) – a 2D array giving the tabulated rate data of the form (index, component) where index is a 1D flattened representation of (rhoY, T).
- class_type = jitclass.TableInterpolator#7fe906e35a30<data:array(float64, 2d, A),table_rhoy_lines:int32,table_temp_lines:int32,rhoy:array(float64, 1d, A),temp:array(float64, 1d, A)>#
- class pynucastro.rates.tabular_rate.TabularRate(*args, **kwargs)[source]#
Bases:
TabularWeakRateA rate tabulated in terms of log10(ρ Y_e) and log10(T).
Deprecated since version 3.0:
TabularRatehas been deprecated. UseTabularWeakRateinstead.TabularRatewill be removed in version 3.1.- Parameters:
rfile (str, pathlib.Path, io.StringIO) – the file containing the data table
- class pynucastro.rates.tabular_rate.TabularWeakRate(rfile=None)[source]#
Bases:
RateA rate tabulated in terms of log10(ρ Y_e) and log10(T).
- Parameters:
rfile (str, pathlib.Path, io.StringIO) – the file containing the data table
- eval_jacobian_term(state, y_i, *, screen_func=None)[source]#
Evaluate ∂flux/∂(y_i), the derivative of the rate with respect to
y_i. This flux term has the full composition dependence, i.e., for a decay rate:flux = Y(p) λ(ρY_e, T)
where p is the parent nucleus. Note that there are 2 contributions,
∂flux/∂(y_i) = δ_{ip} λ + Y(p) ρ ∂λ/∂(ρY_e) Z_i
where we used ∂Y_e/∂Y_i = Z_i
- Parameters:
state (ThermoState) – ThermoState containing relevant thermodynamic information used to evaluate rates. It knows about (rho, T, composition).
y_i (Nucleus) – the nucleus we are differentiating with respect to
screen_func (Callable) – Screening doesn’t apply for electron-capture / decay rates, but we include the argument here to ensure the interface is standard.
- Return type:
- function_string_cxx(dtype='double', specifiers='inline', leave_open=False, extra_args=None)[source]#
Return a string containing the C++ function that computes the rate
- Parameters:
dtype (str) – The C++ datatype to use for all declarations
specifiers (str) – C++ specifiers to add before each function declaration (i.e. “inline”)
leave_open (bool) – If
true, then we leave the function unclosed (no “}” at the end). This can allow additional functions to add to this output.extra_args (list, tuple) – A list of strings representing additional arguments that should be appended to the argument list when defining the function interface.
- Return type:
- get_drate_drhoye(state)[source]#
Evaluate the ∂λ/∂(ρY_e) for the rate.
- Parameters:
state (ThermoState) – ThermoState containing relevant thermodynamic information used to evaluate the rate derivative loss. It knows about (rho, T, composition).
- Return type:
- get_nu_loss(state)[source]#
Evaluate the neutrino loss for the rate.
- Parameters:
state (ThermoState) – ThermoState containing relevant thermodynamic information used to evaluate neutrino loss. It knows about (rho, T, composition).
- Return type:
- log_eval(T, *, rho=None, comp=None, screen_func=None)[source]#
Evaluate the natural log of the reaction rate.
- Parameters:
T (float) – the temperature to evaluate the rate at
rho (float) – the density to evaluate the rate at.
comp (float) – the composition (of type
Composition) to evaluate the rate with.screen_func (Callable) – one of the screening functions from
pynucastro.screening– if provided, then the rate will include screening correction. Unused for Tabular weak rates since screening does not affect weak reactions.
- Return type:
- plot(*, Tmin=None, Tmax=None, rhoYmin=None, rhoYmax=None, color_field='rate', figsize=(10, 10))[source]#
Plot the rate or neutrino loss in the log10(ρ Y_e) and log10(T) plane.
- Parameters:
Tmin (float) – minimum temperature for the plot
Tmax (float) – maximum temperature for the plot
rhoYmin (float) – minimum (ρ Y_e) for the plto
rhoYmax (float) – maximum (ρ Y_e) for the plto
color_field (str) – the field to plot. Possible values are “rate” or “nu_loss”
figsize (tuple) – the horizontal, vertical size (in inches) for the plot
- Return type: