tardis.spectrum.formal_integral.formal_integral_numba module

class tardis.spectrum.formal_integral.formal_integral_numba.NumbaFormalIntegrator(geometry, time_explosion, plasma, points=1000)[source]

Bases: object

Helper class for performing the formal integral with numba.

formal_integral(iT, inu, inu_size, att_S_ul, Jred_lu, Jblue_lu, tau_sobolev, electron_density, N)[source]

Simple wrapper for the numba implementation of the formal integral

tardis.spectrum.formal_integral.formal_integral_numba.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_explosion is needed to norm to unit-length

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.spectrum.formal_integral.formal_integral_numba.numba_formal_integral(geometry, time_explosion, plasma, iT, inu, inu_size, att_S_ul, Jred_lu, Jblue_lu, tau_sobolev, electron_density, N)[source]
Returns:
Lfloat64 array

integrated luminosities

I_nu_pfloat64 2D array

intensities at each p-ray multiplied by p frequency x p-ray grid

tardis.spectrum.formal_integral.formal_integral_numba.populate_z(geometry, time_explosion, 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

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

tardis.spectrum.formal_integral.formal_integral_numba.trapezoid_integration(array, h)[source]

in the future, let’s just replace this with the numpy trapz since it is numba compatable