The download.py
module#
Summary#
Download a case from the remote repository. |
|
Unpack the downloaded tarball file. |
|
Download all supported cases. |
|
Unpack a list of TAR files. |
Description#
Module containing methods to download cases from public databases.
Module detail#
- download.download_case_from_zenodo(database: str, case_number: int, download_folder: pathlib.Path, overwrite: bool = True, validate_hash: bool = True) pathlib.Path | None #
Download a case from the remote repository.
- Parameters:
- Returns:
Path
Path to the tarball that contains the VTK/CASE files.
Examples
Download case 1 from the public repository (
'Strocchi2020'
) of pathological hearts.>>> path_to_tar_file = download_case_from_zenodo( database="Strocchi2020", case_number=1, download_folder="my/download/folder" )
Download case 1 from the public repository (
'Rodero2021'
) of healthy hearts.>>> path_to_tar_file = download_case_from_zenodo( database="Rodero2021", case_number=1, download_folder="my/download/folder" )
- download.unpack_case(tar_path: pathlib.Path, reduce_size: bool = True) str | bool #
Unpack the downloaded tarball file.
- Parameters:
- Returns:
str
Path to the CASE or VTK file.
Examples
>>> from ansys.health.heart.utils.download import unpack_case >>> path = unpack_case("Rodero2021\\01.tar.gz")
- download.download_all_cases(download_dir: str = None) list[str] #
Download all supported cases.
- Parameters:
- download_dir
str
Base directory to download cases to.
- download_dir
Notes
Note that depending on bandwidth, downloading all cases might take a lot of time.
Examples
>>> from ansys.health.heart.utils.download import download_all_cases >>> tar_files = download_all_cases("my-downloads")
To unpack all cases, you can use the
unpack_cases()
method:>>> from ansys.health.heart.utils.download import unpack_cases >>> unpack_cases(tar_files)
- download.unpack_cases(list_of_tar_files: List) None #
Unpack a list of TAR files.
- Parameters:
- list_of_tar_files
typing.List
List of TAR files to unpack.
- list_of_tar_files
Examples
>>> from ansys.health.heart.utils.download import unpack_cases >>> unpack_cases(["01.tar.gz", "02.tar.gz"])