pypret.frequencies module¶
This module handles conversion between frequency units.
The supported units and their shorthands are:
- wl : wavelength in meter
- om: angular frequency in rad/s
- f: frequency in 1/s
- k: angular wavenumber in rad/m
The conversion functions have the form shorthand2shorthand which is not pythonic but very short. A more pythonic conversion can be achieved by using the convert function
>>> convert(x, 'wl', 'om')
The shorthands will be used throughout the package to identify frequency units.
The functions in this module should be used wherever a frequency convention is necessary to avoid mistakes and make the code more expressive.
-
pypret.frequencies.
convert
(x, unit1, unit2)[source]¶ Convert between two frequency units.
Parameters: - x (float or array_like) – Numerical value or array that should be converted.
- unit2 (unit1,) – Shorthands for the original unit (unit1) and the destination unit (unit2).
Returns: The converted numerical value or array. It will always be a copy, even if unit1 == unit2.
Return type: float or array_like
Notes
Unit shorthands can be any of wl : wavelength in meter om : angular frequency in rad/s f : frequency in 1/s k : angular wavenumber in rad/m