The pyedb.misc.downloads library#

Summary#

delete_downloads

Delete all downloaded examples to free space or update the files.

list_examples_files

List all files in a folder of the example-data repository.

download_aedb

Download an example of AEDB File and return the def path.

download_edb_merge_utility

Download an example of WPF Project which allows to merge 2 aedb files.

download_via_wizard

Download an example of Hfss Via Wizard and return the def path.

download_touchstone

Download an example of touchstone File and return the def path.

download_file

Download file from directory.

unzip

Extract all files from a zip archive.

Description#

Download example datasets from pyansys/example-data

Module detail#

downloads.delete_downloads() None#

Delete all downloaded examples to free space or update the files.

Examples

>>> import pyedb.misc.downloads as downloads
>>> downloads.delete_downloads()
downloads.list_examples_files(folder) list#

List all files in a folder of the example-data repository.

Parameters:
folderstr

The folder in the GitHub repository to list files from, e.g., “pyaedt/sbr/”.

Returns:
list

A list of file paths in the specified folder.

downloads.download_aedb(destination: str | None = None) str#

Download an example of AEDB File and return the def path.

Examples files are downloaded to a persistent cache to avoid re-downloading the same file twice.

Parameters:
destinationstr or None, optional

Path for downloading files. The default is None, which uses the user’s temp folder.

Returns:
str

Path to the example file.

Examples

Download an example result file and return the path of the file.

>>> import pyedb.misc.downloads
>>> path = pyedb.misc.downloads.download_aedb()
>>> path
'C:/Users/user/AppData/local/temp/Galileo.aedb'
downloads.download_edb_merge_utility(force_download: bool = False, destination: str | None = None) str#

Download an example of WPF Project which allows to merge 2 aedb files.

Examples files are downloaded to a persistent cache to avoid re-downloading the same file twice.

Parameters:
force_downloadbool, optional

Force to delete cache and download files again. The default is False.

destinationstr or None, optional

Path for downloading files. The default is None, which uses the user’s temp folder.

Returns:
str

Path to the example file.

Examples

Download an example result file and return the path of the file.

>>> import pyedb.misc.downloads
>>> path = pyedb.misc.downloads.download_edb_merge_utility(force_download=True)
>>> path
'C:/Users/user/AppData/local/temp/PyAEDTExamples/wpf_edb_merge/merge_wizard.py'
downloads.download_via_wizard(destination: str | None = None) str#

Download an example of Hfss Via Wizard and return the def path.

Examples files are downloaded to a persistent cache to avoid re-downloading the same file twice.

Parameters:
destinationstr or None, optional

Path for downloading files. The default is None, which uses the user’s temp folder.

Returns:
str

Path to the example file.

Examples

Download an example result file and return the path of the file.

>>> import pyedb.misc.downloads
>>> path = pyedb.misc.downloads.download_via_wizard()
>>> path
'C:/Users/user/AppData/local/temp/PyAEDTExamples/viawizard_vacuum_FR4.aedt'
downloads.download_touchstone(destination: str | None = None) str#

Download an example of touchstone File and return the def path.

Examples files are downloaded to a persistent cache to avoid re-downloading the same file twice.

Parameters:
destinationstr or None, optional

Path for downloading files. The default is None, which uses the user’s temp folder.

Returns:
str

Path to the example file.

Examples

Download an example result file and return the path of the file.

>>> import pyedb.misc.downloads
>>> path = pyedb.misc.downloads.download_touchstone()
>>> path
'C:/Users/user/AppData/local/temp/PyAEDTExamples/SSN_ssn.s6p'
downloads.download_file(directory: str, filename: str | None = None, destination: str | None = None) str#

Download file from directory.

Files are downloaded to a destination. If filename is not specified, the full directory will be downloaded.

Parameters:
directorystr

Directory name.

filenamestr or None, optional

File name to download. The default is None, which downloads all files inside directory.

destinationstr or None, optional

Path where files will be downloaded. The default is None, which uses the user’s temp folder.

Returns:
str

Path to the example file.

Examples

Download an example result file and return the path of the file.

>>> import pyedb.misc.downloads
>>> path = pyedb.misc.downloads.download_file("pyaedt/edb/ansys_interposer", "dummy_interposer_hbm.map")
>>> path
'C:/Users/user/AppData/local/temp/PyAEDTExamples/pyaedt/edb/ansys_interposer/dummy_interposer_hbm.map'
downloads.unzip(source_filename: str, dest_dir: str) None#

Extract all files from a zip archive.

Parameters:
source_filenamestr

Path to the zip file to extract.

dest_dirstr

Destination directory for extracted files.

Examples

>>> import pyedb.misc.downloads as downloads
>>> downloads.unzip("example.zip", "/path/to/destination")
downloads.EXAMPLES_PATH#
downloads.pyedb_logger#