Skip to content

Commit

Permalink
move _handle_kind to component
Browse files Browse the repository at this point in the history
  • Loading branch information
lgiacome committed Nov 18, 2024
1 parent dcd1877 commit 8d4a6e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
12 changes: 0 additions & 12 deletions xwakes/basewake.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ def __init__(self, components):
self.components = components


def _handle_kind(kind):
if isinstance(kind, str):
kind = [kind]

if isinstance(kind, (list, tuple)):
kind = {kk: 1.0 for kk in kind}

assert hasattr(kind, 'keys')

return kind


def _expand_components(components):
_expanded_components = []
for cc in components:
Expand Down
3 changes: 2 additions & 1 deletion xwakes/resonator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Tuple

from .basewake import BaseWake, _handle_kind
from .basewake import BaseWake
from .wit.component import _handle_kind
from .wit import ComponentResonator


Expand Down
3 changes: 2 additions & 1 deletion xwakes/thick_resistive_wall.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Tuple

from .basewake import BaseWake, _handle_kind
from .basewake import BaseWake
from .wit.component import _handle_kind
from .wit import ComponentClassicThickWall


Expand Down
12 changes: 12 additions & 0 deletions xwakes/wit/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
}


def _handle_kind(kind):
if isinstance(kind, str):
kind = [kind]

if isinstance(kind, (list, tuple)):
kind = {kk: 1.0 for kk in kind}

assert hasattr(kind, 'keys')

return kind


def mix_fine_and_rough_sampling(start: float, stop: float, rough_points: int,
fine_points: int, rois: List[Tuple[float, float]]):
"""
Expand Down

0 comments on commit 8d4a6e7

Please sign in to comment.