The general_methods.py
module#
Summary#
Issues deprecation warnings for arguments. |
|
Check if graphics are available. |
|
Decorate a method as requiring graphics. |
|
Compute the magnitude (length) of a 2D or 3D vector using NumPy. |
|
Normalize a 2D or 3D vector to have a length of 1 using NumPy. |
|
Raise error that installation was not found at a location. |
|
Retrieve Speos install location based on Path or Environment. |
|
Convert a given wavelength of light to an approximate RGB color value. |
|
Raise version warning. |
Description#
General methods and helpers collection.
this includes decorator and methods
Module detail#
- general_methods.deprecate_kwargs(old_arguments, removed_version='0.3.0')#
Issues deprecation warnings for arguments.
- general_methods.run_if_graphics_required(warning=False)#
Check if graphics are available.
- general_methods.graphics_required(method)#
Decorate a method as requiring graphics.
- Parameters:
- method
callable()
Method to decorate.
- method
- Returns:
callable()
Decorated method.
- general_methods.magnitude_vector(vector)#
Compute the magnitude (length) of a 2D or 3D vector using NumPy.
- Parameters:
- vector: List[float]
A 2D or 3D vector as a list [x, y] or [x, y, z].
- Returns:
float
The magnitude (length) of the vector.
- general_methods.normalize_vector(vector)#
Normalize a 2D or 3D vector to have a length of 1 using NumPy.
- Parameters:
- vector: List[float]
A vector as a list [x, y] for 2D or [x, y, z] for 3D.
- Returns:
List
[float
]The normalized vector.
- general_methods.error_no_install(install_path, version)#
Raise error that installation was not found at a location.
- general_methods.retrieve_speos_install_dir(speos_rpc_path=None, version=DEFAULT_VERSION)#
Retrieve Speos install location based on Path or Environment.
- general_methods.wavelength_to_rgb(wavelength, gamma=0.8)#
Convert a given wavelength of light to an approximate RGB color value.
The wavelength must be given in nanometers in the range from 380 nm to 750 nm. Based on the code from http://www.physics.sfasu.edu/astro/color/spectra.html
- general_methods.min_speos_version(major, minor, service_pack)#
Raise version warning.
- general_methods.GRAPHICS_ERROR = "Preview unsupported without 'ansys-tools-visualization_interface' installed. You can install...#
- general_methods.VERSION_ERROR = 'The pySpeos feature : {feature_name} needs a Speos Version of {version} or higher.'#