forpy icon indicating copy to clipboard operation
forpy copied to clipboard

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

Open asandrock opened this issue 4 years ago • 1 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.

asandrock avatar Feb 29 '20 12:02 asandrock

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.

ylikx avatar Feb 29 '20 19:02 ylikx