NuRadioMC.utilities.medium_base module

class NuRadioMC.utilities.medium_base.IceModel(z_air_boundary=0, z_bottom=None)[source]

Bases: object

Base class from which all ice models should inheret

Methods

add_reflective_bottom(refl_z, refl_coef, ...)

function which adds a reflective bottom to your ice model

get_average_index_of_refraction(position1, ...)

returns the average index of refraction between two points Reimplement everytime in the specific model

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Reimplement everytime in the specific model

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa.

get_index_of_refraction(position)

returns the index of refraction at position.

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

initiaion of a basic ice model

The bottom defined here is a boundary condition used in simulations and should always be defined. Note: it is not the same as reflective bottom. The latter can be added using the add_reflective_layer function.

Parameters:
z_air_boundary: float, NuRadio length units

z coordinate of the surface of the glacier

z_bottom: float, NuRadio length units

z coordinate of the bedrock/bottom of the glacier.

Methods

add_reflective_bottom(refl_z, refl_coef, ...)

function which adds a reflective bottom to your ice model

get_average_index_of_refraction(position1, ...)

returns the average index of refraction between two points Reimplement everytime in the specific model

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Reimplement everytime in the specific model

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa.

get_index_of_refraction(position)

returns the index of refraction at position.

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

add_reflective_bottom(refl_z, refl_coef, refl_phase_shift)[source]

function which adds a reflective bottom to your ice model

Parameters:
refl_z: float, NuRadio length units

z coordinate of the bottom reflective layer

refl_coef: float between 0 and 1

fraction of the electric field that gets reflected

refl_phase_shift: float, NuRadio angukar units

phase shoft that the reflected electric field receives

get_index_of_refraction(position)[source]

returns the index of refraction at position. Reimplement everytime in the specific model

Parameters:
position: 3dim np.array

point

Returns:
n: float

index of refraction

get_average_index_of_refraction(position1, position2)[source]

returns the average index of refraction between two points Reimplement everytime in the specific model

Parameters:
position1: 3dim np.array

point

position2: 3dim np.array

point

Returns:
n_average: float

averaged index of refraction between the two points

get_gradient_of_index_of_refraction(position)[source]

returns the gradient of index of refraction at position Reimplement everytime in the specific model

Parameters:
position: 3dim np.array

point

Returns:
n_nabla: (3,) np.array

gradient of index of refraction at the point

get_ice_model_radiopropa()[source]

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa. If no specific model is set by the user it returns the default implemented model using the ‘_compute_default_ice_model_radiopropa’ function.

This seperation allows having the posibility to set a more specific/adjusted radiopropa ice model in case they need it, without losing the access to the default model.

DO NOT OVERRIDE THIS FUNCTION

Returns:
ice: RadioPropaIceWrapper

object holding the radiopropa scalarfield and modules

set_ice_model_radiopropa(ice_model_radiopropa)[source]

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

DO NOT OVERRIDE THIS FUNCTION

Parameters:
ice_model_radioprop: RadioPropaIceWrapper

object holding the radiopropa scalarfield and modules

class NuRadioMC.utilities.medium_base.IceModelSimple(n_ice, delta_n, z_0, z_shift=0, z_air_boundary=0, z_bottom=None)[source]

Bases: IceModel

predefined ice model (to inherit from) with exponential shape

Methods

add_reflective_bottom(refl_z, refl_coef, ...)

function which adds a reflective bottom to your ice model

get_average_index_of_refraction(position1, ...)

returns the average index of refraction between two points Overwrites function of the mother class

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Overwrites function of the mother class

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa.

get_index_of_refraction(position)

returns the index of refraction at position.

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

initiaion of a simple exponential ice model

The bottom defined here is a boundary condition used in simulations and should always be defined. Note: it is not the same as reflective bottom. The latter can be added using the add_reflective_layer function.

The z_shift is a variable introduced to be able to shift the exponential up or down along the z direction. For simple models this is almost never but it is used to construct more complex ice models which rely on exp. profiles also

Parameters:
z_air_boundary: float, NuRadio length units

z coordinate of the surface of the glacier

z_bottom: float, NuRadio length units

z coordinate of the bedrock/bottom of the glacier.

n_ice: float, dimensionless

refractive index of the deep bulk ice

delta_n: float, NuRadio length units

difference between n_ice and the refractive index of the snow at the surface

z_0: float, NuRadio length units

scale depth of the exponential

z_shift: float, NuRadio length units

up or down shift od the exponential profile

Methods

add_reflective_bottom(refl_z, refl_coef, ...)

function which adds a reflective bottom to your ice model

