antcal.utils
Utilities.
Module Contents
Functions
Distribute simulation tasks to multiple AEDT sessions. |
|
Close all AEDTs in the queue and top it up with new ones. |
|
Close all AEDTs in the list and top it up with new ones. |
|
A decorator that add the decorated function to a class as its attribute. |
Data
Task function signature |
API
- antcal.utils.TaskFn
None
Task function signature
- async antcal.utils.submit_tasks(task_fn: antcal.utils.TaskFn, vs: numpy.typing.NDArray[numpy.float32], n_workers: int = 3, aedt_list: list[ansys.aedt.core.hfss.Hfss] | None = None) numpy.typing.NDArray[numpy.float32]
Distribute simulation tasks to multiple AEDT sessions.
- Parameters:
task_fn – Task to run.
vs – Input matrix, each row is one sample.
n_workers – Number of AEDT to create, ignored if
aedt_queueis provided.aedt_list – List of AEDT workers, for long running simulation tasks.
- Returns:
Results.
- async antcal.utils.refresh_aedt_queue(aedt_queue: asyncio.Queue[ansys.aedt.core.hfss.Hfss]) None
Close all AEDTs in the queue and top it up with new ones.
- antcal.utils.refresh_aedt_list(aedt_list: list[ansys.aedt.core.hfss.Hfss]) None
Close all AEDTs in the list and top it up with new ones.
- antcal.utils.add_to_class(cls: type) collections.abc.Callable[..., collections.abc.Callable[..., Any]]
A decorator that add the decorated function to a class as its attribute.
In development, this decorator could be used to dynamically overwrite attributes in a class for convenience.
The implementation came from Michael Garod.
- Parameters:
cls – The class to be added to.
- Examples:
class A: def __init__(self) -> None: ... @add_to_class(A) def print_hi(self: A) -> None: print("Hi") >>> a = A() >>> a.print_hi() Hi