forked from kduxin/firelang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More flexible range of Dirac measure with
limits
instead of range
…
…. Removed `range`.
- Loading branch information
Showing
2 changed files
with
68 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from __future__ import annotations | ||
from typing import List, Tuple, Iterable | ||
|
||
__all__ = [ | ||
"parse_rect_limits", | ||
] | ||
|
||
|
||
def parse_rect_limits( | ||
limits: float | Tuple[float, float] | List[Tuple[float, float]], | ||
dim: int, | ||
) -> List[Tuple[float, float]]: | ||
if not isinstance(limits, Iterable): | ||
return [[-limits, limits] for _ in range(dim)] | ||
elif not isinstance(limits[0], Iterable): | ||
assert len(limits) == 2 | ||
return [limits for _ in range(dim)] | ||
else: | ||
assert len(limits) == dim | ||
return limits |