lezargus.library.atmosphere module#

Atmospheric functions and other operations.

This file keeps track of all of the functions and computations which deal with the atmosphere.

lezargus.library.atmosphere.absolute_atmospheric_refraction_function(wavelength: ndarray, zenith_angle: float, temperature: float, pressure: float, water_pressure: float) Callable[[ndarray], ndarray][source]#

Compute the absolute atmospheric refraction function.

The absolute atmospheric refraction is not as useful as the relative atmospheric refraction function. To calculate how the atmosphere refracts one’s object, use that function instead.

Parameters:
  • wavelength (ndarray) – The wavelength over which the absolute atmospheric refraction is being computed over, in microns.

  • zenith_angle (float) – The zenith angle of the sight line, in radians.

  • temperature (float) – The temperature of the atmosphere, in Kelvin.

  • pressure (float) – The pressure of the atmosphere, in Pascals.

  • water_pressure (float) – The partial pressure of water in the atmosphere, Pascals.

Returns:

abs_atm_refr_func – The absolute atmospheric refraction function, as an actual callable function.

Return type:

Callable

lezargus.library.atmosphere.airmass(zenith_angle: float | ndarray) float | ndarray[source]#

Calculate the airmass from the zenith angle.

This function calculates the airmass provided a zenith angle. For most cases the plane-parallel atmosphere method works, and it is what this function uses. However, we also use a more accurate formula for airmass at higher zenith angles (>80 degree), namely from DOI:10.1364/AO.28.004735. We use a weighted average between 75 < z < 80 degrees to allow for a smooth transition.

Parameters:

zenith_angle (float or ndarray) – The zenith angle, in radians.

Returns:

airmass_ – The airmass. The variable name is to avoid name conflicts.

Return type:

float or ndarray

lezargus.library.atmosphere.gaussian_psf_kernel(shape: tuple, x_stddev: float, y_stddev: float, rotation: float) ndarray[source]#

Return a 2D Gaussian point spread function convolution kernel.

We normalize the point spread function via the amplitude of the Gaussian function as a whole for maximal precision: volume = 1. We require the input of the shape of the kernel to allow for x_stddev and y_stddev to be expressed in pixels to keep it general. By definition, the center of the Gaussian kernel is in the center of the array.

Parameters:
  • shape (tuple) – The shape of the 2D kernel, in pixels.

  • x_stddev (float) – The standard deviation of the Gaussian in the x direction, in pixels.

  • y_stddev (float) – The standard deviation of the Gaussian in the y direction, in pixels.

  • rotation (float) – The rotation angle, increasing counterclockwise, in radians.

Returns:

gaussian_kernel – The discrete kernel array.

Return type:

ndarray

lezargus.library.atmosphere.index_of_refraction_dry_air(wavelength: ndarray, pressure: float, temperature: float) ndarray[source]#

Calculate the refraction of air of pressured warm dry air.

The index of refraction depends on wavelength, pressure and temperature, we use the updated Edlén equations found in DOI: 10.1088/0026-1394/30/3/004.

Parameters:
  • wavelength (ndarray) – The wavelength that we are calculating the index of refraction over. This must in microns.

  • pressure (float) – The pressure of the atmosphere, in Pascals.

  • temperature (float) – The temperature of the atmosphere, in Kelvin.

Returns:

ior_dry_air – The dry air index of refraction.

Return type:

ndarray

lezargus.library.atmosphere.index_of_refraction_ideal_air(wavelength: ndarray) ndarray[source]#

Calculate the ideal refraction of air over wavelength.

The index of refraction of air depends slightly on wavelength, we use the updated Edlen equations found in DOI: 10.1088/0026-1394/30/3/004.

Parameters:

wavelength (ndarray) – The wavelength that we are calculating the index of refraction over. This must in microns.

Returns:

ior_ideal_air – The ideal air index of refraction.

Return type:

ndarray

lezargus.library.atmosphere.index_of_refraction_moist_air(wavelength: ndarray, temperature: float, pressure: float, water_pressure: float) ndarray[source]#

Calculate the refraction of air of pressured warm moist air.

The index of refraction depends on wavelength, pressure, temperature, and humidity, we use the updated Edlen equations found in DOI: 10.1088/0026-1394/30/3/004. We use the partial pressure of water in the atmosphere as opposed to actual humidity.

Parameters:
  • wavelength (ndarray) – The wavelength that we are calculating the index of refraction over. This must in microns.

  • temperature (float) – The temperature of the atmosphere, in Kelvin.

  • pressure (float) – The pressure of the atmosphere, in Pascals.

  • water_pressure (float) – The partial pressure of water in the atmosphere, Pascals.

Returns:

ior_moist_air – The moist air index of refraction.

Return type:

ndarray

lezargus.library.atmosphere.relative_atmospheric_refraction_function(wavelength: ndarray, reference_wavelength: float, zenith_angle: float, temperature: float, pressure: float, water_pressure: float) Callable[[ndarray], ndarray][source]#

Compute the relative atmospheric refraction function.

The relative refraction function is the same as the absolute refraction function, however, it is all relative to some specific wavelength.

Parameters:
  • wavelength (ndarray) – The wavelength over which the absolute atmospheric refraction is being computed over, in microns.

  • reference_wavelength (float) – The reference wavelength which the relative refraction is computed against, in microns.

  • zenith_angle (float) – The zenith angle of the sight line, in radians.

  • temperature (float) – The temperature of the atmosphere, in Kelvin.

  • pressure (float) – The pressure of the atmosphere, in Pascals.

  • water_pressure (float) – The partial pressure of water in the atmosphere, Pascals.

Returns:

rel_atm_refr_func – The absolute atmospheric refraction function, as an actual callable function.

Return type:

Callable