Skip to content

Commit

Permalink
#763 extrapolate
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Dec 22, 2019
1 parent b623a40 commit 3e31ab8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/scripts/compare_comsol/compare_comsol_DFN.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
def get_interp_fun(variable_name, domain):
"""
Create a :class:`pybamm.Function` object using the variable, to allow plotting with
:class:`'pybamm.QuickPlot'` (interpolate in space to match edges, and then create
:class:`pybamm.QuickPlot` (interpolate in space to match edges, and then create
function to interpolate in time)
"""
variable = comsol_variables[variable_name]
Expand All @@ -79,7 +79,9 @@ def get_interp_fun(variable_name, domain):

def myinterp(t):
try:
return interp.interp1d(comsol_t, variable)(t)[:, np.newaxis]
return interp.interp1d(comsol_t, variable, fill_value="extrapolate")(t)[
:, np.newaxis
]
except ValueError as err:
raise ValueError(
"""Failed to interpolate '{}' with time range [{}, {}] at time {}.
Expand Down

0 comments on commit 3e31ab8

Please sign in to comment.