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