fnet.utils package¶
Submodules¶
fnet.utils.figures module¶
fnet.utils.general_utils module¶
-
fnet.utils.general_utils.
add_augmentations
(df: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame[source]¶ Adds augmented versions of dataframe rows.
This is intended to be used on dataframes that represent datasets. Two columns will be added: flip_y, flip_x. Each dataframe row will be replicated 3 more times with flip_y, flip_x, or both columns set to 1.
Parameters: df – Dataset dataframe to be augmented. Returns: Augmented dataset dataframe. Return type: pd.DataFrame
-
fnet.utils.general_utils.
add_logging_file_handler
(path_save: pathlib.Path) → None[source]¶ Adds a file handler to fnet logger.
Parameters: path_save – Location to save logging records. Returns: Return type: None
-
fnet.utils.general_utils.
files_from_dir
(path_dir: str, extensions: Optional[Sequence[str]] = None) → List[str][source]¶ Returns sorted list of files in a directory with optional extension(s).
Parameters: - path_dir – Input directory.
- extensions – Optional file extensions.
-
fnet.utils.general_utils.
get_args
()[source]¶ Returns the arguments passed to the calling function.
Example:
>>> def foo(a, b, *args, **kwargs): ... print(get_args()) ... >>> foo(1, 2, 3, 'bar', fizz='buzz') ({'b': 2, 'a': 1, 'fizz': 'buzz'}, (3, 'bar'))
References: kbyanc.blogspot.com/2007/07/python-aggregating-function-arguments.html
Returns: - dict – Named arguments
- list – Unnamed positional arguments
-
fnet.utils.general_utils.
init_fnet_logging
() → None[source]¶ Initializes logging for fnet.
Parameters: path_save – Location to save logging records. Returns: Return type: None
-
fnet.utils.general_utils.
retry_if_oserror
(fn: Callable)[source]¶ Retries input function if an OSError is encountered.
-
fnet.utils.general_utils.
str_to_class
(string: str)[source]¶ Return class from string representation.
-
fnet.utils.general_utils.
str_to_object
(str_o: str)[source]¶ Get object from string.
Parameters: str_o – Fully qualified object name.