EarthsAtmosphere#

class MCEq.geometry.density_profiles.EarthsAtmosphere(*args, **kwargs)[source]#

Bases: object

Abstract class containing common methods on atmosphere. You have to inherit from this class and implement the virtual method get_density().

Note

Do not instantiate this class directly.

thrad#

current zenith angle \(\theta\) in radiants

Type:

float

theta_deg#

current zenith angle \(\theta\) in degrees

Type:

float

max_X#

Slant depth at the surface according to the geometry defined in the MCEq.geometry

Type:

float

geometry#

Can be a custom instance of EarthGeometry

Type:

object

Attributes Summary

max_X

Depth at altitude 0.

max_den

Density at altitude 0.

s_X2rho

Spline for conversion from depth to density.

s_h2X

Spline for conversion from altitude to depth.

s_lX2h

Spline for conversion from depth to altitude.

Methods Summary

X2h(X)

Returns the height above surface as a function of slant depth for currently selected zenith angle.

X2rho(X)

Returns the density \(\rho(X)\).

calculate_density_spline([n_steps])

Calculates and stores a spline of \(\rho(X)\).

gamma_cherenkov_air(h_cm)

Returns the Lorentz factor gamma of Cherenkov threshold in air (MeV).

get_density(h_cm)

Abstract method which implementation should return the density in g/cm**3.

h2X(h)

Returns the depth along path as function of height above surface.

moliere_air(h_cm)

Returns the Moliere unit of air for US standard atmosphere.

nref_rel_air(h_cm)

Returns the refractive index - 1 in air (density parametrization as in CORSIKA).

r_X2rho(X)

Returns the inverse density \(\frac{1}{\rho}(X)\).

set_h_obs(h_obs)

Set the elevation of the observation (detector) level in cm.

set_theta(theta_deg)

Configures geometry and initiates spline calculation for \(\rho(X)\).

theta_cherenkov_air(h_cm)

Returns the Cherenkov angle in air (degrees).

Attributes Documentation

max_X#

Depth at altitude 0.

max_den#

Density at altitude 0.

s_X2rho#

Spline for conversion from depth to density.

s_h2X#

Spline for conversion from altitude to depth.

s_lX2h#

Spline for conversion from depth to altitude.

Methods Documentation

X2h(X)[source]#

Returns the height above surface as a function of slant depth for currently selected zenith angle.

The spline s_lX2h is used, which was calculated or retrieved from cache during the set_theta() call.

Parameters:

X (float) – slant depth in g/cm**2

Returns:

height above surface in cm

Return type:

float h

X2rho(X)[source]#

Returns the density \(\rho(X)\).

The spline s_X2rho is used, which was calculated or retrieved from cache during the set_theta() call.

Parameters:

X (float) – slant depth in g/cm**2

Returns:

\(\rho\) in cm**3/g

Return type:

float

calculate_density_spline(n_steps=2000)[source]#

Calculates and stores a spline of \(\rho(X)\).

Parameters:

n_steps (int, optional) – number of \(X\) values to use for interpolation

Raises:

Exception – if set_theta() was not called before.

gamma_cherenkov_air(h_cm)[source]#

Returns the Lorentz factor gamma of Cherenkov threshold in air (MeV).

abstractmethod get_density(h_cm)[source]#

Abstract method which implementation should return the density in g/cm**3.

Parameters:

h_cm (float) – height in cm

Returns:

density in g/cm**3

Return type:

float

Raises:

NotImplementedError

h2X(h)[source]#

Returns the depth along path as function of height above surface.

The spline s_X2rho is used, which was calculated or retrieved from cache during the set_theta() call.

Parameters:

h (float) – vertical height above surface in cm

Returns:

X slant depth in g/cm**2

Return type:

float

moliere_air(h_cm)[source]#

Returns the Moliere unit of air for US standard atmosphere.

nref_rel_air(h_cm)[source]#

Returns the refractive index - 1 in air (density parametrization as in CORSIKA).

r_X2rho(X)[source]#

Returns the inverse density \(\frac{1}{\rho}(X)\).

The spline s_X2rho is used, which was calculated or retrieved from cache during the set_theta() call.

Parameters:

X (float) – slant depth in g/cm**2

Returns:

\(1/\rho\) in cm**3/g

Return type:

float

set_h_obs(h_obs)[source]#

Set the elevation of the observation (detector) level in cm.

set_theta(theta_deg)[source]#

Configures geometry and initiates spline calculation for \(\rho(X)\).

If the option ‘use_atm_cache’ is enabled in the config, the function will check, if a corresponding spline is available in the cache and use it. Otherwise it will call calculate_density_spline(), make the function r_X2rho() available to the core code and store the spline in the cache.

Parameters:

theta_deg (float) – zenith angle \(\theta\) at detector

theta_cherenkov_air(h_cm)[source]#

Returns the Cherenkov angle in air (degrees).