Help debug python interface

Hi,

I am trying to provide a python wrapper for BifurcationKit.jl. The wrapper is located here GitHub - bifurcationkit/bifurcationkitpy: Computation of bifurcation diagrams in python.

However, I cannot debug the error from python, the stacktraces are quite short (I guess this can be a problem too :wink: )

Can anyone help me run the example1.ipynb? I should then be able to fill the gaps.

Thank you a lot for your help

I’ve not run the notebook, but record_from_solution doesn’t look right. Firstly, there’s a comma missing so it’s not returning a named tuple. Secondly it completely ignores the arguments - the code in seval is run without passing in x.

Maybe you want jl.seval("x->(x=x,)")[x[0]]?

(It will be more efficient to cache that Julia function instead of creating it every time.)

Thank you for your answer. It does not remove the error. In fact, if I remove record_from_solution from the defintion, the error is still the same

u0 = [0.0]
p = bk.seval("(mu = -1.,)")
p.mu

prob = bk.BifurcationProblem(F, u0, p, bk.seval("(@lens _.mu)"), 
                            #  record_from_solution = record_from_solution, 
                             J = J)
bk.newton(prob, bk.NewtonPar(verbose = True))

I still get

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[27], line 2
      1 # strange error. I passed the jacobian J to prob so that ForwardDiff is not used
----> 2 bk.newton(prob, bk.NewtonPar(verbose = True))

File ~/.julia/packages/PythonCall/S5MOg/src/JlWrap/any.jl:223, in __call__(self, *args, **kwargs)
    221     return ValueBase.__dir__(self) + self._jl_callmethod($(pyjl_methodnum(pyjlany_dir)))
    222 def __call__(self, *args, **kwargs):
--> 223     return self._jl_callmethod($(pyjl_methodnum(pyjlany_call)), args, kwargs)
    224 def __bool__(self):
    225     return True

TypeError: 'float' object is not iterable