torcheeg.utils¶
Shared utilities live in the single torcheeg/utils.py module. Utilities that
belong to a specific domain remain in that domain’s existing utils.py.
For plotting APIs, see torcheeg.visualizers.
Files and experiments¶
- torcheeg.utils.download_url(url: str, folder: str, verbose: bool = True, filename: None | str = None)[source][source]¶
- torcheeg.utils.get_random_dir_path(root_path='.torcheeg', dir_prefix='tmp')[source][source]¶
Generates a unique folder name based on the current timestamp and a random suffix. The folder name is intended to be used for creating a temporary cache folder in torcheeg.
- Returns:
A unique folder name.
- Return type:
str
Optional dependencies¶
LazyLoader loads its module on first attribute access. Resolving a class as
a base also accesses an attribute, so a top-level class definition triggers the
import at that point. Importing shared utilities does not load visualizers.
Pass an optional install_hint to provide dependency-specific installation
instructions; the loader itself does not assume a particular package.
Migration¶
Replace direct
imports from the former torcheeg.utils.file, torcheeg.utils.experiment,
torcheeg.utils.cache and torcheeg.utils.lazy_loader submodules with imports
from torcheeg.utils. For example:
from torcheeg.utils import LazyLoader, download_url, ensure_cache
Plotting functions now live in torcheeg.visualizers. Replace plotting imports
from torcheeg.utils or torcheeg.utils.visualize with imports from
torcheeg.visualizers. No domain-specific utils.py file is renamed or moved.