tardis.spectrum.formal_integral_cuda module¶
- exception tardis.spectrum.formal_integral_cuda.BoundsError[source]¶
Bases:
IndexError
Used to check bounds in reverse binary search
- class tardis.spectrum.formal_integral_cuda.CudaFormalIntegrator(geometry, time_explosion, plasma, points=1000)[source]¶
Bases:
object
Helper class for performing the formal integral with CUDA.
- tardis.spectrum.formal_integral_cuda.calculate_p_values(R_max, N)[source]¶
Calculates the p values of N
- Parameters:
- R_maxfloat64
- Nint64
- Returns:
- float64
- tardis.spectrum.formal_integral_cuda.calculate_z_cuda(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.
- Parameters:
- rfloat64
radius of the shell
- pfloat64
distance of the p-line to the center of the supernova
- inv_tfloat64
inverse time_explosio is needed to norm to unit-length
- Returns:
- float64
- tardis.spectrum.formal_integral_cuda.cuda_formal_integral(r_inner, r_outer, time_explosion, line_list_nu, iT, inu, inu_size, att_S_ul, Jred_lu, Jblue_lu, tau_sobolev, electron_density, N, pp, exp_tau, I_nu, z, shell_id)[source]¶
The CUDA version of numba_formal_integral that can run on a NVIDIA GPU.
- Parameters:
- r_innerarray(float64, 1d, C)
inner radius of each shell
- r_outerarray(float64, 1d, C)
outer radius of each shell
- time_explosion: float64
geometrical explosion time
- line_list_nuarray(float64, 1d, A)
List of line transition frequencies
- iTnp.float64
interpolated temperture in cgs units
- inunp.float64
interpolated frequencies in cgs units
- inu_sizeint64
size of inu array
- att_S_ularray(float64, 1d, C)
attentuated source function
- Jred_luarray(float64, 1d, C)
J estimator from red end of the line from lower to upper level
- Jblue_luarray(float64, 1d, C)
J estimator from blue end of the line from lower to upper level
- tau_sobolevarray(float64, 2d, C)
Sobolev Optical depth for each line in each shell
- electron_densityarray(float64, 1d, C)
electron density in each shell
- Nint64
Number of impact parameter values (p)
- Larray(float64, 1d, C)
Luminosity density at each frequency This is where the results will be stored
- pparray(float64, 1d, C)
Impact parameter arrays
- exp_tauarray(float64, 1d, C)
$exp{-tau}$ array to speed up computation
- I_nu array(floatt64, 2d, C)
Radiative intensity per unit frequency per impact parameter
- zarray(float64, 2d, C)
Ray intersections with the shells
- shell_idarray(int64, 2d, C)
List of shells for each thread
- tardis.spectrum.formal_integral_cuda.cuda_vector_integrator(L, I_nu, N, R_max)[source]¶
The CUDA Vectorized integrator over second axis
- Parameters:
- Larray(float64, 1d, C)
Output Array
- I_nuarray(floagt64, 2d, C)
Input Array
- Nint64
- R_maxfloat64
- tardis.spectrum.formal_integral_cuda.intensity_black_body_cuda(nu, temperature)[source]¶
Calculate the blackbody intensity.
- Parameters:
- nufloat64
frequency
- temperaturefloat64
Temperature
- Returns:
- float64
- tardis.spectrum.formal_integral_cuda.line_search_cuda(nu, nu_insert, number_of_lines)[source]¶
Insert a value in to an array of line frequencies
- Parameters:
- nu(array) line frequencies
- nu_insert(int) value of nu key
- number_of_lines(int) number of lines in the line list
- Returns:
- int
index of the next line to the red. If the key value is redder than the reddest line returns number_of_lines.
- tardis.spectrum.formal_integral_cuda.populate_z_cuda(r_inner, r_outer, time_explosion, p, oz, oshell_id)[source]¶
Calculate p line intersections
This function calculates the intersection points of the p-line with each shell
- Parameters:
- r_innerarray(float64, 1d, C)
- r_outerarray(float64, 1d, C)
- pfloat64
distance of the integration line to the center
- ozarray(float64, 1d, C)
will be set with z values. the array is truncated by the value
1
.- oshell_idarray(int64, 1d, C)
will be set with the corresponding shell_ids
- Returns:
- int64
- tardis.spectrum.formal_integral_cuda.reverse_binary_search_cuda(x, x_insert, imin, imax)[source]¶
Find indicies where elements should be inserted to maintain order in an inversely sorted float array.
Find the indices into a sorted array a such that, if the corresponding elements in v were inserted before the indices on the right, the order of a would be preserved.
- Parameters:
- xnp.ndarray(np.float64, 1d, C)
- x_insertfloat64
- iminint
Lower bound
- imaxint
Upper bound
- Returns:
- np.int64
Location of insertion