f2py

using allocatable arrays from modules in f2py

纵然是瞬间 提交于 2021-02-10 20:47:57
问题 I'm having issues with allocatable arrays in f2py . In the code below (stored in mymod.f90 ), I created two modules, vars and worker : vars stores and allocates the array b worker contains subroutines to work with this array from vars . The first worker -subroutine adds a scalar to b . This works as expected. The problem is with the next routine that should add a vector of matching first dimension to the array b . The implemented subroutine add_vector2 works, but needs the dimension of the

using allocatable arrays from modules in f2py

感情迁移 提交于 2021-02-10 20:43:36
问题 I'm having issues with allocatable arrays in f2py . In the code below (stored in mymod.f90 ), I created two modules, vars and worker : vars stores and allocates the array b worker contains subroutines to work with this array from vars . The first worker -subroutine adds a scalar to b . This works as expected. The problem is with the next routine that should add a vector of matching first dimension to the array b . The implemented subroutine add_vector2 works, but needs the dimension of the

Error occurs when coming back from subroutine of fortran by numpy.f2py

好久不见. 提交于 2021-02-10 05:44:05
问题 I made hoge as simple as possible and errors still coming. Please tell me what problems are. This is my Fortran subroutine code. subroutine hoge(d) complex(kind(0d0)), intent(out):: d(5,10,15) ! 5 10 15 does not have special meanings.. ! these two lines works.. ! integer, parameter :: dp = kind(0d0) ! complex(dp), intent(out) :: d(5,10,15) do i=1,15 do j=1,10 do k=1,5 d(k,j,i)=0 enddo enddo enddo ! instead ! d(1:5,1:10,1:15)=0 or ! d(:,:,:)=0 also brings the error. ! print*,'returning' return

Using f2py for faster calculation on Python

让人想犯罪 __ 提交于 2021-01-29 09:07:38
问题 I'm working on a sequence alignment project with python, and python for loop is too slow. So, I decided to use f2py . I don't know much about fortran, so I'm stuck to the point below. There are two sequence named 'column', and 'row' whose type is np.array For example: column = ['A', 'T', 'G', 'C'] row = ['A', 'A', 'C', 'C'] I created a matrix for the Needleman-Wunsch algorithm, and I scored two sequences (column, row). import numpy as np column = np.array(list('ATGC')) row = np.array(list(

Link f2py generated *.so file in a python package using setuptools

放肆的年华 提交于 2020-12-11 10:09:49
问题 I wish to deploy a package to PyPi using setuptools. However, the core part of the package is actually written in Fortran, and I am using f2py to wrap it in python. Basically the project's structure looks like this: my_project license.txt README.md setup.py my_project init .py myfunc.py hello.so The module myfunc.py imports hello.so ( import my_project.hello ) which can then be used by functions inside myfunc.py. This works perfectly on my machine. Then I tried standard setuptools

Link f2py generated *.so file in a python package using setuptools

柔情痞子 提交于 2020-12-11 10:08:33
问题 I wish to deploy a package to PyPi using setuptools. However, the core part of the package is actually written in Fortran, and I am using f2py to wrap it in python. Basically the project's structure looks like this: my_project license.txt README.md setup.py my_project init .py myfunc.py hello.so The module myfunc.py imports hello.so ( import my_project.hello ) which can then be used by functions inside myfunc.py. This works perfectly on my machine. Then I tried standard setuptools

Link f2py generated *.so file in a python package using setuptools

☆樱花仙子☆ 提交于 2020-12-11 10:08:17
问题 I wish to deploy a package to PyPi using setuptools. However, the core part of the package is actually written in Fortran, and I am using f2py to wrap it in python. Basically the project's structure looks like this: my_project license.txt README.md setup.py my_project init .py myfunc.py hello.so The module myfunc.py imports hello.so ( import my_project.hello ) which can then be used by functions inside myfunc.py. This works perfectly on my machine. Then I tried standard setuptools

Link f2py generated *.so file in a python package using setuptools

梦想与她 提交于 2020-12-11 10:03:37
问题 I wish to deploy a package to PyPi using setuptools. However, the core part of the package is actually written in Fortran, and I am using f2py to wrap it in python. Basically the project's structure looks like this: my_project license.txt README.md setup.py my_project init .py myfunc.py hello.so The module myfunc.py imports hello.so ( import my_project.hello ) which can then be used by functions inside myfunc.py. This works perfectly on my machine. Then I tried standard setuptools

Link f2py generated *.so file in a python package using setuptools

天涯浪子 提交于 2020-12-11 10:02:42
问题 I wish to deploy a package to PyPi using setuptools. However, the core part of the package is actually written in Fortran, and I am using f2py to wrap it in python. Basically the project's structure looks like this: my_project license.txt README.md setup.py my_project init .py myfunc.py hello.so The module myfunc.py imports hello.so ( import my_project.hello ) which can then be used by functions inside myfunc.py. This works perfectly on my machine. Then I tried standard setuptools

how to handle occaisional segmentation fault in f2py module

白昼怎懂夜的黑 提交于 2020-05-17 07:45:08
问题 I have an f2py module that I am using. The core of the code I did not write myself, just the f2py wrapper to use it. Because of time constraints, and the knowledge that his code is short term need only, meaning I want to throw it away, not fix it, what I want to do is just catch the behavior when a segfault occurs and try again. The below code is an example: sums.f90 subroutine bad(a, b, c) real, intent(in) :: a, b real, intent(out) :: c real, allocatable :: d(:) real :: r call random_number