lezargus.library.wrapper module#
Function wrappers.
We borrow a lot of functions from different packages; however, for a lot of them, we build wrappers around them to better integrate them into our package provided its own idiosyncrasies. Moreover, a lot of these wrapper functions are either legacy or depreciated or otherwise overly-complex; and as such, they may be changed in future builds so we unify all changes.
- lezargus.library.wrapper.blackbody_function(temperature: float) Callable[[ndarray], ndarray] [source]#
Return a callable blackbody function for a given temperature.
This function is a wrapper around the Astropy blackbody model. This wrapper exists to remove the unit baggage of the original Astropy blackbody model so that we can stick to the convention of Lezargus.
- Parameters:
temperature (float) – The blackbody temperature, in Kelvin.
- Returns:
blackbody – The blackbody function, the wavelength callable is in meters. The return units are in W m^-2 m^-1 sr^-1.
- Return type:
Callable
- lezargus.library.wrapper.flatten_list_recursively(object_list: list[ndarray | list]) list[float] [source]#
Flatten a list containing different sized numerical data.
- Parameters:
object_list (list) – The object to flatten. Note, it must contain numerical data only.
- Returns:
flattened_list – The list object, flattened.
- Return type:
list
- lezargus.library.wrapper.wavelength_overlap_fraction(base: ndarray, contain: ndarray) str [source]#
Check if two wavelengths, defined as arrays, overlap.
This is a function to check if the wavelength arrays overlap each other. Specifically, this checks if the contain wavelength array is within the base wavelength array, and if so, how much.
- Parameters:
base (ndarray) – The base wavelength array which we are comparing the contain array against.
contain (ndarray) – The wavelength array that we are seeing if it is within the base wavelength array.
- Returns:
fraction – The fraction percent the two wavelength regions overlap with each other. This value may be larger than 1 for large overlaps.
- Return type:
float