This post provides you info for installing and using the Fortran to Python ( f2py ) interface generator on windows. f2py is part of the numpy package allows you to connect Python and Fortran languages mainly with the intention to benefit from Fortran's performance. To get f2py to work on windows x64 with a python 3.6 installation, you need to do the following: If you have not done this already, download and install python36 I like to install python under C:\Python36\ rather than the default location. Also, make sure you check the boxes for adding python to your environment variables Install numpy by using python's pip command. Open a command shell and type pip install numpy which will start the installation of Python's numerical package including the f2py interface. Install a Fortran compiler in order to compile code to combine it with Python. There is no default compiler that is shipped with either Python or numpy and therefore needs to be downloaded and ins...
The python code blow illustrates a simplistic concept of how to convert a triangulates surface into a voxel (image stack) representation.This code is not optimized for speed rather than having a clear structure to better understand the individual steps of this algorithm.
The example below demonstrates the code for calculating the averaged per vertex normals of a triangulated mesh. Since pure python is quite slow, numba is used to speed up the calculation. In the given example script, the calculation with native python and the numbafied version took 5.27 sec and 0.32 sec, respectively. The speed increase with numba was about x16.5. Here is the python code:
Comments
Post a Comment