Questions tagged [f2py]

F2PY is a tool that provides an interface between the Python and Fortran programming languages.

F2PY is a tool that provides an interface between the and programming languages. F2PY is part of .

491 questions
3
votes
1 answer

How can I get info on run time errors for Python modules built with f2py

Edit 3/6: Sorry, this was a false alarm. It seems to be working now. I believe the -g flag on gfortran and --debug-capi are sufficient after all to generate line numbers for GDB (gnu debugger). I will make a short answer summarizing how to do…
JohnE
  • 29,156
  • 8
  • 79
  • 109
3
votes
1 answer

f2py: Pre-allocating arrays as input for Fortran subroutine

Here is a minimalized snippet from a Fortran subroutine that i want to call in python. The task is very simple. The first time the code is called a value is assigned to the first entry of the array iwk. The subroutine is then called a second time,…
ye-ti-800
  • 218
  • 1
  • 9
3
votes
2 answers

combining python with fortran, trouble with tutorial

I'm following this tutorial http://www.sam.math.ethz.ch/~raoulb/teaching/PythonTutorial/combining.html I use the same code program hwtest real*8 r1, r2 ,s r1 = 1.0 r2 = 0.0 s = hw1(r1, r2) write(*,*) 'hw1,…
Tom83B
  • 2,059
  • 4
  • 18
  • 28
3
votes
2 answers

Django + Apache deployment on Ubuntu

I scanned tons of links on this topic, devoted to the deployment of Django and Apache on Ubuntu server. Finally, I found this link Django Deployement Installation to Ubuntu 12.04 Server which brought me further than any other guide. So, now, I'm at…
Jacobian
  • 10,122
  • 29
  • 128
  • 221
3
votes
1 answer

How do I create a python module from a fortran program with f2py?

I am trying to read some smps files with python, and found a fortran implementation, so I thought I would give f2py a shot. The problem is that I have no experience with fortran. I have successfully installed gfortran and f2py on my Linux box and…
Lars
  • 77
  • 2
  • 9
3
votes
2 answers

F2PY: Passing single-element arrays to Fortran

The following Fortran code fills a 2D array x with value v subroutine fill(x,v,m,n) real*8 x(m,n),v integer m,n,i cf2py intent(in) :: x,v,m,n forall(i=1:m,j=1:n) x(i,j) = v end When calling this function from Python: x…
gmo
  • 31
  • 2
3
votes
0 answers

Compiling a FORTRAN Module using f2py

I used to compile a FORTRAN program with f2py long time ago. But when I failed to re-compile it today. I guess the reason is not pointing to the right compiler. Last time, my machine was clean only has gnu installed as the only compiler, while today…
TTT
  • 4,354
  • 13
  • 73
  • 123
3
votes
1 answer

f2py a synnonym for the stop command

I have a fortran code called from python whenever it is needed. Sometimes an error is produced in the fortran computations and it is handled with the command STOP, which completely stops both fortran and python codes. However, I need python to…
wuampa
  • 273
  • 4
  • 15
3
votes
2 answers

f2py: Could not locate executable C:Python27pythonw.exe Executable C:Python27pythonw.exe does not exist

I am trying to run a simple Fortran subroutine using numpy.f2py as described on: http://docs.scipy.org/doc/numpy/user/c-info.python-as-glue.html#calling-f2py-from-python When I try to compile (f2py.compile(source, modulename='add')) from python I…
Lene
  • 31
  • 1
  • 5
3
votes
1 answer

Setting python path for WinPython to use f2py

I installed the Winpython distribution on my copy of Windows 7. Launching iPython consoles and other items from the distribution from within the folder it copied to works fine. I'd like to use the f2py module from numpy to be able to call Fortran…
AGK
  • 57
  • 2
  • 6
3
votes
1 answer

Importing fortran files to python

This is a very newbie question, but after searching in Google for a while, I haven't been able to find a solution. I'm writing a Python code using Eclipse (in Linux Mint) which needs some routines written in Fortran 77 (the code is in a file named…
wuampa
  • 273
  • 4
  • 15
3
votes
1 answer

f2py not working for canopy

I am relatively new to python. I am using Enthought Canopy for my work. After importing f2py from numpy, I keep on running into the invalid syntax error when trying to execute: f2py -m (modname) -c --fcompiler=gfortran (prog.f90) Needless to say, I…
Aves
  • 43
  • 4
3
votes
2 answers

call LAPACK drivers/functions from python

I need to use lapack function 'DGGLSE' in python to solve a least square problem with constraints. I found some low level functions of lapack can be found in scipy as follow http://docs.scipy.org/doc/scipy/reference/linalg.lapack.html but the one I…
ywang
  • 101
  • 3
  • 8
3
votes
1 answer

f2py, problems passing a Python function to Fortran

I have a this simple Fortran code (stack.f90): subroutine fortran_sum(f,xs,nf,nxs) integer nf,nxs double precision xs,result dimension xs(nxs),result(nf) external f result = 0.0 do I = 1,nxs result…
Saullo G. P. Castro
  • 56,802
  • 26
  • 179
  • 234
3
votes
1 answer

Mixing f2py with distutils

I have a python package "trees", which contains myscript.py file which makes use of a fortran subroutine. Normally I compile the fortran module with f2py -c -m calctree calctree.f90 and I can then do from trees import…
Tetsuo
  • 169
  • 1
  • 2
  • 9