Skip to content

Commit

Permalink
Fix amici.ExpData() (#2280)
Browse files Browse the repository at this point in the history
Fix `IndexError: tuple index out of range` when calling `amici.ExpData` without any argument.
  • Loading branch information
dweindl authored Jan 30, 2024
1 parent 854eac5 commit aa39743
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions python/sdist/amici/swig_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,22 @@ def ExpData(*args) -> "amici_swig.ExpData":
:returns: ExpData Instance
"""
if not args:
return amici_swig.ExpData()

if isinstance(args[0], numpy.ReturnDataView):
return amici_swig.ExpData(_get_ptr(args[0]["ptr"]), *args[1:])
elif isinstance(args[0], (amici_swig.ExpData, amici_swig.ExpDataPtr)):

if isinstance(args[0], (amici_swig.ExpData, amici_swig.ExpDataPtr)):
# the *args[:1] should be empty, but by the time you read this,
# the constructor signature may have changed, and you are glad this
# wrapper did not break.
return amici_swig.ExpData(_get_ptr(args[0]), *args[1:])
elif isinstance(args[0], (amici_swig.Model, amici_swig.ModelPtr)):

if isinstance(args[0], (amici_swig.Model, amici_swig.ModelPtr)):
return amici_swig.ExpData(_get_ptr(args[0]))
else:
return amici_swig.ExpData(*args)

return amici_swig.ExpData(*args)


def runAmiciSimulations(
Expand Down

0 comments on commit aa39743

Please sign in to comment.