NuRadioMC.SignalProp.radioproparaytracing module
- class NuRadioMC.SignalProp.radioproparaytracing.radiopropa_ray_tracing(medium, attenuation_model='SP1', log_level=30, n_frequencies_integration=100, n_reflections=0, config=None, detector=None)[source]
Bases:
ray_tracing_base
Numerical raytracing using Radiopropa. Currently this only works for icemodels that have only changing refractive index in z. More information on RadioPropa and how to install it can be found at https://github.com/nu-radio/RadioPropa
Methods
apply_propagation_effects
(efield, i_solution)Apply propagation effects to the electric field Note that the 1/r weakening of the electric field is already accounted for in the signal generation
find all solutions between X1 and X2
get_attenuation
(iS, frequency[, ...])calculates the signal attenuation due to attenuation in the medium (ice)
Function that returns the configuration currently used by the raytracer
calculates the correction of the path length of solution iS due to the sphere around the channel
calculates the correction of the travel time of solution iS due to the sphere around the channel
get_focusing
(iS[, dz, limit])calculate the focusing effect in the medium
get_frequencies_for_attenuation
(frequency, ...)helper function to get the frequencies for applying attenuation
calculates the launch vector (in 3D) of solution iS
get_launch_vector_analytic
(iS[, ref_index_model])calculates the launch vector (in 3D) of solution iS (of the analytical ray tracer)
Function that returns the maximum number of raytracing solutions that can exist between each given pair of start and end points
returns the number of solutions
Returns a list with information about parameters to include in the output data structure that are specific to this raytracer
get_path
(iS[, n_points])function that returns the 3D ray tracing path of solution iS
get_path_candidate
(candidate)helper function that returns the 3D ray tracing path of a candidate
get_path_length
(iS)calculates the path length of solution iS
get_raytracing_output
(i_solution)Write parameters that are specific to this raytracer into the output data.
calculates the receive vector (in 3D) of solution iS
calculates the angle of reflection at the surface (in case of a reflected ray)
returns the type of the solution
get_travel_time
(iS)calculates the travel time of solution iS
checks if ray tracing solution exists
raytracer_birefringence
(launch_v, spec, s_rate)Function for the time trace propagation according to the polarization change due to birefringence.
raytracer_iterative
([n_reflections])Uses RadioPropa to find all the numerical ray tracing solutions between sphere X1 and X2.
raytracer_minimizer
([n_reflections])Uses RadioPropa to find all the numerical ray tracing solutions between sphere x1 and x2.
Resets the raytracing solutions back to None.
set_config
(config)Function to change the configuration file used by the raytracer
Set a cut on the viewing angle around the cherenkov angle.
set_iterative_sphere_sizes
([sphere_sizes])Set the sphere_sizes for the iterative ray tracer
set_iterative_step_sizes
([step_zeniths])Set the steps_sizes for the iterative ray tracer
set_maximum_trajectory_length
(max_traj_length)Set a cut on the trajectory length.
set_shower_axis
(shower_axis)Set the the shower axis.
set_solutions
(raytracing_results)Read an already calculated raytracing solution from the input array
set_start_and_end_point
(x1, x2)Set the start and end points of the raytracing
use_optional_function
(function_name, *args, ...)Use optional function which may be different for each ray tracer.
activate_auto_step_size
deactivate_auto_step_size
delta_theta_bottom
delta_theta_reflective
get_results
set_minimizer_tolerance
class initilization
- Parameters:
- medium: medium class
class describing the index-of-refraction profile
- attenuation_model: string
signal attenuation model
- log_level: logging object
specify the log level of the ray tracing class
logging.ERROR
logging.WARNING
logging.INFO
logging.DEBUG
default is WARNING
- n_frequencies_integration: int
the number of frequencies for which the frequency dependent attenuation length is being calculated. The attenuation length for all other frequencies is obtained via linear interpolation.
- n_reflections: int (default 0)
in case of a medium with a reflective layer at the bottom, how many reflections should be considered
- config: dict or None
- a dictionary with the optional config settings. If None, the default config is used:
config[‘propagation’][‘attenuate_ice’] = True config[‘propagation’][‘focusing_limit’] = 2 config[‘propagation’][‘focusing’] = False config[‘propagation’][‘birefringence’] = False config[‘speedup’][‘delta_C_cut’] = 40 * units.degree config[‘propagation’][‘radiopropa’][‘mode’] = ‘iterative’ config[‘propagation’][‘radiopropa’][‘max_traj_length’] = 10000 config[‘propagation’][‘radiopropa’][‘iter_steps_channel’] = [25., 2., .5] config[‘propagation’][‘radiopropa’][‘auto_step_size’] = False config[‘propagation’][‘radiopropa’][‘iter_steps_zenith’] = [.5, .05, .005]
- detector: detector object
Methods
apply_propagation_effects
(efield, i_solution)Apply propagation effects to the electric field Note that the 1/r weakening of the electric field is already accounted for in the signal generation
find all solutions between X1 and X2
get_attenuation
(iS, frequency[, ...])calculates the signal attenuation due to attenuation in the medium (ice)
Function that returns the configuration currently used by the raytracer
calculates the correction of the path length of solution iS due to the sphere around the channel
calculates the correction of the travel time of solution iS due to the sphere around the channel
get_focusing
(iS[, dz, limit])calculate the focusing effect in the medium
get_frequencies_for_attenuation
(frequency, ...)helper function to get the frequencies for applying attenuation
calculates the launch vector (in 3D) of solution iS
get_launch_vector_analytic
(iS[, ref_index_model])calculates the launch vector (in 3D) of solution iS (of the analytical ray tracer)
Function that returns the maximum number of raytracing solutions that can exist between each given pair of start and end points
returns the number of solutions
Returns a list with information about parameters to include in the output data structure that are specific to this raytracer
get_path
(iS[, n_points])function that returns the 3D ray tracing path of solution iS
get_path_candidate
(candidate)helper function that returns the 3D ray tracing path of a candidate
get_path_length
(iS)calculates the path length of solution iS
get_raytracing_output
(i_solution)Write parameters that are specific to this raytracer into the output data.
calculates the receive vector (in 3D) of solution iS
calculates the angle of reflection at the surface (in case of a reflected ray)
returns the type of the solution
get_travel_time
(iS)calculates the travel time of solution iS
checks if ray tracing solution exists
raytracer_birefringence
(launch_v, spec, s_rate)Function for the time trace propagation according to the polarization change due to birefringence.
raytracer_iterative
([n_reflections])Uses RadioPropa to find all the numerical ray tracing solutions between sphere X1 and X2.
raytracer_minimizer
([n_reflections])Uses RadioPropa to find all the numerical ray tracing solutions between sphere x1 and x2.
Resets the raytracing solutions back to None.
set_config
(config)Function to change the configuration file used by the raytracer
Set a cut on the viewing angle around the cherenkov angle.
set_iterative_sphere_sizes
([sphere_sizes])Set the sphere_sizes for the iterative ray tracer
set_iterative_step_sizes
([step_zeniths])Set the steps_sizes for the iterative ray tracer
set_maximum_trajectory_length
(max_traj_length)Set a cut on the trajectory length.
set_shower_axis
(shower_axis)Set the the shower axis.
set_solutions
(raytracing_results)Read an already calculated raytracing solution from the input array
set_start_and_end_point
(x1, x2)Set the start and end points of the raytracing
use_optional_function
(function_name, *args, ...)Use optional function which may be different for each ray tracer.
activate_auto_step_size
deactivate_auto_step_size
delta_theta_bottom
delta_theta_reflective
get_results
set_minimizer_tolerance
- reset_solutions()[source]
Resets the raytracing solutions back to None. This is useful to do in the loop before a new raytracing is prepared.
- set_start_and_end_point(x1, x2)[source]
Set the start and end points of the raytracing
- Parameters:
- x1: 3dim np.array
start point of the ray
- x2: 3dim np.array
stop point of the ray
- set_shower_axis(shower_axis)[source]
Set the the shower axis. This is oposite to the neutrino arrival direction
- Parameters:
- shower_axis: np.array of shape (3,), default unit
the direction of the shower in cartesian coordinates
- set_iterative_sphere_sizes(sphere_sizes=None)[source]
Set the sphere_sizes for the iterative ray tracer
- Parameters:
- sphere_sizes: np.array of size (n,), default unit
the sphere size used by the iterative ray tracer iteration from big to small observer around channel
- set_iterative_step_sizes(step_zeniths=None)[source]
Set the steps_sizes for the iterative ray tracer
- Parameters:
- sphere_sizes: np.array of size (n,), default unit
the sphere size used by the iterative ray tracer iteration from big to small observer around channel
- step_zeniths: np.array size (n,), default unit
the step size for theta used by the iterative ray tracer corresponding to the sphere size, should have same lenght as _sphere_sizes
- auto_step: boolean
defines whether or not an automatic step_size should be calculated for each sphere_size depending on the horizontal distance of the event
- set_cut_viewing_angle(cut)[source]
Set a cut on the viewing angle around the cherenkov angle. Rays with a viewing angle out of this range will be to dim and won’t be seen –> limiting computing time
- Parameters:
- cut: float, default unit
range around the cherenkov angle
- set_maximum_trajectory_length(max_traj_length)[source]
Set a cut on the trajectory length. Otherwise computing infinite may be possible
- Parameters:
- max_traj_length: float, default units
maxmimal length to trace a ray. tracing aborted when reached
- raytracer_iterative(n_reflections=0)[source]
Uses RadioPropa to find all the numerical ray tracing solutions between sphere X1 and X2. If reflections is bigger than 0, also bottom reflected rays are searched for with a max of n_reflections of the bottom
- raytracer_birefringence(launch_v, spec, s_rate, bire_model='A')[source]
Function for the time trace propagation according to the polarization change due to birefringence. The trace propagation is explained in this paper: https://link.springer.com/article/10.1140/epjc/s10052-023-11238-y RadioPropa propagates an electric field through the correct solution of the ray path. To use add to the config.yaml file: propagation: module: radiopropa ice_model: southpole_2015 birefringence: True
- Parameters:
- launch_v: 3d array
launch vector calculated by a previous analytical or numerical ray tracing algorithm
- spec: numpy array
frequency spectrum of the electric field
- s_rate: float
sampling rate of the electric field
- bire_model: string
choose the interpolation to fit the measured refractive index data options include (A, B, C, D, E) description can be found under: NuRadioMC/NuRadioMC/utilities/birefringence_models/model_description
- Returns:
- E_field: np.ndarray([eR, eTheta, ePhi])
[0] - eR - final frequency spectrum of the radial component after birefringence propagation [1] - eTheta - final frequency spectrum of the theta componentnt after birefringence propagation [2] - ePhi - final frequency spectrum of the phi component after birefringence propagation
- raytracer_minimizer(n_reflections=0)[source]
Uses RadioPropa to find all the numerical ray tracing solutions between sphere x1 and x2. Tracer does not work for reflective bottoms or secondary creation at the moment, it only allows for 2 solutions at the moment which should also be further improved.
- set_solutions(raytracing_results)[source]
Read an already calculated raytracing solution from the input array
- Parameters:
- raytracing_results: dict
The dictionary containing the raytracing solution.
- get_path_candidate(candidate)[source]
helper function that returns the 3D ray tracing path of a candidate
- Parameters:
- candidate: radiopropa.candidate
- Returns:
- path: 2dim np.array of shape (n,3)
x, y, z coordinates along second axis
- get_path(iS, n_points=None)[source]
function that returns the 3D ray tracing path of solution iS
- Parameters:
- iS: int
ray tracing solution
- n_points: int
number of points of path if none, the original calculated path is returned
- Returns:
- path: 2dim np.array of shape (n_points,3)
x, y, z coordinates along second axis
- get_solution_type(iS)[source]
returns the type of the solution
- Parameters:
- iS: int
choose for which solution to compute the solution type, counting starts at zero
- Returns:
- solution_type: int
integer corresponding to the types in the dictionary solution_types
- get_launch_vector_analytic(iS, ref_index_model='southpole_2015')[source]
calculates the launch vector (in 3D) of solution iS (of the analytical ray tracer)
- Parameters:
- iS: int
choose for which solution to compute the launch vector, counting starts at zero
- ref_index_model:
choose the ice model for the analytic ray tracer southpole_2015
- Returns:
- launch_vector: np.array of shape (3,)
the launch vector
- get_launch_vector(iS)[source]
calculates the launch vector (in 3D) of solution iS
- Parameters:
- iS: int
choose for which solution to compute the launch vector, counting starts at zero
- Returns:
- launch_vector: np.array of shape (3,)
the launch vector
- get_receive_vector(iS)[source]
calculates the receive vector (in 3D) of solution iS
- Parameters:
- iS: int
choose for which solution to compute the receive vector, counting starts at zero
- Returns:
- receive_vector: np.array of shape (3,)
the receive vector
- get_reflection_angle(iS)[source]
calculates the angle of reflection at the surface (in case of a reflected ray)
- Parameters:
- iS: int
choose for which solution to compute the reflection angle, counting starts at zero
- Returns:
- reflection_angle: 1dim np.array
the reflection angle (for reflected rays) or None for direct and refracted rays
- get_correction_path_length(iS)[source]
calculates the correction of the path length of solution iS due to the sphere around the channel
- Parameters:
- iS: int
choose for which solution to compute the path length correction, counting starts at zero
- Returns:
- distance: float
distance that should be added to the path length
- get_correction_travel_time(iS)[source]
calculates the correction of the travel time of solution iS due to the sphere around the channel
- Parameters:
- iS: int
choose for which solution to compute the travel time correction, counting starts at zero
- Returns:
- distance: float
distance that should be added to the path length
- get_path_length(iS)[source]
calculates the path length of solution iS
- Parameters:
- iS: int
choose for which solution to compute the path length, counting starts at zero
- Returns:
- distance: float
distance from X1 to X2 along the ray path
- get_travel_time(iS)[source]
calculates the travel time of solution iS
- Parameters:
- iS: int
choose for which solution to compute the travel time, counting starts at zero
- Returns:
- time: float
travel time
- get_frequencies_for_attenuation(frequency, max_detector_freq)[source]
helper function to get the frequencies for applying attenuation
- Parameters:
- frequency: array of float of dim (n,)
frequencies of the signal
- max_detector_freq: float or None
the maximum frequency of the final detector sampling (the simulation is internally run with a higher sampling rate, but the relevant part of the attenuation length calculation is the frequency interval visible by the detector, hence a finer calculation is more important)
- Returns:
- freqs: array of float of dim (m,)
the frequencies for which the attenuation is calculated
- get_attenuation(iS, frequency, max_detector_freq=None)[source]
calculates the signal attenuation due to attenuation in the medium (ice)
- Parameters:
- iS: int
choose for which solution to compute the attenuation, counting starts at zero
- frequency: array of floats
the frequencies for which the attenuation is calculated
- max_detector_freq: float or None
the maximum frequency of the final detector sampling (the simulation is internally run with a higher sampling rate, but the relevant part of the attenuation length calculation is the frequency interval visible by the detector, hence a finer calculation is more important)
- Returns:
- attenuation: array of floats
the fraction of the signal that reaches the observer (only ice attenuation, the 1/R signal falloff not considered here)
- get_focusing(iS, dz=-0.01, limit=2.0)[source]
calculate the focusing effect in the medium
- Parameters:
- iS: int
choose for which solution to compute the launch vector, counting starts at zero
- dz: float
the infinitesimal change of the depth of the receiver, 1cm by default
- Returns:
- focusing: a float
gain of the signal at the receiver due to the focusing effect
- apply_propagation_effects(efield, i_solution)[source]
Apply propagation effects to the electric field Note that the 1/r weakening of the electric field is already accounted for in the signal generation
- Parameters:
- efield: ElectricField object
The electric field that the effects should be applied to
- i_solution: int
Index of the raytracing solution the propagation effects should be based on
- Returns:
- efield: ElectricField object
The modified ElectricField object
- get_output_parameters()[source]
Returns a list with information about parameters to include in the output data structure that are specific to this raytracer
! be sure that the first entry is specific to your raytracer !
- Returns:
- list with entries of form [{‘name’: str, ‘ndim’: int}]
! be sure that the first entry is specific to your raytracer ! ‘name’: Name of the new parameter to include in the data structure ‘ndim’: Dimension of the data structure for the parameter
- get_raytracing_output(i_solution)[source]
Write parameters that are specific to this raytracer into the output data.
- Parameters:
- i_solution: int
The index of the raytracing solution
- Returns:
- dictionary with the keys matching the parameter names specified in get_output_parameters and the values being
- the results from the raytracing
- set_config(config)[source]
Function to change the configuration file used by the raytracer
- Parameters:
- config: dict
The new configuration settings
- get_config()
Function that returns the configuration currently used by the raytracer
- get_number_of_raytracing_solutions()
Function that returns the maximum number of raytracing solutions that can exist between each given pair of start and end points
- get_number_of_solutions()
returns the number of solutions
- get_results()
- has_solution()
checks if ray tracing solution exists
- use_optional_function(function_name, *args, **kwargs)
Use optional function which may be different for each ray tracer. If the name of the function is not present for the ray tracer this function does nothing.
- Parameters:
- function_name: string
name of the function to use
- *args: type of the argument required by function
all the neseccary arguments for the function separated by a comma
- **kwargs: type of keyword argument of function
all all the neseccary keyword arguments for the function in the form of key=argument and separated by a comma
Examples
use_optional_function('set_shower_axis',np.array([0,0,1])) use_optional_function('set_iterative_sphere_sizes',sphere_sizes=np.aray([3,1,.5]))