open_viewmin.filter_tree_plot.utilities.ovm_utilities#
Define utility functions and classes for use throughout project.
Functions#
|
Copy key-value pairs for keys from source dictionary that are missing from |
|
Get filters available for a given mesh. |
|
Copy a dictionary, with recursion for values that are dictionaries. |
|
Use pandas.read_csv to import .txt/.dat files quickly |
|
|
|
Find the names of a function's keyword arguments |
|
Convert hex color to RGB (integer-valued). |
|
Modify (if necessary) a new dictionary key to be distinct from existing keys. |
|
Sort names of output files from the same run by timestamp |
Module Contents#
- add_if_dict_lacks(to_dict, from_dict)#
Copy key-value pairs for keys from source dictionary that are missing from destination dictionary.
- Parameters:
to_dict (dict) – Destination dictionary
from_dict (dict) – Source dictionary
- available_filters(mesh)#
Get filters available for a given mesh.
Excludes: “boolean_*” and “plot_*” filters
- Parameters:
mesh (pyvista.dataset)
- Returns:
List of filter names
- Return type:
list of str
- copy_from_dict_recursively(from_dict, to_dict=None)#
Copy a dictionary, with recursion for values that are dictionaries.
- Parameters:
from_dict (dict) – Source dictionary.
to_dict (dict or None) – Destination dictionary. Pass None to copy into a new, empty dictionary.
- Returns:
Dictionary containing copied values.
- Return type:
dict
- fast_import(filename, sep='\t')#
Use pandas.read_csv to import .txt/.dat files quickly
- Parameters:
filename (str) – Name of file to import
sep (str) – Delimiter
- Returns:
Imported data.
- Return type:
np.ndarray
- get_arg_types(func)#
- get_kwargs_and_defaults(func, as_strings=False)#
Find the names of a function’s keyword arguments and their default values
- Parameters:
func (callable()) – The function in question
as_strings (bool, optional) – Whether to force conversion of default values to str.
- Returns:
Dictionary mapping keyword argument keys to default values.
- Return type:
dict
- hex_to_rgb(hex_color)#
Convert hex color to RGB (integer-valued).
- Parameters:
hex_color (str)
- Returns:
RGB values in [0, 255].
- Return type:
(int, int, int)
- name_without_overwriting(try_new_name, dict_of_old_names)#
Modify (if necessary) a new dictionary key to be distinct from existing keys.
- Parameters:
try_new_name (str) – Proposed new key
dict_of_old_names (dict) – Dictionary to which new key will be added.
- Returns:
Modified key
- Return type:
str
- sort_filenames_by_timestamp(filenames)#
Sort names of output files from the same run by timestamp
- Parameters:
filenames (sequence of str)
- Return type:
list of str