Skip to content

Commit

Permalink
Fix HierarchicalAmiciCalculator.__call__ not setting 'hess' in resu…
Browse files Browse the repository at this point in the history
…lt (#1161)

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

Closes #1160
  • Loading branch information
dweindl authored Oct 31, 2023
1 parent 2ca056c commit 378f705
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 378f705

Please sign in to comment.