Skip to content

Commit

Permalink
HierarchicalAmiciCalculator.__call__ missing 'hess' in returned dic…
Browse files Browse the repository at this point in the history
…t upon simulation failure

`HierarchicalAmiciCalculator.__call__` needs to set `'hess'` in the result dict, also in case of simulation failures.

Closes #1160
  • Loading branch information
dweindl committed Oct 30, 2023
1 parent 7210de8 commit 5b6bbc2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pypesto/hierarchical/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AMICI_SIGMAY,
AMICI_Y,
GRAD,
HESS,
INNER_PARAMETERS,
INNER_RDATAS,
RDATAS,
Expand Down Expand Up @@ -115,9 +116,12 @@ def __call__(
if any(rdata.status != amici.AMICI_SUCCESS for rdata in inner_rdatas):
# if the gradient was requested, we need to provide some value
# for it
dim = len(x_ids)
if 1 in sensi_orders:
inner_result[GRAD] = np.full(
shape=len(x_ids), fill_value=np.nan
inner_result[GRAD] = np.full(shape=dim, fill_value=np.nan)
if 2 in sensi_orders:
inner_result[HESS] = np.full(
shape=(dim, dim), fill_value=np.nan
)
return inner_result

Expand Down

0 comments on commit 5b6bbc2

Please sign in to comment.