tardis.transport.montecarlo.formal_integral_cuda module¶
- exception tardis.transport.montecarlo.formal_integral_cuda.BoundsError[source]¶
Bases:
IndexError
Used to check bounds in reverse binary search
- class tardis.transport.montecarlo.formal_integral_cuda.CudaFormalIntegrator(geometry, time_explosion, plasma, points=1000)[source]¶
Bases:
object
Helper class for performing the formal integral with CUDA.
- tardis.transport.montecarlo.formal_integral_cuda.calculate_p_values(R_max, N)[source]¶
Calculates the p values of N
- Parameters:
- R_maxfloat64
- Nint64
- Returns:
- float64
- tardis.transport.montecarlo.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.transport.montecarlo.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, L, 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)
self.geometry.r_inner
- r_outerarray(float64, 1d, C)
self.geometry.r_outer
- time_explosion: float64
self.geometry.time_explosion
- line_list_nuarray(float64, 1d, A)
self.plasma.line_list_nu
- iTnp.float64
- inunp.float64
- inu_sizeint64
- att_S_ularray(float64, 1d, C)
- Jred_luarray(float64, 1d, C)
- Jblue_luarray(float64, 1d, C)
- tau_sobolevarray(float64, 2d, C)
- electron_densityarray(float64, 1d, C)
- Nint64
- Larray(float64, 1d, C)
This is where the results will be stored
- pparray(float64, 1d, C)
- exp_tauarray(float64, 1d, C)
- I_nu array(floatt64, 2d, C)
- zarray(float64, 2d, C)
- shell_idarray(int64, 2d, C)
- tardis.transport.montecarlo.formal_integral_cuda.intensity_black_body_cuda(nu, temperature)[source]¶
Calculate the blackbody intensity.
- Parameters:
- nufloat64
frequency
- temperaturefloat64
Temperature
- Returns:
- float64
- tardis.transport.montecarlo.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.transport.montecarlo.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.transport.montecarlo.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