Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MarJMue committed Jul 19, 2024
1 parent d306edd commit 8e216cf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/elli/dispersions/base_dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ def _guard_invalid_params(params1, params2):
missing_param_strings = ", ".join(f"{p}" for p in missing_params)
raise InvalidParameters(f"Invalid parameter(s): {missing_param_strings}")

@staticmethod
def _hash_params(params: dict | list[dict]) -> int:
"""Creates an single_params_dict or the repeating_params_list."""
if isinstance(params, list):
return hash(tuple([self._hash_params(dictionary) for dictionary in params]))
else:
return hash(tuple([item for _, item in params.items()]))

@staticmethod
def _fill_params_dict(template: dict, *args, **kwargs) -> dict:
BaseDispersion._guard_invalid_params(list(kwargs.keys()), list(template.keys()))
Expand Down Expand Up @@ -97,6 +89,13 @@ def __init__(self, *args, **kwargs):
self.hash_single_params = None
self.hash_rep_params = None

def _hash_params(self, params: dict | list[dict]) -> int:
"""Creates an single_params_dict or the repeating_params_list."""
if isinstance(params, list):
return hash(tuple([self._hash_params(dictionary) for dictionary in params]))
else:
return hash(tuple([item for _, item in params.items()]))

@abstractmethod
def dielectric_function(self, lbda: npt.ArrayLike) -> npt.NDArray:
"""Calculates the dielectric function in a given wavelength window.
Expand Down Expand Up @@ -134,9 +133,10 @@ def get_dielectric(self, lbda: Optional[npt.ArrayLike] = None) -> npt.NDArray:

from .table_epsilon import TableEpsilon
from .table_index import Table
from .pseudo_dielectric import PseudoDielectricFunction

if not isinstance(self, (DispersionSum, IndexDispersionSum)):
if isinstance(self, (TableEpsilon, Table)):
if isinstance(self, (TableEpsilon, Table, PseudoDielectricFunction)):
if self.last_lbda is lbda:
return self.cached_diel
else:
Expand Down

0 comments on commit 8e216cf

Please sign in to comment.