utils

Utility module with various functions used across the codebase.

Some utility functions for the whole alphadia package.

alphadia.utils.expand_path(path: str) str | None[source]

Expand ~ in a path to the user’s home directory.

alphadia.utils.get_isotope_columns(colnames)[source]
alphadia.utils.get_torch_device(use_gpu: bool = False)[source]

Get the torch device to be used.

Parameters:

use_gpu (bool, optional) – If True, use GPU if available, by default False

Returns:

Device to be used, either ‘cpu’, ‘gpu’ or ‘mps’

Return type:

str