tardis.spectrum.formal_integral.formal_integral_cuda module¶
- exception tardis.spectrum.formal_integral.formal_integral_cuda.BoundsError[source]¶
Bases:
IndexError
Used to check bounds in reverse binary search
- class tardis.spectrum.formal_integral.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.formal_integral_cuda.calculate_impact_parameter_values(radius_max, N)[source]¶
Calculates the impact parameter values of N
- Parameters:
- radius_maxfloat64
- Nint64
- Returns:
- float64
- tardis.spectrum.formal_integral.formal_integral_cuda.calculate_intersection_point_cuda(radius, impact_parameter, inverse_time_explosion)[source]¶
Calculate distance to p line
Calculate half of the length of the p-line inside a shell of radius radius in terms of unit length (c * t_exp). If shell and p-line do not intersect, return 0.
- Parameters:
- radiusfloat64
radius of the shell
- impact_parameterfloat64
distance of the p-line to the center of the supernova
- inverse_time_explosionfloat64
inverse time_explosion is needed to norm to unit-length
- Returns:
- float64
- tardis.spectrum.formal_integral.formal_integral_cuda.cuda_formal_integral(radii_inner, radii_outer, time_explosion, line_list_frequencies, iT, interpolated_frequencies, interpolated_frequencies_size, att_S_ul, Jred_lu, Jblue_lu, tau_sobolev, electron_density, N, impact_parameter_array, exp_tau, intensities_nu, intersection_point, shell_id)[source]¶
The CUDA version of numba_formal_integral that can run on a NVIDIA GPU.
- Parameters:
- radii_innerarray(float64, 1d, C)
inner radius of each shell
- radii_outerarray(float64, 1d, C)
outer radius of each shell
- time_explosion: float64
geometrical explosion time
- line_list_frequenciesarray(float64, 1d, A)
List of line transition frequencies
- iTnp.float64
interpolated temperature in cgs units
- interpolated_frequenciesnp.float64
interpolated frequencies in cgs units
- interpolated_frequencies_sizeint64
size of interpolated_frequencies array
- att_S_ularray(float64, 1d, C)
attenuated 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)
- impact_parameter_arrayarray(float64, 1d, C)
Impact parameter arrays
- exp_tauarray(float64, 1d, C)
$exp{-tau}$ array to speed up computation
- intensities_nuarray(float64, 2d, C)
Radiative intensity per unit frequency per impact parameter
- intersection_pointarray(float64, 2d, C)
Ray intersections with the shells
- shell_idarray(int64, 2d, C)
List of shells for each thread
- tardis.spectrum.formal_integral.formal_integral_cuda.cuda_vector_integrator(luminosity_density, intensities_nu, N, radius_max)[source]¶
The CUDA Vectorized integrator over second axis
- Parameters:
- luminosity_densityarray(float64, 1d, C)
Output Array
- intensities_nuarray(float64, 2d, C)
Input Array
- Nint64
- radius_maxfloat64
- tardis.spectrum.formal_integral.formal_integral_cuda.intensity_black_body_cuda(frequency, temperature)[source]¶
Calculate the blackbody intensity.
- Parameters:
- frequencyfloat64
frequency
- temperaturefloat64
Temperature
- Returns:
- float64
- tardis.spectrum.formal_integral.formal_integral_cuda.line_search_cuda(frequencies, frequencies_insert, number_of_lines)[source]¶
Insert a value in to an array of line frequencies
- Parameters:
- frequencies(array) line frequencies
- frequencies_insert(int) value of frequencies 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.formal_integral_cuda.populate_intersection_points_cuda(radii_inner, radii_outer, time_explosion, impact_parameter, oz, oshell_id)[source]¶
Calculate p line intersections
This function calculates the intersection points of the p-line with each shell
- Parameters:
- radii_innerarray(float64, 1d, C)
- radii_outerarray(float64, 1d, C)
- time_explosionfloat64
- impact_parameterfloat64
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.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