tardis.montecarlo.montecarlo_numba.formal_integral module¶
- exception tardis.montecarlo.montecarlo_numba.formal_integral.BoundsError[source]¶
Bases:
ValueError
- class tardis.montecarlo.montecarlo_numba.formal_integral.FormalIntegrator(model, plasma, runner, points=1000)[source]¶
Bases:
object
Class containing the formal integrator
- check(raises=True)[source]¶
A method that determines if the formal integral can be performed with the current configuration settings
The function returns False if the configuration conflicts with the required settings. If raises evaluates to True, then a IntegrationError is raised instead
- generate_numba_objects()[source]¶
instantiate the numba interface objects needed for computing the formal integral
- make_source_function()[source]¶
Calculates the source function using the line absorption rate estimator Edotlu_estimator
Formally it calculates the expression ( 1 - exp(-tau_ul) ) S_ul but this product is what we need later, so there is no need to factor out the source function explicitly.
- Parameters
- modeltardis.model.Radial1DModel
- Returns
- Numpy array containing ( 1 - exp(-tau_ul) ) S_ul ordered by wavelength of the transition u -> l
- exception tardis.montecarlo.montecarlo_numba.formal_integral.IntegrationError[source]¶
Bases:
Exception
- tardis.montecarlo.montecarlo_numba.formal_integral.calculate_p_values(R_max, N)[source]¶
This can probably be replaced with a simpler function
- tardis.montecarlo.montecarlo_numba.formal_integral.calculate_z(r, p, inv_t)[source]¶
Calculate distance to p line
Calculate half of the length of the p-line inside a shell of radius r in terms of unit length (c * t_exp). If shell and p-line do not intersect, return 0.
- Inputs:
- r
(double) radius of the shell
- p
(double) distance of the p-line to the center of the supernova
- inv_t
(double) inverse time_explosio is needed to norm to unit-length
- tardis.montecarlo.montecarlo_numba.formal_integral.intensity_black_body(nu, T)[source]¶
Get the black body intensity at frequency nu and temperature T
- tardis.montecarlo.montecarlo_numba.formal_integral.line_search(nu, nu_insert, number_of_lines)[source]¶
Insert a value in to an array of line frequencies
- Inputs:
- nu
(array) line frequencies
- nu_insert
(int) value of nu key
- number_of_lines
(int) number of lines in the line list
- Outputs:
- index of the next line ot the red.
- If the key value is redder
than the reddest line returns number_of_lines.
- tardis.montecarlo.montecarlo_numba.formal_integral.numba_formal_integral(model, plasma, iT, inu, inu_size, att_S_ul, Jred_lu, Jblue_lu, tau_sobolev, electron_density, N)[source]¶
model, plasma, and estimator are the numba variants
- tardis.montecarlo.montecarlo_numba.formal_integral.populate_z(model, p, oz, oshell_id)[source]¶
Calculate p line intersections
This function calculates the intersection points of the p-line with each shell
- Inputs:
- p
(double) distance of the integration line to the center
- oz
(array of doubles) will be set with z values. the array is truncated by the value 1.
- oshell_id
(int64) will be set with the corresponding shell_ids
- tardis.montecarlo.montecarlo_numba.formal_integral.reverse_binary_search(x, x_insert, imin, imax)[source]¶
Look for a place to insert a value in an inversely sorted float array.
- Inputs:
- x
(array) an inversely (largest to lowest) sorted float array
- x_insert
(value) a value to insert
- imin
(int) lower bound
- imax
(int) upper bound
- Outputs:
index of the next boundary to the left