CorsikaAtmosphere#
- class MCEq.geometry.density_profiles.CorsikaAtmosphere(location, season=None)[source]#
Bases:
EarthsAtmosphereClass, holding the parameters of a Linsley type parameterization similar to the Air-Shower Monte Carlo CORSIKA.
The parameters pre-defined parameters are taken from the CORSIKA manual. If new sets of parameters are added to
init_parameters(), the array _thickl can be calculated usingcalc_thickl().- _atm_param#
(5x5) Stores 5 atmospheric parameters _aatm, _batm, _catm, _thickl, _hlay for each of the 5 layers
- Type:
- Parameters:
location (str) – see
init_parameters()season (str,optional) – see
init_parameters()
Attributes Summary
Depth at altitude 0.
Density at altitude 0.
Spline for conversion from depth to density.
Spline for conversion from altitude to depth.
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)\).
Calculates thickness layers for
depth2height()calculate_density_spline([n_steps])Calculates and stores a spline of \(\rho(X)\).
depth2height(x_v)Converts column/vertical depth to height.
gamma_cherenkov_air(h_cm)Returns the Lorentz factor gamma of Cherenkov threshold in air (MeV).
get_density(h_cm)Returns the density of air in g/cm**3.
get_mass_overburden(h_cm)Returns the mass overburden in atmosphere in g/cm**2.
h2X(h)Returns the depth along path as function of height above surface.
init_parameters(location, season)Initializes
_atm_paramby fetching them from the atmosphere_parameters module.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)\).
rho_inv(X, cos_theta)Returns reciprocal density in cm**3/g using planar approximation.
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)#
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)#
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
- calc_thickl()[source]#
Calculates thickness layers for
depth2height()The analytical inversion of the CORSIKA parameterization relies on the knowledge about the depth \(X\), where trasitions between layers/exponentials occur.
Example
Create a new set of parameters in
init_parameters()inserting arbitrary values in the _thikl array:$ cor_atm = CorsikaAtmosphere(new_location, new_season) $ cor_atm.calc_thickl()
Replace _thickl values with printout.
- calculate_density_spline(n_steps=2000)#
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.
- depth2height(x_v)[source]#
Converts column/vertical depth to height.
- Parameters:
x_v (float) – column depth \(X_v\) in g/cm**2
- Returns:
height in cm
- Return type:
float
- gamma_cherenkov_air(h_cm)#
Returns the Lorentz factor gamma of Cherenkov threshold in air (MeV).
- get_density(h_cm)[source]#
Returns the density of air in g/cm**3.
Uses the optimized module function
corsika_get_density_jit().- Parameters:
h_cm (float) – height in cm
- Returns:
density \(\rho(h_{cm})\) in g/cm**3
- Return type:
float
- get_mass_overburden(h_cm)[source]#
Returns the mass overburden in atmosphere in g/cm**2.
Uses the optimized module function
corsika_get_m_overburden_jit()- Parameters:
h_cm (float) – height in cm
- Returns:
column depth \(T(h_{cm})\) in g/cm**2
- Return type:
float
- h2X(h)#
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
- init_parameters(location, season)[source]#
Initializes
_atm_paramby fetching them from the atmosphere_parameters module.- Parameters:
location (str) – The location identifier.
season (str, optional) – The season identifier.
- Raises:
Exception – if parameter set not available (via get_atmosphere_parameters)
- 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)\).
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
- rho_inv(X, cos_theta)[source]#
Returns reciprocal density in cm**3/g using planar approximation.
This function uses the optimized function
planar_rho_inv_jit()- Parameters:
h_cm (float) – height in cm
- Returns:
\(\frac{1}{\rho}(X,\cos{\theta})\) cm**3/g
- Return type:
float
- 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)\).
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 functionr_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)#
Returns the Cherenkov angle in air (degrees).