-
-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change "u=" to "param=" and make inputs more explicit #905
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #905 +/- ##
========================================
Coverage 98.00% 98.00%
========================================
Files 207 207
Lines 10914 10915 +1
========================================
+ Hits 10696 10697 +1
Misses 218 218
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @tinosulzer looks good to me! is there a reason we call input parameters "inputs" when calling solve, rather than parameters? maybe parameters
or input_parameters
would be more obvious?
u : dict | ||
y_dot : :class:`casadi.MX` | ||
A casadi symbol representing time derivatives of state vectors | ||
params : dict | ||
A dictionary of casadi symbols representing inputs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe change to "input parameters" rather than "inputs", just to be super clear
@@ -38,13 +40,13 @@ def convert(self, symbol, t, y, y_dot, u): | |||
return self._casadi_symbols[symbol.id] | |||
except KeyError: | |||
# Change u to empty dictionary if it's None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change params to...
pybamm/expression_tree/symbol.py
Outdated
@@ -556,7 +555,7 @@ def evaluate(self, t=None, y=None, y_dot=None, u=None, known_evals=None): | |||
y_dot : numpy.array, optional | |||
array with time derivatives of state values to evaluate when solving | |||
(default None) | |||
u : dict, optional | |||
params : dict, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, maybe this should read "input parameters"
pybamm/expression_tree/variable.py
Outdated
@@ -172,18 +176,18 @@ def _evaluate_for_shape(self): | |||
""" See :meth:`pybamm.Symbol.evaluate_for_shape_using_domain()` """ | |||
return np.nan * np.ones((self.size, 1)) | |||
|
|||
def _base_evaluate(self, t=None, y=None, y_dot=None, u=None): | |||
def _base_evaluate(self, t=None, y=None, y_dot=None, params=None): | |||
# u should be a dictionary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u -> params
pybamm/solvers/base_solver.py
Outdated
@@ -826,43 +805,36 @@ def __init__(self, function, name, model): | |||
self._function = function | |||
if isinstance(function, casadi.Function): | |||
self.form = "casadi" | |||
self.inputs = casadi.DM() | |||
# self.inputs = casadi.DM() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this (and line 811) go?
Yeah I guess we should use either |
yeah, I think as long as it's consistent it's ok. I guess using |
Description
u
toparams
when evaluatingFixes #899
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: