Skip to content

Commit

Permalink
revert: add warning when over-defining parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Mar 23, 2021
1 parent b2a190d commit e08f084
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tensorwaves/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
as `sympy` expressions only.
"""

import logging
from typing import Callable, Dict, FrozenSet, Mapping, Tuple, Union

import numpy as np
Expand Down Expand Up @@ -109,6 +110,13 @@ def __init__(
if not all(map(lambda p: isinstance(p, sp.Symbol), parameters)):
raise TypeError(f"Not all parameters are of type {sp.Symbol}")

if not set(parameters) <= set(expression.free_symbols):
unused_parameters = set(parameters) - set(expression.free_symbols)
logging.warning(
f"Parameters {unused_parameters} are defined but do not appear"
" in the model!"
)

def lambdify(self, backend: Union[str, tuple, dict]) -> Callable:
"""Lambdify the model using `~sympy.utilities.lambdify.lambdify`."""
# pylint: disable=import-outside-toplevel
Expand Down

0 comments on commit e08f084

Please sign in to comment.