get_average_index_of_refraction(position1, ...)

returns the average index of refraction between two points Overwrites function of the mother class

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Overwrites function of the mother class

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa.

get_index_of_refraction(position)

returns the index of refraction at position.

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

get_index_of_refraction(position)[source]

returns the index of refraction at position. Overwrites function of the mother class

Parameters:
position: 1D (3,) or 2D (n,3) numpy array

Either one position or an array of positions for which the indices of refraction are returned

Returns:
n: float or 1D numpy array (n,)

index of refraction

get_average_index_of_refraction(position1, position2)[source]

returns the average index of refraction between two points Overwrites function of the mother class

Parameters:
position1: 1D (3,) or 2D (n,3) numpy array

Either one position or an array of positions for which the indices of average refraction are returned

position2: 1D (3,) or 2D (n,3) numpy array

Either one position or an array of positions for which the indices of average refraction are returned

Returns:
n_average: float of 1D numpy array (n,)

averaged index of refraction between the two points

get_gradient_of_index_of_refraction(position)[source]

returns the gradient of index of refraction at position Overwrites function of the mother class

Parameters:
position: 1D or 2D numpy array

Either one position or an array of positions for which the gradient of index of refraction is returned

Returns:
n_nabla: 1D (3,) or 2D (n,3) numpy array

gradient of index of refraction at the point

add_reflective_bottom(refl_z, refl_coef, refl_phase_shift)

function which adds a reflective bottom to your ice model

Parameters:
refl_z: float, NuRadio length units

z coordinate of the bottom reflective layer

refl_coef: float between 0 and 1

fraction of the electric field that gets reflected

refl_phase_shift: float, NuRadio angukar units

phase shoft that the reflected electric field receives

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa. If no specific model is set by the user it returns the default implemented model using the ‘_compute_default_ice_model_radiopropa’ function.

This seperation allows having the posibility to set a more specific/adjusted radiopropa ice model in case they need it, without losing the access to the default model.

DO NOT OVERRIDE THIS FUNCTION

Returns:
ice: RadioPropaIceWrapper

object holding the radiopropa scalarfield and modules

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

DO NOT OVERRIDE THIS FUNCTION

Parameters:
ice_model_radioprop: RadioPropaIceWrapper

object holding the radiopropa scalarfield and modules

class NuRadioMC.utilities.medium_base.IceModelBirefringence(bir_model)[source]

Bases: IceModelSimple

predefined birefringence ice model (to inherit from) including different indieces of refraction for differnt directions

Methods

add_reflective_bottom(refl_z, refl_coef, ...)

function which adds a reflective bottom to your ice model

get_average_index_of_refraction(position1, ...)

returns the average index of refraction between two points Overwrites function of the mother class

get_birefringence_index_of_refraction(position)

returns the birefringent index of refraction at any position, no density effects are included at this point.

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Overwrites function of the mother class

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa.

get_index_of_refraction(position)

returns the index of refraction at position.

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

initiaion of a birefringent ice model with an interpolation of the data as described in: https://link.springer.com/article/10.1140/epjc/s10052-023-11238-y

Parameters:
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

Methods

add_reflective_bottom(refl_z, refl_coef, ...)

function which adds a reflective bottom to your ice model

get_average_index_of_refraction(position1, ...)

returns the average index of refraction between two points Overwrites function of the mother class

get_birefringence_index_of_refraction(position)

returns the birefringent index of refraction at any position, no density effects are included at this point.

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Overwrites function of the mother class

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa.

get_index_of_refraction(position)

returns the index of refraction at position.

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

get_birefringence_index_of_refraction(position)[source]

returns the birefringent index of refraction at any position, no density effects are included at this point.

Parameters:
position: 3dim np.array [x, y, z]

position at which the ice model should be evaluated

Returns:
n: list [nx, ny, nz]

index of refraction for every direction

add_reflective_bottom(refl_z, refl_coef, refl_phase_shift)

function which adds a reflective bottom to your ice model

Parameters:
refl_z: float, NuRadio length units

z coordinate of the bottom reflective layer

refl_coef: float between 0 and 1

fraction of the electric field that gets reflected

refl_phase_shift: float, NuRadio angukar units

phase shoft that the reflected electric field receives

get_average_index_of_refraction(position1, position2)

returns the average index of refraction between two points Overwrites function of the mother class

Parameters:
position1: 1D (3,) or 2D (n,3) numpy array

Either one position or an array of positions for which the indices of average refraction are returned

position2: 1D (3,) or 2D (n,3) numpy array

Either one position or an array of positions for which the indices of average refraction are returned

