ylikx / forpy

Forpy - use Python from Fortran

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use a Fortran function as argument to a Python method?

asandrock opened this issue · comments

Suppose I have written a function in Fortran depending on some parameters I want to fit to data with scipy.optimize.curve_fit. How do I use this function as argument to a Python method?

I tried setitem with the function name and casting it to a Python object, but neither work in this case.

You can write a Python extension module that contains a wrapper to your function (see readme). You can email me if you have questions about doing that. I do not know if it is possible to implement a simpler way in forpy, similar to what you tried, I'd have to think about it more.