deepblink.util module¶
Utility helper functions.
-
deepblink.util.
delete_non_unique_columns
(df: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame[source]¶ Deletes DataFrame columns that only contain one (non-unique) value.
-
deepblink.util.
get_from_module
(path: str, attribute: str) → Callable[source]¶ Grab an attribute (e.g. class) from a given module path.
-
deepblink.util.
predict_pixel_size
(fname: Union[str, os.PathLike[str]]) → Tuple[float, float][source]¶ Predict the pixel size based on tifffile metadata.
-
deepblink.util.
predict_shape
(shape: tuple) → str[source]¶ Predict the channel-arangement based on common standards.
Assumes the following things: * x, y are the two largest axes * rgb only if the last axis is 3 * up to 4 channels * “fill up order” is c, z, t
Parameters: shape – To be predicted shape. Output from np.ndarray.shape
-
deepblink.util.
relative_shuffle
(x: Union[list, numpy.ndarray], y: Union[list, numpy.ndarray]) → Tuple[Union[list, numpy.ndarray], Union[list, numpy.ndarray]][source]¶ Shuffles x and y keeping their relative order.
-
deepblink.util.
remove_falses
(tup: tuple) → tuple[source]¶ Removes all false occurences from a tuple.
-
deepblink.util.
train_valid_split
(x_list: list, y_list: list, valid_split: float = 0.2, shuffle: bool = True) → Iterable[list][source]¶ Split two lists (usually input and ground truth).
Splitting into random training and validation sets with an optional shuffling.
Parameters: - x_list – First list of items. Typically input data.
- y_list – Second list of items. Typically labeled data.
- valid_split – Number between 0-1 to denote the percentage of examples used for validation.
Returns: (x_train, x_valid, y_train, y_valid) splited lists containing training or validation examples respectively.