lezargus.simulator.atmosphere module#
Simulator class for emulating atmospheric effects and properties.
Any and all simulating functions which the atmosphere deals with is handled here. Namely, the main four functions are the atmospheric transmission, radiance, seeing, and diffraction.
- class lezargus.simulator.atmosphere.AtmosphereSimulator(temperature: float, pressure: float, ppw: float, pwv: float, seeing: float, zenith_angle: float, parallactic_angle: float, reference_wavelength: float, *args: hint.Any, transmission_generator: hint.AtmosphereSpectrumGenerator | None = None, radiance_generator: hint.AtmosphereSpectrumGenerator | None = None)[source]#
Bases:
object
The atmospheric simulation class.
- temperature#
The temperature of the atmosphere, in Kelvin.
- Type:
float
- pressure#
The pressure of the atmosphere, in Pascals.
- Type:
float
- ppw#
The partial pressure of water in the atmosphere, in Pascals.
- Type:
float
- pwv#
The precipitable water vapor, in meters.
- Type:
float
- seeing#
The atmospheric seeing parameter, in radians. Measured at the reference zenith angle (0) and the reference wavelength.
- Type:
float
- zenith_angle#
The zenith angle of the observation, in radians. Namely, the direct observable for airmass.
- Type:
float
- parallactic_angle#
The parallactic angle of the observation, in radians. Used to determine the rotations of the properties in the atmosphere.
- Type:
float
- reference_wavelength#
The reference wavelength which form the basis for the atmospheric refraction and the seeing, typically in meters.
- Type:
float
- reference_zenith_angle#
The reference zenith angle which form the basis for the atmospheric refraction and the seeing, in radians. This should always be 0.
- Type:
float
- transmission_generator#
The transmission spectrum generator used to generate the specific transmission spectra.
- radiance_generator#
The transmission spectrum generator used to generate the specific transmission spectra.
- __init__(temperature: float, pressure: float, ppw: float, pwv: float, seeing: float, zenith_angle: float, parallactic_angle: float, reference_wavelength: float, *args: hint.Any, transmission_generator: hint.AtmosphereSpectrumGenerator | None = None, radiance_generator: hint.AtmosphereSpectrumGenerator | None = None) None [source]#
Create the atmospheric simulator, provided atmospheric properties.
- Parameters:
temperature (float) – The temperature of the atmosphere, in Kelvin.
pressure (float) – The pressure of the atmosphere, in Pascals.
ppw (float) – The partial pressure of water in the atmosphere, in Pascals.
pwv (float) – The precipitable water vapor, in meters.
seeing (float) – The atmospheric seeing parameter, in radians.
zenith_angle (float) – The zenith angle of the observation, in radians.
parallactic_angle (float) – The parallactic angle of the observation, in radians.
reference_wavelength (float) – The reference wavelength at which seeing is measured at and where relative refraction is 0.
*args (Any) – A catch to ensure that non-basic atmospheric parameters are to be keywords only.
transmission_generator (AtmosphereSpectrumGenerator, default = None) – The transmission spectrum generator used to generate the specific transmission spectra. If invalid, we use the built-in.
radiance_generator (AtmosphereSpectrumGenerator) – The transmission spectrum generator used to generate the specific transmission spectra. If invalid, we use the built-in.
- static _convolve_atmospheric_spectrum(spectrum: hint.LezargusSpectrum, output_resolution: float | None = None, output_resolving: float | None = None, reference_wavelength: float | None = None, input_resolution: float | None = None, input_resolving: float | None = None) hint.LezargusSpectrum [source]#
Convolve the input spectrum match its resolution with the output.
Nominally, we do this to convolve down the transmission and radiance spectra to better match the resolution of the spectrum we will be applying it to. If they did not match otherwise, it would give erroneous results.
We leverage
kernel_1d_gaussian_resolution()
to make the kernel.- Parameters:
spectrum (LezargusSpectrum) – The input spectrum which we will be preparing. This spectrum should also have its current resolution. A different value is used if overridden if an explicit resolving power is input.
output_resolution (float, default = None) – The spectral resolution of the simulation spectra. Must be in the same units as the simulation spectra.
output_resolving (float, default = None) – The spectral resolving power of the simulation spectra, relative to the wavelength reference_wavelength.
reference_wavelength (float, default = None) – The reference wavelength for any needed conversion.
input_resolution (float, default = None) – The spectral resolution of the input spectra. Must be in the same units as the spectra. Overrides any inherent values from the input spectrum.
input_resolving (float, default = None) – The spectral resolving power of the input spectra, relative to the wavelength reference_wavelength. Overrides any inherent values from the input spectrum.
**kwargs (dict) – Keyword argument catcher.
- Returns:
convolved_spectra – The spectra, after convolution based on the input parameters.
- Return type:
- generate_radiance(template: hint.LezargusContainerArithmetic) hint.LezargusSpectrum [source]#
Generate a radiance spectrum applicable to the template.
This function generates a radiance spectrum with the internal atmospheric parameters. The provided template container is the container class the radiance function is generated for, so the wavelength and container properly match.
- Parameters:
template (LezargusContainerArithmetic) – The template container which is used to define the proper format of the output spectrum. The template container is not affected.
- Returns:
radiance_spectrum – The radiance spectrum.
- Return type:
- generate_refraction_vectors(template: hint.LezargusContainerArithmetic) hint.NDArray [source]#
Generate a set of translation vectors mimicking refraction.
We create a set of translation vectors which simulate fraction for cube-like data. Namely different wavelengths of light are refracted differently (different magnitudes), so they apply a sheer-like translation transformation across the wavelength axis. The vectors generated describe the translation per wavelength.
- Parameters:
template (LezargusContainerArithmetic) – The template container which is used to define the proper format of the output vectors. The template container is not affected.
- Returns:
refraction_vectors – The refraction vectors as an ND array of (x, y) pairs per wavelength describing the translation.
- Return type:
ndarray
- generate_seeing_kernels(template: hint.LezargusContainerArithmetic) hint.NDArray [source]#
Generate a seeing kernel, accounting for wavelength variations.
We create a seeing kernel for convolution. We take into account the seeing variations as a function of wavelength when creating the seeing kernels. By default, we create a stacked 2D set of kernels per the template container’s wavelength.
- Parameters:
template (LezargusContainerArithmetic) – The template container which is used to define the proper format of the output kernels. The template container is not affected.
- Returns:
seeing_kernels – The seeing kernel(s).
- Return type:
ndarray
- generate_transmission(template: hint.LezargusContainerArithmetic) hint.LezargusSpectrum [source]#
Generate a transmission spectrum applicable to the template.
This function generates a transmission spectrum with the internal atmospheric parameters. The provided template spectrum is the spectrum class the transmission function is generated for, so the wavelength and resolutions properly match.
- Parameters:
template (LezargusContainerArithmetic) – The template container which is used to define the proper format of the output spectrum. The template container is not affected.
- Returns:
transmission_spectrum – The transmission spectrum.
- Return type:
- seeing_function(wavelength: hint.NDArray) hint.NDArray [source]#
Seeing function over wavelength for the current atmosphere.
This function primarily takes the proportionality relationships of seeing with regards to zenith angle and wavelength, using the input seeing parameter as the base.
- Parameters:
wavelength (ndaraay) – The wavelength to evaluate the seeing at. Should be in the same unit as the reference wavelength.
- Returns:
seeing – The computed seeing, based on the ratios.
- Return type:
ndarray