Utilities
cm_2_to_nm(cm)
Convert a wavenumber in cm^-1 to a wavelength in nm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cm |
Union[float, ndarray]
|
Wavenumber in cm^-1. |
required |
Returns:
| Type | Description |
|---|---|
Union[float, ndarray]
|
Wavelength in nm. |
color_wavelength(lmb, darkmode=False)
Color the wavelength according to the wavelength.
When darkmode is turned on, pastel colors are used. Definitions of colors are taken from here: https://sciencenotes.org/visible-light-spectrum-wavelengths-and-colors/
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmb |
float
|
Wavelength in nm. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Color string. |
Source code in src/rimsschemedrawer/utils.py
get_elements()
get_ip(ele)
Get the ionization potential for a given element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ele |
str
|
Element symbol, not case sensitive. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Ionization potential in cm-1. |
get_ip_reference(ele)
Get a reference for the ionization potential.
If element is in IP_REFERENCES_NON_NIST, return the reference dictionary.
Otherwise, return a dictionary with "NIST" entries.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with "author", "year", and "url" entries. |
Source code in src/rimsschemedrawer/utils.py
guess_element_from_ip(ip)
Guess an element from the ionization potential.
This routine is mainly provided for backwards compatibility with older RIMSSchemeDrawer instances, where the user used to define the IP manually.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip |
float
|
Ionization potential in cm-1. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Element symbol (best guess). |
Source code in src/rimsschemedrawer/utils.py
my_exp_formatter(val, prec)
Format a value with a given precision to LaTeX output.
my_formatter(val, *args)
Format the axis labels for the left y-axis in scientific notation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val |
float
|
Value to format, must be >= 0. |
required |
args |
Additional arguments - will be ignored. |
()
|
Returns:
| Type | Description |
|---|---|
str
|
Properly formatted string. |
Source code in src/rimsschemedrawer/utils.py
nm_to_cm_2(nm)
Convert a wavelength in nm to wavenumber in cm^-1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nm |
Union[float, ndarray]
|
Wavelength in nm. |
required |
Returns:
| Type | Description |
|---|---|
Union[float, ndarray]
|
Wavenumber in cm^-1. |
term_to_string(tstr)
Convert term symbol to LaTeX enabled string.
Converts a term symbol string to a LaTeX enabled matplotlib string If already a LaTeX string, just return it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tstr |
str
|
Input string to convert |
required |
Returns:
| Type | Description |
|---|---|
|
Output string LaTeX enabled for Matplotlib |