Returns:
n_average: float of 1D numpy array (n,)

averaged index of refraction between the two points

get_gradient_of_index_of_refraction(position)

returns the gradient of index of refraction at position Overwrites function of the mother class

Parameters:
position: 1D or 2D numpy array

Either one position or an array of positions for which the gradient of index of refraction is returned

Returns:
n_nabla: 1D (3,) or 2D (n,3) numpy array

gradient of index of refraction at the point

get_ice_model_radiopropa()

Returns an object holding the radiopropa scalarfield and necessary radiopropa moduldes that define the medium in radiopropa. If no specific model is set by the user it returns the default implemented model using the ‘_compute_default_ice_model_radiopropa’ function.

This seperation allows having the posibility to set a more specific/adjusted radiopropa ice model in case they need it, without losing the access to the default model.

DO NOT OVERRIDE THIS FUNCTION

Returns:
ice: RadioPropaIceWrapper

object holding the radiopropa scalarfield and modules

get_index_of_refraction(position)

returns the index of refraction at position. Overwrites function of the mother class

Parameters:
position: 1D (3,) or 2D (n,3) numpy array

Either one position or an array of positions for which the indices of refraction are returned

Returns:
n: float or 1D numpy array (n,)

index of refraction

set_ice_model_radiopropa(ice_model_radiopropa)

If radiopropa is installed, this function can be used to set a specific RadioPropaIceWrapper object as the ice model used for RadioPropa.

DO NOT OVERRIDE THIS FUNCTION

Parameters:
ice_model_radioprop: RadioPropaIceWrapper

object holding the radiopropa scalarfield and modules

class NuRadioMC.utilities.medium_base.RadioPropaIceWrapper(ice_model_nuradio, scalar_field)[source]

Bases: object

This class holds all the necessary variables for the radiopropa raytracer to work. When radiopropa is installed, this object will automatically be generated for a smooth handeling of the radiopropa ice model.

Methods

add_module(name, module)

add predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers ...) of the ice to the dictionary

get_module(name)

returns the predefined module with that name (like reflective or transmissive layers, a discontinuity in refractive index, observers ...) of the ice for to use in the radiopropa tracer

get_modules()

returns the predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers ...) of the ice for to use in the radiopropa tracer

get_scalar_field()

add predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers ...) of the ice to the dictionary

remove_module(name)

removes predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers ...) of the ice to the dictionary

replace_module(name, new_module)

replaces predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers ...) of the ice to the dictionary

get_modules()[source]

returns the predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers …) of the ice for to use in the radiopropa tracer

Returns:
modules: dictionary {name:module object}

dictionary of modules to run in radiopropa

get_module(name)[source]

returns the predefined module with that name (like reflective or transmissive layers, a discontinuity in refractive index, observers …) of the ice for to use in the radiopropa tracer

Returns:
module: module with this name

radiopropa.module object

add_module(name, module)[source]

add predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers …) of the ice to the dictionary

Parameters:
name: string

name to identify the module

module: radiopropa.Module (and all the daugther classes)

module to run in radiopropa

remove_module(name)[source]

removes predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers …) of the ice to the dictionary

Parameters:
name: string

name to identify the module to be removed

replace_module(name, new_module)[source]

replaces predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers …) of the ice to the dictionary

Parameters:
name: string

name to identify the module to be replaced

module: radiopropa.Module (and all the daugther classes)

new module to run in radiopropa

get_scalar_field()[source]

add predefined modules (like reflective or transmissive layers, a discontinuity in refractive index, observers …) of the ice to the dictionary

Parameters:
scalar_field: radiopropa.ScalarField

scalar field that holds the refractive index to use in radiopropa

class NuRadioMC.utilities.medium_base.ScalarFieldBuilder(*args: Any, **kwargs: Any)[source]

Bases: ScalarField

If the requested ice model does not exist in radiopropa, this class can build one in stead. It is a radiopropa object but constructed through the python wrapper which is much slower.

Methods

__call__(*args, **kwargs)

Call self as a function.

getGradient(position)

returns the gradient of index of refraction at position for radiopropa tracer

getValue(position)

returns the index of refraction at position for radiopropa tracer

getValue(position)[source]

returns the index of refraction at position for radiopropa tracer

Parameters:
position: radiopropa.Vector3d

point

Returns:
n: float

index of refraction

getGradient(position)[source]

returns the gradient of index of refraction at position for radiopropa tracer

Parameters:
position: radiopropa.Vector3d

point

Returns:
n_nabla: radiopropa.Vector3d

gradient of index of refraction at the point